@Test
public void testRemoteChunkingSlaveParserWithProcessorDefined() {
ApplicationContext applicationContext =
new ClassPathXmlApplicationContext("/org/springframework/batch/integration/config/xml/RemoteChunkingSlaveParserTests.xml");
ChunkHandler chunkHandler = applicationContext.getBean(ChunkProcessorChunkHandler.class);
ChunkProcessor chunkProcessor = (SimpleChunkProcessor) TestUtils.getPropertyValue(chunkHandler, "chunkProcessor");
assertNotNull("ChunkProcessor must not be null", chunkProcessor);
ItemWriter<String> itemWriter = (ItemWriter<String>) TestUtils.getPropertyValue(chunkProcessor, "itemWriter");
assertNotNull("ChunkProcessor ItemWriter must not be null", itemWriter);
assertTrue("Got wrong instance of ItemWriter", itemWriter instanceof Writer);
ItemProcessor<String, String> itemProcessor = (ItemProcessor<String, String>) TestUtils.getPropertyValue(chunkProcessor, "itemProcessor");
assertNotNull("ChunkProcessor ItemWriter must not be null", itemProcessor);
assertTrue("Got wrong instance of ItemProcessor", itemProcessor instanceof Processor);
FactoryBean serviceActivatorFactoryBean = applicationContext.getBean(ServiceActivatorFactoryBean.class);
assertNotNull("ServiceActivatorFactoryBean must not be null", serviceActivatorFactoryBean);
assertNotNull("Output channel must not be null", TestUtils.getPropertyValue(serviceActivatorFactoryBean, "outputChannel"));
MessageChannel inputChannel = applicationContext.getBean("requests", MessageChannel.class);
assertNotNull("Input channel must not be null", inputChannel);
String targetMethodName = (String) TestUtils.getPropertyValue(serviceActivatorFactoryBean, "targetMethodName");
assertNotNull("Target method name must not be null", targetMethodName);
assertTrue("Target method name must be handleChunk, got: " + targetMethodName, "handleChunk".equals(targetMethodName));
ChunkHandler targetObject = (ChunkHandler) TestUtils.getPropertyValue(serviceActivatorFactoryBean, "targetObject");
assertNotNull("Target object must not be null", targetObject);
}