Skip to content

Commit b73616d

Browse files
author
Mark Robinson
committed
Remove unused members of CWLStep
1 parent 8bcff23 commit b73616d

File tree

7 files changed

+44
-54
lines changed

7 files changed

+44
-54
lines changed

src/main/java/org/commonwl/view/cwl/CWLService.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ private Map<String, CWLStep> getSteps(JsonNode cwlDoc) {
282282
// Explicit ID and other fields within each input list
283283
for (JsonNode step : steps) {
284284
CWLStep stepObject = new CWLStep(extractLabel(step), extractDoc(step),
285-
extractTypes(step), extractRun(step), getInputs(step), getOutputs(step));
285+
extractRun(step), getInputs(step));
286286
returnMap.put(extractID(step), stepObject);
287287
}
288288
} else if (steps.getClass() == ObjectNode.class) {
@@ -292,8 +292,7 @@ private Map<String, CWLStep> getSteps(JsonNode cwlDoc) {
292292
Map.Entry<String, JsonNode> stepNode = iterator.next();
293293
JsonNode stepJson = stepNode.getValue();
294294
CWLStep stepObject = new CWLStep(extractLabel(stepJson), extractDoc(stepJson),
295-
extractTypes(stepJson), extractRun(stepJson), getInputs(stepJson),
296-
getOutputs(stepJson));
295+
extractRun(stepJson), getInputs(stepJson));
297296
returnMap.put(stepNode.getKey(), stepObject);
298297
}
299298
}

