Skip to content

Commit 12e36f5

Browse files
committed
cleanup & refactoring: removed unnecessary methods + fixed switch task
1 parent c3353ae commit 12e36f5

5 files changed

Lines changed: 10 additions & 25 deletions

File tree

conductor-client/src/main/java/com/netflix/conductor/common/run/tasks/DoWhileTask.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,4 @@ public boolean isFirstIteration() {
7979
return getCurrentIteration() <= 1;
8080
}
8181

82-
/**
83-
* Returns true if the loop task is part of a loop iteration (iteration > 0).
84-
*/
85-
public boolean isLoopOverTask() {
86-
return task.isLoopOverTask();
87-
}
8882
}

conductor-client/src/main/java/com/netflix/conductor/common/run/tasks/SubWorkflowTask.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,4 @@ public String getSubWorkflowId() {
9999
return task.getSubWorkflowId();
100100
}
101101

102-
/**
103-
* Returns true if the sub-workflow has been started (has an ID).
104-
*/
105-
public boolean isSubWorkflowStarted() {
106-
return getSubWorkflowId() != null;
107-
}
108102
}

conductor-client/src/main/java/com/netflix/conductor/common/run/tasks/SwitchTask.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class SwitchTask extends TypedTask {
3131

3232
public static final String EVALUATOR_TYPE_INPUT = "evaluatorType";
3333
public static final String EXPRESSION_INPUT = "expression";
34-
public static final String CASE_VALUE_OUTPUT = "caseOutput";
34+
public static final String SELECTED_CASE = "selectedCase";
3535

3636
public static final String EVALUATOR_TYPE_VALUE_PARAM = "value-param";
3737
public static final String EVALUATOR_TYPE_JAVASCRIPT = "javascript";
@@ -85,14 +85,9 @@ public String getExpression() {
8585
}
8686

8787
/**
88-
* Returns the evaluated case value that was selected, or null if not available.
88+
* Returns the case that was selected, or null if not available.
8989
*/
90-
public String getEvaluatedCase() {
91-
// The evaluated case is typically in the output
92-
String caseOutput = getOutputString(CASE_VALUE_OUTPUT);
93-
if (caseOutput != null) {
94-
return caseOutput;
95-
}
96-
return getOutputString("selectedCase");
90+
public String getSelectedCase() {
91+
return getOutputString(SELECTED_CASE);
9792
}
9893
}

conductor-client/src/test/java/com/netflix/conductor/common/run/tasks/TypedTaskTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ void testSwitchTask() throws IOException {
275275
assertFalse(switchTask.isValueParamEvaluator());
276276

277277
assertEquals("$.type == 'premium' ? 'premium' : 'standard'", switchTask.getExpression());
278-
assertEquals("premium", switchTask.getEvaluatedCase());
278+
assertEquals("premium", switchTask.getSelectedCase());
279279
}
280280

281281
@Test
@@ -284,7 +284,7 @@ void testSwitchTaskViaTaskAs() throws IOException {
284284

285285
SwitchTask switchTask = task.as(SwitchTask.class);
286286

287-
assertEquals("premium", switchTask.getEvaluatedCase());
287+
assertEquals("premium", switchTask.getSelectedCase());
288288
}
289289

290290
@Test
@@ -309,7 +309,6 @@ void testSubWorkflowTask() throws IOException {
309309
assertEquals("order_processing_workflow", subWf.getSubWorkflowName());
310310
assertEquals(2, subWf.getSubWorkflowVersion());
311311
assertEquals("sub-workflow-123", subWf.getSubWorkflowId());
312-
assertTrue(subWf.isSubWorkflowStarted());
313312
}
314313

315314
@Test

conductor-client/src/test/resources/tasks/switch.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
"expression": "$.type == 'premium' ? 'premium' : 'standard'"
1010
},
1111
"outputData": {
12-
"caseOutput": "premium"
12+
"evaluationResult": [
13+
"premium"
14+
],
15+
"selectedCase": "premium"
1316
}
1417
}

0 commit comments

Comments
 (0)