Skip to content

Commit

Permalink
BATCH-2686: Use "this" keyword for class level fields
Browse files Browse the repository at this point in the history
  • Loading branch information
fmbenhassine committed May 3, 2018
1 parent 8faecf4 commit 8fbc847
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 54 deletions.
Expand Up @@ -179,9 +179,9 @@ public RemoteChunkingMasterStepBuilder<I, O> throttleLimit(long throttleLimit) {
*/
public TaskletStep build() {

Assert.notNull(beanDefinitionRegistry, "A BeanDefinitionRegistry must be provided");
Assert.notNull(inputChannel, "An InputChannel must be provided");
Assert.notNull(outputChannel, "An OutputChannel must be provided");
Assert.notNull(this.beanDefinitionRegistry, "A BeanDefinitionRegistry must be provided");
Assert.notNull(this.inputChannel, "An InputChannel must be provided");
Assert.notNull(this.outputChannel, "An OutputChannel must be provided");

// configure messaging template
if (this.messagingTemplate == null) {
Expand All @@ -191,10 +191,10 @@ public TaskletStep build() {

// configure item writer
ChunkMessageChannelItemWriter<O> chunkMessageChannelItemWriter = new ChunkMessageChannelItemWriter<>();
chunkMessageChannelItemWriter.setMessagingOperations(messagingTemplate);
chunkMessageChannelItemWriter.setMaxWaitTimeouts(maxWaitTimeouts);
chunkMessageChannelItemWriter.setThrottleLimit(throttleLimit);
chunkMessageChannelItemWriter.setReplyChannel(inputChannel);
chunkMessageChannelItemWriter.setMessagingOperations(this.messagingTemplate);
chunkMessageChannelItemWriter.setMaxWaitTimeouts(this.maxWaitTimeouts);
chunkMessageChannelItemWriter.setThrottleLimit(this.throttleLimit);
chunkMessageChannelItemWriter.setReplyChannel(this.inputChannel);
super.writer(chunkMessageChannelItemWriter);

// register remote chunk handler factory bean
Expand Down
Expand Up @@ -60,9 +60,9 @@ public RemoteChunkingMasterStepBuilderFactory(
*/
public <I, O> RemoteChunkingMasterStepBuilder<I, O> get(String name) {
return new RemoteChunkingMasterStepBuilder<I, O>(name)
.repository(jobRepository)
.transactionManager(transactionManager)
.beanDefinitionRegistry(beanDefinitionRegistry);
.repository(this.jobRepository)
.transactionManager(this.transactionManager)
.beanDefinitionRegistry(this.beanDefinitionRegistry);
}

}
Expand Up @@ -111,22 +111,22 @@ public RemoteChunkingWorkerBuilder<I, O> outputChannel(DirectChannel outputChann
*/
public IntegrationFlow build() {

Assert.notNull(itemWriter, "An ItemWriter must be provided");
Assert.notNull(inputChannel, "An InputChannel must be provided");
Assert.notNull(outputChannel, "An OutputChannel must be provided");
Assert.notNull(this.itemWriter, "An ItemWriter must be provided");
Assert.notNull(this.inputChannel, "An InputChannel must be provided");
Assert.notNull(this.outputChannel, "An OutputChannel must be provided");

if(this.itemProcessor == null) {
this.itemProcessor = new PassThroughItemProcessor();
}
SimpleChunkProcessor<I, O> chunkProcessor = new SimpleChunkProcessor<>(itemProcessor, itemWriter);
SimpleChunkProcessor<I, O> chunkProcessor = new SimpleChunkProcessor<>(this.itemProcessor, this.itemWriter);

ChunkProcessorChunkHandler<I> chunkProcessorChunkHandler = new ChunkProcessorChunkHandler<>();
chunkProcessorChunkHandler.setChunkProcessor(chunkProcessor);

return IntegrationFlows
.from(inputChannel)
.from(this.inputChannel)
.handle(chunkProcessorChunkHandler, SERVICE_ACTIVATOR_METHOD_NAME)
.channel(outputChannel)
.channel(this.outputChannel)
.get();
}

Expand Down
Expand Up @@ -52,7 +52,8 @@ public BatchIntegrationConfiguration(

@Bean
public RemoteChunkingMasterStepBuilderFactory remoteChunkingMasterStepBuilderFactory() {
return new RemoteChunkingMasterStepBuilderFactory(jobRepository, transactionManager, beanDefinitionRegistry);
return new RemoteChunkingMasterStepBuilderFactory(this.jobRepository,
this.transactionManager, this.beanDefinitionRegistry);
}

@Bean
Expand Down
Expand Up @@ -60,8 +60,8 @@ public class RemoteChunkingMasterStepBuilderTest {
public void testMandatoryBeanDefinitionRegistry() {
// given
RemoteChunkingMasterStepBuilder<String, String> builder = new RemoteChunkingMasterStepBuilder<>("step");
expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("A BeanDefinitionRegistry must be provided");
this.expectedException.expect(IllegalArgumentException.class);
this.expectedException.expectMessage("A BeanDefinitionRegistry must be provided");

// when
builder.build();
Expand All @@ -73,8 +73,8 @@ public void testMandatoryBeanDefinitionRegistry() {
@Test
public void beanDefinitionRegistryMustNotBeNull() {
// given
expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("beanDefinitionRegistry must not be null");
this.expectedException.expect(IllegalArgumentException.class);
this.expectedException.expectMessage("beanDefinitionRegistry must not be null");

// when
TaskletStep step = new RemoteChunkingMasterStepBuilder<String, String>("step")
Expand All @@ -88,8 +88,8 @@ public void beanDefinitionRegistryMustNotBeNull() {
@Test
public void inputChannelMustNotBeNull() {
// given
expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("inputChannel must not be null");
this.expectedException.expect(IllegalArgumentException.class);
this.expectedException.expectMessage("inputChannel must not be null");

// when
TaskletStep step = new RemoteChunkingMasterStepBuilder<String, String>("step")
Expand All @@ -103,8 +103,8 @@ public void inputChannelMustNotBeNull() {
@Test
public void outputChannelMustNotBeNull() {
// given
expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("outputChannel must not be null");
this.expectedException.expect(IllegalArgumentException.class);
this.expectedException.expectMessage("outputChannel must not be null");

// when
TaskletStep step = new RemoteChunkingMasterStepBuilder<String, String>("step")
Expand All @@ -118,8 +118,8 @@ public void outputChannelMustNotBeNull() {
@Test
public void messagingTemplateMustNotBeNull() {
// given
expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("messagingTemplate must not be null");
this.expectedException.expect(IllegalArgumentException.class);
this.expectedException.expectMessage("messagingTemplate must not be null");

// when
TaskletStep step = new RemoteChunkingMasterStepBuilder<String, String>("step")
Expand All @@ -133,8 +133,8 @@ public void messagingTemplateMustNotBeNull() {
@Test
public void maxWaitTimeoutsMustBeGreaterThanZero() {
// given
expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("maxWaitTimeouts must be greater than zero");
this.expectedException.expect(IllegalArgumentException.class);
this.expectedException.expectMessage("maxWaitTimeouts must be greater than zero");

// when
TaskletStep step = new RemoteChunkingMasterStepBuilder<String, String>("step")
Expand All @@ -148,8 +148,8 @@ public void maxWaitTimeoutsMustBeGreaterThanZero() {
@Test
public void throttleLimitMustNotBeGreaterThanZero() {
// given
expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("throttleLimit must be greater than zero");
this.expectedException.expect(IllegalArgumentException.class);
this.expectedException.expectMessage("throttleLimit must be greater than zero");

// when
TaskletStep step = new RemoteChunkingMasterStepBuilder<String, String>("step")
Expand All @@ -166,8 +166,8 @@ public void testMandatoryInputChannel() {
RemoteChunkingMasterStepBuilder<String, String> builder = new RemoteChunkingMasterStepBuilder<String, String>("step")
.beanDefinitionRegistry(new GenericApplicationContext());

expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("An InputChannel must be provided");
this.expectedException.expect(IllegalArgumentException.class);
this.expectedException.expectMessage("An InputChannel must be provided");

// when
TaskletStep step = builder.build();
Expand All @@ -183,8 +183,8 @@ public void testMandatoryOutputChannel() {
.beanDefinitionRegistry(new GenericApplicationContext())
.inputChannel(new QueueChannel());

expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("An OutputChannel must be provided");
this.expectedException.expect(IllegalArgumentException.class);
this.expectedException.expectMessage("An OutputChannel must be provided");

// when
TaskletStep step = builder.build();
Expand All @@ -202,9 +202,9 @@ public void testRemoteChunkHandlerRegistration() {

// when
TaskletStep taskletStep = new RemoteChunkingMasterStepBuilder<String, String>("step")
.reader(itemReader)
.repository(jobRepository)
.transactionManager(transactionManager)
.reader(this.itemReader)
.repository(this.jobRepository)
.transactionManager(this.transactionManager)
.beanDefinitionRegistry(beanDefinitionRegistry)
.inputChannel(inputChannel)
.outputChannel(outputChannel)
Expand Down
Expand Up @@ -40,8 +40,8 @@ public class RemoteChunkingWorkerBuilderTest {
@Test
public void itemProcessorMustNotBeNull() {
// given
expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("itemProcessor must not be null");
this.expectedException.expect(IllegalArgumentException.class);
this.expectedException.expectMessage("itemProcessor must not be null");

// when
IntegrationFlow integrationFlow = new RemoteChunkingWorkerBuilder<String, String>()
Expand All @@ -55,8 +55,8 @@ public void itemProcessorMustNotBeNull() {
@Test
public void itemWriterMustNotBeNull() {
// given
expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("itemWriter must not be null");
this.expectedException.expect(IllegalArgumentException.class);
this.expectedException.expectMessage("itemWriter must not be null");

// when
IntegrationFlow integrationFlow = new RemoteChunkingWorkerBuilder<String, String>()
Expand All @@ -70,8 +70,8 @@ public void itemWriterMustNotBeNull() {
@Test
public void inputChannelMustNotBeNull() {
// given
expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("inputChannel must not be null");
this.expectedException.expect(IllegalArgumentException.class);
this.expectedException.expectMessage("inputChannel must not be null");

// when
IntegrationFlow integrationFlow = new RemoteChunkingWorkerBuilder<String, String>()
Expand All @@ -85,8 +85,8 @@ public void inputChannelMustNotBeNull() {
@Test
public void outputChannelMustNotBeNull() {
// given
expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("outputChannel must not be null");
this.expectedException.expect(IllegalArgumentException.class);
this.expectedException.expectMessage("outputChannel must not be null");

// when
IntegrationFlow integrationFlow = new RemoteChunkingWorkerBuilder<String, String>()
Expand All @@ -102,8 +102,8 @@ public void testMandatoryItemWriter() {
// given
RemoteChunkingWorkerBuilder<String, String> builder = new RemoteChunkingWorkerBuilder<>();

expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("An ItemWriter must be provided");
this.expectedException.expect(IllegalArgumentException.class);
this.expectedException.expectMessage("An ItemWriter must be provided");

// when
builder.build();
Expand All @@ -118,8 +118,8 @@ public void testMandatoryInputChannel() {
RemoteChunkingWorkerBuilder<String, String> builder = new RemoteChunkingWorkerBuilder<String, String>()
.itemWriter(items -> { });

expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("An InputChannel must be provided");
this.expectedException.expect(IllegalArgumentException.class);
this.expectedException.expectMessage("An InputChannel must be provided");

// when
builder.build();
Expand All @@ -135,8 +135,8 @@ public void testMandatoryOutputChannel() {
.itemWriter(items -> { })
.inputChannel(new DirectChannel());

expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("An OutputChannel must be provided");
this.expectedException.expect(IllegalArgumentException.class);
this.expectedException.expectMessage("An OutputChannel must be provided");

// when
builder.build();
Expand All @@ -151,8 +151,8 @@ public void testIntegrationFlowCreation() {
DirectChannel inputChannel = new DirectChannel();
DirectChannel outputChannel = new DirectChannel();
RemoteChunkingWorkerBuilder<String, String> builder = new RemoteChunkingWorkerBuilder<String, String>()
.itemProcessor(itemProcessor)
.itemWriter(itemWriter)
.itemProcessor(this.itemProcessor)
.itemWriter(this.itemWriter)
.inputChannel(inputChannel)
.outputChannel(outputChannel);

Expand Down

0 comments on commit 8fbc847

Please sign in to comment.