src/main/java/org/commonwl/view/cwl/CWLStep.java

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,16 @@ public class CWLStep {
2828

2929
private String label;
3030
private String doc;
31-
private String type;
3231
private String run;
3332
private CWLProcess runType;
34-
private Map<String, CWLElement> inputs;
35-
private Map<String, CWLElement> outputs;
33+
private Map<String, CWLElement> sources;
3634

37-
public CWLStep(String label, String doc, String type, String run,
38-
Map<String, CWLElement> inputs, Map<String, CWLElement> outputs) {
35+
public CWLStep(String label, String doc, String run,
36+
Map<String, CWLElement> sources) {
3937
this.label = label;
4038
this.doc = doc;
41-
this.type = type;
4239
this.run = run;
43-
this.inputs = inputs;
44-
this.outputs = outputs;
40+
this.sources = sources;
4541
}
4642

4743
public String getLabel() {
@@ -60,14 +56,6 @@ public void setDoc(String doc) {
6056
this.doc = doc;
6157
}
6258

63-
public String getType() {
64-
return type;
65-
}
66-
67-
public void setType(String type) {
68-
this.type = type;
69-
}
70-
7159
public String getRun() {
7260
return run;
7361
}
@@ -84,20 +72,8 @@ public void setRunType(CWLProcess runType) {
8472
this.runType = runType;
8573
}
8674

87-
public Map<String, CWLElement> getInputs() {
88-
return inputs;
89-
}
90-
91-
public void setInputs(Map<String, CWLElement> inputs) {
92-
this.inputs = inputs;
93-
}
94-
95-
public Map<String, CWLElement> getOutputs() {
96-
return outputs;
97-
}
98-
99-
public void setOutputs(Map<String, CWLElement> outputs) {
100-
this.outputs = outputs;
75+
public Map<String, CWLElement> getSources() {
76+
return sources;
10177
}
10278

10379
}

src/main/java/org/commonwl/view/graphviz/DotWriter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ private void writeSteps(Workflow workflow) throws IOException {
173173
// Write links between the remaining steps
174174
int defaultCount = 0;
175175
for (Map.Entry<String, CWLStep> step : workflow.getSteps().entrySet()) {
176-
if (step.getValue().getInputs() != null) {
177-
for (Map.Entry<String, CWLElement> input : step.getValue().getInputs().entrySet()) {
176+
if (step.getValue().getSources() != null) {
177+
for (Map.Entry<String, CWLElement> input : step.getValue().getSources().entrySet()) {
178178
List<String> sourceIDs = input.getValue().getSourceIDs();
179179

180180
// Draw the default value on the graph if there are no step inputs (it is a constant)

src/main/java/org/commonwl/view/workflow/WorkflowOverview.java

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
*/
2525
public class WorkflowOverview {
2626

27-
private String fileName;
28-
private String label;
29-
private String doc;
27+
private final String fileName;
28+
private final String label;
29+
private final String doc;
3030

3131
public WorkflowOverview(String fileName, String label, String doc) {
3232
this.fileName = fileName;
@@ -38,24 +38,12 @@ public String getFileName() {
3838
return fileName;
3939
}
4040

41-
public void setFileName(String fileName) {
42-
this.fileName = fileName;
43-
}
44-
4541
public String getLabel() {
4642
return label;
4743
}
4844

49-
public void setLabel(String label) {
50-
this.label = label;
51-
}
52-
5345
public String getDoc() {
5446
return doc;
5547
}
5648

57-
public void setDoc(String doc) {
58-
this.doc = doc;
59-
}
60-
6149
}

src/test/java/org/commonwl/view/cwl/CWLServiceTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ private void testLobSTRWorkflow(Workflow lobSTR) throws Exception {
137137
assertEquals("lobSTR-tool.cwl", steps.get("lobSTR").getRun());
138138
assertEquals(CWLProcess.COMMANDLINETOOL, steps.get("lobSTR").getRunType());
139139
assertNotNull(steps.get("samindex"));
140-
assertTrue(steps.get("samindex").getInputs().get("input").getSourceIDs().contains("samsort"));
140+
assertTrue(steps.get("samindex").getSources().get("input").getSourceIDs().contains("samsort"));
141141

142142
// Output tests
143143
Map<String, CWLElement> outputs = lobSTR.getOutputs();

src/test/java/org/commonwl/view/graphviz/DotWriterTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,23 +61,24 @@ public void setUp() throws Exception {
6161
step1InputElement.addSourceID("input2");
6262
Map<String, CWLElement> step1inputs = new HashMap<>();
6363
step1inputs.put("toolinput1", step1InputElement);
64-
CWLStep step1 = new CWLStep(null, null, null, null, step1inputs, null);
64+
CWLStep step1 = new CWLStep(null, null, null, step1inputs);
6565
steps.put("step1", step1);
6666

6767
CWLElement default1InputElement = new CWLElement();
6868
default1InputElement.setDefaultVal("examplefile.jar");
6969
Map<String, CWLElement> default1inputs = new HashMap<>();
7070
step1inputs.put("defaultInput", default1InputElement);
71-
CWLStep default1 = new CWLStep(null, null, null, null, default1inputs, null);
71+
CWLStep default1 = new CWLStep(null, null, null, default1inputs);
7272
steps.put("default1", default1);
7373

7474
CWLElement step2InputElement = new CWLElement();
7575
step2InputElement.addSourceID("step1");
7676
step2InputElement.addSourceID("default1");
7777
Map<String, CWLElement> step2inputs = new HashMap<>();
7878
step2inputs.put("toolinput1", step2InputElement);
79-
CWLStep step2 = new CWLStep(null, null, null, null, step2inputs, null);
79+
CWLStep step2 = new CWLStep(null, null, null, step2inputs);
8080
step2.setRunType(CWLProcess.WORKFLOW);
81+
step2.setRun("subworkflow.cwl");
8182
steps.put("step2", step2);
8283

8384
// Output

src/test/java/org/commonwl/view/workflow/WorkflowControllerTest.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,32 @@ public void newWorkflowFromGithubURL() throws Exception {
103103

104104
}
105105

106+
/**
107+
* Endpoint for displaying workflows and directories of workflows
108+
*/
109+
@Test
110+
public void getWorkflowByGithubDetails() throws Exception {
111+
112+
// Mock service to return a bundle file and then throw ROBundleNotFoundException
113+
WorkflowService mockWorkflowService = Mockito.mock(WorkflowService.class);
114+
115+
116+
// Mock controller/MVC
117+
WorkflowController workflowController = new WorkflowController(
118+
Mockito.mock(WorkflowFormValidator.class),
119+
mockWorkflowService,
120+
Mockito.mock(GraphVizService.class));
121+
MockMvc mockMvc = MockMvcBuilders
122+
.standaloneSetup(workflowController)
123+
.build();
124+
125+
// Redirect with error
126+
mockMvc.perform(get("/workflows/github.com/owner/reponame/tree/branch/path/within"))
127+
.andExpect(status().isFound())
128+
.andExpect(redirectedUrl("/?url=https://github.com/owner/reponame/tree/branch/path/within"));
129+
130+
}
131+
106132
/**
107133
* Endpoint for downloading RO bundle for a workflow
108134
*/

0 commit comments

Comments
 (0)