Package org.springframework.batch.integration.chunk

Examples of org.springframework.batch.integration.chunk.ChunkHandler


  @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);
  }
View Full Code Here


  @Test
  public void testRemoteChunkingSlaveParserWithProcessorNotDefined() {
    ApplicationContext applicationContext =
        new ClassPathXmlApplicationContext("/org/springframework/batch/integration/config/xml/RemoteChunkingSlaveParserNoProcessorTests.xml");

    ChunkHandler chunkHandler = applicationContext.getBean(ChunkProcessorChunkHandler.class);
    ChunkProcessor chunkProcessor = (SimpleChunkProcessor) TestUtils.getPropertyValue(chunkHandler, "chunkProcessor");
    assertNotNull("ChunkProcessor must not be null", chunkProcessor);

    ItemProcessor<String, String> itemProcessor = (ItemProcessor<String, String>) TestUtils.getPropertyValue(chunkProcessor, "itemProcessor");
    assertNotNull("ChunkProcessor ItemWriter must not be null", itemProcessor);
View Full Code Here

TOP

Related Classes of org.springframework.batch.integration.chunk.ChunkHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.