when(module.getProperties()).thenReturn(properties);
when(module.getDescriptor()).thenReturn(
new ModuleDescriptor.Builder().setGroup(moduleGroupName).setIndex(moduleIndex).setModuleDefinition(
ModuleDefinitions.dummy("testjob", ModuleType.job)).build());
MessageChannel stepsOut = new DirectChannel();
when(module.getComponent("stepExecutionRequests.output", MessageChannel.class)).thenReturn(stepsOut);
PollableChannel stepResultsIn = new QueueChannel();
when(module.getComponent("stepExecutionReplies.input", MessageChannel.class)).thenReturn(stepResultsIn);
PollableChannel stepsIn = new QueueChannel();
when(module.getComponent("stepExecutionRequests.input", MessageChannel.class)).thenReturn(stepsIn);
MessageChannel stepResultsOut = new DirectChannel();
when(module.getComponent("stepExecutionReplies.output", MessageChannel.class)).thenReturn(stepResultsOut);
jobPartitionerPlugin.preProcessModule(module);
jobPartitionerPlugin.postProcessModule(module);
checkBusBound(messageBus);
stepsOut.send(new GenericMessage<String>("foo"));
Message<?> stepExecutionRequest = stepsIn.receive(10000);
assertThat(stepExecutionRequest, hasPayload("foo"));
stepResultsOut.send(MessageBuilder.withPayload("bar")
.copyHeaders(stepExecutionRequest.getHeaders()) // replyTo
.build());
assertThat(stepResultsIn.receive(10000), hasPayload("bar"));
jobPartitionerPlugin.removeModule(module);
checkBusUnbound(messageBus);