Initial Contribution

Signed-off-by: Vinay Vishal <vinay.vishal@oracle.com>
diff --git a/appserver/tests/appserv-tests/devtests/batch/batch-dev-tests/batch-commands-tests/pom.xml b/appserver/tests/appserv-tests/devtests/batch/batch-dev-tests/batch-commands-tests/pom.xml
new file mode 100644
index 0000000..9cafbdf
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/batch-dev-tests/batch-commands-tests/pom.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v. 2.0, which is available at
+    http://www.eclipse.org/legal/epl-2.0.
+
+    This Source Code may also be made available under the following Secondary
+    Licenses when the conditions for such availability set forth in the
+    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+    version 2 with the GNU Classpath Exception, which is available at
+    https://www.gnu.org/software/classpath/license.html.
+
+    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.glassfish.main</groupId>
+    	<artifactId>batch-dev-tests</artifactId>
+        <version>5.0.1-SNAPSHOT</version>
+    </parent>
+    <artifactId>batch-commands-tests</artifactId>
+    <packaging>jar</packaging>
+
+   <dependencies>
+        <dependency>
+            <groupId>org.glassfish.main</groupId>
+            <artifactId>batch-tests-utils</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies> 
+</project>
diff --git a/appserver/tests/appserv-tests/devtests/batch/batch-dev-tests/batch-commands-tests/src/main/resources/README b/appserver/tests/appserv-tests/devtests/batch/batch-dev-tests/batch-commands-tests/src/main/resources/README
new file mode 100644
index 0000000..c40f6e3
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/batch-dev-tests/batch-commands-tests/src/main/resources/README
@@ -0,0 +1,4 @@
+To invoke the joboperator-api application :
+	curl "http://localhost:8080/joboperator-api/PayrollJobSubmitterServlet?inputMonthYear=JAN-2013&calculatePayroll=Calculate+Payroll"
+	The application was built from javaee7 samples project
+
diff --git a/appserver/tests/appserv-tests/devtests/batch/batch-dev-tests/batch-commands-tests/src/test/java/org/glassfish/javaee7/batch/test/BatchCommandsTest.java b/appserver/tests/appserv-tests/devtests/batch/batch-dev-tests/batch-commands-tests/src/test/java/org/glassfish/javaee7/batch/test/BatchCommandsTest.java
new file mode 100644
index 0000000..0ecb2b8
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/batch-dev-tests/batch-commands-tests/src/test/java/org/glassfish/javaee7/batch/test/BatchCommandsTest.java
@@ -0,0 +1,500 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.javaee7.batch.test;
+
+import org.glassfish.javaee7.batch.test.util.CommandUtil;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.util.List;
+import java.util.StringTokenizer;
+
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+public class BatchCommandsTest {
+
+    private static final String VALID_TIMER_POOL_DATA_SOURCE_NAME = "jdbc/__TimerPool";
+
+    private static final String VALID_DEFAULT_DATA_SOURCE_NAME = "jdbc/__default";
+
+    private static final String VALID_EXECUTOR_NAME = "concurrent/__defaultManagedExecutorService";
+
+    private static final String STAND_ALONE_INSTANCE_NAME = "batch-server";
+
+    private static final String SET_BATCH_RUNTIME_COMMAND = "set-batch-runtime-configuration";
+
+    private static final String SERVER_ES1 = "concurrent/__ES1";
+
+    private static final String SERVER_ES2 = "concurrent/__ES2";
+
+    private static final String BATCH_SERVER_ES1 = "concurrent/__BatchServer_ES1";
+
+    private static final String BATCH_SERVER_ES2 = "concurrent/__BatchServer_ES2";
+
+    @BeforeClass
+    public static void setup() {
+        CommandUtil cmd1 = CommandUtil.getInstance().executeCommandAndGetAsList("asadmin", "start-domain", "-d");
+        CommandUtil cmd2 = CommandUtil.getInstance().executeCommandAndGetAsList(
+                "asadmin", "create-local-instance", STAND_ALONE_INSTANCE_NAME);
+        CommandUtil cmd3 = CommandUtil.getInstance().executeCommandAndGetAsList(
+                "asadmin", "start-local-instance", STAND_ALONE_INSTANCE_NAME);
+        CommandUtil cmd4 = CommandUtil.getInstance().executeCommandAndGetAsList(
+                "asadmin", "create-managed-executor-service", "--target", "server", SERVER_ES1);
+        CommandUtil cmd5 = CommandUtil.getInstance().executeCommandAndGetAsList(
+                "asadmin", "create-managed-executor-service", SERVER_ES2);
+        CommandUtil cmd6 = CommandUtil.getInstance().executeCommandAndGetAsList(
+                "asadmin", "create-managed-executor-service", "--target", STAND_ALONE_INSTANCE_NAME, BATCH_SERVER_ES1);
+        CommandUtil cmd7 = CommandUtil.getInstance().executeCommandAndGetAsList(
+                "asadmin", "create-managed-executor-service", "--target", STAND_ALONE_INSTANCE_NAME, BATCH_SERVER_ES2);
+
+        CommandUtil.getInstance().executeCommandAndGetAsList(
+                "asadmin", "list-managed-executor-services");
+        CommandUtil.getInstance().executeCommandAndGetAsList(
+                "asadmin", "list-managed-executor-services", "--target", STAND_ALONE_INSTANCE_NAME);
+
+//        assert(cmd1.ranOK() && cmd2.ranOK() && cmd3.ranOK() && cmd4.ranOK() && cmd5.ranOK() && cmd6.ranOK() && cmd7.ranOK());
+        assertTrue(true);
+    }
+
+    @AfterClass
+     public static void unsetup() {
+        CommandUtil.getInstance().executeCommandAndGetAsList("asadmin",
+                "delete-managed-executor-service", "--target", STAND_ALONE_INSTANCE_NAME, BATCH_SERVER_ES1);
+        CommandUtil.getInstance().executeCommandAndGetAsList("asadmin",
+                "delete-managed-executor-service", "--target", STAND_ALONE_INSTANCE_NAME, BATCH_SERVER_ES2);
+        CommandUtil.getInstance().executeCommandAndGetAsList("asadmin",
+                "delete-managed-executor-service", SERVER_ES1);
+        CommandUtil.getInstance().executeCommandAndGetAsList("asadmin",
+                "delete-managed-executor-service", SERVER_ES2);
+        CommandUtil cmd3 = CommandUtil.getInstance().executeCommandAndGetAsList(
+                "asadmin", "stop-local-instance", STAND_ALONE_INSTANCE_NAME);
+        CommandUtil cmd2 = CommandUtil.getInstance().executeCommandAndGetAsList(
+                "asadmin", "delete-local-instance", STAND_ALONE_INSTANCE_NAME);
+        CommandUtil cmd1 = CommandUtil.getInstance().executeCommandAndGetAsList("asadmin", "stop-domain");
+        assert(true);
+    }
+
+
+    @Test
+    public void listRuntimeConfigurationServerTest() {
+        String[] data = getConfigurationData("server");
+        assertTrue(data.length == 2 && data[0] != null && data[1] != null);
+    }
+
+    @Test
+    public void listRuntimeConfigurationBatchServerTest() {
+        String[] data = getConfigurationData(STAND_ALONE_INSTANCE_NAME);
+        assertTrue(data.length == 2 && data[0] != null && data[1] != null);
+    }
+
+    @Test
+    public void setBatchRuntimeConfigurationWithNoArgsTest() {
+        String[] origEntries = getConfigurationData(null);
+
+        CommandUtil cmd = CommandUtil.getInstance().executeCommandAndGetErrorOutput(
+                "asadmin", SET_BATCH_RUNTIME_COMMAND);
+        System.out.println("==> " + cmd.result().get(0));
+        String expectedMessage = "remote failure: Either dataSourceLookupName or executorServiceLookupName must be specified.";
+        assertTrue(!cmd.ranOK() && assertSameConfigurationData(null, origEntries)
+                && cmd.result().get(0).startsWith(expectedMessage));
+    }
+
+    @Test
+    public void setBatchRuntimeConfigurationWithNoArgsServerTest() {
+        String[] origEntries = getConfigurationData(null);
+
+        CommandUtil cmd = CommandUtil.getInstance().executeCommandAndGetErrorOutput(
+                "asadmin", SET_BATCH_RUNTIME_COMMAND, "--target", "server");
+        System.out.println("==> " + cmd.result().get(0));
+        String expectedMessage = "remote failure: Either dataSourceLookupName or executorServiceLookupName must be specified.";
+        assertTrue(!cmd.ranOK() && assertSameConfigurationData("server", origEntries)
+                && cmd.result().get(0).startsWith(expectedMessage));
+    }
+
+    @Test
+    public void setBatchRuntimeConfigurationWithNoArgsBatchServerTest() {
+        String[] origEntries = getConfigurationData(null);
+
+        CommandUtil cmd = CommandUtil.getInstance().executeCommandAndGetErrorOutput(
+                "asadmin", SET_BATCH_RUNTIME_COMMAND, "--target", STAND_ALONE_INSTANCE_NAME);
+        System.out.println("==> " + cmd.result().get(0));
+        String expectedMessage = "remote failure: Either dataSourceLookupName or executorServiceLookupName must be specified.";
+        assertTrue(!cmd.ranOK() && assertSameConfigurationData(null, origEntries)
+                && cmd.result().get(0).startsWith(expectedMessage));
+    }
+
+    @Test
+    public void setInvalidBatchRuntimeConfigurationTest() {
+        String[] origEntries = getConfigurationData(null);
+
+        CommandUtil cmd = CommandUtil.getInstance().executeCommandAndGetErrorOutput(
+                "asadmin", SET_BATCH_RUNTIME_COMMAND, "-d", "foo");
+        String expectedMessage = "remote failure: foo is not mapped to a DataSource";
+        assertTrue(!cmd.ranOK() && assertSameConfigurationData(null, origEntries)
+                && cmd.result().get(0).startsWith(expectedMessage));
+    }
+
+    @Test
+    public void setInvalidBatchRuntimeConfigurationServerTest() {
+        String[] origEntries = getConfigurationData("server");
+
+        CommandUtil cmd = CommandUtil.getInstance().executeCommandAndGetErrorOutput(
+                "asadmin", SET_BATCH_RUNTIME_COMMAND, "--target", "server", "-d", "foo");
+        String expectedMessage = "remote failure: foo is not mapped to a DataSource";
+        assertTrue(!cmd.ranOK() && assertSameConfigurationData("server", origEntries)
+                && cmd.result().get(0).startsWith(expectedMessage));
+    }
+
+    @Test
+    public void setInvalidBatchRuntimeConfigurationBatchServerTest() {
+        String[] origEntries = getConfigurationData(STAND_ALONE_INSTANCE_NAME);
+
+        CommandUtil cmd = CommandUtil.getInstance().executeCommandAndGetErrorOutput(
+                "asadmin", SET_BATCH_RUNTIME_COMMAND, "--target", STAND_ALONE_INSTANCE_NAME, "-d", "foo2");
+        String expectedMessage = "remote failure: foo2 is not mapped to a DataSource";
+
+        System.out.println("** setInvalidBatchRuntimeConfigurationBatchServerTest ==> "
+            + "ranOK: " + cmd.ranOK() + "; message: " + cmd.result().get(0).startsWith(expectedMessage));
+
+        assertTrue(!cmd.ranOK() && assertSameConfigurationData(STAND_ALONE_INSTANCE_NAME, origEntries)
+                && cmd.result().get(0).startsWith(expectedMessage));
+    }
+
+    @Test
+    public void setValidExecutorConfigurationTest() {
+        String[] origEntries = getConfigurationData(null);
+
+        CommandUtil cmd = CommandUtil.getInstance().executeCommandAndGetErrorOutput(
+                "asadmin", SET_BATCH_RUNTIME_COMMAND, "-x", VALID_EXECUTOR_NAME);
+        assertTrue(cmd.ranOK());
+        String[] newEntries = getConfigurationData("server");
+        assertTrue(newEntries[0].equals(origEntries[0]) && newEntries[1].equals(VALID_EXECUTOR_NAME));
+    }
+
+    @Test
+    public void setValidExecutorConfigurationServerTest() {
+        String[] origEntries = getConfigurationData("server");
+
+        CommandUtil cmd = CommandUtil.getInstance().executeCommandAndGetAsList(
+                "asadmin", SET_BATCH_RUNTIME_COMMAND, "--target", "server", "-x", VALID_EXECUTOR_NAME);
+        assertTrue(cmd.ranOK());
+        String[] newEntries = getConfigurationData("server");
+        assertTrue(newEntries[0].equals(origEntries[0]) && newEntries[1].equals(VALID_EXECUTOR_NAME));
+    }
+
+    @Test
+    public void setValidExecutorConfigurationBatchServerTest() {
+        String[] origEntries = getConfigurationData(STAND_ALONE_INSTANCE_NAME);
+
+        CommandUtil cmd = CommandUtil.getInstance().executeCommandAndGetAsList(
+                "asadmin", SET_BATCH_RUNTIME_COMMAND, "--target", STAND_ALONE_INSTANCE_NAME, "-x", VALID_EXECUTOR_NAME);
+        String[] output = getConfigurationData(STAND_ALONE_INSTANCE_NAME);
+        if (!cmd.ranOK()) {
+            cmd = CommandUtil.getInstance().executeCommandAndGetErrorOutput(
+                    "asadmin", SET_BATCH_RUNTIME_COMMAND, "--target", STAND_ALONE_INSTANCE_NAME, "-x", VALID_EXECUTOR_NAME);
+            output = getConfigurationData(STAND_ALONE_INSTANCE_NAME);
+        }
+        System.out.println("**[##]** setValidExecutorConfigurationBatchServerTest ==> " + cmd.ranOK()
+                + "; " + output[0] + "; " + output[1]);
+        assertTrue(cmd.ranOK() && assertSameConfigurationData(STAND_ALONE_INSTANCE_NAME,
+                new String[]{origEntries[0], VALID_EXECUTOR_NAME}));
+    }
+
+    @Test
+    public void setValidDataSourceConfigurationTest() {
+        String[] origEntries = getConfigurationData(null);
+
+        CommandUtil cmd = CommandUtil.getInstance().executeCommandAndGetErrorOutput(
+                "asadmin", SET_BATCH_RUNTIME_COMMAND, "-d", VALID_TIMER_POOL_DATA_SOURCE_NAME);
+        assertTrue(cmd.ranOK());
+        String[] newEntries = getConfigurationData(null);
+        assertTrue(newEntries[0].equals(VALID_TIMER_POOL_DATA_SOURCE_NAME) && newEntries[1].equals(origEntries[1]) );
+    }
+
+    @Test
+    public void setValidDataSourceConfigurationServerTest() {
+        String[] origEntries = getConfigurationData("server");
+
+        CommandUtil cmd = CommandUtil.getInstance().executeCommandAndGetAsList(
+                "asadmin", SET_BATCH_RUNTIME_COMMAND, "--target", "server", "-d", VALID_TIMER_POOL_DATA_SOURCE_NAME);
+        assertTrue(cmd.ranOK());
+        String[] newEntries = getConfigurationData("server");
+        assertTrue(newEntries[0].equals(VALID_TIMER_POOL_DATA_SOURCE_NAME) && newEntries[1].equals(origEntries[1]) );
+    }
+
+    @Test
+    public void setValidButNonExistentDataSourceConfigurationBatchServerTest() {
+
+        CommandUtil cmd = CommandUtil.getInstance().executeCommandAndGetAsList(
+                "asadmin", SET_BATCH_RUNTIME_COMMAND, "--target", STAND_ALONE_INSTANCE_NAME, "-d", VALID_DEFAULT_DATA_SOURCE_NAME);
+
+        String[] origEntries = getConfigurationData(STAND_ALONE_INSTANCE_NAME);
+        CommandUtil errorCmd = CommandUtil.getInstance().executeCommandAndGetErrorOutput(
+                "asadmin", SET_BATCH_RUNTIME_COMMAND, "--target", STAND_ALONE_INSTANCE_NAME, "-d", VALID_TIMER_POOL_DATA_SOURCE_NAME);
+        assertTrue(!errorCmd.ranOK());
+        String[] newEntries = getConfigurationData(STAND_ALONE_INSTANCE_NAME);
+        assertTrue(newEntries[0].equals(VALID_DEFAULT_DATA_SOURCE_NAME) && newEntries[1].equals(origEntries[1]) );
+    }
+
+    @Test
+    public void setValidDataSourceConfigurationBatchServerTest() {
+        String[] origEntries = getConfigurationData(STAND_ALONE_INSTANCE_NAME);
+
+        CommandUtil cmd = CommandUtil.getInstance().executeCommandAndGetAsList(
+                "asadmin", SET_BATCH_RUNTIME_COMMAND, "--target", STAND_ALONE_INSTANCE_NAME, "-d", VALID_DEFAULT_DATA_SOURCE_NAME);
+        assertTrue(cmd.ranOK());
+        String[] newEntries = getConfigurationData(STAND_ALONE_INSTANCE_NAME);
+        assertTrue(newEntries[0].equals(VALID_DEFAULT_DATA_SOURCE_NAME) && newEntries[1].equals(origEntries[1]) );
+    }
+
+    @Test
+    public void setValidDataSourceAndExecutorConfigurationTest() {
+        CommandUtil cmd = CommandUtil.getInstance().executeCommandAndGetAsList(
+                "asadmin", SET_BATCH_RUNTIME_COMMAND,
+                "-d", VALID_DEFAULT_DATA_SOURCE_NAME, "-x", VALID_EXECUTOR_NAME);
+        assertTrue(cmd.ranOK());
+        String[] newEntries = getConfigurationData(null);
+        System.out.println("**[setValidDataSourceAndExecutorConfigurationTest]: " +  cmd.ranOK()
+                + " ; " + newEntries[0] + "    " + newEntries[1]);
+        assertTrue(newEntries[0].equals(VALID_DEFAULT_DATA_SOURCE_NAME) && newEntries[1].equals(VALID_EXECUTOR_NAME) );
+
+    }
+
+    @Test
+    public void setValidDataSourceAndExecutorConfigurationBatchServerTest() {
+        String[] origEntries = getConfigurationData(STAND_ALONE_INSTANCE_NAME);
+
+        CommandUtil cmd = CommandUtil.getInstance().executeCommandAndGetAsList(
+                "asadmin", SET_BATCH_RUNTIME_COMMAND, "--target", STAND_ALONE_INSTANCE_NAME,
+                "-d", VALID_DEFAULT_DATA_SOURCE_NAME, "-x", VALID_EXECUTOR_NAME);
+        assertTrue(cmd.ranOK());
+        String[] newEntries = getConfigurationData(STAND_ALONE_INSTANCE_NAME);
+        assertTrue(newEntries[0].equals(VALID_DEFAULT_DATA_SOURCE_NAME) && newEntries[1].equals(VALID_EXECUTOR_NAME) );
+    }
+
+    @Test
+    public void setValidDataSourceAndExecutorConfigurationServerTest() {
+        String[] origEntries = getConfigurationData("server");
+
+        CommandUtil cmd = CommandUtil.getInstance().executeCommandAndGetAsList(
+                "asadmin", SET_BATCH_RUNTIME_COMMAND, "--target", "server",
+                "-d", VALID_TIMER_POOL_DATA_SOURCE_NAME, "-x", VALID_EXECUTOR_NAME);
+        assertTrue(cmd.ranOK());
+        String[] newEntries = getConfigurationData("server");
+        assertTrue(newEntries[0].equals(VALID_TIMER_POOL_DATA_SOURCE_NAME) && newEntries[1].equals(VALID_EXECUTOR_NAME) );
+    }
+
+    @Test
+    public void setInvalidDataSourceAndExecutorConfigurationTest() {
+        String[] origEntries = getConfigurationData(null);
+
+        CommandUtil cmd = CommandUtil.getInstance().executeCommandAndGetAsList(
+                "asadmin", SET_BATCH_RUNTIME_COMMAND,
+                "-x", VALID_DEFAULT_DATA_SOURCE_NAME, "-d", VALID_EXECUTOR_NAME);
+        String[] newEntries = getConfigurationData(null);
+        assertTrue(!cmd.ranOK()
+                && newEntries[0].equals(origEntries[0]) && newEntries[1].equals(origEntries[1]) );
+    }
+
+    @Test
+    public void setInvalidDataSourceAndExecutorConfigurationBatchServerTest() {
+        String[] origEntries = getConfigurationData(STAND_ALONE_INSTANCE_NAME);
+
+        CommandUtil cmd = CommandUtil.getInstance().executeCommandAndGetAsList(
+                "asadmin", SET_BATCH_RUNTIME_COMMAND, "--target", STAND_ALONE_INSTANCE_NAME,
+                "-x", VALID_DEFAULT_DATA_SOURCE_NAME, "-d", VALID_EXECUTOR_NAME);
+        String[] newEntries = getConfigurationData(STAND_ALONE_INSTANCE_NAME);
+        assertTrue(!cmd.ranOK()
+                && newEntries[0].equals(origEntries[0]) && newEntries[1].equals(origEntries[1]) );
+    }
+
+    @Test
+    public void setInvalidDataSourceAndExecutorConfigurationServerTest() {
+        String[] origEntries = getConfigurationData("server");
+
+        CommandUtil cmd = CommandUtil.getInstance().executeCommandAndGetAsList(
+                "asadmin", SET_BATCH_RUNTIME_COMMAND, "--target", "server",
+                "-x", VALID_TIMER_POOL_DATA_SOURCE_NAME, "-d", VALID_EXECUTOR_NAME);
+        String[] newEntries = getConfigurationData("server");
+        assertTrue(!cmd.ranOK()
+                && newEntries[0].equals(origEntries[0]) && newEntries[1].equals(origEntries[1]) );
+    }
+
+    @Test
+    public void setAvailableButInvalidExecNamesForServer() {
+        String[] origEntries = getConfigurationData("server");
+
+        CommandUtil cmd1 = CommandUtil.getInstance().executeCommandAndGetAsList(
+                "asadmin", SET_BATCH_RUNTIME_COMMAND, "--target", "server",
+                "-x", BATCH_SERVER_ES1);
+        CommandUtil cmd2 = CommandUtil.getInstance().executeCommandAndGetAsList(
+                "asadmin", SET_BATCH_RUNTIME_COMMAND, "--target", "server",
+                "-x", BATCH_SERVER_ES2);
+        String[] newEntries = getConfigurationData("server");
+        assertTrue(!cmd1.ranOK() && !cmd2.ranOK()
+                && newEntries[0].equals(origEntries[0]) && newEntries[1].equals(origEntries[1]) );
+
+        CommandUtil cmd3 = CommandUtil.getInstance().executeCommandAndGetAsList(
+                "asadmin", SET_BATCH_RUNTIME_COMMAND, "--target", "server",
+                "-x", SERVER_ES1);
+        CommandUtil cmd4 = CommandUtil.getInstance().executeCommandAndGetAsList(
+                "asadmin", SET_BATCH_RUNTIME_COMMAND, "--target", "server",
+                "-x", SERVER_ES2);
+        newEntries = getConfigurationData("server");
+        assertTrue(cmd3.ranOK() && cmd4.ranOK()
+                && newEntries[0].equals(origEntries[0]) && newEntries[1].equals(SERVER_ES2));
+
+        CommandUtil cmd5 = CommandUtil.getInstance().executeCommandAndGetAsList(
+                "asadmin", SET_BATCH_RUNTIME_COMMAND, "-x", SERVER_ES2);
+        CommandUtil cmd6 = CommandUtil.getInstance().executeCommandAndGetAsList(
+                "asadmin", SET_BATCH_RUNTIME_COMMAND, "-x", SERVER_ES1);
+        String[] newEntries2 = getConfigurationData(null);
+        assertTrue(cmd5.ranOK() && cmd6.ranOK()
+                && newEntries2[0].equals(newEntries[0]) && newEntries2[1].equals(SERVER_ES1));
+
+    }
+
+    @Test
+    public void setAvailableButInvalidExecNamesForBatchServer() {
+        String[] origServerEntries = getConfigurationData(null);
+        String[] origEntries = getConfigurationData(STAND_ALONE_INSTANCE_NAME);
+
+        CommandUtil cmd1 = CommandUtil.getInstance().executeCommandAndGetAsList(
+                "asadmin", SET_BATCH_RUNTIME_COMMAND, "--target", STAND_ALONE_INSTANCE_NAME,
+                "-x", SERVER_ES1);
+        CommandUtil cmd2 = CommandUtil.getInstance().executeCommandAndGetAsList(
+                "asadmin", SET_BATCH_RUNTIME_COMMAND, "--target", STAND_ALONE_INSTANCE_NAME,
+                "-x", SERVER_ES2);
+        assertTrue(!cmd1.ranOK() && !cmd2.ranOK()
+                && assertSameConfigurationData(STAND_ALONE_INSTANCE_NAME, origEntries)
+                && assertSameConfigurationData(null, origServerEntries));
+
+
+        CommandUtil cmd3 = CommandUtil.getInstance().executeCommandAndGetAsList(
+                "asadmin", SET_BATCH_RUNTIME_COMMAND, "--target", STAND_ALONE_INSTANCE_NAME,
+                "-x", BATCH_SERVER_ES1);
+        CommandUtil cmd4 = CommandUtil.getInstance().executeCommandAndGetAsList(
+                "asadmin", SET_BATCH_RUNTIME_COMMAND, "--target", STAND_ALONE_INSTANCE_NAME,
+                "-x", BATCH_SERVER_ES2);
+        System.out.println("**##@@ => " + cmd3.ranOK() + "; " + cmd4.ranOK());
+        for (String s : cmd3.result()) {
+            System.out.println("cmd3 **=> " + s);
+        }
+        for (String s : cmd4.result()) {
+            System.out.println("cmd4 **=> " + s);
+        }
+        assertTrue(cmd3.ranOK() && cmd4.ranOK()
+                && assertSameConfigurationData(STAND_ALONE_INSTANCE_NAME, new String[]{origEntries[0], BATCH_SERVER_ES2})
+                && assertSameConfigurationData(null, origServerEntries));
+//
+//        CommandUtil cmd5 = CommandUtil.getInstance().executeCommandAndGetAsList(
+//                "asadmin", SET_BATCH_RUNTIME_COMMAND, "--target", STAND_ALONE_INSTANCE_NAME,
+//                "-x", BATCH_SERVER_ES2);
+//        CommandUtil cmd6 = CommandUtil.getInstance().executeCommandAndGetAsList(
+//                "asadmin", SET_BATCH_RUNTIME_COMMAND, "--target", STAND_ALONE_INSTANCE_NAME,
+//                "-x", BATCH_SERVER_ES1);
+//        assertTrue(cmd5.ranOK() && cmd6.ranOK() && assertSameConfigurationData(null, origServerEntries)
+//            && assertSameConfigurationData(STAND_ALONE_INSTANCE_NAME, new String[] {origEntries[0], BATCH_SERVER_ES1}));
+
+    }
+
+    @Test
+    public void listBatchJobsTest() {
+        getListBatchJobsData(null);
+        assertTrue(true);
+    }
+
+    @Test
+    public void listBatchJobsServerTest() {
+        getListBatchJobsData("server");
+        assertTrue(true);
+    }
+
+    @Test
+    public void listBatchJobsBatchServerTest() {
+        getListBatchJobsData(STAND_ALONE_INSTANCE_NAME);
+        assertTrue(true);
+    }
+
+    @Test
+    public void listRuntimeConfigurationTest() {
+        String[] data = getConfigurationData(null);
+        assertTrue(data.length == 2 && data[0] != null && data[1] != null);
+    }
+
+    @Test
+    public void testListJobsWithJustJobNameHeader() {
+        CommandUtil cmd = CommandUtil.getInstance().executeCommandAndGetAsList("asadmin",
+                "list-batch-jobs", "-l");
+        int size = cmd.result().size();
+
+        CommandUtil cmdWithJustName = CommandUtil.getInstance().executeCommandAndGetAsList("asadmin",
+                "list-batch-jobs", "-o", "jobname");
+	System.out.println("************************************************************************");
+	System.out.println("************************************************************************");
+	System.out.println("** list-batch-jobs -l ==> " + size + ";   list-batch-jobs -o jobname ==> " + cmdWithJustName.result().size());
+	System.out.println("************************************************************************");
+	System.out.println("************************************************************************");
+	System.out.println("************************************************************************");
+        assertTrue(cmd.ranOK());
+        assertTrue(cmdWithJustName.ranOK() && cmdWithJustName.result().size() == cmd.result().size());
+    }
+
+
+    @Test
+    public void testListJobsWithInvalidHeader() {
+        CommandUtil cmd = CommandUtil.getInstance().executeCommandAndGetErrorOutput("asadmin",
+                "list-batch-jobs", "-o", "abc");
+        assertTrue(!cmd.ranOK() && "remote failure: Invalid header abc".equals(cmd.result().get(0)));
+    }
+
+    private String[] getConfigurationData(String target) {
+        String[] command = target == null
+                ? new String[] {"asadmin", "list-batch-runtime-configuration"}
+                : new String[] {"asadmin", "list-batch-runtime-configuration", "--target", target};
+        CommandUtil cmd = CommandUtil.getInstance().executeCommandAndGetAsList(true, command);
+        String output = cmd.result().get(1);
+        String[] data = new String[2];
+        StringTokenizer stok = new StringTokenizer(output, " \t\n\r");
+        if (stok.hasMoreTokens()) data[0] = stok.nextToken();
+        if (stok.hasMoreTokens()) data[1] = stok.nextToken();
+
+        return data;
+    }
+
+    private boolean assertSameConfigurationData(String target, String[] orig) {
+        String[] data = getConfigurationData(target);
+        boolean result = orig[0].equals(data[0]) && orig[1].equals(data[1]);
+        if (! result) {
+            System.out.println("orig[0] == " + orig[0] + "             data[0] == " + data[0]);
+            System.out.println("orig[1] == " + orig[1] + "             data[1] == " + data[1]);
+        }
+
+        return result;
+    }
+
+    private List<String> getListBatchJobsData(String target) {
+        String[] command = target == null
+                ? new String[] {"asadmin", "list-batch-jobs"}
+                : new String[] {"asadmin", "list-batch-jobs", "--target", target};
+        CommandUtil cmd = CommandUtil.getInstance().executeCommandAndGetAsList(command);
+        return cmd.result();
+    }
+
+}
diff --git a/appserver/tests/appserv-tests/devtests/batch/batch-dev-tests/batch-tests-utils/pom.xml b/appserver/tests/appserv-tests/devtests/batch/batch-dev-tests/batch-tests-utils/pom.xml
new file mode 100644
index 0000000..8be1b21
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/batch-dev-tests/batch-tests-utils/pom.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v. 2.0, which is available at
+    http://www.eclipse.org/legal/epl-2.0.
+
+    This Source Code may also be made available under the following Secondary
+    Licenses when the conditions for such availability set forth in the
+    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+    version 2 with the GNU Classpath Exception, which is available at
+    https://www.gnu.org/software/classpath/license.html.
+
+    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.glassfish.main</groupId>
+    	<artifactId>batch-dev-tests</artifactId>
+        <version>5.0.1-SNAPSHOT</version>
+    </parent>
+    <artifactId>batch-tests-utils</artifactId>
+    <packaging>jar</packaging>
+    
+</project>
diff --git a/appserver/tests/appserv-tests/devtests/batch/batch-dev-tests/batch-tests-utils/src/main/java/org/glassfish/javaee7/batch/test/util/CommandUtil.java b/appserver/tests/appserv-tests/devtests/batch/batch-dev-tests/batch-tests-utils/src/main/java/org/glassfish/javaee7/batch/test/util/CommandUtil.java
new file mode 100644
index 0000000..d47c95c
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/batch-dev-tests/batch-tests-utils/src/main/java/org/glassfish/javaee7/batch/test/util/CommandUtil.java
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.javaee7.batch.test.util;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created with IntelliJ IDEA.
+ * User: makannan
+ * Date: 4/5/13
+ * Time: 4:13 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class CommandUtil {
+
+    private int exitCode;
+
+    private Throwable cause;
+
+    private List<String> result = new ArrayList<String>();
+
+    private CommandUtil() {}
+
+    public static CommandUtil getInstance() {
+        return new CommandUtil();
+    }
+
+    public CommandUtil executeCommandAndGetAsList(String... command) {
+        return executeCommandAndGetAsList(true, command);
+    }
+
+    public CommandUtil executeCommandAndGetAsList(boolean  withOutput, String... command) {
+        try {
+            if (withOutput) {
+                System.out.println();
+                for (String s : command) System.out.print(s + " ");
+                System.out.println();
+            }
+            ProcessBuilder pb = new ProcessBuilder(command);
+            Process process = pb.start();
+
+            BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream()));
+            try {
+                for (String line = br.readLine(); line != null; line = br.readLine()) {
+                    result.add(line);
+                    if (withOutput)
+                        System.out.println(line);
+                }
+            } finally {
+                br.close();
+            }
+
+            exitCode = process.waitFor();
+
+        } catch (Throwable ex) {
+            cause = ex;
+        }
+
+        return this;
+    }
+    public CommandUtil executeCommandAndGetErrorOutput(String... command) {
+        return executeCommandAndGetErrorOutput(true, command);
+    }
+
+    public CommandUtil executeCommandAndGetErrorOutput(boolean  withOutput, String... command) {
+        try {
+            if (withOutput) {
+                System.out.println();
+                for (String s : command) System.out.print(s + " ");
+                System.out.println();
+            }
+            ProcessBuilder pb = new ProcessBuilder(command);
+            Process process = pb.start();
+
+            BufferedReader br = new BufferedReader(new InputStreamReader(process.getErrorStream()));
+            try {
+                for (String line = br.readLine(); line != null; line = br.readLine()) {
+                    result.add(line);
+                    if (withOutput)
+                        System.out.println(line);
+                }
+            } finally {
+                br.close();
+            }
+
+            exitCode = process.waitFor();
+
+        } catch (Throwable ex) {
+            cause = ex;
+        }
+
+        return this;
+    }
+
+    public boolean ranOK() {
+        return cause == null && exitCode == 0;
+    }
+
+    public int getExitCode() {
+        return exitCode;
+    }
+
+    public Throwable getCause() {
+        return cause;
+    }
+
+    public List<String> result() {
+        return result;
+    }
+}
diff --git a/appserver/tests/appserv-tests/devtests/batch/batch-dev-tests/batch-tests-utils/src/test/java/org/glassfish/javaee7/batch/test/config/CommandUtilTest.java b/appserver/tests/appserv-tests/devtests/batch/batch-dev-tests/batch-tests-utils/src/test/java/org/glassfish/javaee7/batch/test/config/CommandUtilTest.java
new file mode 100644
index 0000000..4de50f5
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/batch-dev-tests/batch-tests-utils/src/test/java/org/glassfish/javaee7/batch/test/config/CommandUtilTest.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.javaee7.batch.test.config;
+
+import java.util.*;
+
+import static org.junit.Assert.*;
+
+import org.glassfish.javaee7.batch.test.util.CommandUtil;
+import org.junit.Test;
+
+public class CommandUtilTest {
+
+    @Test
+    public void basicTest() {
+        assertTrue(true);
+    }
+
+    @Test
+    public void runCommand() {
+        List<String> result = CommandUtil.getInstance().executeCommandAndGetAsList("ls", "-l").result();
+        for (String line : result)
+            System.out.println(line);
+        assertTrue(true);
+    }
+
+    @Test
+    public void runCommandWithPipe() {
+        CommandUtil cmdUtil = CommandUtil.getInstance().executeCommandAndGetAsList("als", "-l | wc");
+
+        assertTrue(!cmdUtil.ranOK());
+    }
+}
diff --git a/appserver/tests/appserv-tests/devtests/batch/batch-dev-tests/build.xml b/appserver/tests/appserv-tests/devtests/batch/batch-dev-tests/build.xml
new file mode 100644
index 0000000..00fc4e3
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/batch-dev-tests/build.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+    Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v. 2.0, which is available at
+    http://www.eclipse.org/legal/epl-2.0.
+
+    This Source Code may also be made available under the following Secondary
+    Licenses when the conditions for such availability set forth in the
+    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+    version 2 with the GNU Classpath Exception, which is available at
+    https://www.gnu.org/software/classpath/license.html.
+
+    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+
+<!DOCTYPE project [
+<!ENTITY commonSetup SYSTEM "./../../../config/properties.xml">
+<!ENTITY commonBuild SYSTEM "./../../../config/common.xml">
+<!ENTITY commonRun SYSTEM "./../../../config/run.xml">
+
+]>
+
+<project name="batch-dev-tests" default="usage" basedir="." xmlns:artifact="antlib:org.apache.maven.artifact.ant">
+
+    &commonSetup;
+    &commonBuild;
+    &commonRun;
+
+<property environment="env" />
+<get src="http://central.maven.org/maven2/org/apache/maven/maven-ant-tasks/2.1.3/maven-ant-tasks-2.1.3.jar" dest="${env.APS_HOME}/lib/maven-ant-tasks-2.1.3.jar"/>
+<path id="maven-ant-tasks.classpath" path="${env.APS_HOME}/lib/maven-ant-tasks-2.1.3.jar" />
+<typedef resource="org/apache/maven/artifact/ant/antlib.xml"
+           uri="antlib:org.apache.maven.artifact.ant"
+           classpathref="maven-ant-tasks.classpath" />
+    <target name="all" depends="runMaven"/>
+    <target name="runMaven">
+      <artifact:mvn mavenHome="${env.M2_HOME}" fork="true">
+        <jvmarg value="-Dmaven.multiModuleProjectDirectory"/>
+        <jvmarg value="-Dmaven.javadoc.skip=true" />
+        <arg value="clean"/>
+        <arg value="verify"/>
+      </artifact:mvn>
+    </target>
+</project>
diff --git a/appserver/tests/appserv-tests/devtests/batch/batch-dev-tests/pom.xml b/appserver/tests/appserv-tests/devtests/batch/batch-dev-tests/pom.xml
new file mode 100644
index 0000000..67020da
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/batch-dev-tests/pom.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v. 2.0, which is available at
+    http://www.eclipse.org/legal/epl-2.0.
+
+    This Source Code may also be made available under the following Secondary
+    Licenses when the conditions for such availability set forth in the
+    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+    version 2 with the GNU Classpath Exception, which is available at
+    https://www.gnu.org/software/classpath/license.html.
+
+    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.glassfish.main</groupId>
+        <artifactId>glassfish-nucleus-parent</artifactId>
+        <version>5.0.1-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>batch-dev-tests</artifactId>
+    <packaging>pom</packaging>
+    
+   <modules>
+       <module>batch-tests-utils</module>
+       <module>batch-commands-tests</module>
+   </modules>
+</project>
diff --git a/appserver/tests/appserv-tests/devtests/batch/batch_derby.sql b/appserver/tests/appserv-tests/devtests/batch/batch_derby.sql
new file mode 100644
index 0000000..7a8f5c1
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/batch_derby.sql
@@ -0,0 +1,12 @@
+DROP TABLE JOBSTATUS
+CREATE TABLE JOBSTATUS(id BIGINT, obj BLOB)
+DROP TABLE STEPSTATUS
+CREATE TABLE STEPSTATUS(id VARCHAR(512), obj BLOB)
+DROP TABLE CHECKPOINTDATA
+CREATE TABLE CHECKPOINTDATA(id VARCHAR(512), obj BLOB)
+DROP TABLE JOBINSTANCEDATA
+CREATE TABLE JOBINSTANCEDATA(id VARCHAR(512), obj BLOB)
+DROP TABLE EXECUTIONINSTANCEDATA
+CREATE TABLE EXECUTIONINSTANCEDATA(id VARCHAR(512), createtime TIMESTAMP, starttime TIMESTAMP, endtime TIMESTAMP, updatetime TIMESTAMP, parameters BLOB, jobinstanceid VARCHAR(512), batchstatus BLOB, exitstatus BLOB)
+DROP TABLE STEPEXECUTIONINSTANCEDATA
+CREATE TABLE STEPEXECUTIONINSTANCEDATA(id VARCHAR(512), jobexecid VARCHAR(512), stepexecid VARCHAR(512))
\ No newline at end of file
diff --git a/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/build.properties b/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/build.properties
new file mode 100644
index 0000000..bac1121
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/build.properties
@@ -0,0 +1,39 @@
+<!--
+
+    Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v. 2.0, which is available at
+    http://www.eclipse.org/legal/epl-2.0.
+
+    This Source Code may also be made available under the following Secondary
+    Licenses when the conditions for such availability set forth in the
+    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+    version 2 with the GNU Classpath Exception, which is available at
+    https://www.gnu.org/software/classpath/license.html.
+
+    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+ 
+
+<property name="module" value="devtest-batch-bmt-chunk-job"/>
+<property name="appname" value="${module}"/>         
+<property name="assemble" value="${build.classes.dir}/archive"/>
+<property name="test.client" 
+	value="Client"/>
+<property name="application.xml" value="descriptor/application.xml"/>
+<property name="beans.xml" value="descriptor/beans.xml"/>
+<property name="batch.xml" value="descriptor/batch.xml"/>
+<property name="sun-application.xml" value="descriptor/sun-application.xml"/>
+<property name="ejb-jar.xml" value="descriptor/ejb-jar.xml"/>
+<property name="batch.jobs.dir" value="descriptor/batch-jobs"/>
+<property name="sun-ejb-jar.xml" value="descriptor/sun-ejb-jar.xml"/>
+<property name="application-client.xml" 
+	value="descriptor/application-client.xml"/>
+<property name="sun-application-client.xml" 
+	value="descriptor/sun-application-client.xml"/>
+<property name="appclientjar.files" value="${build.classes.dir}"/>         
+<property name="appclient.jar" value="${assemble.dir}/${appname}-client.jar"/>
+<property name="app.type" value="application"/>
+<property name="batch_derby.sql" value="../../batch_derby.sql"/>
diff --git a/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/build.xml b/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/build.xml
new file mode 100644
index 0000000..62f6060
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/build.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+    Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v. 2.0, which is available at
+    http://www.eclipse.org/legal/epl-2.0.
+
+    This Source Code may also be made available under the following Secondary
+    Licenses when the conditions for such availability set forth in the
+    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+    version 2 with the GNU Classpath Exception, which is available at
+    https://www.gnu.org/software/classpath/license.html.
+
+    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+
+<!DOCTYPE project [
+<!ENTITY commonSetup SYSTEM "../../../config/properties.xml">
+<!ENTITY commonBuild SYSTEM "../../../config/common.xml">
+<!ENTITY testproperties SYSTEM "build.properties">
+]>
+
+<project name="devtest-batch-bmt-chunk-job-App" default="usage" basedir=".">
+
+    &commonSetup;
+    &commonBuild;
+    &testproperties;
+
+    <!--
+    <target name="all" depends="build,copy-batch-sql,deploy,run,undeploy"/>
+    -->
+
+    <target name="all" depends="build,deploy,run,undeploy"/>
+
+    <target name="clean" depends="init-common">
+      <antcall  target="clean-common"/>
+    </target>
+ 
+    <target name="compile" depends="clean">
+        <antcall target="compile-common">
+            <param name="src" value="ejb"/>
+        </antcall>
+        <antcall target="compile-common">
+            <param name="src" value="client"/>
+        </antcall>
+    </target>
+
+
+    <target name="build" depends="compile">
+        <antcall target="build-ear-common">
+            <param name="ejbjar.classes" 
+              value="**/*.class"/>
+            <param name="appclientjar.classes" 
+              value="**/Client.class,**/Sless.class,**/Sless30.class"/>
+        </antcall>
+    </target> 
+    
+    <target name="copy-batch-sql" depends="build">
+    	<echo message="***** Copy ${batch_derby.sql} to Target dir: ${env.S1AS_HOME}/lib"/>
+    	<copy file="${batch_derby.sql}" todir="${env.S1AS_HOME}/lib"/>
+    </target>
+
+    <target name="deploy" 
+            depends="init-common">
+        <antcall target="deploy-common"/>
+    </target>
+
+    <target name="run" depends="init-common">
+        <antcall target="runclient-common"/>
+    </target>
+ 
+    <target name="undeploy" depends="init-common">
+        <antcall target="undeploy-common"/>
+    </target>   
+
+    <target name="usage">
+        <antcall target="usage-common"/>
+    </target>
+</project>
diff --git a/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/client/Client.java b/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/client/Client.java
new file mode 100644
index 0000000..57252b8
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/client/Client.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package com.sun.ejb.devtest.client;
+
+import java.io.*;
+import java.util.*;
+import javax.naming.*;
+import javax.ejb.EJB;
+import com.oracle.javaee7.samples.batch.chunk.*;
+import com.sun.ejte.ccl.reporter.SimpleReporterAdapter;
+
+@EJB(name="ejb/GG", beanInterface=Sless.class)
+public class Client {
+
+    private static SimpleReporterAdapter stat = 
+        new SimpleReporterAdapter("appserv-tests");
+
+    public static void main (String[] args) {
+
+        stat.addDescription("batch-chunk-stateless");
+        Client client = new Client(args);
+        client.doTest();
+        stat.printSummary("batch-chunk-stateless");
+    }  
+    
+    public Client (String[] args) {
+    }
+    
+    private static @EJB(name="ejb/kk") Sless sless;
+
+    public void doTest() {
+        try {
+            (new InitialContext()).lookup("java:comp/env/ejb/GG");
+	    long executionId = sless.submitJob();
+	    System.out.println("************************************************");
+	    System.out.println("******* JobID: " + executionId + " ******************");
+	    System.out.println("************************************************");
+	    String jobBatchStatus = "";
+	    for (int sec=10; sec>0; sec--) {
+	        try {
+		    jobBatchStatus = sless.getJobExitStatus(executionId);
+		    if (! "COMPLETED".equals(jobBatchStatus)) {
+		        System.out.println("Will sleep for " + sec + " more seconds...: " + jobBatchStatus);
+		        Thread.currentThread().sleep(1000);
+		    }
+		} catch (Exception ex) {
+		}
+	    }
+            stat.addStatus("batch-chunk-stateless", ("COMPLETED".equals(jobBatchStatus) ? stat.PASS : stat.FAIL));
+	} catch (Exception ex) {
+            stat.addStatus("batch-chunk-stateless", stat.FAIL);
+        }
+    }
+
+}
+
diff --git a/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/client/MANIFEST.MF b/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/client/MANIFEST.MF
new file mode 100644
index 0000000..ae04b30
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/client/MANIFEST.MF
@@ -0,0 +1,4 @@
+Manifest-Version: 1.0
+Created-By: 1.4.0-beta3 (Sun Microsystems Inc.)
+Main-Class: com.sun.ejb.devtest.client.Client
+Class-Path: reporter.jar
diff --git a/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/descriptor/batch-jobs/ChunkJob.xml b/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/descriptor/batch-jobs/ChunkJob.xml
new file mode 100644
index 0000000..2019837
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/descriptor/batch-jobs/ChunkJob.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v. 2.0, which is available at
+    http://www.eclipse.org/legal/epl-2.0.
+
+    This Source Code may also be made available under the following Secondary
+    Licenses when the conditions for such availability set forth in the
+    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+    version 2 with the GNU Classpath Exception, which is available at
+    https://www.gnu.org/software/classpath/license.html.
+
+    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+
+<job id="bmt-chunk-job" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
+    <step id="step1">
+        <chunk item-count="3">
+            <reader ref="SimpleItemReader"></reader> 
+            <processor ref="SimpleItemProcessor"></processor>
+            <writer ref="SimpleItemWriter"></writer> 
+        </chunk>
+    </step>
+</job>
diff --git a/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/descriptor/beans.xml b/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/descriptor/beans.xml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/descriptor/beans.xml
diff --git a/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/ejb/com/oracle/javaee7/samples/LICENSE.md b/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/ejb/com/oracle/javaee7/samples/LICENSE.md
new file mode 100644
index 0000000..e0358f9
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/ejb/com/oracle/javaee7/samples/LICENSE.md
@@ -0,0 +1,29 @@
+
+    Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
+   
+    Redistribution and use in source and binary forms, with or without
+    modification, are permitted provided that the following conditions
+    are met:
+   
+      - Redistributions of source code must retain the above copyright
+        notice, this list of conditions and the following disclaimer.
+   
+      - Redistributions in binary form must reproduce the above copyright
+        notice, this list of conditions and the following disclaimer in the
+        documentation and/or other materials provided with the distribution.
+   
+      - Neither the name of the Eclipse Foundation, Inc. nor the names of its
+        contributors may be used to endorse or promote products derived
+        from this software without specific prior written permission.
+   
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+    IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+    THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+    PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+    EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+    PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+    LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/ejb/com/oracle/javaee7/samples/README.md b/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/ejb/com/oracle/javaee7/samples/README.md
new file mode 100644
index 0000000..766dda6
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/ejb/com/oracle/javaee7/samples/README.md
@@ -0,0 +1 @@
+This directory contains sample code and hence files within this directory and below are covered under EDL 1.0.
diff --git a/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/chunk/IdGenerator.java b/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/chunk/IdGenerator.java
new file mode 100644
index 0000000..157ea40
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/chunk/IdGenerator.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.oracle.javaee7.samples.batch.chunk;
+
+/**
+ *
+ * @author makannan
+ */
+public interface IdGenerator {
+
+    public String nextId();
+    
+}
diff --git a/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/chunk/SimpleIdGenerator.java b/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/chunk/SimpleIdGenerator.java
new file mode 100644
index 0000000..782ac85
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/chunk/SimpleIdGenerator.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.oracle.javaee7.samples.batch.chunk;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ *
+ * @author makannan
+ */
+public class SimpleIdGenerator
+    implements IdGenerator {
+    
+    private AtomicInteger counter = new AtomicInteger(0);
+    
+    public String nextId() {
+        return "" + counter.incrementAndGet();
+    }
+}
diff --git a/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/chunk/SimpleItemProcessor.java b/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/chunk/SimpleItemProcessor.java
new file mode 100644
index 0000000..ac427a9
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/chunk/SimpleItemProcessor.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.oracle.javaee7.samples.batch.chunk;
+
+import javax.inject.Inject;
+
+
+@javax.inject.Named("SimpleItemProcessor")
+public class SimpleItemProcessor
+    implements javax.batch.api.chunk.ItemProcessor {
+
+//    @Inject
+//    IdGenerator idGen;
+    
+    @Override
+    public String processItem(Object obj) throws Exception {
+	String t = (String) obj;
+        String[] record = t.split(", ");
+        
+    //EMP-ID, MONTH-YEAR, SALARY, TAX%, MEDICARE%, OTHER
+        int salary = Integer.valueOf(record[2]);
+        double tax = Double.valueOf(record[3]);
+        double mediCare = Double.valueOf(record[4]);
+        StringBuilder sb = new StringBuilder(t);
+        sb.append(", ").append(salary * tax / 100);
+        sb.append(", ").append(salary * mediCare / 100);
+        sb.append(", ").append(salary - (salary * tax / 100) - (salary * mediCare / 100));
+        return  sb.toString();
+    }
+    
+}
diff --git a/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/chunk/SimpleItemReader.java b/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/chunk/SimpleItemReader.java
new file mode 100644
index 0000000..74f446d
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/chunk/SimpleItemReader.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.oracle.javaee7.samples.batch.chunk;
+
+import java.io.Serializable;
+
+@javax.inject.Named("SimpleItemReader")
+public class SimpleItemReader
+    implements javax.batch.api.chunk.ItemReader {
+
+    private int index = 0;
+    
+    //EMP-ID, MONTH-YEAR, SALARY, TAX%, MEDICARE%, OTHER
+    private String[] items = new String[] {
+        "120-01, JAN-2013, 8000, 27, 3, 0",
+        "120-02, JAN-2013, 8500, 27, 3, 0",
+        "120-03, JAN-2013, 9000, 33, 4, 0",
+        "120-04, JAN-2013, 8500, 33, 4, 0",
+        "120-05, JAN-2013, 10000, 33, 4, 0",
+        "120-06, JAN-2013, 10500, 33, 4, 0",
+        "120-07, JAN-2013, 11000, 36, 5, 0",
+        "120-08, JAN-2013, 11500, 36, 5, 0",
+    };
+    
+    @Override
+    public void open(Serializable e) throws Exception {
+    }
+
+    @Override
+    public void close() throws Exception {
+    }
+
+    @Override
+    public Object readItem() throws Exception {
+        return index < items.length ? items[index++] : null;
+    }
+
+    @Override
+    public Serializable checkpointInfo() throws Exception {
+        return null;
+    }
+    
+}
diff --git a/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/chunk/SimpleItemWriter.java b/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/chunk/SimpleItemWriter.java
new file mode 100644
index 0000000..96394df
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/chunk/SimpleItemWriter.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.oracle.javaee7.samples.batch.chunk;
+
+import java.io.Serializable;
+import java.util.List;
+@javax.inject.Named("SimpleItemWriter")
+public class SimpleItemWriter
+    implements javax.batch.api.chunk.ItemWriter {
+    
+    @Override
+    public void open(Serializable e) throws Exception {
+    }
+
+    @Override
+    public void close() throws Exception {
+    }
+
+    @Override
+    public void writeItems(List lst) throws Exception {
+        StringBuilder sb = new StringBuilder("SimpleItemWriter:");
+	List<String> list = (List<String>) lst;
+        for (String s : list) {
+            sb.append(" ").append(s);
+        }
+        System.out.println(sb.toString());
+    }
+
+    @Override
+    public Serializable checkpointInfo() throws Exception {
+        return null;
+    }
+    
+}
diff --git a/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/chunk/Sless.java b/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/chunk/Sless.java
new file mode 100644
index 0000000..c5c3e8a
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/chunk/Sless.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+package com.oracle.javaee7.samples.batch.chunk;
+
+import javax.ejb.Remote;
+
+@Remote
+public interface Sless {
+
+    public long submitJob();
+
+    public String getJobExitStatus(long executionId);
+
+    public boolean wasEjbCreateCalled();
+
+}
+
diff --git a/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/chunk/SlessBean.java b/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/chunk/SlessBean.java
new file mode 100644
index 0000000..ae7c2e1
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/bmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/chunk/SlessBean.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+package com.oracle.javaee7.samples.batch.chunk;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.util.Properties;
+
+import javax.annotation.PostConstruct;
+
+import javax.batch.operations.JobOperator;
+import javax.batch.runtime.BatchRuntime;
+import javax.batch.runtime.JobExecution;
+import javax.ejb.Stateless;
+import javax.ejb.EJB;
+import javax.ejb.TransactionManagement;
+import javax.ejb.TransactionManagementType;
+
+@TransactionManagement(TransactionManagementType.BEAN)
+@Stateless
+public class SlessBean
+    implements Sless {
+
+    boolean ejbCreateCalled = false;
+
+    public void ejbCreate() {
+        this.ejbCreateCalled = true;
+    }
+
+    public long submitJob() {
+	try {
+	  JobOperator jobOperator = BatchRuntime.getJobOperator();
+
+	  Properties props = new Properties();
+	  for (int i=0; i<9; i++)
+		props.put("Chunk-Key-"+ i, "Chunk-Value-" + i);
+	  return  jobOperator.start("ChunkJob", props);
+        } catch (Exception ex) {
+	  throw new RuntimeException(ex);
+	}
+    }
+
+    public String getJobExitStatus(long executionId) {
+	try {
+	  JobOperator jobOperator = BatchRuntime.getJobOperator();
+	  JobExecution je =  jobOperator.getJobExecution(executionId);
+	  return je.getExitStatus();
+	} catch (Exception ex) {
+	  throw new RuntimeException(ex);
+	}
+
+    }
+
+    public boolean wasEjbCreateCalled() {
+	return ejbCreateCalled;
+    }
+
+														            
+}
diff --git a/appserver/tests/appserv-tests/devtests/batch/build.xml b/appserver/tests/appserv-tests/devtests/batch/build.xml
new file mode 100755
index 0000000..4f7ae81
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/build.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+    Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v. 2.0, which is available at
+    http://www.eclipse.org/legal/epl-2.0.
+
+    This Source Code may also be made available under the following Secondary
+    Licenses when the conditions for such availability set forth in the
+    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+    version 2 with the GNU Classpath Exception, which is available at
+    https://www.gnu.org/software/classpath/license.html.
+
+    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+
+<!DOCTYPE project [
+<!ENTITY commonSetup SYSTEM "./../../config/properties.xml">
+<!ENTITY commonBuild SYSTEM "./../../config/common.xml">
+<!ENTITY run SYSTEM "./../../config/run.xml">
+]>
+
+<project name="batch" default="usage" basedir=".">
+
+    &commonSetup;
+    &commonBuild;
+    &run;
+
+<property file="build.properties" />
+
+    <target name="all">
+	<delete>
+           <fileset dir="${env.APS_HOME}" includes="test_results*"/>
+        </delete>
+        <delete>
+           <fileset dir="." includes="*.output"/>
+        </delete>
+        <record name="batch.output" action="start" />
+<!--	<ant dir="batch-dev-tests" target="all"/>  -->
+	<ant dir="bmt-chunk-job" target="all"/>
+	<ant dir="cmt-chunk-job" target="all"/>
+<!--	<ant dir="pay-roll-job-with-ejb/stateless" target="all"/>  
+	<ant dir="simple-batchlet" target="all"/> -->
+	<ant dir="simple-validation-test" target="all"/>
+<!--	<ant dir="two-steps-job" target="all"/>   -->
+	<record name="batch.output" action="stop" />
+	
+    </target>
+</project>
+	
diff --git a/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/build.properties b/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/build.properties
new file mode 100644
index 0000000..6781708
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/build.properties
@@ -0,0 +1,39 @@
+<!--
+
+    Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v. 2.0, which is available at
+    http://www.eclipse.org/legal/epl-2.0.
+
+    This Source Code may also be made available under the following Secondary
+    Licenses when the conditions for such availability set forth in the
+    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+    version 2 with the GNU Classpath Exception, which is available at
+    https://www.gnu.org/software/classpath/license.html.
+
+    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+ 
+
+<property name="module" value="batch-cmt-chunk"/>
+<property name="appname" value="${module}"/>         
+<property name="assemble" value="${build.classes.dir}/archive"/>
+<property name="test.client" 
+	value="Client"/>
+<property name="application.xml" value="descriptor/application.xml"/>
+<property name="beans.xml" value="descriptor/beans.xml"/>
+<property name="batch.xml" value="descriptor/batch.xml"/>
+<property name="sun-application.xml" value="descriptor/sun-application.xml"/>
+<property name="ejb-jar.xml" value="descriptor/ejb-jar.xml"/>
+<property name="batch.jobs.dir" value="descriptor/batch-jobs"/>
+<property name="sun-ejb-jar.xml" value="descriptor/sun-ejb-jar.xml"/>
+<property name="application-client.xml" 
+	value="descriptor/application-client.xml"/>
+<property name="sun-application-client.xml" 
+	value="descriptor/sun-application-client.xml"/>
+<property name="appclientjar.files" value="${build.classes.dir}"/>         
+<property name="appclient.jar" value="${assemble.dir}/${appname}-client.jar"/>
+<property name="app.type" value="application"/>
+<property name="batch_derby.sql" value="../../batch_derby.sql"/>
diff --git a/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/build.xml b/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/build.xml
new file mode 100644
index 0000000..1681cb4
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/build.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+    Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v. 2.0, which is available at
+    http://www.eclipse.org/legal/epl-2.0.
+
+    This Source Code may also be made available under the following Secondary
+    Licenses when the conditions for such availability set forth in the
+    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+    version 2 with the GNU Classpath Exception, which is available at
+    https://www.gnu.org/software/classpath/license.html.
+
+    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+
+<!DOCTYPE project [
+<!ENTITY commonSetup SYSTEM "../../../config/properties.xml">
+<!ENTITY commonBuild SYSTEM "../../../config/common.xml">
+<!ENTITY testproperties SYSTEM "build.properties">
+]>
+
+<project name="batch-cmt-chunkApp" default="usage" basedir=".">
+
+    &commonSetup;
+    &commonBuild;
+    &testproperties;
+
+    <!--
+    <target name="all" depends="build,copy-batch-sql,deploy,run,undeploy"/>
+    -->
+
+    <target name="all" depends="build,deploy,run,undeploy"/>
+
+    <target name="clean" depends="init-common">
+      <antcall  target="clean-common"/>
+    </target>
+ 
+    <target name="compile" depends="clean">
+        <antcall target="compile-common">
+            <param name="src" value="ejb"/>
+        </antcall>
+        <antcall target="compile-common">
+            <param name="src" value="client"/>
+        </antcall>
+    </target>
+
+
+    <target name="build" depends="compile">
+        <antcall target="build-ear-common">
+            <param name="ejbjar.classes" 
+              value="**/*.class"/>
+            <param name="appclientjar.classes" 
+              value="**/Client.class,**/JobSubmitter.class"/>
+        </antcall>
+    </target> 
+    
+    <target name="copy-batch-sql" depends="build">
+    	<echo message="***** Copy ${batch_derby.sql} to Target dir: ${env.S1AS_HOME}/lib"/>
+    	<copy file="${batch_derby.sql}" todir="${env.S1AS_HOME}/lib"/>
+    </target>
+
+    <target name="deploy" 
+            depends="init-common">
+        <antcall target="deploy-common"/>
+    </target>
+
+    <target name="run" depends="init-common">
+        <antcall target="runclient-common"/>
+    </target>
+ 
+    <target name="undeploy" depends="init-common">
+        <antcall target="undeploy-common"/>
+    </target>   
+
+    <target name="usage">
+        <antcall target="usage-common"/>
+    </target>
+</project>
diff --git a/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/client/Client.java b/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/client/Client.java
new file mode 100644
index 0000000..693cee5
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/client/Client.java
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package com.sun.ejb.devtest.client;
+
+import java.io.*;
+import java.util.*;
+import javax.naming.*;
+import javax.ejb.EJB;
+import com.oracle.javaee7.samples.batch.cmt.chunk.*;
+import com.sun.ejte.ccl.reporter.SimpleReporterAdapter;
+
+public class Client {
+
+    private static SimpleReporterAdapter stat = 
+        new SimpleReporterAdapter("appserv-tests");
+
+    public static void main (String[] args) {
+
+        stat.addDescription("batch-cmt-chunk");
+        Client client = new Client(args);
+        client.doTest();
+        stat.printSummary("batch-cmt-chunk");
+    }  
+    
+    public Client (String[] args) {
+    }
+    
+    private static @EJB JobSubmitter jobSubmitter;
+
+    int MAX_JOB_SIZE = 2;
+    long[] executionIds = new long[MAX_JOB_SIZE];
+
+    public void doTest() {
+	for (int i=0; i<MAX_JOB_SIZE; i++)
+	    executionIds[i] = -1;
+        submitJobs();
+        checkJobExecution(executionIds[0]);
+    	isJobExecutionOK(executionIds[0]);
+    	checkIfOnlyJobsFromThisAppAreVisible();
+    }
+
+    public void submitJobs() {
+        try {
+	    for (int i = 0; i< MAX_JOB_SIZE; i++) {
+	        executionIds[i] = jobSubmitter.submitJob("CMT-ChunkJob");
+	        checkBatchJobStatus(executionIds[i], 10);
+	    }
+	    boolean result = true;
+	    for (int i=0; i<MAX_JOB_SIZE; i++) {
+	       result = result && executionIds[i] != -1;
+	    }
+            stat.addStatus("batch-cmt-chunk-test1", (result ? stat.PASS : stat.FAIL));
+	} catch (Exception ex) {
+            stat.addStatus("batch-cmt-chunk-test1", stat.FAIL);
+        }
+    }
+
+    public void checkJobExecution(long executionId) {
+        try {
+	    boolean status = true;
+	    Map<String, String> map = jobSubmitter.toMap(executionId);
+
+            stat.addStatus("batch-cmt-status-checkExe-jobName", map.get("jobName") != null ? stat.PASS : stat.FAIL);
+            stat.addStatus("batch-cmt-status-checkExe-appName", map.get("appName") != null ? stat.PASS : stat.FAIL);
+            stat.addStatus("batch-cmt-status-checkExe-instanceCount", map.get("instanceCount") != null ? stat.PASS : stat.FAIL);
+            stat.addStatus("batch-cmt-status-checkExe-instanceID", map.get("instanceID") != null ? stat.PASS : stat.FAIL);
+            stat.addStatus("batch-cmt-status-checkExe-executionID", map.get("executionID") != null ? stat.PASS : stat.FAIL);
+            stat.addStatus("batch-cmt-status-checkExe-startTime", map.get("startTime") != null ? stat.PASS : stat.FAIL);
+            stat.addStatus("batch-cmt-status-checkExe-batchStatus", map.get("batchStatus") != null ? stat.PASS : stat.FAIL);
+            stat.addStatus("batch-cmt-status-checkExe-endTime", map.get("endTime") != null ? stat.PASS : stat.FAIL);
+
+	} catch (Exception ex) {
+            stat.addStatus("batch-cmt-chunk-test3", stat.FAIL);
+        }
+    }
+
+    public void isJobExecutionOK(long executionId) {
+        stat.addStatus("batch-cmt-status-checkExe-isJobExecutionOK", checkOneJobExecution(executionId) ? stat.PASS : stat.FAIL);
+    }
+
+    private boolean checkOneJobExecution(long executionId) {
+        try {
+	    Map<String, String> map = jobSubmitter.toMap(executionId);
+	    return map != null &&
+            	map.get("jobName") != null &&
+            	map.get("appName") != null &&
+            	map.get("instanceCount") != null &&
+            	map.get("instanceID") != null &&
+            	map.get("executionID") != null &&
+            	map.get("startTime") != null &&
+            	map.get("batchStatus") != null &&
+            	map.get("endTime") != null;
+
+	} catch (Exception ex) {
+
+        }
+        return false;
+    }
+
+    public void checkIfOnlyJobsFromThisAppAreVisible() {
+        try {
+	    boolean status = true;
+            for (long exeId : jobSubmitter.getAllExecutionIds(null)) {
+	        Map<String, String> map = jobSubmitter.toMap(exeId);
+		String jobName = map.get("jobName");
+		String appName = map.get("appName");
+	        if (!jobName.startsWith("cmt-chunk-job") || !appName.startsWith("server-config:batch-cmt-chunkApp")) {
+		    System.out.println("***********************************************");
+		    System.out.println("*** Job From another app? " + jobName + "; " + appName + " ***");
+		    System.out.println("***********************************************");
+		    status = false;
+		    break;
+		}
+	    }
+            stat.addStatus("batch-cmt-chunk-checkIfOnlyJobsFromThisAppAreVisible", (status ? stat.PASS : stat.FAIL));
+	} catch (Exception ex) {
+            stat.addStatus("batch-cmt-chunk-checkIfOnlyJobsFromThisAppAreVisible", stat.FAIL);
+        }
+    }
+
+    public void checkBatchJobStatus(long executionId, int sec) {
+	while (sec-- > 0) {
+            try {
+		String status = jobSubmitter.getJobExitStatus(executionId);
+		if ("COMPLETED".equalsIgnoreCase(status) || "FAILED".equalsIgnoreCase(status)) {
+		    System.out.println("** checkBatchJobStatus[" + executionId + "]  ==> " + status);
+		    break;
+		}
+                System.out.println("Will sleep for " + sec + " more seconds...");
+                Thread.currentThread().sleep(1000);
+            } catch (Exception ex) {
+	    }
+        }
+    }
+
+}
+
diff --git a/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/client/MANIFEST.MF b/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/client/MANIFEST.MF
new file mode 100644
index 0000000..ae04b30
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/client/MANIFEST.MF
@@ -0,0 +1,4 @@
+Manifest-Version: 1.0
+Created-By: 1.4.0-beta3 (Sun Microsystems Inc.)
+Main-Class: com.sun.ejb.devtest.client.Client
+Class-Path: reporter.jar
diff --git a/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/descriptor/batch-jobs/CMT-ChunkJob.xml b/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/descriptor/batch-jobs/CMT-ChunkJob.xml
new file mode 100644
index 0000000..1de0cd6
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/descriptor/batch-jobs/CMT-ChunkJob.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v. 2.0, which is available at
+    http://www.eclipse.org/legal/epl-2.0.
+
+    This Source Code may also be made available under the following Secondary
+    Licenses when the conditions for such availability set forth in the
+    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+    version 2 with the GNU Classpath Exception, which is available at
+    https://www.gnu.org/software/classpath/license.html.
+
+    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+
+<job id="cmt-chunk-job" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
+    <step id="step1">
+        <chunk item-count="3">
+            <reader ref="SimpleItemReader"></reader> 
+            <processor ref="SimpleItemProcessor"></processor>
+            <writer ref="SimpleItemWriter"></writer> 
+        </chunk>
+    </step>
+</job>
diff --git a/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/descriptor/beans.xml b/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/descriptor/beans.xml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/descriptor/beans.xml
diff --git a/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/ejb/com/oracle/javaee7/samples/LICENSE.md b/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/ejb/com/oracle/javaee7/samples/LICENSE.md
new file mode 100644
index 0000000..e0358f9
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/ejb/com/oracle/javaee7/samples/LICENSE.md
@@ -0,0 +1,29 @@
+
+    Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
+   
+    Redistribution and use in source and binary forms, with or without
+    modification, are permitted provided that the following conditions
+    are met:
+   
+      - Redistributions of source code must retain the above copyright
+        notice, this list of conditions and the following disclaimer.
+   
+      - Redistributions in binary form must reproduce the above copyright
+        notice, this list of conditions and the following disclaimer in the
+        documentation and/or other materials provided with the distribution.
+   
+      - Neither the name of the Eclipse Foundation, Inc. nor the names of its
+        contributors may be used to endorse or promote products derived
+        from this software without specific prior written permission.
+   
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+    IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+    THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+    PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+    EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+    PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+    LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/ejb/com/oracle/javaee7/samples/README.md b/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/ejb/com/oracle/javaee7/samples/README.md
new file mode 100644
index 0000000..766dda6
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/ejb/com/oracle/javaee7/samples/README.md
@@ -0,0 +1 @@
+This directory contains sample code and hence files within this directory and below are covered under EDL 1.0.
diff --git a/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/IdGenerator.java b/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/IdGenerator.java
new file mode 100644
index 0000000..7823249
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/IdGenerator.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.oracle.javaee7.samples.batch.cmt.chunk;
+
+/**
+ *
+ * @author makannan
+ */
+public interface IdGenerator {
+
+    public String nextId();
+    
+}
diff --git a/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/JobSubmitter.java b/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/JobSubmitter.java
new file mode 100644
index 0000000..d241e5f
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/JobSubmitter.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+package com.oracle.javaee7.samples.batch.cmt.chunk;
+
+import javax.ejb.Remote;
+import java.util.Collection;
+import java.util.Map;
+import java.util.List;
+
+@Remote
+public interface JobSubmitter {
+
+    public String nextId();
+
+    public long submitJob(String jobName);
+
+    public Collection<String> listJobs(boolean useLongFormat);
+
+    public Collection<String> listJobExecutions(boolean useLongFormat, long... executinIds);
+
+    public Map<String, String> toMap(long executionId);
+
+    public String getJobExitStatus(long executionId);
+
+    public List<Long> getAllExecutionIds(String jobName);
+
+}
+
diff --git a/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/JobSubmitterBean.java b/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/JobSubmitterBean.java
new file mode 100644
index 0000000..385609a
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/JobSubmitterBean.java
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+package com.oracle.javaee7.samples.batch.cmt.chunk;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.util.Properties;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Collection;
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.HashMap;
+
+import javax.inject.Inject;
+import javax.annotation.PostConstruct;
+
+import javax.batch.operations.JobOperator;
+import javax.batch.runtime.BatchRuntime;
+import javax.batch.runtime.JobExecution;
+import javax.batch.runtime.JobInstance;
+import com.ibm.jbatch.spi.TaggedJobExecution;
+
+import javax.ejb.Stateless;
+import javax.ejb.EJB;
+
+@Stateless
+public class JobSubmitterBean
+    implements JobSubmitter {
+
+    //@Inject
+    IdGenerator idGenerator;
+
+    public String nextId() {
+        return idGenerator != null ? idGenerator.nextId() : "-1";
+    }
+
+    public long submitJob(String jobName) {
+	try {
+	  JobOperator jobOperator = BatchRuntime.getJobOperator();
+
+	  Properties props = new Properties();
+	  for (int i=0; i<3; i++)
+		props.put(jobName + "-Key-" + i, jobName+"-Value-" + i);
+	  return  jobOperator.start(jobName, props);
+        } catch (Exception ex) {
+	  throw new RuntimeException(ex);
+	}
+    }
+
+    public String getJobExitStatus(long executionId) {
+	try {
+	  JobOperator jobOperator = BatchRuntime.getJobOperator();
+	  JobExecution je =  jobOperator.getJobExecution(executionId);
+	  return je.getExitStatus();
+	} catch (Exception ex) {
+	  throw new RuntimeException(ex);
+	}
+
+    }
+
+    public Collection<String> listJobs(boolean useLongFormat) {
+	try {
+	  JobOperator jobOperator = BatchRuntime.getJobOperator();
+	  Set<String> jobs = new HashSet<String>();
+	  if (!useLongFormat) {
+	      for (String jobName : jobOperator.getJobNames()) {
+	          StringBuilder sb = new StringBuilder();
+		  sb.append(jobName).append(" ").append(jobOperator.getJobInstanceCount(jobName));
+		  jobs.add(sb.toString());
+	     }
+          } else {
+	     int index = 0;
+	     for (String jobName : jobOperator.getJobNames()) {
+		List<JobInstance> exe = jobOperator.getJobInstances(jobName, 0, Integer.MAX_VALUE - 1);
+		if (exe != null) {
+		   for (JobInstance ji : exe) {
+		      for (JobExecution je : jobOperator.getJobExecutions(ji)) {
+	                  StringBuilder sb = new StringBuilder();
+                          try {
+                              sb.append(index++).append(" ").append(jobName).append(" ").append(((TaggedJobExecution) je).getTagName())
+			      	.append(" ").append(je.getBatchStatus()).append(" ").append(je.getExitStatus());
+	                      jobs.add(sb.toString());
+                          } catch (Exception ex) {
+	                      jobs.add("Exception : " + sb.toString());
+                          }
+                      }
+                   }
+		}
+	     }
+	   }
+
+	   return jobs;
+	} catch (Exception ex) {
+	  throw new RuntimeException(ex);
+	}
+     }
+
+    public Map<String, String> toMap(long executionId) {
+       HashMap<String, String> map = new HashMap<String, String>();
+       try {
+	  JobOperator jobOperator = BatchRuntime.getJobOperator();
+	  JobExecution je = jobOperator.getJobExecution(executionId);
+          map.put("jobName", ""+je.getJobName());
+          map.put("appName", ""+((TaggedJobExecution) je).getTagName());
+
+	  try {
+            map.put("instanceCount", ""+jobOperator.getJobInstanceCount(je.getJobName()));
+          } catch (Exception ex) {}
+
+          map.put("instanceID", ""+jobOperator.getJobInstance(je.getExecutionId()).getInstanceId());
+          map.put("executionID", ""+je.getBatchStatus());
+          map.put("batchStatus", ""+je.getBatchStatus());
+          map.put("exitStatus", ""+je.getExitStatus());
+          map.put("startTime", ""+je.getStartTime().getTime());
+          map.put("endTime", ""+je.getEndTime().getTime());
+       } catch (Exception ex) {
+          map.put("EXCEPTION", ex.toString());
+       }
+
+       return map;
+    }
+	
+    public Collection<String> listJobExecutions(boolean useLongFormat, long... executinIds) {
+	Set<String> jobs = new HashSet<String>();
+	return jobs;
+    }
+
+    public List<Long> getAllExecutionIds(String jobName) {
+	List<Long> list = new LinkedList<Long>();
+	try {
+        if (jobName != null)
+           getAllExecutionIds(jobName, list);
+	else {
+	   JobOperator jobOperator = BatchRuntime.getJobOperator();
+	   for (String jn : jobOperator.getJobNames())
+              getAllExecutionIds(jn, list);
+	}
+        } catch (Exception ex) {
+
+	}
+	return list;
+    }
+
+    private void getAllExecutionIds(String jobName, List<Long> list)
+    	throws Exception {
+	JobOperator jobOperator = BatchRuntime.getJobOperator();
+	List<JobInstance> exe = jobOperator.getJobInstances(jobName, 0, Integer.MAX_VALUE - 1);
+	if (exe != null) {
+	   for (JobInstance ji : exe) {
+	      for (JobExecution je : jobOperator.getJobExecutions(ji)) {
+                 list.add(je.getExecutionId());
+              }
+           }
+	}
+     }
+
+}
diff --git a/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/SimpleIdGenerator.java b/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/SimpleIdGenerator.java
new file mode 100644
index 0000000..0cf4ee2
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/SimpleIdGenerator.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.oracle.javaee7.samples.batch.cmt.chunk;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ *
+ * @author makannan
+ */
+public class SimpleIdGenerator
+    implements IdGenerator {
+    
+    private AtomicInteger counter = new AtomicInteger(0);
+    
+    public String nextId() {
+        return "" + counter.incrementAndGet();
+    }
+}
diff --git a/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/SimpleItemProcessor.java b/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/SimpleItemProcessor.java
new file mode 100644
index 0000000..4ec8c54
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/SimpleItemProcessor.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.oracle.javaee7.samples.batch.cmt.chunk;
+
+import javax.inject.Inject;
+
+
+@javax.inject.Named("SimpleItemProcessor")
+public class SimpleItemProcessor
+    implements javax.batch.api.chunk.ItemProcessor {
+
+//    @Inject
+//    IdGenerator idGen;
+    
+    @Override
+    public String processItem(Object obj) throws Exception {
+	String t = (String) obj;
+        String[] record = t.split(", ");
+        
+    //EMP-ID, MONTH-YEAR, SALARY, TAX%, MEDICARE%, OTHER
+        int salary = Integer.valueOf(record[2]);
+        double tax = Double.valueOf(record[3]);
+        double mediCare = Double.valueOf(record[4]);
+        StringBuilder sb = new StringBuilder(t);
+        sb.append(", ").append(salary * tax / 100);
+        sb.append(", ").append(salary * mediCare / 100);
+        sb.append(", ").append(salary - (salary * tax / 100) - (salary * mediCare / 100));
+        return  sb.toString();
+    }
+    
+}
diff --git a/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/SimpleItemReader.java b/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/SimpleItemReader.java
new file mode 100644
index 0000000..8354666
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/SimpleItemReader.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.oracle.javaee7.samples.batch.cmt.chunk;
+
+import java.io.Serializable;
+
+@javax.inject.Named("SimpleItemReader")
+public class SimpleItemReader
+    implements javax.batch.api.chunk.ItemReader {
+
+    private int index = 0;
+    
+    //EMP-ID, MONTH-YEAR, SALARY, TAX%, MEDICARE%, OTHER
+    private String[] items = new String[] {
+        "120-01, JAN-2013, 8000, 27, 3, 0",
+        "120-02, JAN-2013, 8500, 27, 3, 0",
+        "120-03, JAN-2013, 9000, 33, 4, 0",
+        "120-04, JAN-2013, 8500, 33, 4, 0",
+        "120-05, JAN-2013, 10000, 33, 4, 0",
+        "120-06, JAN-2013, 10500, 33, 4, 0",
+        "120-07, JAN-2013, 11000, 36, 5, 0",
+        "120-08, JAN-2013, 11500, 36, 5, 0",
+    };
+    
+    @Override
+    public void open(Serializable e) throws Exception {
+    }
+
+    @Override
+    public void close() throws Exception {
+    }
+
+    @Override
+    public Object readItem() throws Exception {
+        return index < items.length ? items[index++] : null;
+    }
+
+    @Override
+    public Serializable checkpointInfo() throws Exception {
+        return null;
+    }
+    
+}
diff --git a/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/SimpleItemWriter.java b/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/SimpleItemWriter.java
new file mode 100644
index 0000000..32abffb
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/cmt-chunk-job/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/SimpleItemWriter.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.oracle.javaee7.samples.batch.cmt.chunk;
+
+import java.io.Serializable;
+import java.util.List;
+@javax.inject.Named("SimpleItemWriter")
+public class SimpleItemWriter
+    implements javax.batch.api.chunk.ItemWriter {
+    
+    @Override
+    public void open(Serializable e) throws Exception {
+    }
+
+    @Override
+    public void close() throws Exception {
+    }
+
+    @Override
+    public void writeItems(List lst) throws Exception {
+        StringBuilder sb = new StringBuilder("SimpleItemWriter:");
+	List<String> list = (List<String>) lst;
+        for (String s : list) {
+            sb.append(" ").append(s);
+        }
+        System.out.println(sb.toString());
+    }
+
+    @Override
+    public Serializable checkpointInfo() throws Exception {
+        return null;
+    }
+    
+}
diff --git a/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/build.properties b/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/build.properties
new file mode 100644
index 0000000..f5f2f47
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/build.properties
@@ -0,0 +1,39 @@
+<!--
+
+    Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v. 2.0, which is available at
+    http://www.eclipse.org/legal/epl-2.0.
+
+    This Source Code may also be made available under the following Secondary
+    Licenses when the conditions for such availability set forth in the
+    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+    version 2 with the GNU Classpath Exception, which is available at
+    https://www.gnu.org/software/classpath/license.html.
+
+    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+ 
+
+<property name="module" value="devtest-intro-stateless"/>
+<property name="appname" value="${module}"/>         
+<property name="assemble" value="${build.classes.dir}/archive"/>
+<property name="test.client" 
+	value="Client"/>
+<property name="application.xml" value="descriptor/application.xml"/>
+<property name="beans.xml" value="descriptor/beans.xml"/>
+<property name="batch.xml" value="descriptor/batch.xml"/>
+<property name="sun-application.xml" value="descriptor/sun-application.xml"/>
+<property name="ejb-jar.xml" value="descriptor/ejb-jar.xml"/>
+<property name="batch.jobs.dir" value="descriptor/batch-jobs"/>
+<property name="sun-ejb-jar.xml" value="descriptor/sun-ejb-jar.xml"/>
+<property name="application-client.xml" 
+	value="descriptor/application-client.xml"/>
+<property name="sun-application-client.xml" 
+	value="descriptor/sun-application-client.xml"/>
+<property name="appclientjar.files" value="${build.classes.dir}"/>         
+<property name="appclient.jar" value="${assemble.dir}/${appname}-client.jar"/>
+<property name="app.type" value="application"/>
+<property name="batch_derby.sql" value="../../batch_derby.sql"/>
diff --git a/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/build.xml b/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/build.xml
new file mode 100644
index 0000000..d102ff4
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/build.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+    Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v. 2.0, which is available at
+    http://www.eclipse.org/legal/epl-2.0.
+
+    This Source Code may also be made available under the following Secondary
+    Licenses when the conditions for such availability set forth in the
+    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+    version 2 with the GNU Classpath Exception, which is available at
+    https://www.gnu.org/software/classpath/license.html.
+
+    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+
+<!DOCTYPE project [
+<!ENTITY commonSetup SYSTEM "../../../../config/properties.xml">
+<!ENTITY commonBuild SYSTEM "../../../../config/common.xml">
+<!ENTITY testproperties SYSTEM "build.properties">
+]>
+
+<project name="devtest-intro-stateless-App" default="usage" basedir=".">
+
+    &commonSetup;
+    &commonBuild;
+    &testproperties;
+
+    <!--
+    <target name="all" depends="build,copy-batch-sql,deploy,run,undeploy"/>
+    -->
+
+    <target name="all" depends="build,deploy,run,undeploy"/>
+
+    <target name="clean" depends="init-common">
+      <antcall  target="clean-common"/>
+    </target>
+ 
+    <target name="compile" depends="clean">
+        <antcall target="compile-common">
+            <param name="src" value="ejb"/>
+        </antcall>
+        <antcall target="compile-common">
+            <param name="src" value="client"/>
+        </antcall>
+    </target>
+
+
+    <target name="build" depends="compile">
+        <antcall target="build-ear-common">
+            <param name="ejbjar.classes" 
+              value="**/*.class"/>
+            <param name="appclientjar.classes" 
+              value="**/Client.class,**/Sless.class,**/Sless30.class"/>
+        </antcall>
+    </target> 
+    
+    <target name="copy-batch-sql" depends="build">
+    	<echo message="***** Copy ${batch_derby.sql} to Target dir: ${env.S1AS_HOME}/lib"/>
+    	<copy file="${batch_derby.sql}" todir="${env.S1AS_HOME}/lib"/>
+    </target>
+
+    <target name="deploy" 
+            depends="init-common">
+        <antcall target="deploy-common"/>
+    </target>
+
+    <target name="run" depends="init-common">
+        <antcall target="runclient-common"/>
+    </target>
+ 
+    <target name="undeploy" depends="init-common">
+        <antcall target="undeploy-common"/>
+    </target>   
+
+    <target name="usage">
+        <antcall target="usage-common"/>
+    </target>
+</project>
diff --git a/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/client/Client.java b/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/client/Client.java
new file mode 100644
index 0000000..061b4f6
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/client/Client.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package com.sun.ejb.devtest.client;
+
+import java.io.*;
+import java.util.*;
+import javax.naming.*;
+import javax.ejb.EJB;
+import com.oracle.javaee7.samples.batch.simple.*;
+import com.sun.ejte.ccl.reporter.SimpleReporterAdapter;
+
+@EJB(name="ejb/GG", beanInterface=Sless.class)
+public class Client {
+
+    private static SimpleReporterAdapter stat = 
+        new SimpleReporterAdapter("appserv-tests");
+
+    public static void main (String[] args) {
+
+        stat.addDescription("batch-pay-rool-job-ejb-stateless");
+        Client client = new Client(args);
+        client.doTest();
+        stat.printSummary("batch-pay-rool-job-ejb-stateless");
+    }  
+    
+    public Client (String[] args) {
+    }
+    
+    private static @EJB(name="ejb/kk") Sless sless;
+
+    public void doTest() {
+        try {
+            (new InitialContext()).lookup("java:comp/env/ejb/GG");
+	    long result = sless.submitJob();
+	    System.out.println("************************************************");
+	    System.out.println("******* JobID: " + result + " ******************");
+	    System.out.println("************************************************");
+            stat.addStatus("batch payroll", stat.PASS);
+	} catch (Exception ex) {
+            stat.addStatus("batch payroll", stat.FAIL);
+        }
+    }
+
+}
+
diff --git a/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/client/MANIFEST.MF b/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/client/MANIFEST.MF
new file mode 100644
index 0000000..ae04b30
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/client/MANIFEST.MF
@@ -0,0 +1,4 @@
+Manifest-Version: 1.0
+Created-By: 1.4.0-beta3 (Sun Microsystems Inc.)
+Main-Class: com.sun.ejb.devtest.client.Client
+Class-Path: reporter.jar
diff --git a/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/descriptor/batch-jobs/PayRollJob.xml b/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/descriptor/batch-jobs/PayRollJob.xml
new file mode 100644
index 0000000..625f54b
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/descriptor/batch-jobs/PayRollJob.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v. 2.0, which is available at
+    http://www.eclipse.org/legal/epl-2.0.
+
+    This Source Code may also be made available under the following Secondary
+    Licenses when the conditions for such availability set forth in the
+    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+    version 2 with the GNU Classpath Exception, which is available at
+    https://www.gnu.org/software/classpath/license.html.
+
+    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+
+<job id="job1" xmlns="http://batch.jsr352/jsl">
+    <step id="prepare" next="process">
+        <chunk item-count="1">
+            <reader ref="SimpleItemReader"></reader> 
+            <processor ref="SimpleItemProcessor"></processor>
+            <writer ref="SimpleItemWriter"></writer> 
+        </chunk>
+    </step>
+    <step id="process">
+        <chunk item-count="3">
+            <reader ref="SimpleItemReader"></reader> 
+            <processor ref="SimpleItemProcessor"></processor>
+            <writer ref="SimpleItemWriter"></writer> 
+        </chunk>
+    </step>
+</job>
diff --git a/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/descriptor/beans.xml b/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/descriptor/beans.xml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/descriptor/beans.xml
diff --git a/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/ejb/com/oracle/javaee7/samples/LICENSE.md b/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/ejb/com/oracle/javaee7/samples/LICENSE.md
new file mode 100644
index 0000000..e0358f9
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/ejb/com/oracle/javaee7/samples/LICENSE.md
@@ -0,0 +1,29 @@
+
+    Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
+   
+    Redistribution and use in source and binary forms, with or without
+    modification, are permitted provided that the following conditions
+    are met:
+   
+      - Redistributions of source code must retain the above copyright
+        notice, this list of conditions and the following disclaimer.
+   
+      - Redistributions in binary form must reproduce the above copyright
+        notice, this list of conditions and the following disclaimer in the
+        documentation and/or other materials provided with the distribution.
+   
+      - Neither the name of the Eclipse Foundation, Inc. nor the names of its
+        contributors may be used to endorse or promote products derived
+        from this software without specific prior written permission.
+   
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+    IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+    THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+    PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+    EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+    PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+    LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/ejb/com/oracle/javaee7/samples/README.md b/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/ejb/com/oracle/javaee7/samples/README.md
new file mode 100644
index 0000000..766dda6
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/ejb/com/oracle/javaee7/samples/README.md
@@ -0,0 +1 @@
+This directory contains sample code and hence files within this directory and below are covered under EDL 1.0.
diff --git a/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/ejb/com/oracle/javaee7/samples/batch/simple/JobSubmitterServlet.java b/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/ejb/com/oracle/javaee7/samples/batch/simple/JobSubmitterServlet.java
new file mode 100644
index 0000000..ef250c4
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/ejb/com/oracle/javaee7/samples/batch/simple/JobSubmitterServlet.java
@@ -0,0 +1,175 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.oracle.javaee7.samples.batch.simple;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import javax.annotation.Resource;
+import javax.batch.operations.JobOperator;
+import javax.batch.runtime.BatchRuntime;
+import javax.batch.runtime.JobExecution;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.batch.runtime.context.BatchContext;
+import javax.enterprise.concurrent.ManagedExecutorService;
+import javax.inject.Inject;
+
+/**
+ *
+ * @author makannan
+ */
+public class JobSubmitterServlet extends HttpServlet {
+    
+//    @Resource(name="concurrent/batch-executor-service")
+//    ManagedExecutorService managedExecutorService;
+    
+    /**
+     * Processes requests for both HTTP
+     * <code>GET</code> and
+     * <code>POST</code> methods.
+     *
+     * @param request servlet request
+     * @param response servlet response
+     * @throws ServletException if a servlet-specific error occurs
+     * @throws IOException if an I/O error occurs
+     */
+    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
+            throws ServletException, IOException {
+        response.setContentType("text/html;charset=UTF-8");
+        PrintWriter out = response.getWriter();
+        try {
+            out.println("<html>");
+            out.println("<head>");
+            out.println("<title>Servlet JobSubmitterServlet V2</title>");
+            out.println("</head>");
+            out.println("<body>");
+//                out.println("<h1>ManagedExecutorService: " + managedExecutorService + "</h1>");
+                out.println("<h1>Servlet JobSubmitterServlet Version 2 at " + request.getContextPath() + "</h1>");
+            out.println("<form method=\"POST\" >");
+            out.println("<table>");
+            out.println("<tr><td>Submit Job From XML</td><td><input type=\"submit\" name=\"submitJobFromXML\" value=\"Submit Job From XML\"/></td></tr>");
+            out.println("<tr><td>List Jobs</td><td><input type=\"submit\" name=\"listJobs\" value=\"List Job\"/></td></tr>");
+            if (request.getParameter("submitJobFromXML") != null) {
+                submitJobFromXML(out);
+            } else if (request.getParameter("listJobs") != null) {
+                out.println("<tr><td>listJobs</td><td>Not implemented yet</td></tr>");
+            } 
+
+
+            out.println("</table>");
+            out.println("</form>");
+            out.println("</body>");
+            out.println("</html>");
+        } catch (Exception ex) {
+            throw new ServletException(ex);
+        } finally {
+            out.close();
+        }
+    }
+
+    private void submitJobFromXML(PrintWriter pw)
+            throws Exception {
+        
+        JobOperator jobOperator = BatchRuntime.getJobOperator();
+        pw.println("<tr><td>JobOperator class </td><td>" + jobOperator.getClass().getName() + " </td></tr>");
+
+        Properties props = new Properties();
+        for (int i=0; i<9; i++)
+            props.put(i, i);
+        Long id = jobOperator.start("PayRollJob", props);
+        
+        pw.println(jobInfo(jobOperator, id, pw));
+        
+    }
+    
+    //getJobNames()
+    private String jobNames(JobOperator jobOperator) {
+        StringBuilder sb = new StringBuilder("JobOperator.jobNames: ");
+        for (String j : jobOperator.getJobNames())
+            sb.append(" ").append(j);
+        return sb.toString();
+    }
+    
+    private String jobInfo(JobOperator jobOperator, long id, PrintWriter pw) {
+        StringBuilder sb = new StringBuilder("JobOperator.jobNames: ");
+        sb.append("<tr><td>Id</td><td" + id + "</td></tr>");
+        JobExecution je = jobOperator.getJobExecution(id);
+        sb.append("<tr><td>jobParams</td><td>" + je.getJobParameters() +" </td></tr>");
+        sb.append(asString(jobOperator.getJobExecution(id)));
+        return sb.toString();
+    }
+    
+    private String asString(JobExecution je) {
+        StringBuilder sb = new StringBuilder("JobExecution: ");
+        sb.append("<tr><td>=>    createTime</td><td>").append(je.getCreateTime()).append("</td></tr>");
+        sb.append("<tr><td>=>    endTime: </td><td>").append(je.getEndTime()).append("</td></tr>");
+        sb.append("<tr><td>=>    executionId: </td><td>").append(je.getExecutionId()).append("</td></tr>");
+        sb.append("<tr><td>=>    exitStatus: </td><td>").append(je.getExitStatus()).append("</td></tr>");
+        sb.append("<tr><td>=>    instanceId: </td><td>").append(je.getInstanceId()).append("</td></tr>");
+        sb.append("<tr><td>=>    jobParameters: </td><td>").append(je.getJobParameters()).append("</td></tr>");
+        sb.append("<tr><td>=>    lastUpdatedTime: </td><td>").append(je.getLastUpdatedTime()).append("</td></tr>");
+        sb.append("<tr><td>=>    status: </td><td>").append(je.getExitStatus()).append("</td></tr>");
+        
+        return sb.toString();
+    }
+    
+    // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
+    /**
+     * Handles the HTTP
+     * <code>GET</code> method.
+     *
+     * @param request servlet request
+     * @param response servlet response
+     * @throws ServletException if a servlet-specific error occurs
+     * @throws IOException if an I/O error occurs
+     */
+    @Override
+    protected void doGet(HttpServletRequest request, HttpServletResponse response)
+            throws ServletException, IOException {
+        processRequest(request, response);
+    }
+
+    /**
+     * Handles the HTTP
+     * <code>POST</code> method.
+     *
+     * @param request servlet request
+     * @param response servlet response
+     * @throws ServletException if a servlet-specific error occurs
+     * @throws IOException if an I/O error occurs
+     */
+    @Override
+    protected void doPost(HttpServletRequest request, HttpServletResponse response)
+            throws ServletException, IOException {
+        processRequest(request, response);
+    }
+
+    /**
+     * Returns a short description of the servlet.
+     *
+     * @return a String containing servlet description
+     */
+    @Override
+    public String getServletInfo() {
+        return "Short description";
+    }// </editor-fold>
+}
diff --git a/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/ejb/com/oracle/javaee7/samples/batch/simple/SimpleItemProcessor.java b/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/ejb/com/oracle/javaee7/samples/batch/simple/SimpleItemProcessor.java
new file mode 100644
index 0000000..912806d
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/ejb/com/oracle/javaee7/samples/batch/simple/SimpleItemProcessor.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.oracle.javaee7.samples.batch.simple;
+
+import javax.inject.Inject;
+
+
+@javax.inject.Named//("com.oracle.javaee7.samples.batch.simple.SimpleItemProcessor")
+public class SimpleItemProcessor
+    implements javax.batch.api.ItemProcessor<String, String> {
+
+//    @Inject
+//    IdGenerator idGen;
+    
+    @Override
+    public String processItem(String t) throws Exception {
+        String[] record = t.split(", ");
+        
+    //EMP-ID, MONTH-YEAR, SALARY, TAX%, MEDICARE%, OTHER
+        int salary = Integer.valueOf(record[2]);
+        double tax = Double.valueOf(record[3]);
+        double mediCare = Double.valueOf(record[4]);
+        StringBuilder sb = new StringBuilder(t);
+        sb.append(", ").append(salary * tax / 100);
+        sb.append(", ").append(salary * mediCare / 100);
+        sb.append(", ").append(salary - (salary * tax / 100) - (salary * mediCare / 100));
+        return  sb.toString();
+    }
+    
+}
diff --git a/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/ejb/com/oracle/javaee7/samples/batch/simple/SimpleItemReader.java b/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/ejb/com/oracle/javaee7/samples/batch/simple/SimpleItemReader.java
new file mode 100644
index 0000000..1e4bd8c
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/ejb/com/oracle/javaee7/samples/batch/simple/SimpleItemReader.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.oracle.javaee7.samples.batch.simple;
+
+import java.io.Externalizable;
+
+@javax.inject.Named("SimpleItemReader")
+public class SimpleItemReader
+    extends javax.batch.api.AbstractItemReader<String> {
+
+    private int index = 0;
+    
+    //EMP-ID, MONTH-YEAR, SALARY, TAX%, MEDICARE%, OTHER
+    private String[] items = new String[] {
+        "120-01, JAN-2013, 8000, 27, 3, 0",
+        "120-02, JAN-2013, 8500, 27, 3, 0",
+        "120-03, JAN-2013, 9000, 33, 4, 0",
+        "120-04, JAN-2013, 8500, 33, 4, 0",
+        "120-05, JAN-2013, 10000, 33, 4, 0",
+        "120-06, JAN-2013, 10500, 33, 4, 0",
+        "120-07, JAN-2013, 11000, 36, 5, 0",
+        "120-08, JAN-2013, 11500, 36, 5, 0",
+    };
+    
+    @Override
+    public void open(Externalizable e) throws Exception {
+    }
+
+    @Override
+    public void close() throws Exception {
+    }
+
+    @Override
+    public String readItem() throws Exception {
+        return index < items.length ? items[index++] : null;
+    }
+
+    @Override
+    public Externalizable checkpointInfo() throws Exception {
+        return null;
+    }
+    
+}
diff --git a/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/ejb/com/oracle/javaee7/samples/batch/simple/SimpleItemWriter.java b/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/ejb/com/oracle/javaee7/samples/batch/simple/SimpleItemWriter.java
new file mode 100644
index 0000000..3d9d8da
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/ejb/com/oracle/javaee7/samples/batch/simple/SimpleItemWriter.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.oracle.javaee7.samples.batch.simple;
+
+import java.io.Externalizable;
+import java.util.List;
+@javax.inject.Named("SimpleItemWriter")
+public class SimpleItemWriter
+    extends javax.batch.api.AbstractItemWriter<String> {
+    
+    @Override
+    public void open(Externalizable e) throws Exception {
+    }
+
+    @Override
+    public void close() throws Exception {
+    }
+
+    @Override
+    public void writeItems(List<String> list) throws Exception {
+        StringBuilder sb = new StringBuilder("SimpleItemWriter:");
+        for (String s : list) {
+            sb.append(" ").append(s);
+        }
+        System.out.println(sb.toString());
+    }
+
+    @Override
+    public Externalizable checkpointInfo() throws Exception {
+        return null;
+    }
+    
+}
diff --git a/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/ejb/com/oracle/javaee7/samples/batch/simple/Sless.java b/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/ejb/com/oracle/javaee7/samples/batch/simple/Sless.java
new file mode 100644
index 0000000..5c5ac84
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/ejb/com/oracle/javaee7/samples/batch/simple/Sless.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+package com.oracle.javaee7.samples.batch.simple;
+
+import javax.ejb.Remote;
+
+@Remote
+public interface Sless {
+
+    public long submitJob();
+
+    public boolean wasEjbCreateCalled();
+
+}
+
diff --git a/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/ejb/com/oracle/javaee7/samples/batch/simple/SlessBean.java b/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/ejb/com/oracle/javaee7/samples/batch/simple/SlessBean.java
new file mode 100644
index 0000000..245c768
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/pay-roll-job-with-ejb/stateless/ejb/com/oracle/javaee7/samples/batch/simple/SlessBean.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+package com.oracle.javaee7.samples.batch.simple;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.util.Properties;
+
+import javax.annotation.PostConstruct;
+
+import javax.batch.operations.JobOperator;
+import javax.batch.runtime.BatchRuntime;
+import javax.ejb.Stateless;
+import javax.ejb.EJB;
+
+@Stateless
+public class SlessBean
+    implements Sless {
+
+    boolean ejbCreateCalled = false;
+
+    public void ejbCreate() {
+        this.ejbCreateCalled = true;
+    }
+
+    public long submitJob() {
+	try {
+	  JobOperator jobOperator = BatchRuntime.getJobOperator();
+
+	  Properties props = new Properties();
+	  for (int i=0; i<9; i++)
+		props.put(i, i);
+	  return  jobOperator.start("PayRollJob", props);
+        } catch (Exception ex) {
+	  throw new RuntimeException(ex);
+	}
+    }
+
+    public boolean wasEjbCreateCalled() {
+	return ejbCreateCalled;
+    }
+
+														            
+}
diff --git a/appserver/tests/appserv-tests/devtests/batch/run_test.sh b/appserver/tests/appserv-tests/devtests/batch/run_test.sh
new file mode 100755
index 0000000..3ba0e83
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/run_test.sh
@@ -0,0 +1,82 @@
+#!/bin/bash -ex
+#
+# Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+#
+# This program and the accompanying materials are made available under the
+# terms of the Eclipse Public License v. 2.0, which is available at
+# http://www.eclipse.org/legal/epl-2.0.
+#
+# This Source Code may also be made available under the following Secondary
+# Licenses when the conditions for such availability set forth in the
+# Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+# version 2 with the GNU Classpath Exception, which is available at
+# https://www.gnu.org/software/classpath/license.html.
+#
+# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+#
+
+list_test_ids(){
+  echo batch_all
+}
+
+test_run(){
+  $S1AS_HOME/bin/asadmin start-domain
+  $S1AS_HOME/bin/asadmin start-database
+  cd $APS_HOME/devtests/batch
+  PROXY_HOST=`echo ${http_proxy} | cut -d':' -f2 | ${SED} 's/\/\///g'`
+  PROXY_PORT=`echo ${http_proxy} | cut -d':' -f3 | ${SED} 's/\///g'`
+  ANT_OPTS="${ANT_OPTS} \
+  -Dhttp.proxyHost=${PROXY_HOST} \
+  -Dhttp.proxyPort=${PROXY_PORT} \
+  -Dhttp.noProxyHosts='127.0.0.1|localhost|*.oracle.com' \
+  -Dhttps.proxyHost=${PROXY_HOST} \
+  -Dhttps.proxyPort=${PROXY_PORT} \
+  -Dhttps.noProxyHosts='127.0.0.1|localhost|*.oracle.com'"
+  export ANT_OPTS
+  echo "ANT_OPTS=${ANT_OPTS}"
+  ant $TARGET | tee $TEST_RUN_LOG
+  $S1AS_HOME/bin/asadmin stop-database
+  $S1AS_HOME/bin/asadmin stop-domain   
+}
+
+run_test_id(){
+  #a common util script located at main/appserver/tests/common_test.sh
+  source `dirname $0`/../../../common_test.sh
+  kill_process
+  delete_gf
+  download_test_resources glassfish.zip version-info.txt
+  unzip_test_resources $WORKSPACE/bundles/glassfish.zip
+  cd `dirname $0`
+  test_init
+  get_test_target $1
+  #run the actual test function
+  test_run
+  generate_junit_report $1
+  change_junit_report_class_names
+}
+
+post_test_run(){
+  copy_test_artifects
+  upload_test_results
+  delete_bundle
+  cd -
+}
+
+get_test_target(){
+	case $1 in
+		batch_all )
+			TARGET=all
+			export TARGET;;
+	esac
+
+}
+
+OPT=$1
+TEST_ID=$2
+case $OPT in
+  list_test_ids )
+    list_test_ids;;
+  run_test_id )
+    trap post_test_run EXIT
+    run_test_id $TEST_ID ;;
+esac
diff --git a/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/build.properties b/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/build.properties
new file mode 100644
index 0000000..bf01b64
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/build.properties
@@ -0,0 +1,39 @@
+<!--
+
+    Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v. 2.0, which is available at
+    http://www.eclipse.org/legal/epl-2.0.
+
+    This Source Code may also be made available under the following Secondary
+    Licenses when the conditions for such availability set forth in the
+    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+    version 2 with the GNU Classpath Exception, which is available at
+    https://www.gnu.org/software/classpath/license.html.
+
+    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+ 
+
+<property name="module" value="devtest-intro-simple-batchlet"/>
+<property name="appname" value="${module}"/>         
+<property name="assemble" value="${build.classes.dir}/archive"/>
+<property name="test.client" 
+	value="Client"/>
+<property name="application.xml" value="descriptor/application.xml"/>
+<property name="beans.xml" value="descriptor/beans.xml"/>
+<property name="batch.xml" value="descriptor/batch.xml"/>
+<property name="sun-application.xml" value="descriptor/sun-application.xml"/>
+<property name="ejb-jar.xml" value="descriptor/ejb-jar.xml"/>
+<property name="batch.jobs.dir" value="descriptor/batch-jobs"/>
+<property name="sun-ejb-jar.xml" value="descriptor/sun-ejb-jar.xml"/>
+<property name="application-client.xml" 
+	value="descriptor/application-client.xml"/>
+<property name="sun-application-client.xml" 
+	value="descriptor/sun-application-client.xml"/>
+<property name="appclientjar.files" value="${build.classes.dir}"/>         
+<property name="appclient.jar" value="${assemble.dir}/${appname}-client.jar"/>
+<property name="app.type" value="application"/>
+<property name="batch_derby.sql" value="../../batch_derby.sql"/>
diff --git a/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/build.xml b/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/build.xml
new file mode 100644
index 0000000..ad53320
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/build.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+    Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v. 2.0, which is available at
+    http://www.eclipse.org/legal/epl-2.0.
+
+    This Source Code may also be made available under the following Secondary
+    Licenses when the conditions for such availability set forth in the
+    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+    version 2 with the GNU Classpath Exception, which is available at
+    https://www.gnu.org/software/classpath/license.html.
+
+    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+
+<!DOCTYPE project [
+<!ENTITY commonSetup SYSTEM "../../../config/properties.xml">
+<!ENTITY commonBuild SYSTEM "../../../config/common.xml">
+<!ENTITY testproperties SYSTEM "build.properties">
+]>
+
+<project name="devtest-intro-simple-batchlet-App" default="usage" basedir=".">
+
+    &commonSetup;
+    &commonBuild;
+    &testproperties;
+
+    <!--
+    <target name="all" depends="build,copy-batch-sql,deploy,run,undeploy"/>
+    -->
+
+    <target name="all" depends="build,deploy,run,undeploy"/>
+
+    <target name="clean" depends="init-common">
+      <antcall  target="clean-common"/>
+    </target>
+ 
+    <target name="compile" depends="clean">
+        <antcall target="compile-common">
+            <param name="src" value="ejb"/>
+        </antcall>
+        <antcall target="compile-common">
+            <param name="src" value="client"/>
+        </antcall>
+    </target>
+
+
+    <target name="build" depends="compile">
+        <antcall target="build-ear-common">
+            <param name="ejbjar.classes" 
+              value="**/*.class"/>
+            <param name="appclientjar.classes" 
+              value="**/Client.class,**/Sless.class,**/Sless30.class"/>
+        </antcall>
+    </target> 
+    
+    <target name="copy-batch-sql" depends="build">
+    	<echo message="***** Copy ${batch_derby.sql} to Target dir: ${env.S1AS_HOME}/lib"/>
+    	<copy file="${batch_derby.sql}" todir="${env.S1AS_HOME}/lib"/>
+    </target>
+
+    <target name="deploy" 
+            depends="init-common">
+        <antcall target="deploy-common"/>
+    </target>
+
+    <target name="run" depends="init-common">
+        <antcall target="runclient-common"/>
+    </target>
+ 
+    <target name="undeploy" depends="init-common">
+        <antcall target="undeploy-common"/>
+    </target>   
+
+    <target name="usage">
+        <antcall target="usage-common"/>
+    </target>
+</project>
diff --git a/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/client/Client.java b/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/client/Client.java
new file mode 100644
index 0000000..eb6f32b
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/client/Client.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package com.sun.ejb.devtest.client;
+
+import java.io.*;
+import java.util.*;
+import javax.naming.*;
+import javax.ejb.EJB;
+import com.oracle.javaee7.samples.batch.simple.batchlet.*;
+import com.sun.ejte.ccl.reporter.SimpleReporterAdapter;
+
+@EJB(name="ejb/GG", beanInterface=Sless.class)
+public class Client {
+
+    private static SimpleReporterAdapter stat = 
+        new SimpleReporterAdapter("appserv-tests");
+
+    public static void main (String[] args) {
+
+        stat.addDescription("batch-pay-rool-job-ejb-stateless");
+        Client client = new Client(args);
+        client.doTest();
+        stat.printSummary("batch-pay-rool-job-ejb-stateless");
+    }  
+    
+    public Client (String[] args) {
+    }
+    
+    private static @EJB(name="ejb/kk") Sless sless;
+
+    public void doTest() {
+        try {
+            (new InitialContext()).lookup("java:comp/env/ejb/GG");
+	    long executionId = sless.submitJob();
+	    System.out.println("************************************************");
+	    System.out.println("******* JobID: " + executionId + " ******************");
+	    System.out.println("************************************************");
+	    String jobBatchStatus = "";
+	    for (int sec=10; sec>0; sec--) {
+	        try {
+		    jobBatchStatus = sless.getJobExitStatus(executionId);
+		    if (! "COMPLETED".equals(jobBatchStatus)) {
+		        System.out.println("Will sleep for " + sec + " more seconds...: " + jobBatchStatus);
+		        Thread.currentThread().sleep(1000);
+		    }
+		} catch (Exception ex) {
+		}
+	    }
+            stat.addStatus("simple-batchlet payroll", ("COMPLETED".equals(jobBatchStatus) ? stat.PASS : stat.FAIL));
+	} catch (Exception ex) {
+            stat.addStatus("simple-batchlet payroll", stat.FAIL);
+        }
+    }
+
+}
+
diff --git a/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/client/MANIFEST.MF b/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/client/MANIFEST.MF
new file mode 100644
index 0000000..ae04b30
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/client/MANIFEST.MF
@@ -0,0 +1,4 @@
+Manifest-Version: 1.0
+Created-By: 1.4.0-beta3 (Sun Microsystems Inc.)
+Main-Class: com.sun.ejb.devtest.client.Client
+Class-Path: reporter.jar
diff --git a/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/descriptor/batch-jobs/SimpleBatchletJob.xml b/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/descriptor/batch-jobs/SimpleBatchletJob.xml
new file mode 100644
index 0000000..69e0d8c
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/descriptor/batch-jobs/SimpleBatchletJob.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v. 2.0, which is available at
+    http://www.eclipse.org/legal/epl-2.0.
+
+    This Source Code may also be made available under the following Secondary
+    Licenses when the conditions for such availability set forth in the
+    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+    version 2 with the GNU Classpath Exception, which is available at
+    https://www.gnu.org/software/classpath/license.html.
+
+    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+
+<job id="simple-batchlet-job" xmlns="http://xmlns.jcp.org/xml/ns/javaee">
+    <step id="batchlet-step">
+        <batchlet ref="SimpleBatchlet"/>
+    </step>
+</job>
diff --git a/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/descriptor/batch.xml b/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/descriptor/batch.xml
new file mode 100644
index 0000000..af6d306
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/descriptor/batch.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v. 2.0, which is available at
+    http://www.eclipse.org/legal/epl-2.0.
+
+    This Source Code may also be made available under the following Secondary
+    Licenses when the conditions for such availability set forth in the
+    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+    version 2 with the GNU Classpath Exception, which is available at
+    https://www.gnu.org/software/classpath/license.html.
+
+    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+
+<batch-artifacts xmlns="http://xmlns.jcp.org/xml/ns/javaee">
+<ref id="SimpleBatchlet" class="com.oracle.javaee7.samples.batch.simple.batchlet.SimpleBatchlet"/>
+</batch-artifacts>
diff --git a/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/descriptor/beans.xml b/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/descriptor/beans.xml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/descriptor/beans.xml
diff --git a/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/ejb/com/oracle/javaee7/samples/LICENSE.md b/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/ejb/com/oracle/javaee7/samples/LICENSE.md
new file mode 100644
index 0000000..e0358f9
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/ejb/com/oracle/javaee7/samples/LICENSE.md
@@ -0,0 +1,29 @@
+
+    Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
+   
+    Redistribution and use in source and binary forms, with or without
+    modification, are permitted provided that the following conditions
+    are met:
+   
+      - Redistributions of source code must retain the above copyright
+        notice, this list of conditions and the following disclaimer.
+   
+      - Redistributions in binary form must reproduce the above copyright
+        notice, this list of conditions and the following disclaimer in the
+        documentation and/or other materials provided with the distribution.
+   
+      - Neither the name of the Eclipse Foundation, Inc. nor the names of its
+        contributors may be used to endorse or promote products derived
+        from this software without specific prior written permission.
+   
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+    IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+    THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+    PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+    EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+    PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+    LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/ejb/com/oracle/javaee7/samples/README.md b/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/ejb/com/oracle/javaee7/samples/README.md
new file mode 100644
index 0000000..766dda6
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/ejb/com/oracle/javaee7/samples/README.md
@@ -0,0 +1 @@
+This directory contains sample code and hence files within this directory and below are covered under EDL 1.0.
diff --git a/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/ejb/com/oracle/javaee7/samples/batch/simple/batchlet/IdGenerator.java b/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/ejb/com/oracle/javaee7/samples/batch/simple/batchlet/IdGenerator.java
new file mode 100644
index 0000000..15b7304
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/ejb/com/oracle/javaee7/samples/batch/simple/batchlet/IdGenerator.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.oracle.javaee7.samples.batch.simple.batchlet;
+
+/**
+ *
+ * @author makannan
+ */
+public interface IdGenerator {
+
+    public String nextId();
+    
+}
diff --git a/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/ejb/com/oracle/javaee7/samples/batch/simple/batchlet/SimpleBatchlet.java b/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/ejb/com/oracle/javaee7/samples/batch/simple/batchlet/SimpleBatchlet.java
new file mode 100644
index 0000000..8263f5a
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/ejb/com/oracle/javaee7/samples/batch/simple/batchlet/SimpleBatchlet.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.oracle.javaee7.samples.batch.simple.batchlet;
+
+import javax.inject.Inject;
+
+
+@javax.inject.Named
+public class SimpleBatchlet
+    implements javax.batch.api.Batchlet {
+
+    @Override
+    public String process() throws Exception {
+        return  "GREAT_SUCCESS";
+    }
+    
+    @Override
+    public void  stop() throws Exception {
+    }
+    
+}
diff --git a/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/ejb/com/oracle/javaee7/samples/batch/simple/batchlet/SimpleIdGenerator.java b/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/ejb/com/oracle/javaee7/samples/batch/simple/batchlet/SimpleIdGenerator.java
new file mode 100644
index 0000000..58acfe6
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/ejb/com/oracle/javaee7/samples/batch/simple/batchlet/SimpleIdGenerator.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.oracle.javaee7.samples.batch.simple.batchlet;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ *
+ * @author makannan
+ */
+public class SimpleIdGenerator
+    implements IdGenerator {
+    
+    private AtomicInteger counter = new AtomicInteger(0);
+    
+    public String nextId() {
+        return "" + counter.incrementAndGet();
+    }
+}
diff --git a/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/ejb/com/oracle/javaee7/samples/batch/simple/batchlet/Sless.java b/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/ejb/com/oracle/javaee7/samples/batch/simple/batchlet/Sless.java
new file mode 100644
index 0000000..195c01d
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/ejb/com/oracle/javaee7/samples/batch/simple/batchlet/Sless.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+package com.oracle.javaee7.samples.batch.simple.batchlet;
+
+import javax.ejb.Remote;
+
+@Remote
+public interface Sless {
+
+    public long submitJob();
+
+    public boolean wasEjbCreateCalled();
+
+    public String getJobExitStatus(long executionId);
+
+}
+
diff --git a/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/ejb/com/oracle/javaee7/samples/batch/simple/batchlet/SlessBean.java b/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/ejb/com/oracle/javaee7/samples/batch/simple/batchlet/SlessBean.java
new file mode 100644
index 0000000..11b8e00
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/simple-batchlet/ejb/com/oracle/javaee7/samples/batch/simple/batchlet/SlessBean.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+package com.oracle.javaee7.samples.batch.simple.batchlet;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.util.Properties;
+
+import javax.annotation.PostConstruct;
+
+import javax.batch.operations.JobOperator;
+import javax.batch.runtime.BatchRuntime;
+import javax.batch.runtime.JobExecution;
+import javax.ejb.Stateless;
+import javax.ejb.EJB;
+
+@Stateless
+public class SlessBean
+    implements Sless {
+
+    boolean ejbCreateCalled = false;
+
+    public void ejbCreate() {
+        this.ejbCreateCalled = true;
+    }
+
+    public long submitJob() {
+	try {
+	  JobOperator jobOperator = BatchRuntime.getJobOperator();
+
+	  Properties props = new Properties();
+	  for (int i=0; i<9; i++)
+		props.put(i, i);
+	  return  jobOperator.start("simpleBatchletJob", props);
+        } catch (Exception ex) {
+	  throw new RuntimeException(ex);
+	}
+    }
+
+    public String getJobExitStatus(long executionId) {
+	try {
+	JobOperator jobOperator = BatchRuntime.getJobOperator();
+	JobExecution jobExecution = jobOperator.getJobExecution(executionId);
+	return jobExecution.getExitStatus();
+        } catch (Exception ex) {}
+	return "-1";
+    }
+
+
+    public boolean wasEjbCreateCalled() {
+	return ejbCreateCalled;
+    }
+
+														            
+}
diff --git a/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/build.properties b/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/build.properties
new file mode 100644
index 0000000..33dfc9d
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/build.properties
@@ -0,0 +1,39 @@
+<!--
+
+    Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v. 2.0, which is available at
+    http://www.eclipse.org/legal/epl-2.0.
+
+    This Source Code may also be made available under the following Secondary
+    Licenses when the conditions for such availability set forth in the
+    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+    version 2 with the GNU Classpath Exception, which is available at
+    https://www.gnu.org/software/classpath/license.html.
+
+    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+ 
+
+<property name="module" value="Simple-Validation"/>
+<property name="appname" value="${module}"/>         
+<property name="assemble" value="${build.classes.dir}/archive"/>
+<property name="test.client" 
+	value="Client"/>
+<property name="application.xml" value="descriptor/application.xml"/>
+<property name="beans.xml" value="descriptor/beans.xml"/>
+<property name="batch.xml" value="descriptor/batch.xml"/>
+<property name="sun-application.xml" value="descriptor/sun-application.xml"/>
+<property name="ejb-jar.xml" value="descriptor/ejb-jar.xml"/>
+<property name="batch.jobs.dir" value="descriptor/batch-jobs"/>
+<property name="sun-ejb-jar.xml" value="descriptor/sun-ejb-jar.xml"/>
+<property name="application-client.xml" 
+	value="descriptor/application-client.xml"/>
+<property name="sun-application-client.xml" 
+	value="descriptor/sun-application-client.xml"/>
+<property name="appclientjar.files" value="${build.classes.dir}"/>         
+<property name="appclient.jar" value="${assemble.dir}/${appname}-client.jar"/>
+<property name="app.type" value="application"/>
+<property name="batch_derby.sql" value="../../batch_derby.sql"/>
diff --git a/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/build.xml b/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/build.xml
new file mode 100644
index 0000000..127e68a
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/build.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+    Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v. 2.0, which is available at
+    http://www.eclipse.org/legal/epl-2.0.
+
+    This Source Code may also be made available under the following Secondary
+    Licenses when the conditions for such availability set forth in the
+    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+    version 2 with the GNU Classpath Exception, which is available at
+    https://www.gnu.org/software/classpath/license.html.
+
+    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+
+<!DOCTYPE project [
+<!ENTITY commonSetup SYSTEM "../../../config/properties.xml">
+<!ENTITY commonBuild SYSTEM "../../../config/common.xml">
+<!ENTITY testproperties SYSTEM "build.properties">
+]>
+
+<project name="Simple-ValidationApp" default="usage" basedir=".">
+
+    &commonSetup;
+    &commonBuild;
+    &testproperties;
+
+    <!--
+    <target name="all" depends="build,copy-batch-sql,deploy,run,undeploy"/>
+    -->
+
+    <target name="all" depends="build,deploy,run,undeploy"/>
+
+    <target name="clean" depends="init-common">
+      <antcall  target="clean-common"/>
+    </target>
+ 
+    <target name="compile" depends="clean">
+        <antcall target="compile-common">
+            <param name="src" value="ejb"/>
+        </antcall>
+        <antcall target="compile-common">
+            <param name="src" value="client"/>
+        </antcall>
+    </target>
+
+
+    <target name="build" depends="compile">
+        <antcall target="build-ear-common">
+            <param name="ejbjar.classes" 
+              value="**/*.class"/>
+            <param name="appclientjar.classes" 
+              value="**/Client.class,**/JobSubmitter.class"/>
+        </antcall>
+    </target> 
+    
+    <target name="copy-batch-sql" depends="build">
+    	<echo message="***** Copy ${batch_derby.sql} to Target dir: ${env.S1AS_HOME}/lib"/>
+    	<copy file="${batch_derby.sql}" todir="${env.S1AS_HOME}/lib"/>
+    </target>
+
+    <target name="deploy" 
+            depends="init-common">
+        <antcall target="deploy-common"/>
+    </target>
+
+    <target name="run" depends="init-common">
+        <antcall target="runclient-common"/>
+    </target>
+ 
+    <target name="undeploy" depends="init-common">
+        <antcall target="undeploy-common"/>
+    </target>   
+
+    <target name="usage">
+        <antcall target="usage-common"/>
+    </target>
+</project>
diff --git a/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/client/Client.java b/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/client/Client.java
new file mode 100644
index 0000000..b13dea2
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/client/Client.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package com.sun.ejb.devtest.client;
+
+import java.io.*;
+import java.util.*;
+import javax.naming.*;
+import javax.ejb.EJB;
+import com.oracle.javaee7.samples.batch.cmt.chunk.*;
+import com.sun.ejte.ccl.reporter.SimpleReporterAdapter;
+
+public class Client {
+
+    private static SimpleReporterAdapter stat = 
+        new SimpleReporterAdapter("appserv-tests");
+
+    public static void main (String[] args) {
+
+        stat.addDescription("batch-cmt-chunk");
+        Client client = new Client(args);
+        client.doTest();
+        stat.printSummary("batch-cmt-chunk");
+    }  
+    
+    public Client (String[] args) {
+    }
+    
+    private static @EJB JobSubmitter jobSubmitter;
+
+    int MAX_JOB_SIZE = 2;
+    long[] executionIds = new long[MAX_JOB_SIZE];
+
+    public void doTest() {
+	for (int i=0; i<MAX_JOB_SIZE; i++)
+	    executionIds[i] = -1;
+        submitJobs();
+        listBatchJobs();
+        listBatchJobsInLongFormat();
+        checkJobExecution(executionIds[0]);
+    	isJobExecutionOK(executionIds[0]);
+    	checkAllJobExecutions();
+    	checkIfOnlyJobsFromThisAppAreVisible();
+    }
+
+    public void submitJobs() {
+        try {
+	    for (int i = 0; i< MAX_JOB_SIZE; i++) {
+	        executionIds[i] = jobSubmitter.submitJob("Simple-Validation-Job");
+	        checkBatchJobStatus(executionIds[i], 100);
+	    }
+	    boolean result = true;
+	    for (int i=0; i<MAX_JOB_SIZE; i++) {
+	       result = result && executionIds[i] != -1;
+	    }
+            stat.addStatus("batch-cmt-chunk-test1", (result ? stat.PASS : stat.FAIL));
+	} catch (Exception ex) {
+            stat.addStatus("batch-cmt-chunk-test1", stat.FAIL);
+        }
+    }
+
+    public void listBatchJobs() {
+        try {
+	    boolean status = true;
+	    Collection<String> jobs = jobSubmitter.listJobs(false);
+	    for (String job : jobs) {
+	        System.out.println("** JOB ==> " + job);
+	    }
+            stat.addStatus("batch-cmt-chunk-test2", (status ? stat.PASS : stat.FAIL));
+	} catch (Exception ex) {
+            stat.addStatus("batch-cmt-chunk-test2", stat.FAIL);
+        }
+    }
+
+    public void listBatchJobsInLongFormat() {
+        try {
+	    boolean status = true;
+	    Collection<String> jobs = jobSubmitter.listJobs(true);
+	    for (String job : jobs) {
+	        System.out.println("** JOB ==> " + job);
+	    }
+            stat.addStatus("batch-cmt-chunk-test3", (status ? stat.PASS : stat.FAIL));
+	} catch (Exception ex) {
+            stat.addStatus("batch-cmt-chunk-test3", stat.FAIL);
+        }
+    }
+
+    public void checkJobExecution(long executionId) {
+        try {
+	    boolean status = true;
+	    Map<String, String> map = jobSubmitter.toMap(executionId);
+
+            stat.addStatus("batch-cmt-status-checkExe-jobName", map.get("jobName") != null ? stat.PASS : stat.FAIL);
+            stat.addStatus("batch-cmt-status-checkExe-appName", map.get("appName") != null ? stat.PASS : stat.FAIL);
+            stat.addStatus("batch-cmt-status-checkExe-instanceCount", map.get("instanceCount") != null ? stat.PASS : stat.FAIL);
+            stat.addStatus("batch-cmt-status-checkExe-instanceID", map.get("instanceID") != null ? stat.PASS : stat.FAIL);
+            stat.addStatus("batch-cmt-status-checkExe-executionID", map.get("executionID") != null ? stat.PASS : stat.FAIL);
+            stat.addStatus("batch-cmt-status-checkExe-startTime", map.get("startTime") != null ? stat.PASS : stat.FAIL);
+            stat.addStatus("batch-cmt-status-checkExe-batchStatus", map.get("batchStatus") != null ? stat.PASS : stat.FAIL);
+            stat.addStatus("batch-cmt-status-checkExe-endTime", map.get("endTime") != null ? stat.PASS : stat.FAIL);
+
+	} catch (Exception ex) {
+            stat.addStatus("batch-cmt-chunk-test3", stat.FAIL);
+        }
+    }
+
+    public void isJobExecutionOK(long executionId) {
+        stat.addStatus("batch-cmt-status-checkExe-isJobExecutionOK", checkOneJobExecution(executionId) ? stat.PASS : stat.FAIL);
+    }
+
+    private boolean checkOneJobExecution(long executionId) {
+        try {
+	    Map<String, String> map = jobSubmitter.toMap(executionId);
+	    return map != null &&
+            	map.get("jobName") != null &&
+            	map.get("appName") != null &&
+            	map.get("instanceCount") != null &&
+            	map.get("instanceID") != null &&
+            	map.get("executionID") != null &&
+            	map.get("startTime") != null &&
+            	map.get("batchStatus") != null &&
+            	map.get("endTime") != null;
+
+	} catch (Exception ex) {
+
+        }
+        return false;
+    }
+
+    public void checkAllJobExecutions() {
+       boolean result = true;
+       for (long exeId : jobSubmitter.getAllExecutionIds(null)) {
+           if (!checkOneJobExecution(exeId)) {
+              result = false;
+	      break;
+	   }
+       }
+        stat.addStatus("batch-cmt-status-checkExe-checkAllJobExecutions", result ? stat.PASS : stat.FAIL);
+    }
+
+    public void checkIfOnlyJobsFromThisAppAreVisible() {
+        try {
+	    boolean status = true;
+            for (long exeId : jobSubmitter.getAllExecutionIds(null)) {
+	        Map<String, String> map = jobSubmitter.toMap(exeId);
+		String jobName = map.get("jobName");
+		String appName = map.get("appName");
+	        if (!jobName.startsWith("Simple-Validation-Job") || !appName.startsWith("server-config:Simple-ValidationApp")) {
+		    System.out.println("***********************************************");
+		    System.out.println("*** Job From another app? " + jobName + "; " + appName + " ***");
+		    System.out.println("***********************************************");
+		    status = false;
+		    break;
+		}
+	    }
+            stat.addStatus("batch-cmt-chunk-checkIfOnlyJobsFromThisAppAreVisible", (status ? stat.PASS : stat.FAIL));
+	} catch (Exception ex) {
+            stat.addStatus("batch-cmt-chunk-checkIfOnlyJobsFromThisAppAreVisible", stat.FAIL);
+        }
+    }
+
+    public void checkBatchJobStatus(long executionId, int sec) {
+	while (sec-- > 0) {
+            try {
+		String status = jobSubmitter.getJobExitStatus(executionId);
+		if ("COMPLETED".equalsIgnoreCase(status) || "FAILED".equalsIgnoreCase(status)) {
+		    System.out.println("** checkBatchJobStatus[" + executionId + "]  ==> " + status);
+		    break;
+		}
+                System.out.println("Will sleep for " + sec + " more seconds...");
+                Thread.currentThread().sleep(1000);
+            } catch (Exception ex) {
+	    }
+        }
+    }
+
+}
+
diff --git a/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/client/MANIFEST.MF b/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/client/MANIFEST.MF
new file mode 100644
index 0000000..ae04b30
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/client/MANIFEST.MF
@@ -0,0 +1,4 @@
+Manifest-Version: 1.0
+Created-By: 1.4.0-beta3 (Sun Microsystems Inc.)
+Main-Class: com.sun.ejb.devtest.client.Client
+Class-Path: reporter.jar
diff --git a/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/descriptor/batch-jobs/CMT-OneStepJob.xml b/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/descriptor/batch-jobs/CMT-OneStepJob.xml
new file mode 100644
index 0000000..1de0cd6
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/descriptor/batch-jobs/CMT-OneStepJob.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v. 2.0, which is available at
+    http://www.eclipse.org/legal/epl-2.0.
+
+    This Source Code may also be made available under the following Secondary
+    Licenses when the conditions for such availability set forth in the
+    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+    version 2 with the GNU Classpath Exception, which is available at
+    https://www.gnu.org/software/classpath/license.html.
+
+    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+
+<job id="cmt-chunk-job" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
+    <step id="step1">
+        <chunk item-count="3">
+            <reader ref="SimpleItemReader"></reader> 
+            <processor ref="SimpleItemProcessor"></processor>
+            <writer ref="SimpleItemWriter"></writer> 
+        </chunk>
+    </step>
+</job>
diff --git a/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/descriptor/batch-jobs/Simple-Validation-Job.xml b/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/descriptor/batch-jobs/Simple-Validation-Job.xml
new file mode 100644
index 0000000..a234573
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/descriptor/batch-jobs/Simple-Validation-Job.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v. 2.0, which is available at
+    http://www.eclipse.org/legal/epl-2.0.
+
+    This Source Code may also be made available under the following Secondary
+    Licenses when the conditions for such availability set forth in the
+    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+    version 2 with the GNU Classpath Exception, which is available at
+    https://www.gnu.org/software/classpath/license.html.
+
+    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+
+<job id="Simple-Validation-Job" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
+    <step id="step1" next="step2">
+        <chunk item-count="3">
+            <reader ref="SimpleItemReader"></reader> 
+            <processor ref="SimpleItemProcessor"></processor>
+            <writer ref="SimpleItemWriter"></writer> 
+        </chunk>
+    </step>
+    <step id="step2">
+        <chunk item-count="2">
+            <reader ref="SimpleItemReader"></reader> 
+            <processor ref="SimpleItemProcessor"></processor>
+            <writer ref="SimpleItemWriter"></writer> 
+        </chunk>
+    </step>
+</job>
diff --git a/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/descriptor/beans.xml b/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/descriptor/beans.xml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/descriptor/beans.xml
diff --git a/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/ejb/com/oracle/javaee7/samples/LICENSE.md b/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/ejb/com/oracle/javaee7/samples/LICENSE.md
new file mode 100644
index 0000000..e0358f9
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/ejb/com/oracle/javaee7/samples/LICENSE.md
@@ -0,0 +1,29 @@
+
+    Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
+   
+    Redistribution and use in source and binary forms, with or without
+    modification, are permitted provided that the following conditions
+    are met:
+   
+      - Redistributions of source code must retain the above copyright
+        notice, this list of conditions and the following disclaimer.
+   
+      - Redistributions in binary form must reproduce the above copyright
+        notice, this list of conditions and the following disclaimer in the
+        documentation and/or other materials provided with the distribution.
+   
+      - Neither the name of the Eclipse Foundation, Inc. nor the names of its
+        contributors may be used to endorse or promote products derived
+        from this software without specific prior written permission.
+   
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+    IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+    THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+    PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+    EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+    PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+    LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/ejb/com/oracle/javaee7/samples/README.md b/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/ejb/com/oracle/javaee7/samples/README.md
new file mode 100644
index 0000000..766dda6
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/ejb/com/oracle/javaee7/samples/README.md
@@ -0,0 +1 @@
+This directory contains sample code and hence files within this directory and below are covered under EDL 1.0.
diff --git a/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/IdGenerator.java b/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/IdGenerator.java
new file mode 100644
index 0000000..7823249
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/IdGenerator.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.oracle.javaee7.samples.batch.cmt.chunk;
+
+/**
+ *
+ * @author makannan
+ */
+public interface IdGenerator {
+
+    public String nextId();
+    
+}
diff --git a/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/JobSubmitter.java b/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/JobSubmitter.java
new file mode 100644
index 0000000..d241e5f
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/JobSubmitter.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+package com.oracle.javaee7.samples.batch.cmt.chunk;
+
+import javax.ejb.Remote;
+import java.util.Collection;
+import java.util.Map;
+import java.util.List;
+
+@Remote
+public interface JobSubmitter {
+
+    public String nextId();
+
+    public long submitJob(String jobName);
+
+    public Collection<String> listJobs(boolean useLongFormat);
+
+    public Collection<String> listJobExecutions(boolean useLongFormat, long... executinIds);
+
+    public Map<String, String> toMap(long executionId);
+
+    public String getJobExitStatus(long executionId);
+
+    public List<Long> getAllExecutionIds(String jobName);
+
+}
+
diff --git a/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/JobSubmitterBean.java b/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/JobSubmitterBean.java
new file mode 100644
index 0000000..385609a
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/JobSubmitterBean.java
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+package com.oracle.javaee7.samples.batch.cmt.chunk;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.util.Properties;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Collection;
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.HashMap;
+
+import javax.inject.Inject;
+import javax.annotation.PostConstruct;
+
+import javax.batch.operations.JobOperator;
+import javax.batch.runtime.BatchRuntime;
+import javax.batch.runtime.JobExecution;
+import javax.batch.runtime.JobInstance;
+import com.ibm.jbatch.spi.TaggedJobExecution;
+
+import javax.ejb.Stateless;
+import javax.ejb.EJB;
+
+@Stateless
+public class JobSubmitterBean
+    implements JobSubmitter {
+
+    //@Inject
+    IdGenerator idGenerator;
+
+    public String nextId() {
+        return idGenerator != null ? idGenerator.nextId() : "-1";
+    }
+
+    public long submitJob(String jobName) {
+	try {
+	  JobOperator jobOperator = BatchRuntime.getJobOperator();
+
+	  Properties props = new Properties();
+	  for (int i=0; i<3; i++)
+		props.put(jobName + "-Key-" + i, jobName+"-Value-" + i);
+	  return  jobOperator.start(jobName, props);
+        } catch (Exception ex) {
+	  throw new RuntimeException(ex);
+	}
+    }
+
+    public String getJobExitStatus(long executionId) {
+	try {
+	  JobOperator jobOperator = BatchRuntime.getJobOperator();
+	  JobExecution je =  jobOperator.getJobExecution(executionId);
+	  return je.getExitStatus();
+	} catch (Exception ex) {
+	  throw new RuntimeException(ex);
+	}
+
+    }
+
+    public Collection<String> listJobs(boolean useLongFormat) {
+	try {
+	  JobOperator jobOperator = BatchRuntime.getJobOperator();
+	  Set<String> jobs = new HashSet<String>();
+	  if (!useLongFormat) {
+	      for (String jobName : jobOperator.getJobNames()) {
+	          StringBuilder sb = new StringBuilder();
+		  sb.append(jobName).append(" ").append(jobOperator.getJobInstanceCount(jobName));
+		  jobs.add(sb.toString());
+	     }
+          } else {
+	     int index = 0;
+	     for (String jobName : jobOperator.getJobNames()) {
+		List<JobInstance> exe = jobOperator.getJobInstances(jobName, 0, Integer.MAX_VALUE - 1);
+		if (exe != null) {
+		   for (JobInstance ji : exe) {
+		      for (JobExecution je : jobOperator.getJobExecutions(ji)) {
+	                  StringBuilder sb = new StringBuilder();
+                          try {
+                              sb.append(index++).append(" ").append(jobName).append(" ").append(((TaggedJobExecution) je).getTagName())
+			      	.append(" ").append(je.getBatchStatus()).append(" ").append(je.getExitStatus());
+	                      jobs.add(sb.toString());
+                          } catch (Exception ex) {
+	                      jobs.add("Exception : " + sb.toString());
+                          }
+                      }
+                   }
+		}
+	     }
+	   }
+
+	   return jobs;
+	} catch (Exception ex) {
+	  throw new RuntimeException(ex);
+	}
+     }
+
+    public Map<String, String> toMap(long executionId) {
+       HashMap<String, String> map = new HashMap<String, String>();
+       try {
+	  JobOperator jobOperator = BatchRuntime.getJobOperator();
+	  JobExecution je = jobOperator.getJobExecution(executionId);
+          map.put("jobName", ""+je.getJobName());
+          map.put("appName", ""+((TaggedJobExecution) je).getTagName());
+
+	  try {
+            map.put("instanceCount", ""+jobOperator.getJobInstanceCount(je.getJobName()));
+          } catch (Exception ex) {}
+
+          map.put("instanceID", ""+jobOperator.getJobInstance(je.getExecutionId()).getInstanceId());
+          map.put("executionID", ""+je.getBatchStatus());
+          map.put("batchStatus", ""+je.getBatchStatus());
+          map.put("exitStatus", ""+je.getExitStatus());
+          map.put("startTime", ""+je.getStartTime().getTime());
+          map.put("endTime", ""+je.getEndTime().getTime());
+       } catch (Exception ex) {
+          map.put("EXCEPTION", ex.toString());
+       }
+
+       return map;
+    }
+	
+    public Collection<String> listJobExecutions(boolean useLongFormat, long... executinIds) {
+	Set<String> jobs = new HashSet<String>();
+	return jobs;
+    }
+
+    public List<Long> getAllExecutionIds(String jobName) {
+	List<Long> list = new LinkedList<Long>();
+	try {
+        if (jobName != null)
+           getAllExecutionIds(jobName, list);
+	else {
+	   JobOperator jobOperator = BatchRuntime.getJobOperator();
+	   for (String jn : jobOperator.getJobNames())
+              getAllExecutionIds(jn, list);
+	}
+        } catch (Exception ex) {
+
+	}
+	return list;
+    }
+
+    private void getAllExecutionIds(String jobName, List<Long> list)
+    	throws Exception {
+	JobOperator jobOperator = BatchRuntime.getJobOperator();
+	List<JobInstance> exe = jobOperator.getJobInstances(jobName, 0, Integer.MAX_VALUE - 1);
+	if (exe != null) {
+	   for (JobInstance ji : exe) {
+	      for (JobExecution je : jobOperator.getJobExecutions(ji)) {
+                 list.add(je.getExecutionId());
+              }
+           }
+	}
+     }
+
+}
diff --git a/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/SimpleIdGenerator.java b/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/SimpleIdGenerator.java
new file mode 100644
index 0000000..0cf4ee2
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/SimpleIdGenerator.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.oracle.javaee7.samples.batch.cmt.chunk;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ *
+ * @author makannan
+ */
+public class SimpleIdGenerator
+    implements IdGenerator {
+    
+    private AtomicInteger counter = new AtomicInteger(0);
+    
+    public String nextId() {
+        return "" + counter.incrementAndGet();
+    }
+}
diff --git a/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/SimpleItemProcessor.java b/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/SimpleItemProcessor.java
new file mode 100644
index 0000000..7a4f3de
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/SimpleItemProcessor.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.oracle.javaee7.samples.batch.cmt.chunk;
+
+import javax.inject.Inject;
+
+
+@javax.inject.Named("SimpleItemProcessor")
+public class SimpleItemProcessor
+    implements javax.batch.api.chunk.ItemProcessor {
+
+    @Inject
+    IdGenerator idGen;
+    
+    @Override
+    public String processItem(Object obj) throws Exception {
+	String t = (String) obj;
+        String[] record = t.split(", ");
+        
+    //EMP-ID, MONTH-YEAR, SALARY, TAX%, MEDICARE%, OTHER
+        int salary = Integer.valueOf(record[2]);
+        double tax = Double.valueOf(record[3]);
+        double mediCare = Double.valueOf(record[4]);
+        StringBuilder sb = new StringBuilder(t);
+        sb.append(", ").append(salary * tax / 100);
+        sb.append(", ").append(salary * mediCare / 100);
+        sb.append(", ").append(salary - (salary * tax / 100) - (salary * mediCare / 100));
+
+System.out.println("IdGen ==> " + idGen);
+        return  sb.toString();
+    }
+    
+}
diff --git a/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/SimpleItemReader.java b/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/SimpleItemReader.java
new file mode 100644
index 0000000..8354666
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/SimpleItemReader.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.oracle.javaee7.samples.batch.cmt.chunk;
+
+import java.io.Serializable;
+
+@javax.inject.Named("SimpleItemReader")
+public class SimpleItemReader
+    implements javax.batch.api.chunk.ItemReader {
+
+    private int index = 0;
+    
+    //EMP-ID, MONTH-YEAR, SALARY, TAX%, MEDICARE%, OTHER
+    private String[] items = new String[] {
+        "120-01, JAN-2013, 8000, 27, 3, 0",
+        "120-02, JAN-2013, 8500, 27, 3, 0",
+        "120-03, JAN-2013, 9000, 33, 4, 0",
+        "120-04, JAN-2013, 8500, 33, 4, 0",
+        "120-05, JAN-2013, 10000, 33, 4, 0",
+        "120-06, JAN-2013, 10500, 33, 4, 0",
+        "120-07, JAN-2013, 11000, 36, 5, 0",
+        "120-08, JAN-2013, 11500, 36, 5, 0",
+    };
+    
+    @Override
+    public void open(Serializable e) throws Exception {
+    }
+
+    @Override
+    public void close() throws Exception {
+    }
+
+    @Override
+    public Object readItem() throws Exception {
+        return index < items.length ? items[index++] : null;
+    }
+
+    @Override
+    public Serializable checkpointInfo() throws Exception {
+        return null;
+    }
+    
+}
diff --git a/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/SimpleItemWriter.java b/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/SimpleItemWriter.java
new file mode 100644
index 0000000..46f6932
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/simple-validation-test/ejb/com/oracle/javaee7/samples/batch/cmt/chunk/SimpleItemWriter.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.oracle.javaee7.samples.batch.cmt.chunk;
+
+import java.io.Serializable;
+import java.util.List;
+@javax.inject.Named("SimpleItemWriter")
+public class SimpleItemWriter
+    implements javax.batch.api.chunk.ItemWriter {
+    
+    @Override
+    public void open(Serializable e) throws Exception {
+    }
+
+    @Override
+    public void close() throws Exception {
+    }
+
+    @Override
+    public void writeItems(List lst) throws Exception {
+        StringBuilder sb = new StringBuilder("SimpleItemWriter:");
+	List<String> list = (List<String>) lst;
+        for (String s : list) {
+            sb.append(" ").append(s);
+        }
+        System.out.println(sb.toString());
+	try { Thread.currentThread().sleep(1000); } catch (Exception ex) {}
+    }
+
+    @Override
+    public Serializable checkpointInfo() throws Exception {
+        return null;
+    }
+    
+}
diff --git a/appserver/tests/appserv-tests/devtests/batch/two-steps-job/build.properties b/appserver/tests/appserv-tests/devtests/batch/two-steps-job/build.properties
new file mode 100644
index 0000000..50a282e
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/two-steps-job/build.properties
@@ -0,0 +1,39 @@
+<!--
+
+    Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v. 2.0, which is available at
+    http://www.eclipse.org/legal/epl-2.0.
+
+    This Source Code may also be made available under the following Secondary
+    Licenses when the conditions for such availability set forth in the
+    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+    version 2 with the GNU Classpath Exception, which is available at
+    https://www.gnu.org/software/classpath/license.html.
+
+    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+ 
+
+<property name="module" value="devtest-batch-two-steps-job"/>
+<property name="appname" value="${module}"/>         
+<property name="assemble" value="${build.classes.dir}/archive"/>
+<property name="test.client" 
+	value="Client"/>
+<property name="application.xml" value="descriptor/application.xml"/>
+<property name="beans.xml" value="descriptor/beans.xml"/>
+<property name="batch.xml" value="descriptor/batch.xml"/>
+<property name="sun-application.xml" value="descriptor/sun-application.xml"/>
+<property name="ejb-jar.xml" value="descriptor/ejb-jar.xml"/>
+<property name="batch.jobs.dir" value="descriptor/batch-jobs"/>
+<property name="sun-ejb-jar.xml" value="descriptor/sun-ejb-jar.xml"/>
+<property name="application-client.xml" 
+	value="descriptor/application-client.xml"/>
+<property name="sun-application-client.xml" 
+	value="descriptor/sun-application-client.xml"/>
+<property name="appclientjar.files" value="${build.classes.dir}"/>         
+<property name="appclient.jar" value="${assemble.dir}/${appname}-client.jar"/>
+<property name="app.type" value="application"/>
+<property name="batch_derby.sql" value="../../batch_derby.sql"/>
diff --git a/appserver/tests/appserv-tests/devtests/batch/two-steps-job/build.xml b/appserver/tests/appserv-tests/devtests/batch/two-steps-job/build.xml
new file mode 100644
index 0000000..408654f
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/two-steps-job/build.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+    Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v. 2.0, which is available at
+    http://www.eclipse.org/legal/epl-2.0.
+
+    This Source Code may also be made available under the following Secondary
+    Licenses when the conditions for such availability set forth in the
+    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+    version 2 with the GNU Classpath Exception, which is available at
+    https://www.gnu.org/software/classpath/license.html.
+
+    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+
+<!DOCTYPE project [
+<!ENTITY commonSetup SYSTEM "../../../config/properties.xml">
+<!ENTITY commonBuild SYSTEM "../../../config/common.xml">
+<!ENTITY testproperties SYSTEM "build.properties">
+]>
+
+<project name="devtest-batch-two-steps-job-App" default="usage" basedir=".">
+
+    &commonSetup;
+    &commonBuild;
+    &testproperties;
+
+    <!--
+    <target name="all" depends="build,copy-batch-sql,deploy,run,undeploy"/>
+    -->
+
+    <target name="all" depends="build,deploy,run,undeploy"/>
+
+    <target name="clean" depends="init-common">
+      <antcall  target="clean-common"/>
+    </target>
+ 
+    <target name="compile" depends="clean">
+        <antcall target="compile-common">
+            <param name="src" value="ejb"/>
+        </antcall>
+        <antcall target="compile-common">
+            <param name="src" value="client"/>
+        </antcall>
+    </target>
+
+
+    <target name="build" depends="compile">
+        <antcall target="build-ear-common">
+            <param name="ejbjar.classes" 
+              value="**/*.class"/>
+            <param name="appclientjar.classes" 
+              value="**/Client.class,**/Sless.class,**/Sless30.class"/>
+        </antcall>
+    </target> 
+    
+    <target name="copy-batch-sql" depends="build">
+    	<echo message="***** Copy ${batch_derby.sql} to Target dir: ${env.S1AS_HOME}/lib"/>
+    	<copy file="${batch_derby.sql}" todir="${env.S1AS_HOME}/lib"/>
+    </target>
+
+    <target name="deploy" 
+            depends="init-common">
+        <antcall target="deploy-common"/>
+    </target>
+
+    <target name="run" depends="init-common">
+        <antcall target="runclient-common"/>
+    </target>
+ 
+    <target name="undeploy" depends="init-common">
+        <antcall target="undeploy-common"/>
+    </target>   
+
+    <target name="usage">
+        <antcall target="usage-common"/>
+    </target>
+</project>
diff --git a/appserver/tests/appserv-tests/devtests/batch/two-steps-job/client/Client.java b/appserver/tests/appserv-tests/devtests/batch/two-steps-job/client/Client.java
new file mode 100644
index 0000000..55fb7e3
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/two-steps-job/client/Client.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package com.sun.ejb.devtest.client;
+
+import java.io.*;
+import java.util.*;
+import javax.naming.*;
+import javax.ejb.EJB;
+import com.oracle.javaee7.samples.batch.twosteps.*;
+import com.sun.ejte.ccl.reporter.SimpleReporterAdapter;
+
+@EJB(name="ejb/GG", beanInterface=Sless.class)
+public class Client {
+
+    private static SimpleReporterAdapter stat = 
+        new SimpleReporterAdapter("appserv-tests");
+
+    public static void main (String[] args) {
+
+        stat.addDescription("batch-two-steps-stateless");
+        Client client = new Client(args);
+        client.doTest();
+        stat.printSummary("batch-two-steps-stateless");
+    }  
+    
+    public Client (String[] args) {
+    }
+    
+    private static @EJB(name="ejb/kk") Sless sless;
+
+    public void doTest() {
+        try {
+            (new InitialContext()).lookup("java:comp/env/ejb/GG");
+	    long executionId = sless.submitJob();
+	    System.out.println("************************************************");
+	    System.out.println("******* JobID: " + executionId + " ******************");
+	    System.out.println("************************************************");
+	    String jobBatchStatus = "";
+	    for (int sec=10; sec>0; sec--) {
+	        try {
+		    jobBatchStatus = sless.getJobExitStatus(executionId);
+		    if (! "COMPLETED".equals(jobBatchStatus)) {
+		        System.out.println("Will sleep for " + sec + " more seconds...: " + jobBatchStatus);
+		        Thread.currentThread().sleep(1000);
+		    }
+		} catch (Exception ex) {
+		}
+	    }
+            stat.addStatus("batch-two-steps-stateless", ("COMPLETED".equals(jobBatchStatus) ? stat.PASS : stat.FAIL));
+	} catch (Exception ex) {
+            stat.addStatus("batch-two-steps-stateless", stat.FAIL);
+        }
+    }
+
+}
+
diff --git a/appserver/tests/appserv-tests/devtests/batch/two-steps-job/client/MANIFEST.MF b/appserver/tests/appserv-tests/devtests/batch/two-steps-job/client/MANIFEST.MF
new file mode 100644
index 0000000..ae04b30
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/two-steps-job/client/MANIFEST.MF
@@ -0,0 +1,4 @@
+Manifest-Version: 1.0
+Created-By: 1.4.0-beta3 (Sun Microsystems Inc.)
+Main-Class: com.sun.ejb.devtest.client.Client
+Class-Path: reporter.jar
diff --git a/appserver/tests/appserv-tests/devtests/batch/two-steps-job/descriptor/batch-jobs/TwoStepsJob.xml b/appserver/tests/appserv-tests/devtests/batch/two-steps-job/descriptor/batch-jobs/TwoStepsJob.xml
new file mode 100644
index 0000000..a85ba1e
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/two-steps-job/descriptor/batch-jobs/TwoStepsJob.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v. 2.0, which is available at
+    http://www.eclipse.org/legal/epl-2.0.
+
+    This Source Code may also be made available under the following Secondary
+    Licenses when the conditions for such availability set forth in the
+    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+    version 2 with the GNU Classpath Exception, which is available at
+    https://www.gnu.org/software/classpath/license.html.
+
+    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+
+<job id="two-steps-job" xmlns="http://batch.jsr352/jsl">
+    <step id="step1" next="step2">
+        <chunk item-count="1">
+            <reader ref="SimpleItemReader"></reader> 
+            <processor ref="SimpleItemProcessor"></processor>
+            <writer ref="SimpleItemWriter"></writer> 
+        </chunk>
+    </step>
+    <step id="step2">
+        <chunk item-count="2">
+            <reader ref="SimpleItemReader"></reader> 
+            <processor ref="SimpleItemProcessor"></processor>
+            <writer ref="SimpleItemWriter"></writer> 
+        </chunk>
+    </step>
+</job>
diff --git a/appserver/tests/appserv-tests/devtests/batch/two-steps-job/descriptor/batch.xml b/appserver/tests/appserv-tests/devtests/batch/two-steps-job/descriptor/batch.xml
new file mode 100644
index 0000000..b58ebe4
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/two-steps-job/descriptor/batch.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v. 2.0, which is available at
+    http://www.eclipse.org/legal/epl-2.0.
+
+    This Source Code may also be made available under the following Secondary
+    Licenses when the conditions for such availability set forth in the
+    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+    version 2 with the GNU Classpath Exception, which is available at
+    https://www.gnu.org/software/classpath/license.html.
+
+    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+
+<batch-artifacts xmlns="http://jcp.org.batch/jsl">
+<ref id="SimpleItemReader" class="com.oracle.javaee7.samples.batch.twosteps.SimpleItemReader"/>
+<ref id="SimpleItemProcessor" class="com.oracle.javaee7.samples.batch.twosteps.SimpleItemProcessor"/>
+<ref id="SimpleItemWriter" class="com.oracle.javaee7.samples.batch.twosteps.SimpleItemWriter"/>
+</batch-artifacts>
diff --git a/appserver/tests/appserv-tests/devtests/batch/two-steps-job/descriptor/beans.xml b/appserver/tests/appserv-tests/devtests/batch/two-steps-job/descriptor/beans.xml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/two-steps-job/descriptor/beans.xml
diff --git a/appserver/tests/appserv-tests/devtests/batch/two-steps-job/ejb/com/oracle/javaee7/samples/LICENSE.md b/appserver/tests/appserv-tests/devtests/batch/two-steps-job/ejb/com/oracle/javaee7/samples/LICENSE.md
new file mode 100644
index 0000000..e0358f9
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/two-steps-job/ejb/com/oracle/javaee7/samples/LICENSE.md
@@ -0,0 +1,29 @@
+
+    Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
+   
+    Redistribution and use in source and binary forms, with or without
+    modification, are permitted provided that the following conditions
+    are met:
+   
+      - Redistributions of source code must retain the above copyright
+        notice, this list of conditions and the following disclaimer.
+   
+      - Redistributions in binary form must reproduce the above copyright
+        notice, this list of conditions and the following disclaimer in the
+        documentation and/or other materials provided with the distribution.
+   
+      - Neither the name of the Eclipse Foundation, Inc. nor the names of its
+        contributors may be used to endorse or promote products derived
+        from this software without specific prior written permission.
+   
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+    IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+    THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+    PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+    EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+    PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+    LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/appserver/tests/appserv-tests/devtests/batch/two-steps-job/ejb/com/oracle/javaee7/samples/README.md b/appserver/tests/appserv-tests/devtests/batch/two-steps-job/ejb/com/oracle/javaee7/samples/README.md
new file mode 100644
index 0000000..766dda6
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/two-steps-job/ejb/com/oracle/javaee7/samples/README.md
@@ -0,0 +1 @@
+This directory contains sample code and hence files within this directory and below are covered under EDL 1.0.
diff --git a/appserver/tests/appserv-tests/devtests/batch/two-steps-job/ejb/com/oracle/javaee7/samples/batch/twosteps/IdGenerator.java b/appserver/tests/appserv-tests/devtests/batch/two-steps-job/ejb/com/oracle/javaee7/samples/batch/twosteps/IdGenerator.java
new file mode 100644
index 0000000..16b06ff
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/two-steps-job/ejb/com/oracle/javaee7/samples/batch/twosteps/IdGenerator.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.oracle.javaee7.samples.batch.twosteps;
+
+/**
+ *
+ * @author makannan
+ */
+public interface IdGenerator {
+
+    public String nextId();
+    
+}
diff --git a/appserver/tests/appserv-tests/devtests/batch/two-steps-job/ejb/com/oracle/javaee7/samples/batch/twosteps/SimpleIdGenerator.java b/appserver/tests/appserv-tests/devtests/batch/two-steps-job/ejb/com/oracle/javaee7/samples/batch/twosteps/SimpleIdGenerator.java
new file mode 100644
index 0000000..9dc4790
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/two-steps-job/ejb/com/oracle/javaee7/samples/batch/twosteps/SimpleIdGenerator.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.oracle.javaee7.samples.batch.twosteps;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ *
+ * @author makannan
+ */
+public class SimpleIdGenerator
+    implements IdGenerator {
+    
+    private AtomicInteger counter = new AtomicInteger(0);
+    
+    public String nextId() {
+        return "" + counter.incrementAndGet();
+    }
+}
diff --git a/appserver/tests/appserv-tests/devtests/batch/two-steps-job/ejb/com/oracle/javaee7/samples/batch/twosteps/SimpleItemProcessor.java b/appserver/tests/appserv-tests/devtests/batch/two-steps-job/ejb/com/oracle/javaee7/samples/batch/twosteps/SimpleItemProcessor.java
new file mode 100644
index 0000000..fff0112
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/two-steps-job/ejb/com/oracle/javaee7/samples/batch/twosteps/SimpleItemProcessor.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.oracle.javaee7.samples.batch.twosteps;
+
+import javax.inject.Inject;
+
+
+@javax.inject.Named//("com.oracle.javaee7.samples.batch.simple.SimpleItemProcessor")
+public class SimpleItemProcessor
+    implements javax.batch.api.ItemProcessor<String, String> {
+
+//    @Inject
+//    IdGenerator idGen;
+    
+    @Override
+    public String processItem(String t) throws Exception {
+        String[] record = t.split(", ");
+        
+    //EMP-ID, MONTH-YEAR, SALARY, TAX%, MEDICARE%, OTHER
+        int salary = Integer.valueOf(record[2]);
+        double tax = Double.valueOf(record[3]);
+        double mediCare = Double.valueOf(record[4]);
+        StringBuilder sb = new StringBuilder(t);
+        sb.append(", ").append(salary * tax / 100);
+        sb.append(", ").append(salary * mediCare / 100);
+        sb.append(", ").append(salary - (salary * tax / 100) - (salary * mediCare / 100));
+        return  sb.toString();
+    }
+    
+}
diff --git a/appserver/tests/appserv-tests/devtests/batch/two-steps-job/ejb/com/oracle/javaee7/samples/batch/twosteps/SimpleItemReader.java b/appserver/tests/appserv-tests/devtests/batch/two-steps-job/ejb/com/oracle/javaee7/samples/batch/twosteps/SimpleItemReader.java
new file mode 100644
index 0000000..b512335
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/two-steps-job/ejb/com/oracle/javaee7/samples/batch/twosteps/SimpleItemReader.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.oracle.javaee7.samples.batch.twosteps;
+
+import java.io.Externalizable;
+
+@javax.inject.Named("SimpleItemReader")
+public class SimpleItemReader
+    extends javax.batch.api.AbstractItemReader<String> {
+
+    private int index = 0;
+    
+    //EMP-ID, MONTH-YEAR, SALARY, TAX%, MEDICARE%, OTHER
+    private String[] items = new String[] {
+        "120-01, JAN-2013, 8000, 27, 3, 0",
+        "120-02, JAN-2013, 8500, 27, 3, 0",
+        "120-03, JAN-2013, 9000, 33, 4, 0",
+        "120-04, JAN-2013, 8500, 33, 4, 0",
+        "120-05, JAN-2013, 10000, 33, 4, 0",
+        "120-06, JAN-2013, 10500, 33, 4, 0",
+        "120-07, JAN-2013, 11000, 36, 5, 0",
+        "120-08, JAN-2013, 11500, 36, 5, 0",
+    };
+    
+    @Override
+    public void open(Externalizable e) throws Exception {
+    }
+
+    @Override
+    public void close() throws Exception {
+    }
+
+    @Override
+    public String readItem() throws Exception {
+        return index < items.length ? items[index++] : null;
+    }
+
+    @Override
+    public Externalizable checkpointInfo() throws Exception {
+        return null;
+    }
+    
+}
diff --git a/appserver/tests/appserv-tests/devtests/batch/two-steps-job/ejb/com/oracle/javaee7/samples/batch/twosteps/SimpleItemWriter.java b/appserver/tests/appserv-tests/devtests/batch/two-steps-job/ejb/com/oracle/javaee7/samples/batch/twosteps/SimpleItemWriter.java
new file mode 100644
index 0000000..bcc1aa9
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/two-steps-job/ejb/com/oracle/javaee7/samples/batch/twosteps/SimpleItemWriter.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.oracle.javaee7.samples.batch.twosteps;
+
+import java.io.Externalizable;
+import java.util.List;
+@javax.inject.Named("SimpleItemWriter")
+public class SimpleItemWriter
+    extends javax.batch.api.AbstractItemWriter<String> {
+    
+    @Override
+    public void open(Externalizable e) throws Exception {
+    }
+
+    @Override
+    public void close() throws Exception {
+    }
+
+    @Override
+    public void writeItems(List<String> list) throws Exception {
+        StringBuilder sb = new StringBuilder("SimpleItemWriter:");
+        for (String s : list) {
+            sb.append(" ").append(s);
+        }
+        System.out.println(sb.toString());
+    }
+
+    @Override
+    public Externalizable checkpointInfo() throws Exception {
+        return null;
+    }
+    
+}
diff --git a/appserver/tests/appserv-tests/devtests/batch/two-steps-job/ejb/com/oracle/javaee7/samples/batch/twosteps/Sless.java b/appserver/tests/appserv-tests/devtests/batch/two-steps-job/ejb/com/oracle/javaee7/samples/batch/twosteps/Sless.java
new file mode 100644
index 0000000..b0c2039
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/two-steps-job/ejb/com/oracle/javaee7/samples/batch/twosteps/Sless.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+package com.oracle.javaee7.samples.batch.twosteps;
+
+import javax.ejb.Remote;
+
+@Remote
+public interface Sless {
+
+    public long submitJob();
+
+    public String getJobExitStatus(long executionId);
+
+    public boolean wasEjbCreateCalled();
+
+}
+
diff --git a/appserver/tests/appserv-tests/devtests/batch/two-steps-job/ejb/com/oracle/javaee7/samples/batch/twosteps/SlessBean.java b/appserver/tests/appserv-tests/devtests/batch/two-steps-job/ejb/com/oracle/javaee7/samples/batch/twosteps/SlessBean.java
new file mode 100644
index 0000000..cba5902
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/batch/two-steps-job/ejb/com/oracle/javaee7/samples/batch/twosteps/SlessBean.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+package com.oracle.javaee7.samples.batch.twosteps;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.util.Properties;
+
+import javax.annotation.PostConstruct;
+
+import javax.batch.operations.JobOperator;
+import javax.batch.runtime.BatchRuntime;
+import javax.batch.runtime.JobExecution;
+import javax.ejb.Stateless;
+import javax.ejb.EJB;
+
+@Stateless
+public class SlessBean
+    implements Sless {
+
+    boolean ejbCreateCalled = false;
+
+    public void ejbCreate() {
+        this.ejbCreateCalled = true;
+    }
+
+    public long submitJob() {
+	try {
+	  JobOperator jobOperator = BatchRuntime.getJobOperator();
+
+	  Properties props = new Properties();
+	  for (int i=0; i<9; i++)
+		props.put("Param-For-TwoSteps-Job-" + i, "Value-" + i);
+	  return  jobOperator.start("TwoStepsJob", props);
+        } catch (Exception ex) {
+	  throw new RuntimeException(ex);
+	}
+    }
+
+    public String getJobExitStatus(long executionId) {
+	try {
+	  JobOperator jobOperator = BatchRuntime.getJobOperator();
+	  JobExecution je =  jobOperator.getJobExecution(executionId);
+	  return je.getExitStatus();
+	} catch (Exception ex) {
+	  throw new RuntimeException(ex);
+	}
+
+    }
+
+    public boolean wasEjbCreateCalled() {
+	return ejbCreateCalled;
+    }
+
+														            
+}