0 Replies Latest reply on May 9, 2017 10:07 PM by cfang

    Added sample app at test-apps/simple

    cfang

      I recently added a sample app at test-apps/simple, which aims to be a extremely simple batch app taking advantage of components from jberet-support module.  The following is the structure and files withint this simple sample app:

       

      ├── pom.xml

      ├── src

      │   ├── main

      │   │   ├── java

      │   │   └── resources

      │   │       └── META-INF

      │   │           ├── batch-jobs

      │   │           │   └── simple.xml

      │   │           ├── batch.xml

      │   │           └── beans.xml

      │   └── test

      │       └── java

      │           └── org

      │               └── jberet

      │                   └── testapps

      │                       └── simple

      │                           └── SimpleIT.java

       

      As you can see, aside from pom.xml and test file, the sole really useful file is the batch job file simple.xml:

       

      <job id="simple" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
        <step id="simple.step1">
        <chunk>
        <reader ref="arrayItemReader">
        <properties>
        <property name="resource" value="[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]"/>
        <property name="beanType" value="java.lang.Integer"/>
        <property name="skipBeanValidation" value="true"/>
        </properties>
        </reader>
        <writer ref="mockItemWriter"/>
        </chunk>
        </step>
      </job>

       

      arrayItemReader and mockItemWriter are reusable components from jberet-support.

       

      There is no input file, since the input batch data is embedded in line under arrayItemReader, for testing purpose.

       

      There is no separate output file either, since mockItemWriter can log output to the console, for testing and quick visual check.

       

      Here we are only using the most basic features in arrayItemReader and mockItemWriter.  See earlier discussions (arrayItemReader and mockItemWriter) for more ways to help your batch application development.