/** * Creates a {@link RemotePartitioningWorkerStepBuilder} and initializes its job * repository, job explorer, bean factory and transaction manager. * @param name the name of the step * @return a {@link RemotePartitioningWorkerStepBuilder} */ public RemotePartitioningWorkerStepBuilder get(String name) { return new RemotePartitioningWorkerStepBuilder(name) .repository(this.jobRepository) .jobExplorer(this.jobExplorer) .beanFactory(this.beanFactory) .transactionManager(this.transactionManager); }
@Bean public Step workerStep() { return this.workerStepBuilderFactory.get("workerStep") .inputChannel(requests()) .outputChannel(replies()) .tasklet(tasklet(null)) .build(); }
@Override public PartitionStepBuilder partitioner(String stepName, Partitioner partitioner) { configureWorkerIntegrationFlow(); return super.partitioner(stepName, partitioner); }
@Test public void testMandatoryJobExplorer() { // given DirectChannel inputChannel = new DirectChannel(); this.expectedException.expect(IllegalArgumentException.class); this.expectedException.expectMessage("A JobExplorer must be provided"); // when new RemotePartitioningWorkerStepBuilder("step") .inputChannel(inputChannel) .tasklet(this.tasklet); // then // expected exception }
@Bean public Step workerStep() { return this.workerStepBuilderFactory.get("workerStep") .inputChannel(requests()) .tasklet(tasklet(null)) .build(); }
@Test public void outputChannelMustNotBeNull() { // given this.expectedException.expect(IllegalArgumentException.class); this.expectedException.expectMessage("outputChannel must not be null"); // when new RemotePartitioningWorkerStepBuilder("step").outputChannel(null); // then // expected exception }
@Test public void inputChannelMustNotBeNull() { // given this.expectedException.expect(IllegalArgumentException.class); this.expectedException.expectMessage("inputChannel must not be null"); // when new RemotePartitioningWorkerStepBuilder("step").inputChannel(null); // then // expected exception }
@Test public void testMandatoryInputChannel() { // given this.expectedException.expect(IllegalArgumentException.class); this.expectedException.expectMessage("An InputChannel must be provided"); // when new RemotePartitioningWorkerStepBuilder("step").tasklet(this.tasklet); // then // expected exception }
@Test public void jobExplorerMustNotBeNull() { // given this.expectedException.expect(IllegalArgumentException.class); this.expectedException.expectMessage("jobExplorer must not be null"); // when new RemotePartitioningWorkerStepBuilder("step").jobExplorer(null); // then // expected exception }
@Test public void beanFactoryMustNotBeNull() { // given this.expectedException.expect(IllegalArgumentException.class); this.expectedException.expectMessage("beanFactory must not be null"); // when new RemotePartitioningWorkerStepBuilder("step").beanFactory(null); // then // expected exception }
@Test public void stepLocatorMustNotBeNull() { // given this.expectedException.expect(IllegalArgumentException.class); this.expectedException.expectMessage("stepLocator must not be null"); // when new RemotePartitioningWorkerStepBuilder("step").stepLocator(null); // then // expected exception }
@Override public TaskletStepBuilder tasklet(Tasklet tasklet) { configureWorkerIntegrationFlow(); return super.tasklet(tasklet); }
@Override public <I, O> SimpleStepBuilder<I, O> chunk(CompletionPolicy completionPolicy) { configureWorkerIntegrationFlow(); return super.chunk(completionPolicy); }
@Override public JobStepBuilder job(Job job) { configureWorkerIntegrationFlow(); return super.job(job); }
@Override public <I, O> SimpleStepBuilder<I, O> chunk(int chunkSize) { configureWorkerIntegrationFlow(); return super.chunk(chunkSize); }
@Override public PartitionStepBuilder partitioner(Step step) { configureWorkerIntegrationFlow(); return super.partitioner(step); }
@Override public FlowStepBuilder flow(Flow flow) { configureWorkerIntegrationFlow(); return super.flow(flow); }