Make the outputChannel and messagingTemplate mutually exclusive
This commit changes the remote chunking and partitioning master step builders to either accept an output channel or a messaging template but not both. See BATCH-2687
This commit is contained in:
@@ -176,13 +176,15 @@ public class RemoteChunkingMasterStepBuilderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMandatoryOutputChannel() {
|
||||
public void eitherOutputChannelOrMessagingTemplateMustBeProvided() {
|
||||
// given
|
||||
RemoteChunkingMasterStepBuilder<String, String> builder = new RemoteChunkingMasterStepBuilder<String, String>("step")
|
||||
.inputChannel(this.inputChannel);
|
||||
.inputChannel(this.inputChannel)
|
||||
.outputChannel(new DirectChannel())
|
||||
.messagingTemplate(new MessagingTemplate());
|
||||
|
||||
this.expectedException.expect(IllegalArgumentException.class);
|
||||
this.expectedException.expectMessage("An OutputChannel must be provided");
|
||||
this.expectedException.expect(IllegalStateException.class);
|
||||
this.expectedException.expectMessage("You must specify either an outputChannel or a messagingTemplate but not both.");
|
||||
|
||||
// when
|
||||
TaskletStep step = builder.build();
|
||||
|
||||
@@ -118,12 +118,14 @@ public class RemotePartitioningMasterStepBuilderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMandatoryOutputChannel() {
|
||||
public void eitherOutputChannelOrMessagingTemplateMustBeProvided() {
|
||||
// given
|
||||
RemotePartitioningMasterStepBuilder builder = new RemotePartitioningMasterStepBuilder("step");
|
||||
RemotePartitioningMasterStepBuilder builder = new RemotePartitioningMasterStepBuilder("step")
|
||||
.outputChannel(new DirectChannel())
|
||||
.messagingTemplate(new MessagingTemplate());
|
||||
|
||||
this.expectedException.expect(IllegalArgumentException.class);
|
||||
this.expectedException.expectMessage("An outputChannel must be provided");
|
||||
this.expectedException.expect(IllegalStateException.class);
|
||||
this.expectedException.expectMessage("You must specify either an outputChannel or a messagingTemplate but not both.");
|
||||
|
||||
// when
|
||||
Step step = builder.build();
|
||||
|
||||
Reference in New Issue
Block a user