Skip to content

Commit 92ca121

Browse files
committed
scope: chop off the correct end of the fragment
1 parent bf65a84 commit 92ca121

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

src/main/java/org/w3id/cwl/cwl1_2/utils/LoadingOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public String expandUrl(
9494
final ArrayList<String> sp = new ArrayList(Arrays.asList(splitbase.fragment.split("/")));
9595
int n = scopedRef;
9696
while (n > 0 && sp.size() > 0) {
97-
sp.remove(0);
97+
sp.remove(sp.size()-1);
9898
n -= 1;
9999
}
100100
sp.add(url);
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package org.w3id.cwl.cwl1_2.utils;
2+
3+
import org.w3id.cwl.cwl1_2.Process;
4+
import org.w3id.cwl.cwl1_2.SchemaDefRequirement;
5+
import org.w3id.cwl.cwl1_2.Workflow;
6+
import org.w3id.cwl.cwl1_2.WorkflowStep;
7+
import org.w3id.cwl.cwl1_2.WorkflowStepInput;
8+
import org.w3id.cwl.cwl1_2.CWLVersion;
9+
import org.w3id.cwl.cwl1_2.InlineJavascriptRequirement;
10+
import org.w3id.cwl.cwl1_2.InputRecordSchema;
11+
12+
import java.net.URISyntaxException;
13+
import java.nio.file.Paths;
14+
import java.util.List;
15+
16+
import org.junit.Assert;
17+
import org.junit.Test;
18+
19+
public class PackedWorkflowClassTest {
20+
List<Process> doc;
21+
22+
@SuppressWarnings("unchecked")
23+
public PackedWorkflowClassTest() throws URISyntaxException {
24+
super();
25+
this.doc = (List<Process>) RootLoader
26+
.loadDocument(Paths.get(getClass().getResource("valid_scatter-wf4.cwl").toURI()));
27+
}
28+
29+
@Test
30+
public void className() {
31+
Workflow workflow = (Workflow) doc.get(1);
32+
Assert.assertEquals("WorkflowImpl", workflow.getClass().getSimpleName());
33+
}
34+
35+
@Test
36+
public void workflowStepInputSources() {
37+
Workflow workflow = (Workflow) doc.get(1);
38+
String workflow_id = workflow.getId().get();
39+
WorkflowStep step1 = (WorkflowStep) workflow.getSteps().get(0);
40+
List<Object> inputs = step1.getIn();
41+
WorkflowStepInput step1_input1 = (WorkflowStepInput) inputs.get(0);
42+
Assert.assertEquals(workflow_id + "/step1/echo_in1", step1_input1.getId().get());
43+
Assert.assertEquals(workflow_id + "/inp1", step1_input1.getSource());
44+
}
45+
46+
}

0 commit comments

Comments
 (0)