@Test public void testBuildOnOneLine() throws Exception { FlowJobBuilder builder = new JobBuilder("flow").repository(jobRepository).start(step1).on("COMPLETED") .to(step2).end().preventRestart(); builder.build().execute(execution); assertEquals(BatchStatus.COMPLETED, execution.getStatus()); assertEquals(2, execution.getStepExecutions().size()); }
@Test public void testBuildOverTwoLines() throws Exception { FlowJobBuilder builder = new JobBuilder("flow").repository(jobRepository).start(step1).on("COMPLETED") .to(step2).end(); builder.preventRestart(); builder.build().execute(execution); assertEquals(BatchStatus.COMPLETED, execution.getStatus()); assertEquals(2, execution.getStepExecutions().size()); }
@Test public void testBuildSingleFlow() throws Exception { Flow flow = new FlowBuilder<Flow>("subflow").from(step1).next(step2).build(); FlowJobBuilder builder = new JobBuilder("flow").repository(jobRepository).start(flow).end().preventRestart(); builder.build().execute(execution); assertEquals(BatchStatus.COMPLETED, execution.getStatus()); assertEquals(2, execution.getStepExecutions().size()); }
@Test public void testBuildSubflow() throws Exception { Flow flow = new FlowBuilder<Flow>("subflow").from(step1).end(); JobFlowBuilder builder = new JobBuilder("flow").repository(jobRepository).start(flow); builder.on("COMPLETED").to(step2); builder.end().preventRestart().build().execute(execution); assertEquals(BatchStatus.COMPLETED, execution.getStatus()); assertEquals(2, execution.getStepExecutions().size()); }
@Test public void testBuildSplit_BATCH_2282() throws Exception { Flow flow1 = new FlowBuilder<Flow>("subflow1").from(step1).end(); Flow flow2 = new FlowBuilder<Flow>("subflow2").from(step2).end(); Flow splitFlow = new FlowBuilder<Flow>("splitflow").split(new SimpleAsyncTaskExecutor()).add(flow1, flow2).build(); FlowJobBuilder builder = new JobBuilder("flow").repository(jobRepository).start(splitFlow).end(); builder.preventRestart().build().execute(execution); assertEquals(BatchStatus.COMPLETED, execution.getStatus()); assertEquals(2, execution.getStepExecutions().size()); }
@Test public void testBuildSplitUsingStartAndAdd_BATCH_2346() throws Exception { Flow subflow1 = new FlowBuilder<Flow>("subflow1").from(step2).end(); Flow subflow2 = new FlowBuilder<Flow>("subflow2").from(step3).end(); Flow splitflow = new FlowBuilder<Flow>("splitflow").start(subflow1).split(new SimpleAsyncTaskExecutor()) .add(subflow2).build(); FlowJobBuilder builder = new JobBuilder("flow").repository(jobRepository).start(splitflow).end(); builder.preventRestart().build().execute(execution); assertEquals(BatchStatus.COMPLETED, execution.getStatus()); assertEquals(2, execution.getStepExecutions().size()); }