Skip to content

Updated documentation and added unit tests for flow builder priority #4504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import java.util.Comparator;

/**
* Sorts by decreasing specificity of pattern, based on just counting wildcards (with *
* Sorts by ascending specificity of pattern, based on just counting wildcards (with *
* taking precedence over ?). If wildcard counts are equal then falls back to alphabetic
* comparison. Hence * > foo* > ??? > fo? > foo.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,36 @@ public FlowExecutionStatus decide(JobExecution jobExecution, @Nullable StepExecu
assertEquals(1, execution.getStepExecutions().size());
}

@Test
void testBuildWithDeciderPriority() {
JobExecutionDecider decider = (jobExecution, stepExecution) -> new FlowExecutionStatus("COMPLETED_PARTIALLY");
JobFlowBuilder builder = new JobBuilder("flow_priority", jobRepository).start(decider);
builder.on("COMPLETED_PARTIALLY").end();
builder.on("COMPLETED*").fail();
builder.build().preventRestart().build().execute(execution);
assertEquals(BatchStatus.COMPLETED, execution.getStatus());
}

@Test
void testBuildWithWildcardDeciderPriority() {
JobExecutionDecider decider = (jobExecution, stepExecution) -> new FlowExecutionStatus("COMPLETED_PARTIALLY");
JobFlowBuilder builder = new JobBuilder("flow_priority", jobRepository).start(decider);
builder.on("COMPLETED_?ARTIALLY").end();
builder.on("COMPLETED_*ARTIALLY").fail();
builder.build().preventRestart().build().execute(execution);
assertEquals(BatchStatus.COMPLETED, execution.getStatus());
}

@Test
void testBuildWithDeciderPrioritySubstringAndWildcard() {
JobExecutionDecider decider = (jobExecution, stepExecution) -> new FlowExecutionStatus("CONTINUABLE");
JobFlowBuilder builder = new JobBuilder("flow_priority", jobRepository).start(decider);
builder.on("CONTINUABLE").end();
builder.on("CONTIN*").fail();
builder.build().preventRestart().build().execute(execution);
assertEquals(BatchStatus.COMPLETED, execution.getStatus());
}

@Test
void testBuildWithIntermediateSimpleJob() {
SimpleJobBuilder builder = new JobBuilder("flow", jobRepository).start(step1);
Expand Down