-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
junit5: fix WorkflowDefinitionUpdateTest
When running WorkflowDefinitionUpdateTest API returned unexpected workflow definitions. Spring component scan picked up a workflow that test was expecting not to be present. For some reason this didn't happen with H2 profile. Modify the test to use a new workflow which is not used by any other test and that is not component scanned.
- Loading branch information
Showing
2 changed files
with
64 additions
and
9 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
nflow-tests/src/main/java/io/nflow/tests/demo/workflow/Demo2Workflow.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package io.nflow.tests.demo.workflow; | ||
|
||
import io.nflow.engine.workflow.definition.*; | ||
import org.springframework.stereotype.Component; | ||
|
||
import static io.nflow.engine.workflow.definition.NextAction.moveToState; | ||
import static io.nflow.engine.workflow.definition.NextAction.stopInState; | ||
import static io.nflow.engine.workflow.definition.WorkflowStateType.*; | ||
|
||
public class Demo2Workflow extends WorkflowDefinition<Demo2Workflow.State> { | ||
|
||
public static final String DEMO2_WORKFLOW_TYPE = "demo2"; | ||
|
||
public static enum State implements WorkflowState { | ||
begin(start), process(normal), done(end), error(manual); | ||
|
||
private WorkflowStateType type; | ||
|
||
private State(WorkflowStateType type) { | ||
this.type = type; | ||
} | ||
|
||
@Override | ||
public WorkflowStateType getType() { | ||
return type; | ||
} | ||
|
||
@Override | ||
public String getDescription() { | ||
return name(); | ||
} | ||
} | ||
|
||
public Demo2Workflow() { | ||
super(DEMO2_WORKFLOW_TYPE, State.begin, State.error); | ||
setDescription("Simple demo workflow: start -> process -> end"); | ||
permit(State.begin, State.process); | ||
permit(State.process, State.done); | ||
} | ||
|
||
public NextAction begin(@SuppressWarnings("unused") StateExecution execution) { | ||
return moveToState(State.process, "Go to process state"); | ||
} | ||
|
||
public NextAction process(@SuppressWarnings("unused") StateExecution execution) { | ||
return stopInState(State.done, "Go to done state"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters