Upgrade spring-javaformat maven plugin to version 0.0.39

This commit is contained in:
Mahmoud Ben Hassine
2023-06-05 11:11:48 +02:00
parent bb5598e569
commit c25cd55901
264 changed files with 2551 additions and 1397 deletions

View File

@@ -149,8 +149,8 @@ public class ChunkMessageChannelItemWriter<T>
}
if (timedOut) {
stepExecution.setStatus(BatchStatus.FAILED);
return ExitStatus.FAILED.addExitDescription(
"Timed out waiting for " + localState.getExpecting() + " backlog at end of step");
return ExitStatus.FAILED
.addExitDescription("Timed out waiting for " + localState.getExpecting() + " backlog at end of step");
}
return ExitStatus.COMPLETED.addExitDescription("Waited for " + expecting + " results.");
}

View File

@@ -53,7 +53,7 @@ public class RemoteChunkingManagerStepBuilderFactory {
*/
public <I, O> RemoteChunkingManagerStepBuilder<I, O> get(String name) {
return new RemoteChunkingManagerStepBuilder<I, O>(name, this.jobRepository)
.transactionManager(this.transactionManager);
.transactionManager(this.transactionManager);
}
}

View File

@@ -116,8 +116,10 @@ public class RemoteChunkingWorkerBuilder<I, O> {
ChunkProcessorChunkHandler<I> chunkProcessorChunkHandler = new ChunkProcessorChunkHandler<>();
chunkProcessorChunkHandler.setChunkProcessor(chunkProcessor);
return IntegrationFlow.from(this.inputChannel).handle(chunkProcessorChunkHandler, SERVICE_ACTIVATOR_METHOD_NAME)
.channel(this.outputChannel).get();
return IntegrationFlow.from(this.inputChannel)
.handle(chunkProcessorChunkHandler, SERVICE_ACTIVATOR_METHOD_NAME)
.channel(this.outputChannel)
.get();
}
}

View File

@@ -132,6 +132,7 @@ import org.springframework.integration.config.EnableIntegration;
*
* }
* </pre>
*
* @since 4.1
* @author Mahmoud Ben Hassine
* @author Taeik Lim

View File

@@ -48,7 +48,7 @@ public class JobLaunchingGatewayParser extends AbstractConsumerEndpointParser {
protected BeanDefinitionBuilder parseHandler(Element element, ParserContext parserContext) {
final BeanDefinitionBuilder jobLaunchingGatewayBuilder = BeanDefinitionBuilder
.genericBeanDefinition(JobLaunchingGateway.class);
.genericBeanDefinition(JobLaunchingGateway.class);
final String jobLauncher = element.getAttribute("job-launcher");

View File

@@ -70,16 +70,18 @@ public class RemoteChunkingManagerParser extends AbstractBeanDefinitionParser {
BeanDefinitionRegistry beanDefinitionRegistry = parserContext.getRegistry();
BeanDefinition chunkMessageChannelItemWriter = BeanDefinitionBuilder
.genericBeanDefinition(ChunkMessageChannelItemWriter.class)
.addPropertyReference(MESSAGING_OPERATIONS_PROPERTY, messageTemplate)
.addPropertyReference(REPLY_CHANNEL_PROPERTY, replyChannel).getBeanDefinition();
.genericBeanDefinition(ChunkMessageChannelItemWriter.class)
.addPropertyReference(MESSAGING_OPERATIONS_PROPERTY, messageTemplate)
.addPropertyReference(REPLY_CHANNEL_PROPERTY, replyChannel)
.getBeanDefinition();
beanDefinitionRegistry.registerBeanDefinition(id, chunkMessageChannelItemWriter);
BeanDefinition remoteChunkHandlerFactoryBean = BeanDefinitionBuilder
.genericBeanDefinition(RemoteChunkHandlerFactoryBean.class)
.addPropertyValue(CHUNK_WRITER_PROPERTY, chunkMessageChannelItemWriter)
.addPropertyValue(STEP_PROPERTY, step).getBeanDefinition();
.genericBeanDefinition(RemoteChunkHandlerFactoryBean.class)
.addPropertyValue(CHUNK_WRITER_PROPERTY, chunkMessageChannelItemWriter)
.addPropertyValue(STEP_PROPERTY, step)
.getBeanDefinition();
beanDefinitionRegistry.registerBeanDefinition(CHUNK_HANDLER_BEAN_NAME_PREFIX + step,
remoteChunkHandlerFactoryBean);

View File

@@ -81,8 +81,8 @@ public class RemoteChunkingWorkerParser extends AbstractBeanDefinitionParser {
BeanDefinitionRegistry beanDefinitionRegistry = parserContext.getRegistry();
BeanDefinitionBuilder chunkProcessorBuilder = BeanDefinitionBuilder
.genericBeanDefinition(SimpleChunkProcessor.class)
.addPropertyReference(ITEM_WRITER_PROPERTY_NAME, itemWriter);
.genericBeanDefinition(SimpleChunkProcessor.class)
.addPropertyReference(ITEM_WRITER_PROPERTY_NAME, itemWriter);
if (StringUtils.hasText(itemProcessor)) {
chunkProcessorBuilder.addPropertyReference(ITEM_PROCESSOR_PROPERTY_NAME, itemProcessor);
@@ -92,9 +92,9 @@ public class RemoteChunkingWorkerParser extends AbstractBeanDefinitionParser {
}
BeanDefinition chunkProcessorChunkHandler = BeanDefinitionBuilder
.genericBeanDefinition(ChunkProcessorChunkHandler.class)
.addPropertyValue(CHUNK_PROCESSOR_PROPERTY_NAME, chunkProcessorBuilder.getBeanDefinition())
.getBeanDefinition();
.genericBeanDefinition(ChunkProcessorChunkHandler.class)
.addPropertyValue(CHUNK_PROCESSOR_PROPERTY_NAME, chunkProcessorBuilder.getBeanDefinition())
.getBeanDefinition();
beanDefinitionRegistry.registerBeanDefinition(CHUNK_PROCESSOR_CHUNK_HANDLER_BEAN_NAME_PREFIX + id,
chunkProcessorChunkHandler);
@@ -123,7 +123,7 @@ public class RemoteChunkingWorkerParser extends AbstractBeanDefinitionParser {
@Override
protected BeanDefinitionBuilder parseHandler(Element element, ParserContext parserContext) {
BeanDefinitionBuilder builder = BeanDefinitionBuilder
.genericBeanDefinition(ServiceActivatorFactoryBean.class);
.genericBeanDefinition(ServiceActivatorFactoryBean.class);
builder.addPropertyValue(TARGET_METHOD_NAME_PROPERTY_NAME, HANDLE_CHUNK_METHOD_NAME);
builder.addPropertyValue(TARGET_OBJECT_PROPERTY_NAME,
new RuntimeBeanReference(CHUNK_PROCESSOR_CHUNK_HANDLER_BEAN_NAME_PREFIX + id));

View File

@@ -256,13 +256,16 @@ public class MessageChannelPartitionHandler extends AbstractPartitionHandler imp
Callable<Set<StepExecution>> callback = new Callable<Set<StepExecution>>() {
@Override
public Set<StepExecution> call() throws Exception {
Set<Long> currentStepExecutionIds = split.stream().map(StepExecution::getId)
.collect(Collectors.toSet());
Set<Long> currentStepExecutionIds = split.stream()
.map(StepExecution::getId)
.collect(Collectors.toSet());
JobExecution jobExecution = jobExplorer.getJobExecution(managerStepExecution.getJobExecutionId());
jobExecution.getStepExecutions().stream()
.filter(stepExecution -> currentStepExecutionIds.contains(stepExecution.getId()))
.filter(stepExecution -> !result.contains(stepExecution))
.filter(stepExecution -> !stepExecution.getStatus().isRunning()).forEach(result::add);
jobExecution.getStepExecutions()
.stream()
.filter(stepExecution -> currentStepExecutionIds.contains(stepExecution.getId()))
.filter(stepExecution -> !result.contains(stepExecution))
.filter(stepExecution -> !stepExecution.getStatus().isRunning())
.forEach(result::add);
if (logger.isDebugEnabled()) {
logger.debug(String.format("Currently waiting on %s partitions to finish", split.size()));
@@ -290,7 +293,7 @@ public class MessageChannelPartitionHandler extends AbstractPartitionHandler imp
private Set<StepExecution> receiveReplies(PollableChannel currentReplyChannel) {
Message<Set<StepExecution>> message = (Message<Set<StepExecution>>) messagingGateway
.receive(currentReplyChannel);
.receive(currentReplyChannel);
if (message == null) {
throw new MessageTimeoutException("Timeout occurred before all partitions returned");
@@ -304,10 +307,12 @@ public class MessageChannelPartitionHandler extends AbstractPartitionHandler imp
private Message<StepExecutionRequest> createMessage(int sequenceNumber, int sequenceSize,
StepExecutionRequest stepExecutionRequest, PollableChannel replyChannel) {
return MessageBuilder.withPayload(stepExecutionRequest).setSequenceNumber(sequenceNumber)
.setSequenceSize(sequenceSize)
.setCorrelationId(stepExecutionRequest.getJobExecutionId() + ":" + stepExecutionRequest.getStepName())
.setReplyChannel(replyChannel).build();
return MessageBuilder.withPayload(stepExecutionRequest)
.setSequenceNumber(sequenceNumber)
.setSequenceSize(sequenceSize)
.setCorrelationId(stepExecutionRequest.getJobExecutionId() + ":" + stepExecutionRequest.getStepName())
.setReplyChannel(replyChannel)
.build();
}
}

View File

@@ -220,7 +220,9 @@ public class RemotePartitioningManagerStepBuilder extends PartitionStepBuilder {
PollableChannel replies = new QueueChannel();
partitionHandler.setReplyChannel(replies);
StandardIntegrationFlow standardIntegrationFlow = IntegrationFlow.from(this.inputChannel)
.aggregate(aggregatorSpec -> aggregatorSpec.processor(partitionHandler)).channel(replies).get();
.aggregate(aggregatorSpec -> aggregatorSpec.processor(partitionHandler))
.channel(replies)
.get();
IntegrationFlowContext integrationFlowContext = this.beanFactory.getBean(IntegrationFlowContext.class);
integrationFlowContext.registration(standardIntegrationFlow).autoStartup(false).register();
}

View File

@@ -63,7 +63,7 @@ public class RemotePartitioningManagerStepBuilderFactory implements BeanFactoryA
*/
public RemotePartitioningManagerStepBuilder get(String name) {
return new RemotePartitioningManagerStepBuilder(name, this.jobRepository).jobExplorer(this.jobExplorer)
.beanFactory(this.beanFactory);
.beanFactory(this.beanFactory);
}
}

View File

@@ -278,7 +278,9 @@ public class RemotePartitioningWorkerStepBuilder extends StepBuilder {
stepExecutionRequestHandler.setStepLocator(this.stepLocator);
StandardIntegrationFlow standardIntegrationFlow = IntegrationFlow.from(this.inputChannel)
.handle(stepExecutionRequestHandler, SERVICE_ACTIVATOR_METHOD_NAME).channel(this.outputChannel).get();
.handle(stepExecutionRequestHandler, SERVICE_ACTIVATOR_METHOD_NAME)
.channel(this.outputChannel)
.get();
IntegrationFlowContext integrationFlowContext = this.beanFactory.getBean(IntegrationFlowContext.class);
integrationFlowContext.registration(standardIntegrationFlow).autoStartup(false).register();
}

View File

@@ -63,7 +63,7 @@ public class RemotePartitioningWorkerStepBuilderFactory implements BeanFactoryAw
*/
public RemotePartitioningWorkerStepBuilder get(String name) {
return new RemotePartitioningWorkerStepBuilder(name, this.jobRepository).jobExplorer(this.jobExplorer)
.beanFactory(this.beanFactory);
.beanFactory(this.beanFactory);
}
}

View File

@@ -47,7 +47,7 @@ class AsyncItemProcessorMessagingGatewayTests {
StepExecution getStepExecution() {
return MetaDataInstanceFactory
.createStepExecution(new JobParametersBuilder().addLong("factor", 2L).toJobParameters());
.createStepExecution(new JobParametersBuilder().addLong("factor", 2L).toJobParameters());
}
@Test

View File

@@ -49,7 +49,7 @@ class PollingAsyncItemProcessorMessagingGatewayTests {
StepExecution getStepExecution() {
return MetaDataInstanceFactory
.createStepExecution(new JobParametersBuilder().addLong("factor", 2L).toJobParameters());
.createStepExecution(new JobParametersBuilder().addLong("factor", 2L).toJobParameters());
}
@Test

View File

@@ -78,8 +78,9 @@ class ChunkMessageItemWriterIntegrationTests {
@BeforeEach
void setUp() throws Exception {
EmbeddedDatabase embeddedDatabase = new EmbeddedDatabaseBuilder().generateUniqueName(true)
.addScript("/org/springframework/batch/core/schema-drop-hsqldb.sql")
.addScript("/org/springframework/batch/core/schema-hsqldb.sql").build();
.addScript("/org/springframework/batch/core/schema-drop-hsqldb.sql")
.addScript("/org/springframework/batch/core/schema-hsqldb.sql")
.build();
JdbcTransactionManager transactionManager = new JdbcTransactionManager(embeddedDatabase);
JobRepositoryFactoryBean repositoryFactoryBean = new JobRepositoryFactoryBean();
repositoryFactoryBean.setDataSource(embeddedDatabase);
@@ -208,7 +209,8 @@ class ChunkMessageItemWriterIntegrationTests {
@SuppressWarnings({ "unchecked", "rawtypes" })
private GenericMessage<ChunkRequest> getSimpleMessage(Long jobId, String... items) {
StepContribution stepContribution = new JobExecution(new JobInstance(0L, "job"), new JobParameters())
.createStepExecution("step").createStepContribution();
.createStepExecution("step")
.createStepContribution();
ChunkRequest chunk = new ChunkRequest(0, Chunk.of(items), jobId, stepContribution);
GenericMessage<ChunkRequest> message = new GenericMessage<>(chunk);
return message;

View File

@@ -97,7 +97,8 @@ class RemoteChunkingManagerStepBuilderTests {
// when
final Exception expectedException = assertThrows(IllegalArgumentException.class,
() -> new RemoteChunkingManagerStepBuilder<String, String>("step", this.jobRepository)
.inputChannel(null).build());
.inputChannel(null)
.build());
// then
assertThat(expectedException).hasMessage("inputChannel must not be null");
@@ -108,7 +109,8 @@ class RemoteChunkingManagerStepBuilderTests {
// when
final Exception expectedException = assertThrows(IllegalArgumentException.class,
() -> new RemoteChunkingManagerStepBuilder<String, String>("step", this.jobRepository)
.outputChannel(null).build());
.outputChannel(null)
.build());
// then
assertThat(expectedException).hasMessage("outputChannel must not be null");
@@ -119,7 +121,8 @@ class RemoteChunkingManagerStepBuilderTests {
// when
final Exception expectedException = assertThrows(IllegalArgumentException.class,
() -> new RemoteChunkingManagerStepBuilder<String, String>("step", this.jobRepository)
.messagingTemplate(null).build());
.messagingTemplate(null)
.build());
// then
assertThat(expectedException).hasMessage("messagingTemplate must not be null");
@@ -130,7 +133,8 @@ class RemoteChunkingManagerStepBuilderTests {
// when
final Exception expectedException = assertThrows(IllegalArgumentException.class,
() -> new RemoteChunkingManagerStepBuilder<String, String>("step", this.jobRepository)
.maxWaitTimeouts(-1).build());
.maxWaitTimeouts(-1)
.build());
// then
assertThat(expectedException).hasMessage("maxWaitTimeouts must be greater than zero");
@@ -141,7 +145,8 @@ class RemoteChunkingManagerStepBuilderTests {
// when
final Exception expectedException = assertThrows(IllegalArgumentException.class,
() -> new RemoteChunkingManagerStepBuilder<String, String>("step", this.jobRepository)
.throttleLimit(-1L).build());
.throttleLimit(-1L)
.build());
// then
assertThat(expectedException).hasMessage("throttleLimit must be greater than zero");
@@ -164,15 +169,17 @@ class RemoteChunkingManagerStepBuilderTests {
void eitherOutputChannelOrMessagingTemplateMustBeProvided() {
// given
RemoteChunkingManagerStepBuilder<String, String> builder = new RemoteChunkingManagerStepBuilder<String, String>(
"step", this.jobRepository).inputChannel(this.inputChannel).outputChannel(new DirectChannel())
.messagingTemplate(new MessagingTemplate());
"step", this.jobRepository)
.inputChannel(this.inputChannel)
.outputChannel(new DirectChannel())
.messagingTemplate(new MessagingTemplate());
// when
final Exception expectedException = assertThrows(IllegalStateException.class, builder::build);
// then
assertThat(expectedException)
.hasMessage("You must specify either an outputChannel or a messagingTemplate but not both.");
.hasMessage("You must specify either an outputChannel or a messagingTemplate but not both.");
}
@Test
@@ -180,9 +187,14 @@ class RemoteChunkingManagerStepBuilderTests {
// when
final Exception expectedException = assertThrows(UnsupportedOperationException.class,
() -> new RemoteChunkingManagerStepBuilder<String, String>("step", this.jobRepository)
.reader(this.itemReader).writer(items -> {
}).repository(this.jobRepository).transactionManager(this.transactionManager)
.inputChannel(this.inputChannel).outputChannel(this.outputChannel).build());
.reader(this.itemReader)
.writer(items -> {
})
.repository(this.jobRepository)
.transactionManager(this.transactionManager)
.inputChannel(this.inputChannel)
.outputChannel(this.outputChannel)
.build());
// then
assertThat(expectedException).hasMessage(
@@ -195,8 +207,11 @@ class RemoteChunkingManagerStepBuilderTests {
void testManagerStepCreation() {
// when
TaskletStep taskletStep = new RemoteChunkingManagerStepBuilder<String, String>("step", this.jobRepository)
.reader(this.itemReader).transactionManager(this.transactionManager).inputChannel(this.inputChannel)
.outputChannel(this.outputChannel).build();
.reader(this.itemReader)
.transactionManager(this.transactionManager)
.inputChannel(this.inputChannel)
.outputChannel(this.outputChannel)
.build();
// then
assertNotNull(taskletStep);
@@ -266,15 +281,36 @@ class RemoteChunkingManagerStepBuilderTests {
};
TaskletStep taskletStep = new RemoteChunkingManagerStepBuilder<String, String>("step", this.jobRepository)
.reader(itemReader).readerIsTransactionalQueue().processor(itemProcessor)
.transactionManager(this.transactionManager).transactionAttribute(transactionAttribute)
.inputChannel(this.inputChannel).outputChannel(this.outputChannel).listener(annotatedListener)
.listener(skipListener).listener(chunkListener).listener(stepExecutionListener)
.listener(itemReadListener).listener(itemWriteListener).listener(retryListener).skip(Exception.class)
.noSkip(RuntimeException.class).skipLimit(10).retry(IOException.class).noRetry(RuntimeException.class)
.retryLimit(10).retryContextCache(retryCache).noRollback(Exception.class).startLimit(3)
.allowStartIfComplete(true).stepOperations(stepOperations).chunk(3).backOffPolicy(backOffPolicy)
.stream(stream).keyGenerator(Object::hashCode).build();
.reader(itemReader)
.readerIsTransactionalQueue()
.processor(itemProcessor)
.transactionManager(this.transactionManager)
.transactionAttribute(transactionAttribute)
.inputChannel(this.inputChannel)
.outputChannel(this.outputChannel)
.listener(annotatedListener)
.listener(skipListener)
.listener(chunkListener)
.listener(stepExecutionListener)
.listener(itemReadListener)
.listener(itemWriteListener)
.listener(retryListener)
.skip(Exception.class)
.noSkip(RuntimeException.class)
.skipLimit(10)
.retry(IOException.class)
.noRetry(RuntimeException.class)
.retryLimit(10)
.retryContextCache(retryCache)
.noRollback(Exception.class)
.startLimit(3)
.allowStartIfComplete(true)
.stepOperations(stepOperations)
.chunk(3)
.backOffPolicy(backOffPolicy)
.stream(stream)
.keyGenerator(Object::hashCode)
.build();
JobExecution jobExecution = this.jobRepository.createJobExecution("job1", new JobParameters());
StepExecution stepExecution = new StepExecution("step1", jobExecution);
@@ -328,7 +364,9 @@ class RemoteChunkingManagerStepBuilderTests {
@Bean
DataSource dataSource() {
return new EmbeddedDatabaseBuilder().addScript("/org/springframework/batch/core/schema-drop-hsqldb.sql")
.addScript("/org/springframework/batch/core/schema-hsqldb.sql").generateUniqueName(true).build();
.addScript("/org/springframework/batch/core/schema-hsqldb.sql")
.generateUniqueName(true)
.build();
}
@Bean

View File

@@ -93,8 +93,8 @@ class RemoteChunkingWorkerBuilderTests {
void testMandatoryInputChannel() {
// given
RemoteChunkingWorkerBuilder<String, String> builder = new RemoteChunkingWorkerBuilder<String, String>()
.itemWriter(items -> {
});
.itemWriter(items -> {
});
// when
final Exception expectedException = assertThrows(IllegalArgumentException.class, builder::build);
@@ -107,8 +107,9 @@ class RemoteChunkingWorkerBuilderTests {
void testMandatoryOutputChannel() {
// given
RemoteChunkingWorkerBuilder<String, String> builder = new RemoteChunkingWorkerBuilder<String, String>()
.itemWriter(items -> {
}).inputChannel(new DirectChannel());
.itemWriter(items -> {
})
.inputChannel(new DirectChannel());
// when
final Exception expectedException = assertThrows(IllegalArgumentException.class, builder::build);
@@ -123,8 +124,10 @@ class RemoteChunkingWorkerBuilderTests {
DirectChannel inputChannel = new DirectChannel();
DirectChannel outputChannel = new DirectChannel();
RemoteChunkingWorkerBuilder<String, String> builder = new RemoteChunkingWorkerBuilder<String, String>()
.itemProcessor(this.itemProcessor).itemWriter(this.itemWriter).inputChannel(inputChannel)
.outputChannel(outputChannel);
.itemProcessor(this.itemProcessor)
.itemWriter(this.itemWriter)
.inputChannel(inputChannel)
.outputChannel(outputChannel);
// when
IntegrationFlow integrationFlow = builder.build();

View File

@@ -33,7 +33,9 @@ public class JobLauncherParserTestsConfiguration {
@Bean
public DataSource dataSource() {
return new EmbeddedDatabaseBuilder().addScript("/org/springframework/batch/core/schema-drop-hsqldb.sql")
.addScript("/org/springframework/batch/core/schema-hsqldb.sql").generateUniqueName(true).build();
.addScript("/org/springframework/batch/core/schema-hsqldb.sql")
.generateUniqueName(true)
.build();
}
@Bean

View File

@@ -70,7 +70,7 @@ class RemoteChunkingParserTests {
assertTrue(itemWriter instanceof Writer, "Got wrong instance of ItemWriter");
ItemProcessor<String, String> itemProcessor = (ItemProcessor<String, String>) TestUtils
.getPropertyValue(chunkProcessor, "itemProcessor");
.getPropertyValue(chunkProcessor, "itemProcessor");
assertNotNull(itemProcessor, "ChunkProcessor ItemWriter must not be null");
assertTrue(itemProcessor instanceof Processor, "Got wrong instance of ItemProcessor");
@@ -104,7 +104,7 @@ class RemoteChunkingParserTests {
assertNotNull(chunkProcessor, "ChunkProcessor must not be null");
ItemProcessor<String, String> itemProcessor = (ItemProcessor<String, String>) TestUtils
.getPropertyValue(chunkProcessor, "itemProcessor");
.getPropertyValue(chunkProcessor, "itemProcessor");
assertNotNull(itemProcessor, "ChunkProcessor ItemWriter must not be null");
assertTrue(itemProcessor instanceof PassThroughItemProcessor, "Got wrong instance of ItemProcessor");
}
@@ -121,7 +121,7 @@ class RemoteChunkingParserTests {
assertNotNull(TestUtils.getPropertyValue(itemWriter, "replyChannel"), "Reply channel must not be null");
FactoryBean<ChunkHandler> remoteChunkingHandlerFactoryBean = applicationContext
.getBean(RemoteChunkHandlerFactoryBean.class);
.getBean(RemoteChunkHandlerFactoryBean.class);
assertNotNull(TestUtils.getPropertyValue(remoteChunkingHandlerFactoryBean, "chunkWriter"),
"Chunk writer must not be null");
assertNotNull(TestUtils.getPropertyValue(remoteChunkingHandlerFactoryBean, "step"), "Step must not be null");

View File

@@ -42,11 +42,12 @@ class JobLaunchingGatewayTests {
void testExceptionRaised() throws Exception {
final Message<JobLaunchRequest> message = MessageBuilder
.withPayload(new JobLaunchRequest(new JobSupport("testJob"), new JobParameters())).build();
.withPayload(new JobLaunchRequest(new JobSupport("testJob"), new JobParameters()))
.build();
final JobLauncher jobLauncher = mock(JobLauncher.class);
when(jobLauncher.run(any(Job.class), any(JobParameters.class)))
.thenThrow(new JobParametersInvalidException("This is a JobExecutionException."));
.thenThrow(new JobParametersInvalidException("This is a JobExecutionException."));
JobLaunchingGateway jobLaunchingGateway = new JobLaunchingGateway(jobLauncher);
Exception exception = assertThrows(MessageHandlingException.class,

View File

@@ -127,14 +127,16 @@ class RemotePartitioningManagerStepBuilderTests {
void eitherOutputChannelOrMessagingTemplateMustBeProvided() {
// given
RemotePartitioningManagerStepBuilder builder = new RemotePartitioningManagerStepBuilder("step",
this.jobRepository).outputChannel(new DirectChannel()).messagingTemplate(new MessagingTemplate());
this.jobRepository)
.outputChannel(new DirectChannel())
.messagingTemplate(new MessagingTemplate());
// when
final Exception expectedException = assertThrows(IllegalStateException.class, builder::build);
// then
assertThat(expectedException)
.hasMessage("You must specify either an outputChannel or a messagingTemplate but not both.");
.hasMessage("You must specify either an outputChannel or a messagingTemplate but not both.");
}
@Test
@@ -169,9 +171,15 @@ class RemotePartitioningManagerStepBuilderTests {
// when
Step step = new RemotePartitioningManagerStepBuilder("managerStep", this.jobRepository)
.outputChannel(outputChannel).partitioner("workerStep", partitioner).gridSize(gridSize)
.pollInterval(pollInterval).timeout(timeout).startLimit(startLimit).aggregator(stepExecutionAggregator)
.allowStartIfComplete(true).build();
.outputChannel(outputChannel)
.partitioner("workerStep", partitioner)
.gridSize(gridSize)
.pollInterval(pollInterval)
.timeout(timeout)
.startLimit(startLimit)
.aggregator(stepExecutionAggregator)
.allowStartIfComplete(true)
.build();
// then
assertNotNull(step);
@@ -206,8 +214,13 @@ class RemotePartitioningManagerStepBuilderTests {
// when
Step step = new RemotePartitioningManagerStepBuilder("managerStep", this.jobRepository)
.outputChannel(outputChannel).partitioner("workerStep", partitioner).gridSize(gridSize)
.startLimit(startLimit).aggregator(stepExecutionAggregator).allowStartIfComplete(true).build();
.outputChannel(outputChannel)
.partitioner("workerStep", partitioner)
.gridSize(gridSize)
.startLimit(startLimit)
.aggregator(stepExecutionAggregator)
.allowStartIfComplete(true)
.build();
// then
assertNotNull(step);
@@ -239,7 +252,9 @@ class RemotePartitioningManagerStepBuilderTests {
@Bean
DataSource dataSource() {
return new EmbeddedDatabaseBuilder().addScript("/org/springframework/batch/core/schema-drop-hsqldb.sql")
.addScript("/org/springframework/batch/core/schema-hsqldb.sql").generateUniqueName(true).build();
.addScript("/org/springframework/batch/core/schema-hsqldb.sql")
.generateUniqueName(true)
.build();
}
@Bean

View File

@@ -130,7 +130,8 @@ class RemotePartitioningWorkerStepBuilderTests {
// given
DirectChannel inputChannel = new DirectChannel();
final RemotePartitioningWorkerStepBuilder builder = new RemotePartitioningWorkerStepBuilder("step",
this.jobRepository).inputChannel(inputChannel);
this.jobRepository)
.inputChannel(inputChannel);
// when
final Exception expectedException = assertThrows(IllegalArgumentException.class,

View File

@@ -94,8 +94,8 @@ class RepeatTransactionalPollingIntegrationTests implements ApplicationContextAw
@Test
@DirtiesContext
void testSunnyDay() throws Exception {
list = TransactionAwareProxyFactory.createTransactionalList(
Arrays.asList(StringUtils.commaDelimitedListToStringArray("a,b,c,d,e,f,g,h,j,k")));
list = TransactionAwareProxyFactory
.createTransactionalList(Arrays.asList(StringUtils.commaDelimitedListToStringArray("a,b,c,d,e,f,g,h,j,k")));
expected = Arrays.asList(StringUtils.commaDelimitedListToStringArray("a,b,c,d"));
waitForResults(bus, expected.size(), 60);
assertEquals(expected, processed);

View File

@@ -80,8 +80,8 @@ class RetryRepeatTransactionalPollingIntegrationTests implements ApplicationCont
@Test
@DirtiesContext
void testSunnyDay() throws Exception {
list = TransactionAwareProxyFactory.createTransactionalList(
Arrays.asList(StringUtils.commaDelimitedListToStringArray("a,b,c,d,e,f,g,h,j,k")));
list = TransactionAwareProxyFactory
.createTransactionalList(Arrays.asList(StringUtils.commaDelimitedListToStringArray("a,b,c,d,e,f,g,h,j,k")));
List<String> expected = Arrays.asList(StringUtils.commaDelimitedListToStringArray("a,b,c,d"));
service.setExpected(expected);
waitForResults(lifecycle, expected.size(), 60);

View File

@@ -82,8 +82,8 @@ public class RetryTransactionalPollingIntegrationTests implements ApplicationCon
@Test
@DirtiesContext
void testSunnyDay() throws Exception {
list = TransactionAwareProxyFactory.createTransactionalList(
Arrays.asList(StringUtils.commaDelimitedListToStringArray("a,b,c,d,e,f,g,h,j,k")));
list = TransactionAwareProxyFactory
.createTransactionalList(Arrays.asList(StringUtils.commaDelimitedListToStringArray("a,b,c,d,e,f,g,h,j,k")));
List<String> expected = Arrays.asList(StringUtils.commaDelimitedListToStringArray("a,b,c,d"));
service.setExpected(expected);
waitForResults(bus, expected.size(), 60);