diff --git a/sql/db2/db2.ddl.jbatch-tck.sql b/sql/db2/db2.ddl.jbatch-tck.sql deleted file mode 100644 index 40c1cd8d7f..0000000000 --- a/sql/db2/db2.ddl.jbatch-tck.sql +++ /dev/null @@ -1,81 +0,0 @@ -DROP TABLE Numbers! -DROP TABLE Orders! -DROP TABLE Inventory! - -CREATE TABLE Numbers ( - item INT, - quantity INT -)! - -CREATE TABLE Orders ( - orderID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1) PRIMARY KEY, - itemID INT, - quantity INT -)! - -CREATE TABLE Inventory( - itemID INT NOT NULL PRIMARY KEY, - quantity INT NOT NULL -)! - -INSERT INTO Inventory VALUES (1, 100)! - -INSERT INTO Numbers -VALUES (1, 10)! - -INSERT INTO Numbers -VALUES (2, 10)! - -INSERT INTO Numbers -VALUES (3, 10)! - -INSERT INTO Numbers -VALUES (4, 10)! - -INSERT INTO Numbers -VALUES (5, 10)! - -INSERT INTO Numbers -VALUES (6, 10)! - -INSERT INTO Numbers -VALUES (7, 10)! - -INSERT INTO Numbers -VALUES (8, 10)! - -INSERT INTO Numbers -VALUES (9, 10)! - -INSERT INTO Numbers -VALUES (10, 10)! - -INSERT INTO Numbers -VALUES (11, 10)! - -INSERT INTO Numbers -VALUES (12, 10)! - -INSERT INTO Numbers -VALUES (13, 10)! - -INSERT INTO Numbers -VALUES (14, 10)! - -INSERT INTO Numbers -VALUES (15, 10)! - -INSERT INTO Numbers -VALUES (16, 10)! - -INSERT INTO Numbers -VALUES (17, 10)! - -INSERT INTO Numbers -VALUES (18, 10)! - -INSERT INTO Numbers -VALUES (19, 10)! - -INSERT INTO Numbers -VALUES (20, 10)! \ No newline at end of file diff --git a/sql/derby/derby.ddl.jbatch-tck.sql b/sql/derby/derby.ddl.jbatch-tck.sql deleted file mode 100644 index 8a2a8ee5ec..0000000000 --- a/sql/derby/derby.ddl.jbatch-tck.sql +++ /dev/null @@ -1,81 +0,0 @@ -DROP TABLE Numbers; -DROP TABLE Orders; -DROP TABLE Inventory; - -CREATE TABLE Numbers ( - item INT, - quantity INT -); - -CREATE TABLE Orders ( - orderID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1) PRIMARY KEY, - itemID INT, - quantity INT -); - -CREATE TABLE Inventory( - itemID INT NOT NULL PRIMARY KEY, - quantity INT NOT NULL -); - -INSERT INTO Inventory VALUES (1, 100); - -INSERT INTO Numbers -VALUES (1, 10); - -INSERT INTO Numbers -VALUES (2, 10); - -INSERT INTO Numbers -VALUES (3, 10); - -INSERT INTO Numbers -VALUES (4, 10); - -INSERT INTO Numbers -VALUES (5, 10); - -INSERT INTO Numbers -VALUES (6, 10); - -INSERT INTO Numbers -VALUES (7, 10); - -INSERT INTO Numbers -VALUES (8, 10); - -INSERT INTO Numbers -VALUES (9, 10); - -INSERT INTO Numbers -VALUES (10, 10); - -INSERT INTO Numbers -VALUES (11, 10); - -INSERT INTO Numbers -VALUES (12, 10); - -INSERT INTO Numbers -VALUES (13, 10); - -INSERT INTO Numbers -VALUES (14, 10); - -INSERT INTO Numbers -VALUES (15, 10); - -INSERT INTO Numbers -VALUES (16, 10); - -INSERT INTO Numbers -VALUES (17, 10); - -INSERT INTO Numbers -VALUES (18, 10); - -INSERT INTO Numbers -VALUES (19, 10); - -INSERT INTO Numbers -VALUES (20, 10); diff --git a/sql/mssqlserver/mssqlserver.ddl.jbatch-tck.sql b/sql/mssqlserver/mssqlserver.ddl.jbatch-tck.sql deleted file mode 100644 index 7b3937b816..0000000000 --- a/sql/mssqlserver/mssqlserver.ddl.jbatch-tck.sql +++ /dev/null @@ -1,83 +0,0 @@ -DROP TABLE Numbers; -DROP TABLE Orders; -DROP TABLE Inventory; - -CREATE TABLE Numbers ( - item INT, - quantity INT -); - -CREATE TABLE Orders ( - orderID INTEGER NOT NULL IDENTITY(1,1) PRIMARY KEY, - itemID INT, - quantity INT -); - -SET IDENTITY_INSERT Orders ON; - -CREATE TABLE Inventory( - itemID INT NOT NULL PRIMARY KEY, - quantity INT NOT NULL -); - -INSERT INTO Inventory VALUES (1, 100); - -INSERT INTO Numbers -VALUES (1, 10); - -INSERT INTO Numbers -VALUES (2, 10); - -INSERT INTO Numbers -VALUES (3, 10); - -INSERT INTO Numbers -VALUES (4, 10); - -INSERT INTO Numbers -VALUES (5, 10); - -INSERT INTO Numbers -VALUES (6, 10); - -INSERT INTO Numbers -VALUES (7, 10); - -INSERT INTO Numbers -VALUES (8, 10); - -INSERT INTO Numbers -VALUES (9, 10); - -INSERT INTO Numbers -VALUES (10, 10); - -INSERT INTO Numbers -VALUES (11, 10); - -INSERT INTO Numbers -VALUES (12, 10); - -INSERT INTO Numbers -VALUES (13, 10); - -INSERT INTO Numbers -VALUES (14, 10); - -INSERT INTO Numbers -VALUES (15, 10); - -INSERT INTO Numbers -VALUES (16, 10); - -INSERT INTO Numbers -VALUES (17, 10); - -INSERT INTO Numbers -VALUES (18, 10); - -INSERT INTO Numbers -VALUES (19, 10); - -INSERT INTO Numbers -VALUES (20, 10); \ No newline at end of file diff --git a/sql/mysql/mysql.ddl.jbatch-tck.sql b/sql/mysql/mysql.ddl.jbatch-tck.sql deleted file mode 100644 index 5c08277c8a..0000000000 --- a/sql/mysql/mysql.ddl.jbatch-tck.sql +++ /dev/null @@ -1,78 +0,0 @@ -CREATE TABLE IF NOT EXISTS Numbers ( - item INT, - quantity INT -)! - -CREATE TABLE IF NOT EXISTS Orders ( - orderID INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - itemID INT, - quantity INT -)! - -DROP TABLE Inventory! -CREATE TABLE IF NOT EXISTS Inventory( - itemID INT NOT NULL PRIMARY KEY, - quantity INT NOT NULL -)! - -INSERT INTO Inventory VALUES (1, 100)! - -INSERT INTO Numbers -VALUES (1, 10)! - -INSERT INTO Numbers -VALUES (2, 10)! - -INSERT INTO Numbers -VALUES (3, 10)! - -INSERT INTO Numbers -VALUES (4, 10)! - -INSERT INTO Numbers -VALUES (5, 10)! - -INSERT INTO Numbers -VALUES (6, 10)! - -INSERT INTO Numbers -VALUES (7, 10)! - -INSERT INTO Numbers -VALUES (8, 10)! - -INSERT INTO Numbers -VALUES (9, 10)! - -INSERT INTO Numbers -VALUES (10, 10)! - -INSERT INTO Numbers -VALUES (11, 10)! - -INSERT INTO Numbers -VALUES (12, 10)! - -INSERT INTO Numbers -VALUES (13, 10)! - -INSERT INTO Numbers -VALUES (14, 10)! - -INSERT INTO Numbers -VALUES (15, 10)! - -INSERT INTO Numbers -VALUES (16, 10)! - -INSERT INTO Numbers -VALUES (17, 10)! - -INSERT INTO Numbers -VALUES (18, 10)! - -INSERT INTO Numbers -VALUES (19, 10)! - -INSERT INTO Numbers -VALUES (20, 10)! diff --git a/sql/oracle/oracle.ddl.jbatch-tck.sql b/sql/oracle/oracle.ddl.jbatch-tck.sql deleted file mode 100644 index 51fbef487c..0000000000 --- a/sql/oracle/oracle.ddl.jbatch-tck.sql +++ /dev/null @@ -1,98 +0,0 @@ -DROP TABLE Numbers! -DROP TABLE Orders! -DROP TABLE Inventory! -DROP SEQUENCE order_seq! - -CREATE TABLE Numbers ( - item INT, - quantity INT -)! - -CREATE TABLE Orders ( - orderID INT NOT NULL PRIMARY KEY, - itemID INT, - quantity INT -)! - -CREATE TABLE Inventory( - itemID INT NOT NULL PRIMARY KEY, - quantity INT NOT NULL -)! - -CREATE SEQUENCE order_seq - MINVALUE 1 - START WITH 1 - INCREMENT BY 1 - NOCACHE! - -CREATE or REPLACE trigger order_trigger -BEFORE INSERT ON Orders -FOR EACH ROW -BEGIN - IF (:new.orderID IS NULL) THEN - SELECT order_seq.nextval INTO :new.orderID - FROM DUAL; - END IF; -END;! - -INSERT INTO Inventory VALUES (1, 100)! - -INSERT INTO Numbers -VALUES (1, 10)! - -INSERT INTO Numbers -VALUES (2, 10)! - -INSERT INTO Numbers -VALUES (3, 10)! - -INSERT INTO Numbers -VALUES (4, 10)! - -INSERT INTO Numbers -VALUES (5, 10)! - -INSERT INTO Numbers -VALUES (6, 10)! - -INSERT INTO Numbers -VALUES (7, 10)! - -INSERT INTO Numbers -VALUES (8, 10)! - -INSERT INTO Numbers -VALUES (9, 10)! - -INSERT INTO Numbers -VALUES (10, 10)! - -INSERT INTO Numbers -VALUES (11, 10)! - -INSERT INTO Numbers -VALUES (12, 10)! - -INSERT INTO Numbers -VALUES (13, 10)! - -INSERT INTO Numbers -VALUES (14, 10)! - -INSERT INTO Numbers -VALUES (15, 10)! - -INSERT INTO Numbers -VALUES (16, 10)! - -INSERT INTO Numbers -VALUES (17, 10)! - -INSERT INTO Numbers -VALUES (18, 10)! - -INSERT INTO Numbers -VALUES (19, 10)! - -INSERT INTO Numbers -VALUES (20, 10)! diff --git a/sql/postgresql/postgresql.ddl.jbatch-tck.sql b/sql/postgresql/postgresql.ddl.jbatch-tck.sql deleted file mode 100644 index f25da2310d..0000000000 --- a/sql/postgresql/postgresql.ddl.jbatch-tck.sql +++ /dev/null @@ -1,81 +0,0 @@ -DROP TABLE Numbers; -DROP TABLE Orders; -DROP TABLE Inventory; - -CREATE TABLE Numbers ( - item INT, - quantity INT -); - -CREATE TABLE Orders ( - orderID INT PRIMARY KEY, - itemID INT, - quantity INT -); - -CREATE TABLE Inventory( - itemID INT NOT NULL PRIMARY KEY, - quantity INT NOT NULL -); - -INSERT INTO Inventory VALUES (1, 100); - -INSERT INTO Numbers -VALUES (1, 10); - -INSERT INTO Numbers -VALUES (2, 10); - -INSERT INTO Numbers -VALUES (3, 10); - -INSERT INTO Numbers -VALUES (4, 10); - -INSERT INTO Numbers -VALUES (5, 10); - -INSERT INTO Numbers -VALUES (6, 10); - -INSERT INTO Numbers -VALUES (7, 10); - -INSERT INTO Numbers -VALUES (8, 10); - -INSERT INTO Numbers -VALUES (9, 10); - -INSERT INTO Numbers -VALUES (10, 10); - -INSERT INTO Numbers -VALUES (11, 10); - -INSERT INTO Numbers -VALUES (12, 10); - -INSERT INTO Numbers -VALUES (13, 10); - -INSERT INTO Numbers -VALUES (14, 10); - -INSERT INTO Numbers -VALUES (15, 10); - -INSERT INTO Numbers -VALUES (16, 10); - -INSERT INTO Numbers -VALUES (17, 10); - -INSERT INTO Numbers -VALUES (18, 10); - -INSERT INTO Numbers -VALUES (19, 10); - -INSERT INTO Numbers -VALUES (20, 10); \ No newline at end of file diff --git a/sql/sybase/sybase.ddl.jbatch-tck.sql b/sql/sybase/sybase.ddl.jbatch-tck.sql deleted file mode 100644 index fb642ac00d..0000000000 --- a/sql/sybase/sybase.ddl.jbatch-tck.sql +++ /dev/null @@ -1,84 +0,0 @@ -DROP TABLE Numbers! -DROP TABLE Orders! -DROP TABLE Inventory! - -CREATE TABLE Numbers ( - item INT, - quantity INT -)! - -CREATE TABLE Orders ( - orderID INT NOT NULL, - itemID INT, - quantity INT, - PRIMARY KEY (orderID) -)! - - -CREATE TABLE Inventory( - itemID INT NOT NULL, - quantity INT NOT NULL, - PRIMARY KEY (itemID) -)! - -INSERT INTO Inventory VALUES (1, 100)! - -INSERT INTO Numbers -VALUES (1, 10)! - -INSERT INTO Numbers -VALUES (2, 10)! - -INSERT INTO Numbers -VALUES (3, 10)! - -INSERT INTO Numbers -VALUES (4, 10)! - -INSERT INTO Numbers -VALUES (5, 10)! - -INSERT INTO Numbers -VALUES (6, 10)! - -INSERT INTO Numbers -VALUES (7, 10)! - -INSERT INTO Numbers -VALUES (8, 10)! - -INSERT INTO Numbers -VALUES (9, 10)! - -INSERT INTO Numbers -VALUES (10, 10)! - -INSERT INTO Numbers -VALUES (11, 10)! - -INSERT INTO Numbers -VALUES (12, 10)! - -INSERT INTO Numbers -VALUES (13, 10)! - -INSERT INTO Numbers -VALUES (14, 10)! - -INSERT INTO Numbers -VALUES (15, 10)! - -INSERT INTO Numbers -VALUES (16, 10)! - -INSERT INTO Numbers -VALUES (17, 10)! - -INSERT INTO Numbers -VALUES (18, 10)! - -INSERT INTO Numbers -VALUES (19, 10)! - -INSERT INTO Numbers -VALUES (20, 10)! \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/ConnectionHelper.java b/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/ConnectionHelper.java deleted file mode 100644 index 47171198df..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/ConnectionHelper.java +++ /dev/null @@ -1,109 +0,0 @@ -/** - * Copyright 2012 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.chunkartifacts; - - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.logging.Logger; - -import javax.sql.DataSource; - -public class ConnectionHelper { - - private static final String CLASSNAME = ConnectionHelper.class.getName(); - private final static Logger logger = Logger.getLogger(CLASSNAME); - - public static final String jndiName = "java:module/env/jdbc/orderDB"; - - public static final String INSERT_INVENTORY = "insert into inventory values(?, ?)"; - - public static final String UPDATE_INVENTORY = "update inventory set quantity = ? where itemID = ?"; - - public static final String SELECT_INVENTORY = "select itemID, quantity from inventory where itemID = ?"; - - public static final String DELETE_INVENTORY = "delete from Inventory where itemID = ?"; - - public static final String DELETE_ALL_ORDERS = "delete from Orders where orderID > 0"; - - public static final String INSERT_ORDER = "insert into Orders values(DEFAULT, ?, ?)"; - - public static final String COUNT_ORDERS = "select COUNT(*) AS rowcount from Orders"; - - /* - * Connection where autoCommit defaults to true unless we are in a global tran where it gets ignored - */ - public static Connection getConnection(DataSource dataSource) throws SQLException { - - Connection conn = dataSource.getConnection(); - return conn; - } - - - public static Connection getConnection(DataSource dataSource, boolean autoCommit) throws SQLException { - Connection conn = dataSource.getConnection(); - conn.setAutoCommit(autoCommit); - - return conn; - } - - /** - * closes connection to DB - * - * @param conn - connection object to close - * @param rs - result set object to close - * @param statement - statement object to close - */ - public static void cleanupConnection(Connection conn, ResultSet rs, PreparedStatement statement) { - logger.entering(CLASSNAME, "cleanupConnection", new Object[] {conn, rs, statement}); - if (rs != null) { - try { - rs.close(); - } catch (SQLException e) { - throw new RuntimeException(e); - } - } - - if (statement != null) { - try { - statement.close(); - } catch (SQLException e) { - throw new RuntimeException(e); - } - } - - if (conn != null) { - try { - conn.close(); - } catch (SQLException e) { - throw new RuntimeException(e); - } finally { - try { - conn.close(); - } catch (SQLException e) { - throw new RuntimeException(e); - } - } - } - logger.exiting(CLASSNAME, "cleanupConnection"); - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/InventoryInitProcessor.java b/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/InventoryInitProcessor.java deleted file mode 100644 index 55b91a809a..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/InventoryInitProcessor.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.chunkartifacts; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import jakarta.batch.api.BatchProperty; -import jakarta.batch.api.chunk.ItemProcessor; -import jakarta.inject.Inject; - -import com.ibm.jbatch.tck.artifacts.chunktypes.InventoryRecord; - - -@jakarta.inject.Named("inventoryInitProcessor") -public class InventoryInitProcessor implements ItemProcessor { - - - @Inject - @BatchProperty(name="init.inventory.quantity") - String quantityProp = null; - - @Override - public InventoryRecord processItem(Object record) throws Exception { - - //we don't care what quantity is in the db, we just want to reset it - - int itemID = ((InventoryRecord)record).getItemID(); - int quantity = Integer.parseInt(quantityProp); - - //reset the database to initial state, this is for test setup purposes only - - return new InventoryRecord(itemID, quantity); - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/InventoryInitReader.java b/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/InventoryInitReader.java deleted file mode 100644 index 7de1629973..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/InventoryInitReader.java +++ /dev/null @@ -1,90 +0,0 @@ -/** - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.chunkartifacts; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.io.Serializable; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - -import jakarta.batch.api.chunk.AbstractItemReader; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import javax.sql.DataSource; - -import com.ibm.jbatch.tck.artifacts.chunktypes.InventoryCheckpointData; -import com.ibm.jbatch.tck.artifacts.chunktypes.InventoryRecord; - -@jakarta.inject.Named("inventoryInitReader") -public class InventoryInitReader extends AbstractItemReader { - - protected DataSource dataSource = null; - - private int count = 0; - - public void open(Serializable cpd) throws NamingException { - - InitialContext ctx = new InitialContext(); - dataSource = (DataSource) ctx.lookup(ConnectionHelper.jndiName); - - } - - @Override - public InventoryRecord readItem() throws SQLException { - if (count > 0) { - return null; - } - - Connection connection = null; - PreparedStatement statement = null; - ResultSet rs = null; - - try { - connection = ConnectionHelper.getConnection(dataSource); - - statement = connection.prepareStatement(ConnectionHelper.SELECT_INVENTORY); - statement.setInt(1, 1); - rs = statement.executeQuery(); - - int quantity = -1; - while (rs.next()) { - quantity = rs.getInt("quantity"); - count++; - } - - return new InventoryRecord(1, quantity); - - } catch (SQLException e) { - throw e; - } finally { - ConnectionHelper.cleanupConnection(connection, rs, statement); - } - - } - - - @Override - public Serializable checkpointInfo() throws Exception { - InventoryCheckpointData chkpData = new InventoryCheckpointData(); - chkpData.setInventoryCount(count); - return chkpData; - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/InventoryInitWriter.java b/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/InventoryInitWriter.java deleted file mode 100644 index a24ff2c6ce..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/InventoryInitWriter.java +++ /dev/null @@ -1,90 +0,0 @@ -/** - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.chunkartifacts; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.io.Serializable; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; -import java.util.List; - -import jakarta.batch.api.chunk.AbstractItemWriter; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import javax.sql.DataSource; - -import com.ibm.jbatch.tck.artifacts.chunktypes.InventoryRecord; - -@jakarta.inject.Named("inventoryInitWriter") -public class InventoryInitWriter extends AbstractItemWriter { - - - protected DataSource dataSource = null; - - public void open(Serializable cpd) throws NamingException { - - InitialContext ctx = new InitialContext(); - dataSource = (DataSource) ctx.lookup(ConnectionHelper.jndiName); - - } - - - @Override - public void writeItems(List records) throws Exception { - int itemID = -1; - int quantity = -1; - - - - for (Object record : records) { - itemID = ((InventoryRecord)record).getItemID(); - quantity = ((InventoryRecord)record).getQuantity(); - } - - Connection connection = null; - PreparedStatement statement = null; - - try { - - //Clear all orders from the orders table - connection = ConnectionHelper.getConnection(dataSource); - statement = connection.prepareStatement(ConnectionHelper.DELETE_ALL_ORDERS); - int rs = statement.executeUpdate(); - - - ConnectionHelper.cleanupConnection(connection, null, statement); - - //Reset the inventory table - connection = ConnectionHelper.getConnection(dataSource); - statement = connection.prepareStatement(ConnectionHelper.UPDATE_INVENTORY); - statement.setInt(2, itemID); - statement.setInt(1, quantity); - rs = statement.executeUpdate(); - - } catch (SQLException e) { - throw e; - } finally { - ConnectionHelper.cleanupConnection(connection, null, statement); - } - - - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/InventoryProcessor.java b/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/InventoryProcessor.java deleted file mode 100644 index f963b3f4ea..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/InventoryProcessor.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.chunkartifacts; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import com.ibm.jbatch.tck.artifacts.chunktypes.InventoryRecord; - - -@jakarta.inject.Named("inventoryProcessor") -public class InventoryProcessor implements jakarta.batch.api.chunk.ItemProcessor{ - - - @Override - public InventoryRecord processItem(Object record) throws Exception { - - - //The processor doesn't really do anything in this test. It just passes along - //the item item and the quantity to the item writer to create and order in the - //order table. - - int itemID = ((InventoryRecord)record).getItemID(); - int quantity = ((InventoryRecord)record).getQuantity(); - - return new InventoryRecord(itemID, quantity); - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/InventoryReader.java b/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/InventoryReader.java deleted file mode 100644 index 6f79a80021..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/InventoryReader.java +++ /dev/null @@ -1,144 +0,0 @@ -/** - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.chunkartifacts; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.io.Serializable; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.logging.Logger; - -import jakarta.batch.api.chunk.AbstractItemReader; -import jakarta.batch.runtime.context.JobContext; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import javax.sql.DataSource; - -import com.ibm.jbatch.tck.artifacts.chunktypes.InventoryCheckpointData; -import com.ibm.jbatch.tck.artifacts.chunktypes.InventoryRecord; - -@jakarta.inject.Named("inventoryReader") -public class InventoryReader extends AbstractItemReader { - - private static final String CLASSNAME = InventoryReader.class.getName(); - private final static Logger logger = Logger.getLogger(CLASSNAME); - - - protected DataSource dataSource = null; - - @Inject - JobContext jobCtx; - - @Inject - StepContext stepCtx; - - - int readerIndex = 0; //the number of items that have already been read - InventoryCheckpointData inventoryCheckpoint = new InventoryCheckpointData(); - - - public void open(Serializable cpd) throws NamingException { - - InventoryCheckpointData checkpointData = (InventoryCheckpointData)cpd; - - - - InitialContext ctx = new InitialContext(); - dataSource = (DataSource) ctx.lookup(ConnectionHelper.jndiName); - - if (cpd != null) { - this.readerIndex = checkpointData.getInventoryCount(); - // Fix for Bug 5490: https://java.net/bugzilla/show_bug.cgi?id=5490 - stepCtx.setTransientUserData(this.readerIndex); - } - } - - public InventoryRecord readItem() throws Exception { - - - Connection connection = null; - PreparedStatement statement = null; - ResultSet rs = null; - - try { - connection = ConnectionHelper.getConnection(dataSource); - - statement = connection.prepareStatement(ConnectionHelper.SELECT_INVENTORY); - statement.setInt(1, 1); - rs = statement.executeQuery(); - - int quantity = -1; - while (rs.next()) { - quantity = rs.getInt("quantity"); - } - - //If we run out of items we are done so stop processing orders - if (quantity < 1) { - return null; - } - - //decrement the quantity and update the table - - InventoryRecord ir = new InventoryRecord(1, --quantity); - decrementInventory(connection, ir); - - readerIndex++; - this.inventoryCheckpoint.setInventoryCount(readerIndex); - - return new InventoryRecord(1, 1); //Every order only orders 1 item - } catch (SQLException e) { - throw e; - } finally { - ConnectionHelper.cleanupConnection(connection, rs, statement); - } - - } - - - @Override - public Serializable checkpointInfo() throws Exception { - logger.finer("InventoryReader.getInventoryCheckpoint() index = " +this.inventoryCheckpoint.getInventoryCount()); - - return this.inventoryCheckpoint; - } - - - - - private void decrementInventory(Connection connection, InventoryRecord record) throws SQLException { - - int itemID = record.getItemID(); - int quantity = record.getQuantity(); - - PreparedStatement statement = null; - - statement = connection.prepareStatement(ConnectionHelper.UPDATE_INVENTORY); - statement.setInt(2, itemID); - statement.setInt(1, quantity); - int rs = statement.executeUpdate(); - - } - - - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/InventoryStepListener.java b/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/InventoryStepListener.java deleted file mode 100644 index 0fa1f307e0..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/InventoryStepListener.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.chunkartifacts; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.logging.Logger; - -import jakarta.batch.api.listener.AbstractStepListener; -import jakarta.batch.runtime.context.JobContext; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import javax.sql.DataSource; - -import com.ibm.jbatch.tck.artifacts.common.StatusConstants; - -@jakarta.inject.Named("inventoryStepListener") -public class InventoryStepListener extends AbstractStepListener implements StatusConstants { - - private final static String sourceClass = InventoryStepListener.class.getName(); - private final static Logger logger = Logger.getLogger(sourceClass); - - @Inject - StepContext stepCtx; - - @Inject - JobContext jobCtx; - - //protected String jndiName = "jdbc/orderDB"; - - protected DataSource dataSource = null; - - private void init() throws NamingException { - if (dataSource == null) { - InitialContext ctx = new InitialContext(); - dataSource = (DataSource) ctx.lookup(ConnectionHelper.jndiName); - } - } - - @Override - public void afterStep() throws Exception { - logger.fine("afterStep"); - - int finalInventoryCount = this.getInventoryCount(); - int orderCount = this.getOrderCount(); - // Fix for Bug 5490: https://java.net/bugzilla/show_bug.cgi?id=5490 - String initCheckpoint = String.valueOf((Integer)stepCtx.getTransientUserData()); - - String exitStatus = "Inventory=" + finalInventoryCount + " InitialCheckpoint=" + initCheckpoint + " OrderCount="+orderCount; - jobCtx.setExitStatus(exitStatus); - } - - - private int getInventoryCount() throws Exception { - - this.init(); - - Connection connection = null; - PreparedStatement statement = null; - ResultSet rs = null; - - try { - connection = ConnectionHelper.getConnection(dataSource); - - statement = connection.prepareStatement(ConnectionHelper.SELECT_INVENTORY); - statement.setInt(1, 1); - rs = statement.executeQuery(); - - int quantity = -1; - while (rs.next()) { - quantity = rs.getInt("quantity"); - } - - return quantity; - - } catch (SQLException e) { - throw e; - } finally { - ConnectionHelper.cleanupConnection(connection, rs, statement); - } - - } - - private int getOrderCount() throws Exception { - - this.init(); - - Connection connection = null; - PreparedStatement statement = null; - ResultSet rs = null; - - try { - connection = ConnectionHelper.getConnection(dataSource); - - statement = connection.prepareStatement(ConnectionHelper.COUNT_ORDERS); - rs = statement.executeQuery(); - - int count = 0; - while (rs.next()) { - count = rs.getInt("rowcount"); - } - - return count; - - } catch (SQLException e) { - throw e; - } finally { - ConnectionHelper.cleanupConnection(connection, rs, statement); - } - - } - - @Override - public void beforeStep() { - } - - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/InventoryWriter.java b/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/InventoryWriter.java deleted file mode 100644 index fe883ea5fa..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/InventoryWriter.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.chunkartifacts; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.io.Serializable; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; -import java.util.List; - -import jakarta.batch.api.BatchProperty; -import jakarta.batch.api.chunk.AbstractItemWriter; -import jakarta.inject.Inject; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import javax.sql.DataSource; - -import com.ibm.jbatch.tck.artifacts.chunktypes.InventoryRecord; - -@jakarta.inject.Named("inventoryWriter") -public class InventoryWriter extends AbstractItemWriter { - - protected DataSource dataSource = null; - - @Inject - @BatchProperty(name = "forced.fail.count") - String forcedFailCountProp; - - @Inject - @BatchProperty(name = "dummy.delay.seconds") - String dummyDelayProp; - - int forcedFailCount, dummyDelay = -1; - - int writerIndex = 0; // the number of items that have already been written - - @Override - public void open(Serializable cpd) throws NamingException { - - InitialContext ctx = new InitialContext(); - dataSource = (DataSource) ctx.lookup(ConnectionHelper.jndiName); - - forcedFailCount = Integer.parseInt(forcedFailCountProp); - dummyDelay = Integer.parseInt(dummyDelayProp); - - } - - @Override - public void writeItems(List records) throws Exception { - - - int itemID = -1; - int quantity = -1; - - Connection connection = null; - PreparedStatement statement = null; - - try { - connection = ConnectionHelper.getConnection(dataSource); - - for (Object record : records) { - itemID = ((InventoryRecord)record).getItemID(); - quantity = ((InventoryRecord)record).getQuantity(); - - statement = connection.prepareStatement(ConnectionHelper.INSERT_ORDER); - statement.setInt(1, itemID); - statement.setInt(2, quantity); - int rs = statement.executeUpdate(); - - writerIndex++; - - if (forcedFailCount != 0 && writerIndex >= forcedFailCount) { - // after writing up to the forced fail number force a dummy delay - if (dummyDelay > 0) { - Thread.sleep(dummyDelay); // sleep for dummyDelay seconds to - // force a tran timeout - or to show that one does not hit? - forcedFailCount = 0; - dummyDelay = 0; - } else { - throw new Exception("Fail on purpose in InventoryRecord.readItem()"); - } - } - } - } catch (SQLException e) { - throw e; - } finally { - ConnectionHelper.cleanupConnection(connection, null, statement); - } - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/NumbersReader.java b/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/NumbersReader.java deleted file mode 100644 index 8afee5ccb2..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/NumbersReader.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.chunkartifacts; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.io.Serializable; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.logging.Logger; - -import jakarta.batch.api.BatchProperty; -import jakarta.batch.api.chunk.AbstractItemReader; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import javax.sql.DataSource; - - - -import com.ibm.jbatch.tck.artifacts.chunktypes.NumbersCheckpointData; -import com.ibm.jbatch.tck.artifacts.chunktypes.NumbersRecord; -import com.ibm.jbatch.tck.artifacts.reusable.MyParentException; - - -@jakarta.inject.Named("numbersReader") -public class NumbersReader extends AbstractItemReader { - - private static final String CLASSNAME = NumbersReader.class.getName(); - private final static Logger logger = Logger.getLogger(CLASSNAME); - - - protected DataSource dataSource = null; - - private static final int STATE_NORMAL = 0; - private static final int STATE_RETRY = 1; - private int testState = STATE_NORMAL; - - @Inject - StepContext stepCtx; - - @Inject - @BatchProperty(name="forced.fail.count.read") - String forcedFailCountProp; - - int forcedFailCount, dummyDelay, expectedReaderChkp = -1; - - int readerIndex = 1; - - int failindex = 0; - - NumbersCheckpointData numbersCheckpoint = new NumbersCheckpointData(); - - public void open(Serializable cpd) throws NamingException { - - NumbersCheckpointData numbersCheckpointData = (NumbersCheckpointData)cpd; - - forcedFailCount = Integer.parseInt(forcedFailCountProp); - - InitialContext ctx = new InitialContext(); - dataSource = (DataSource) ctx.lookup(RetryConnectionHelper.jndiName); - - - if (cpd != null) { - forcedFailCount = 0; - this.readerIndex = numbersCheckpointData.getCount(); - stepCtx.getProperties().setProperty("init.checkpoint", this.readerIndex + ""); - } - } - - @Override - public NumbersRecord readItem() throws Exception { - int i = readerIndex; - - // Throw an exception when forcedFailCount is reached - if (forcedFailCount != 0 && readerIndex >= forcedFailCount) { - forcedFailCount = 0; - failindex = readerIndex; - testState = STATE_RETRY; - TestUtil.logMsg("Fail on purpose NumbersRecord.readItem

"); - throw new MyParentException("Fail on purpose in NumbersRecord.readItem()"); - } - - if (testState == STATE_RETRY) - { - if(stepCtx.getProperties().getProperty("retry.read.exception.invoked") != "true") { - TestUtil.logMsg("onRetryReadException not invoked

"); - throw new Exception("onRetryReadException not invoked"); - } - - if(stepCtx.getProperties().getProperty("retry.read.exception.match") != "true") { - TestUtil.logMsg("retryable exception does not match"); - throw new Exception("retryable exception does not match"); - } - - testState = STATE_NORMAL; - } - - if (readerIndex > 5) { - return null; - } - - Connection connection = null; - PreparedStatement statement = null; - ResultSet rs = null; - - try { - connection = RetryConnectionHelper.getConnection(dataSource); - - statement = connection.prepareStatement(RetryConnectionHelper.SELECT_NUMBERS); - statement.setInt(1, readerIndex); - rs = statement.executeQuery(); - - int quantity = -1; - while (rs.next()) { - quantity = rs.getInt("quantity"); - } - - readerIndex++; - - return new NumbersRecord(i, quantity); - } catch (SQLException e) { - throw e; - } finally { - RetryConnectionHelper.cleanupConnection(connection, rs, statement); - } - - } - - @Override - public Serializable checkpointInfo() throws Exception { - NumbersCheckpointData _chkptData = new NumbersCheckpointData(); - _chkptData.setCount(readerIndex); - stepCtx.getProperties().setProperty("checkpoint.index", Integer.toString(readerIndex)); - return _chkptData; - } - - - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/RetryConnectionHelper.java b/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/RetryConnectionHelper.java deleted file mode 100644 index c6983a3e25..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/RetryConnectionHelper.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright 2012 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.chunkartifacts; - - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.logging.Logger; - -import javax.sql.DataSource; - -public class RetryConnectionHelper { - - private static final String CLASSNAME = RetryConnectionHelper.class.getName(); - private final static Logger logger = Logger.getLogger(CLASSNAME); - - public static final String jndiName = "java:module/env/jdbc/orderDB"; - - public static final String INSERT_NUMBERS = "insert into numbers values(?, ?)"; - - public static final String UPDATE_NUMBERS = "update numbers set quantity = ? where item = ?"; - - public static final String SELECT_NUMBERS = "select item, quantity from numbers where item = ?"; - - - /* - * Connection where autoCommit defaults to true unless we are in a global tran where it gets ignored - */ - public static Connection getConnection(DataSource dataSource) throws SQLException { - - Connection conn = dataSource.getConnection(); - return conn; - } - - - public static Connection getConnection(DataSource dataSource, boolean autoCommit) throws SQLException { - Connection conn = dataSource.getConnection(); - conn.setAutoCommit(autoCommit); - - return conn; - } - - /** - * closes connection to DB - * - * @param conn - connection object to close - * @param rs - result set object to close - * @param statement - statement object to close - */ - public static void cleanupConnection(Connection conn, ResultSet rs, PreparedStatement statement) { - logger.entering(CLASSNAME, "cleanupConnection", new Object[] {conn, rs, statement}); - if (rs != null) { - try { - rs.close(); - } catch (SQLException e) { - throw new RuntimeException(e); - } - } - - if (statement != null) { - try { - statement.close(); - } catch (SQLException e) { - throw new RuntimeException(e); - } - } - - if (conn != null) { - try { - conn.close(); - } catch (SQLException e) { - throw new RuntimeException(e); - } finally { - try { - conn.close(); - } catch (SQLException e) { - throw new RuntimeException(e); - } - } - } - logger.exiting(CLASSNAME, "cleanupConnection"); - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/RetryInitProcessor.java b/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/RetryInitProcessor.java deleted file mode 100644 index 8fc0f8b009..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/RetryInitProcessor.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.chunkartifacts; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import jakarta.batch.api.BatchProperty; -import jakarta.batch.api.chunk.ItemProcessor; -import jakarta.inject.Inject; - -import com.ibm.jbatch.tck.artifacts.chunktypes.NumbersRecord; - - -@jakarta.inject.Named("retryInitProcessor") -public class RetryInitProcessor implements ItemProcessor { - - - @Inject - @BatchProperty(name="init.numbers.quantity") - String quantityProp = null; - - @Override - public NumbersRecord processItem(Object record) throws Exception { - //we don't care what quantity is in the db, we just want to reset it - int item = ((NumbersRecord)record).getItem(); - int quantity = Integer.parseInt(quantityProp); - //reset the database to initial state, this is for test setup purposes only - return new NumbersRecord(item, quantity); - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/RetryInitReader.java b/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/RetryInitReader.java deleted file mode 100644 index 574a621ffa..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/RetryInitReader.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.chunkartifacts; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.io.Serializable; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - -import jakarta.batch.api.chunk.AbstractItemReader; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import javax.sql.DataSource; - -import com.ibm.jbatch.tck.artifacts.chunktypes.NumbersCheckpointData; -import com.ibm.jbatch.tck.artifacts.chunktypes.NumbersRecord; - -@jakarta.inject.Named("retryInitReader") -public class RetryInitReader extends AbstractItemReader { - - protected DataSource dataSource = null; - - private int count = 0; - - public void open(Serializable cpd) throws NamingException { - InitialContext ctx = new InitialContext(); - dataSource = (DataSource) ctx.lookup(RetryConnectionHelper.jndiName); - } - - @Override - public NumbersRecord readItem() throws SQLException { - if (count > 19) { - return null; - } - - Connection connection = null; - PreparedStatement statement = null; - ResultSet rs = null; - - try { - connection = RetryConnectionHelper.getConnection(dataSource); - - statement = connection.prepareStatement(RetryConnectionHelper.SELECT_NUMBERS); - statement.setInt(1, 1); - rs = statement.executeQuery(); - - int quantity = -1; - while (rs.next()) { - quantity = rs.getInt("quantity"); - count++; - } - - return new NumbersRecord(count, quantity); - - } catch (SQLException e) { - e.printStackTrace(); - throw e; - } finally { - RetryConnectionHelper.cleanupConnection(connection, rs, statement); - } - - } - - @Override - public Serializable checkpointInfo() { - NumbersCheckpointData chkpData = new NumbersCheckpointData(); - chkpData.setCount(count); - return chkpData; - } -} - diff --git a/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/RetryInitWriter.java b/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/RetryInitWriter.java deleted file mode 100644 index bf4f67d080..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/RetryInitWriter.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.chunkartifacts; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.io.Serializable; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; -import java.util.List; - -import jakarta.batch.api.chunk.AbstractItemWriter; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import javax.sql.DataSource; - -import com.ibm.jbatch.tck.artifacts.chunktypes.NumbersRecord; - -@jakarta.inject.Named("retryInitWriter") -public class RetryInitWriter extends AbstractItemWriter { - - - protected DataSource dataSource = null; - - public void open(Serializable cpd) throws NamingException { - InitialContext ctx = new InitialContext(); - dataSource = (DataSource) ctx.lookup(RetryConnectionHelper.jndiName); - } - - @Override - public void writeItems(List records) throws SQLException { - - int item = -1; - int quantity = -1; - - Connection connection = null; - PreparedStatement statement = null; - - try { - for (Object record : records) { - item = ((NumbersRecord)record).getItem(); - quantity = ((NumbersRecord)record).getQuantity(); - - connection = RetryConnectionHelper.getConnection(dataSource); - - statement = connection.prepareStatement(RetryConnectionHelper.UPDATE_NUMBERS); - statement.setInt(2, item); - statement.setInt(1, quantity); - int rs = statement.executeUpdate(); - } - - } catch (SQLException e) { - e.printStackTrace(); - throw e; - } finally { - RetryConnectionHelper.cleanupConnection(connection, null, statement); - } - } -} - diff --git a/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/RetryProcessor.java b/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/RetryProcessor.java deleted file mode 100644 index 170a06fdaa..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/RetryProcessor.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.chunkartifacts; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.Properties; - -import jakarta.batch.api.BatchProperty; -import jakarta.batch.api.chunk.ItemProcessor; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - - - -import com.ibm.jbatch.tck.artifacts.chunktypes.NumbersRecord; -import com.ibm.jbatch.tck.artifacts.reusable.MyParentException; - - -@jakarta.inject.Named("retryProcessor") -public class RetryProcessor implements ItemProcessor { - - - @Inject - StepContext stepCtx; - - @Inject - @BatchProperty(name="forced.fail.count.process") - String forcedFailCountProp; - - @Inject - @BatchProperty(name="rollback") - String rollbackProp; - - private static final int STATE_NORMAL = 0; - private static final int STATE_RETRY = 1; - private static final int STATE_SKIP = 2; - private static final int STATE_EXCEPTION = 3; - - private int testState = STATE_NORMAL; - - int failitem = 0; - int count = 1; - int forcedFailCount; - - boolean isInited = false; - boolean rollback; - - int failindex = 0; - - public NumbersRecord processItem(Object record) throws Exception { - int item = ((NumbersRecord)record).getItem(); - int quantity = ((NumbersRecord)record).getQuantity(); - TestUtil.logMsg("Processing item: " + item + "...
"); - TestUtil.logMsg("Processing quantity: " + quantity + "...

"); - - if(!isInited) { - forcedFailCount = Integer.parseInt(forcedFailCountProp); - rollback = Boolean.parseBoolean(rollbackProp); - isInited = true; - } - - // Throw an exception when forcedFailCount is reached - if (forcedFailCount != 0 && count >= forcedFailCount && (testState == STATE_NORMAL)) { - //forcedFailCount = 0; - failindex = count; - testState = STATE_RETRY; - TestUtil.logMsg("Fail on purpose in NumbersRecord.processItem

"); - throw new MyParentException("Fail on purpose in NumbersRecord.processItem()"); - } else if (forcedFailCount != 0 && (count >= forcedFailCount) && (testState == STATE_EXCEPTION)) { - failindex = count; - testState = STATE_SKIP; - forcedFailCount = 0; - TestUtil.logMsg("Test skip -- Fail on purpose NumbersRecord.readItem

"); - throw new MyParentException("Test skip -- Fail on purpose in NumbersRecord.readItem()"); - } - - if (testState == STATE_RETRY) - { - if (((Properties)stepCtx.getTransientUserData()).getProperty("retry.process.exception.invoked") != "true") { - TestUtil.logMsg("onRetryProcessException not invoked

"); - throw new Exception("onRetryProcessException not invoked"); - } else { - TestUtil.logMsg("onRetryProcessException was invoked

"); - } - - if (((Properties)stepCtx.getTransientUserData()).getProperty("retry.process.exception.match") != "true") { - TestUtil.logMsg("retryable exception does not match

"); - throw new Exception("retryable exception does not match"); - } else { - TestUtil.logMsg("retryable exception matches

"); - } - - testState = STATE_EXCEPTION; - } else if(testState == STATE_SKIP) { - if (((Properties)stepCtx.getTransientUserData()).getProperty("skip.process.item.invoked") != "true") { - TestUtil.logMsg("onSkipProcessItem not invoked

"); - throw new Exception("onSkipProcessItem not invoked"); - } else { - TestUtil.logMsg("onSkipProcessItem was invoked

"); - } - - if (((Properties)stepCtx.getTransientUserData()).getProperty("skip.process.item.match") != "true") { - TestUtil.logMsg("skippable exception does not match

"); - throw new Exception("skippable exception does not match"); - } else { - TestUtil.logMsg("skippable exception matches

"); - } - testState = STATE_NORMAL; - } - - - quantity = quantity + 1; - TestUtil.logMsg("Process [item: " + item + " -- new quantity: " + quantity + "]

"); - count++; - - return new NumbersRecord(item, quantity); - } - -} - diff --git a/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/RetryReader.java b/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/RetryReader.java deleted file mode 100644 index d7fa373703..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/RetryReader.java +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.chunkartifacts; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.io.Serializable; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.Properties; -import java.util.logging.Logger; - -import jakarta.batch.api.BatchProperty; -import jakarta.batch.api.chunk.AbstractItemReader; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import javax.sql.DataSource; - - - -import com.ibm.jbatch.tck.artifacts.chunktypes.NumbersCheckpointData; -import com.ibm.jbatch.tck.artifacts.chunktypes.NumbersRecord; -import com.ibm.jbatch.tck.artifacts.reusable.MyParentException; - - -@jakarta.inject.Named("retryReader") -public class RetryReader extends AbstractItemReader { - - private static final String CLASSNAME = NumbersReader.class.getName(); - private final static Logger logger = Logger.getLogger(CLASSNAME); - - - protected DataSource dataSource = null; - - private static final int STATE_NORMAL = 0; - private static final int STATE_RETRY = 1; - private static final int STATE_SKIP = 2; - private static final int STATE_EXCEPTION = 3; - - private int testState = STATE_NORMAL; - - @Inject - StepContext stepCtx; - - @Inject - @BatchProperty(name="forced.fail.count.read") - String forcedFailCountProp; - - @Inject - @BatchProperty(name="rollback") - String rollbackProp; - - - int forcedFailCount, expectedReaderChkp = -1; - boolean rollback; - boolean didRetry; - - int readerIndex = 1; - - int failindex = 0; - - NumbersCheckpointData numbersCheckpoint = new NumbersCheckpointData(); - - public void open(Serializable cpd) throws NamingException { - NumbersCheckpointData numbersCheckpointData = (NumbersCheckpointData)cpd; - - forcedFailCount = Integer.parseInt(forcedFailCountProp); - rollback = Boolean.parseBoolean(rollbackProp); - - InitialContext ctx = new InitialContext(); - dataSource = (DataSource) ctx.lookup(RetryConnectionHelper.jndiName); - - initializeUserDataWithProperties(); - - if (cpd != null) { - this.readerIndex = numbersCheckpointData.getCount(); - ((Properties)stepCtx.getTransientUserData()).setProperty("init.checkpoint", this.readerIndex + ""); - } - } - - @Override - public NumbersRecord readItem() throws Exception { - int i = readerIndex; - - TestUtil.logMsg("Reading item: " + readerIndex + "...
"); - - // Throw an exception when forcedFailCount is reached - if (forcedFailCount != 0 && (readerIndex >= forcedFailCount) && (testState == STATE_NORMAL)) { - //forcedFailCount = 0; - failindex = readerIndex; - testState = STATE_RETRY; - TestUtil.logMsg("Fail on purpose NumbersRecord.readItem

"); - throw new MyParentException("Fail on purpose in NumbersRecord.readItem()"); - - } else if (forcedFailCount != 0 && (readerIndex >= forcedFailCount) && (testState == STATE_EXCEPTION)) { - failindex = readerIndex; - testState = STATE_SKIP; - forcedFailCount = 0; - TestUtil.logMsg("Test skip -- Fail on purpose NumbersRecord.readItem

"); - throw new MyParentException("Test skip -- Fail on purpose in NumbersRecord.readItem()"); - } - - - if (testState == STATE_RETRY) - { - // should be retrying at same index with no rollback - /*if(!rollback) { - if(failindex != readerIndex) - throw new Exception("Error reading data. Expected to be at index " + failindex + " but got index " + readerIndex); - } - - // should be retrying at last checkpoint with rollback - else { - - int checkpointIndex = Integer.parseInt((Properties)stepCtx.getTransientUserData()).getProperty("checkpoint.index")); - - if(checkpointIndex != readerIndex) - throw new Exception("Error reading data. Expected to be at index " + checkpointIndex + " but got index " + readerIndex); - }*/ - - if (((Properties)stepCtx.getTransientUserData()).getProperty("retry.read.exception.invoked") != "true") { - TestUtil.logMsg("onRetryReadException not invoked

"); - throw new Exception("onRetryReadException not invoked"); - } else { - TestUtil.logMsg("onRetryReadException was invoked

"); - } - - if (((Properties)stepCtx.getTransientUserData()).getProperty("retry.read.exception.match") != "true") { - TestUtil.logMsg("retryable exception does not match

"); - throw new Exception("retryable exception does not match"); - } else { - TestUtil.logMsg("Retryable exception matches

"); - } - testState = STATE_EXCEPTION; - //TestUtil.logMsg("Test skip after retry -- Fail on purpose in NumbersRecord.readItem

"); - //throw new MyParentException("Test skip after retry -- Fail on purpose in NumbersRecord.readItem()"); - } - else if(testState == STATE_SKIP) { - if (((Properties)stepCtx.getTransientUserData()).getProperty("skip.read.item.invoked") != "true") { - TestUtil.logMsg("onSkipReadItem not invoked

"); - throw new Exception("onSkipReadItem not invoked"); - } else { - TestUtil.logMsg("onSkipReadItem was invoked

"); - } - - if (((Properties)stepCtx.getTransientUserData()).getProperty("skip.read.item.match") != "true") { - TestUtil.logMsg("skippable exception does not match

"); - throw new Exception("skippable exception does not match"); - } else { - TestUtil.logMsg("skippable exception matches

"); - } - testState = STATE_NORMAL; - } - - - if (readerIndex > 20) { - return null; - } - - Connection connection = null; - PreparedStatement statement = null; - ResultSet rs = null; - - try { - connection = RetryConnectionHelper.getConnection(dataSource); - - statement = connection.prepareStatement(RetryConnectionHelper.SELECT_NUMBERS); - statement.setInt(1, readerIndex); - rs = statement.executeQuery(); - - int quantity = -1; - while (rs.next()) { - quantity = rs.getInt("quantity"); - } - - readerIndex++; - TestUtil.logMsg("Read [item: " + i + " quantity: " + quantity + "]

"); - return new NumbersRecord(i, quantity); - } catch (SQLException e) { - throw e; - } finally { - RetryConnectionHelper.cleanupConnection(connection, rs, statement); - } - - } - - @Override - public Serializable checkpointInfo() throws Exception { - NumbersCheckpointData _chkptData = new NumbersCheckpointData(); - _chkptData.setCount(readerIndex); - ((Properties)stepCtx.getTransientUserData()).setProperty("checkpoint.index", Integer.toString(readerIndex)); - return _chkptData; - } - - // Since this is a late change to the TCK, we'll be a bit more lenient than we might and not worry - // about when exactly the Properties object should or shouldn't already be in the userdata. We'll just - // create if needed and if not continue on. - private void initializeUserDataWithProperties() { - if (stepCtx.getTransientUserData() == null) { - stepCtx.setTransientUserData(new Properties()); - } - } - -} - diff --git a/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/RetryWriter.java b/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/RetryWriter.java deleted file mode 100644 index 5621d753de..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/chunkartifacts/RetryWriter.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.chunkartifacts; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.io.Serializable; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; -import java.util.List; -import java.util.Properties; - -import jakarta.batch.api.BatchProperty; -import jakarta.batch.api.chunk.AbstractItemWriter; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import javax.sql.DataSource; - - - -import com.ibm.jbatch.tck.artifacts.chunktypes.NumbersRecord; -import com.ibm.jbatch.tck.artifacts.reusable.MyParentException; - - -@jakarta.inject.Named("retryWriter") -public class RetryWriter extends AbstractItemWriter { - - - protected DataSource dataSource = null; - - @Inject - StepContext stepCtx; - - - @Inject - @BatchProperty(name="forced.fail.count.write") - String forcedFailCountProp; - - @Inject - @BatchProperty(name="rollback") - String rollbackProp; - - private static final int STATE_NORMAL = 0; - private static final int STATE_RETRY = 1; - private static final int STATE_SKIP = 2; - private static final int STATE_EXCEPTION = 3; - - private int testState = STATE_NORMAL; - - int forcedFailCount = 0; - boolean isInited = false; - boolean rollback; - int count = 1; - - @Override - public void open(Serializable cpd) throws NamingException { - InitialContext ctx = new InitialContext(); - dataSource = (DataSource) ctx.lookup(RetryConnectionHelper.jndiName); - } - - @Override - public void writeItems(List records) throws Exception { - int item = -1; - int quantity = -1; - int check = -1; - - - if(!isInited) { - forcedFailCount = Integer.parseInt(forcedFailCountProp); - rollback = Boolean.parseBoolean(rollbackProp); - isInited = true; - } - - for (Object record : records) { - item = ((NumbersRecord)record).getItem(); - quantity = ((NumbersRecord)record).getQuantity(); - - TestUtil.logMsg("Writing item: " + item + "...
"); - - // Throw an exception when forcedFailCount is reached - if (forcedFailCount != 0 && count >= forcedFailCount && (testState == STATE_NORMAL)) { - //forcedFailCount = 0; - testState = STATE_RETRY; - TestUtil.logMsg("Fail on purpose in NumbersRecord.writeItems

"); - throw new MyParentException("Fail on purpose in NumbersRecord.writeItems()"); - } else if (forcedFailCount != 0 && count > forcedFailCount && (testState == STATE_EXCEPTION)) { - testState = STATE_SKIP; - forcedFailCount = 0; - TestUtil.logMsg("Test skip -- Fail on purpose NumbersRecord.writeItems

"); - throw new MyParentException("Test skip -- Fail on purpose in NumbersRecord.writeItems()"); - } - - if (testState == STATE_RETRY) - { - - if (((Properties)stepCtx.getTransientUserData()).getProperty("retry.write.exception.invoked") != "true") { - TestUtil.logMsg("onRetryWriteException not invoked

"); - throw new Exception("onRetryWriteException not invoked"); - } else { - TestUtil.logMsg("onRetryWriteException was invoked

"); - } - - if (((Properties)stepCtx.getTransientUserData()).getProperty("retry.write.exception.match") != "true") { - TestUtil.logMsg("retryable exception does not match"); - throw new Exception("retryable exception does not match"); - } else { - TestUtil.logMsg("retryable exception matches"); - } - - testState = STATE_EXCEPTION; - } else if(testState == STATE_SKIP) { - if (((Properties)stepCtx.getTransientUserData()).getProperty("skip.write.item.invoked") != "true") { - TestUtil.logMsg("onSkipWriteItem not invoked

"); - throw new Exception("onSkipWriteItem not invoked"); - } else { - TestUtil.logMsg("onSkipWriteItem was invoked

"); - } - - if (((Properties)stepCtx.getTransientUserData()).getProperty("skip.write.item.match") != "true") { - TestUtil.logMsg("skippable exception does not match

"); - throw new Exception("skippable exception does not match"); - } else { - TestUtil.logMsg("skippable exception matches

"); - } - testState = STATE_NORMAL; - } - - Connection connection = null; - PreparedStatement statement = null; - - try { - connection = RetryConnectionHelper.getConnection(dataSource); - - statement = connection.prepareStatement(RetryConnectionHelper.UPDATE_NUMBERS); - statement.setInt(2, item); - statement.setInt(1, quantity); - TestUtil.logMsg("Write [item: " + item + " quantity: " + quantity + "]

"); - int rs = statement.executeUpdate(); - count++; - - } catch (SQLException e) { - throw e; - } finally { - RetryConnectionHelper.cleanupConnection(connection, null, statement); - } - } - } - -} - diff --git a/src/com/ibm/jbatch/tck/artifacts/chunktypes/ArrayIndexCheckpointData.java b/src/com/ibm/jbatch/tck/artifacts/chunktypes/ArrayIndexCheckpointData.java deleted file mode 100644 index 80f645e296..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/chunktypes/ArrayIndexCheckpointData.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.chunktypes; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.io.Externalizable; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.logging.Logger; - -@jakarta.inject.Named("arrayIndexCheckpointData") -public class ArrayIndexCheckpointData implements Externalizable { - - private final static Logger logger = Logger.getLogger(ArrayIndexCheckpointData.class.getName()); - - private final static long serialVersionUID = 1L; - private int i = 0; - - @Override - public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { - i = in.readInt(); - logger.fine("AJM: reading in the chkpt data: " + i); - } - - @Override - public void writeExternal(ObjectOutput out) throws IOException { - logger.fine("AJM: must have been checkpointed, writing out array index: " + i); - out.writeInt(i); - - } - - public int getCurrentIndex(){ - logger.fine("AJM: current index = " + i); - return i; - } - - public void setCurrentIndex(int incoming_idx){ - i = incoming_idx; - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/chunktypes/CheckpointData.java b/src/com/ibm/jbatch/tck/artifacts/chunktypes/CheckpointData.java deleted file mode 100644 index 296725c3d5..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/chunktypes/CheckpointData.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.chunktypes; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.io.Externalizable; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; - -@jakarta.inject.Named("checkpointData") -public class CheckpointData implements Externalizable { - - private final static long serialVersionUID = 1L; - - @Override - public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { - // TODO Auto-generated method stub - } - - @Override - public void writeExternal(ObjectOutput out) throws IOException { - // TODO Auto-generated method stub - - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/chunktypes/InventoryCheckpointData.java b/src/com/ibm/jbatch/tck/artifacts/chunktypes/InventoryCheckpointData.java deleted file mode 100644 index d8dce56164..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/chunktypes/InventoryCheckpointData.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2012 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.chunktypes; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.io.Externalizable; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; - -public class InventoryCheckpointData implements Externalizable { - - private final static long serialVersionUID = 1L; - - private int inventoryCount; //this represent how many orders have been completely processed. - - - public int getInventoryCount() { - return inventoryCount; - } - - public void setInventoryCount(int inventoryCount) { - this.inventoryCount = inventoryCount; - } - - @Override - public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { - inventoryCount = in.readInt(); - } - - @Override - public void writeExternal(ObjectOutput out) throws IOException { - out.writeInt(inventoryCount); - - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/chunktypes/InventoryRecord.java b/src/com/ibm/jbatch/tck/artifacts/chunktypes/InventoryRecord.java deleted file mode 100644 index 04a317aac2..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/chunktypes/InventoryRecord.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright 2012 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.chunktypes; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -public class InventoryRecord { - - private int itemID; - private int quantity; - - public InventoryRecord(int itemID, int quantity) { - this.itemID = itemID; - this.quantity = quantity; - } - - public int getItemID() { - return itemID; - } - - public int getQuantity() { - return quantity; - } - - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/chunktypes/NumbersCheckpointData.java b/src/com/ibm/jbatch/tck/artifacts/chunktypes/NumbersCheckpointData.java deleted file mode 100644 index 59c3eeca2b..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/chunktypes/NumbersCheckpointData.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2012 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.chunktypes; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.io.Externalizable; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; - -public class NumbersCheckpointData implements Externalizable { - - private final static long serialVersionUID = 1L; - - private int count; - - - public int getCount() { - return count; - } - - public void setCount(int count) { - this.count = count; - } - - @Override - public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { - count = in.readInt(); - } - - @Override - public void writeExternal(ObjectOutput out) throws IOException { - out.writeInt(count); - - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/chunktypes/NumbersRecord.java b/src/com/ibm/jbatch/tck/artifacts/chunktypes/NumbersRecord.java deleted file mode 100644 index cef1ceaa33..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/chunktypes/NumbersRecord.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2012 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.chunktypes; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -public class NumbersRecord { - - private int item; - private int quantity; - - public NumbersRecord(int item, int quantity) { - this.item = item; - this.quantity = quantity; - } - - public int getItem() { - return item; - } - - public int getQuantity() { - return quantity; - } - - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/chunktypes/ReadRecord.java b/src/com/ibm/jbatch/tck/artifacts/chunktypes/ReadRecord.java deleted file mode 100644 index 86339bf403..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/chunktypes/ReadRecord.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.chunktypes; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.logging.Logger; - -@jakarta.inject.Named("readRecord") -public class ReadRecord { - - private final static Logger logger = Logger.getLogger(ReadRecord.class.getName()); - - private int count = 0; - - public ReadRecord() { - //logger.fine("AJM: in ReadRecord ctor"); - } - - public ReadRecord(int in) { - count = in; - logger.fine("AJM: in ReadRecord ctor (int), count = " + count); - - } - public int getCount() { - return count; - } - - public void setRecord(int i) { - //logger.fine("AJM: in setRecord"); - count = i; - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/chunktypes/WriteRecord.java b/src/com/ibm/jbatch/tck/artifacts/chunktypes/WriteRecord.java deleted file mode 100644 index b79d6e4495..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/chunktypes/WriteRecord.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.chunktypes; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -@jakarta.inject.Named("writeRecord") -public class WriteRecord { -private int count = 0; - - public WriteRecord() { - - } - - public WriteRecord(int in) { - count = in; - - } - public int getCount() { - return count; - } - - public void setRecord(int i) { - count = i; - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/common/StatusConstants.java b/src/com/ibm/jbatch/tck/artifacts/common/StatusConstants.java deleted file mode 100644 index 8032aadb90..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/common/StatusConstants.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2012 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.common; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -public interface StatusConstants { - public final String GOOD_JOB_EXIT_STATUS = "JOB:ES:Good"; - public final String GOOD_STEP_EXIT_STATUS = "STEP:ES:Good"; - public final String SPECIAL_EXIT_STATUS = "STEP:ES:Special"; - - // Thought is that this should never happen in a successful test, even one in which failure is expected. - public final String UNEXPECTED = "ES: TCK Test Failure : unexpected"; - - public final String A_STEP_RAN = "StepRan;"; -} diff --git a/src/com/ibm/jbatch/tck/artifacts/reusable/CountInvocationsObjectParameterizationStepListener.java b/src/com/ibm/jbatch/tck/artifacts/reusable/CountInvocationsObjectParameterizationStepListener.java deleted file mode 100644 index 50a4e09bde..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/reusable/CountInvocationsObjectParameterizationStepListener.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.reusable; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.logging.Logger; - -import jakarta.batch.api.listener.AbstractStepListener; -import jakarta.batch.runtime.context.JobContext; -import jakarta.inject.Inject; -import jakarta.inject.Named; - -@Named -public class CountInvocationsObjectParameterizationStepListener extends AbstractStepListener { - - private final static Logger logger = Logger.getLogger(CountInvocationsObjectParameterizationStepListener.class.getName()); - - @Inject - private JobContext jobCtx = null; - - @Override - public void beforeStep() throws Exception { - if (jobCtx.getTransientUserData() == null) { - MyCounter ctr = new MyCounter(); - ctr.incrementBeforeCount(); - jobCtx.setTransientUserData(ctr); - } else if (jobCtx.getTransientUserData() instanceof MyCounter) { - MyCounter ctr = (MyCounter)jobCtx.getTransientUserData(); - ctr.incrementBeforeCount(); - } else { - logger.fine("In beforeStep(), not MyCounter"); - } - } - - @Override - public void afterStep() throws Exception { - if (jobCtx.getTransientUserData() instanceof MyCounter) { - MyCounter ctr = (MyCounter)jobCtx.getTransientUserData(); - ctr.incrementAfterCount(); - jobCtx.setExitStatus(ctr.getBeforeCount() + "," + ctr.getAfterCount()); - } else { - logger.fine("In afterStep(), not MyCounter"); - } - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/reusable/CountInvocationsStepListener.java b/src/com/ibm/jbatch/tck/artifacts/reusable/CountInvocationsStepListener.java deleted file mode 100644 index 6d052dabe8..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/reusable/CountInvocationsStepListener.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.reusable; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.logging.Logger; - -import jakarta.batch.api.listener.AbstractStepListener; -import jakarta.batch.runtime.context.JobContext; -import jakarta.inject.Inject; -import jakarta.inject.Named; - -@Named -public class CountInvocationsStepListener extends AbstractStepListener { - - private final static Logger logger = Logger.getLogger(CountInvocationsStepListener.class.getName()); - - @Inject - private JobContext jobCtx = null; - - public static int STATIC_BEFORE_COUNT = 0; - public static int STATIC_AFTER_COUNT = 0; - - @Override - public void beforeStep() throws Exception { - if (jobCtx.getTransientUserData() == null) { - MyCounter ctr = new MyCounter(); - ctr.incrementBeforeCount(); - jobCtx.setTransientUserData(ctr); - } else if (jobCtx.getTransientUserData() instanceof MyCounter) { - MyCounter ctr = (MyCounter)jobCtx.getTransientUserData(); - ctr.incrementBeforeCount(); - } else { - logger.fine("In beforeStep(), not MyCounter"); - } - STATIC_BEFORE_COUNT++; - } - - @Override - public void afterStep() throws Exception { - if (jobCtx.getTransientUserData() instanceof MyCounter) { - MyCounter ctr = (MyCounter)jobCtx.getTransientUserData(); - ctr.incrementAfterCount(); - jobCtx.setExitStatus(ctr.getBeforeCount() + "," + ctr.getAfterCount()); - } else { - logger.fine("In afterStep(), not MyCounter"); - } - STATIC_AFTER_COUNT++; - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/reusable/ExternalizableString.java b/src/com/ibm/jbatch/tck/artifacts/reusable/ExternalizableString.java deleted file mode 100644 index 1e95e103db..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/reusable/ExternalizableString.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Copyright 2012 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.reusable; - - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.io.Externalizable; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; - -public class ExternalizableString implements Externalizable { - - private String string; - - public ExternalizableString() { - } - - public ExternalizableString(final String string) { - this.string = string; - } - - public String getString() { - return string; - } - - public void setString(String string) { - this.string = string; - } - - @Override - public String toString() { - return this.string; - } - - @Override - public void readExternal(ObjectInput in) throws IOException, - ClassNotFoundException { - string = (String)in.readObject(); - } - - @Override - public void writeExternal(ObjectOutput out) throws IOException { - out.writeObject(string); - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/reusable/MyBatchletImpl.java b/src/com/ibm/jbatch/tck/artifacts/reusable/MyBatchletImpl.java deleted file mode 100644 index f7eb950dea..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/reusable/MyBatchletImpl.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.reusable; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.logging.Logger; - -import jakarta.batch.api.AbstractBatchlet; -import jakarta.batch.runtime.context.JobContext; -import jakarta.inject.Inject; - - -@jakarta.inject.Named("myBatchletImpl") -public class MyBatchletImpl extends AbstractBatchlet { - private final static Logger logger = Logger.getLogger(MyBatchletImpl.class.getName()); - - private volatile static int count = 1; - - public static String GOOD_EXIT_STATUS = "VERY GOOD INVOCATION"; - - @Inject - JobContext jobCtx; - - @Override - public String process() throws Exception { - - String curStatus = jobCtx.getExitStatus(); - - jobCtx.setExitStatus(curStatus + "UnusedExitStatusForPartitions"); - - logger.fine("Running batchlet process(): " + count); - - count++; - - return GOOD_EXIT_STATUS; - - } - - @Override - public void stop() throws Exception { - - } - - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/reusable/MyChildException.java b/src/com/ibm/jbatch/tck/artifacts/reusable/MyChildException.java deleted file mode 100644 index e5dcb4c989..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/reusable/MyChildException.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright 2012 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.reusable; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -public class MyChildException extends MyParentException { - - public MyChildException(){ - super(); - } - - public MyChildException(String s){ - super(s); - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/reusable/MyCounter.java b/src/com/ibm/jbatch/tck/artifacts/reusable/MyCounter.java deleted file mode 100644 index 2d8d6d5137..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/reusable/MyCounter.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2012 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.reusable; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -public class MyCounter { - - public int getBeforeCount() { - return beforeCount; - } - public void incrementBeforeCount() { - this.beforeCount++; - } - public int getAfterCount() { - return afterCount; - } - public void incrementAfterCount() { - this.afterCount++; - } - private int beforeCount = 0; - private int afterCount = 0; -} diff --git a/src/com/ibm/jbatch/tck/artifacts/reusable/MyGrandchildException.java b/src/com/ibm/jbatch/tck/artifacts/reusable/MyGrandchildException.java deleted file mode 100644 index 7de2bb2a3d..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/reusable/MyGrandchildException.java +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright 2012 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.reusable; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -public class MyGrandchildException extends MyChildException { - - public MyGrandchildException(){ - super(); - } - - public MyGrandchildException(String s){ - super(s); - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/reusable/MyParallelSubJobsExitStatusBatchlet.java b/src/com/ibm/jbatch/tck/artifacts/reusable/MyParallelSubJobsExitStatusBatchlet.java deleted file mode 100644 index 8526ce479a..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/reusable/MyParallelSubJobsExitStatusBatchlet.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.reusable; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.logging.Logger; - -import jakarta.batch.api.AbstractBatchlet; -import jakarta.batch.api.BatchProperty; -import jakarta.inject.Inject; - - -@jakarta.inject.Named("myParallelSubJobsExitStatusBatchlet") -public class MyParallelSubJobsExitStatusBatchlet extends AbstractBatchlet { - - private final static Logger logger = Logger.getLogger(MyParallelSubJobsExitStatusBatchlet.class.getName()); - - - public static String GOOD_EXIT_STATUS = "VERY GOOD INVOCATION"; - - @Inject - @BatchProperty(name="sleep.time") - String sleepTimeString; - - @Override - public String process() throws Exception { - logger.fine("Running batchlet process() "); - - int sleepTime = Integer.parseInt(sleepTimeString); - - - String returnString = "VERY GOOD INVOCATION"; - return returnString; - } - - @Override - public void stop() throws Exception { - - } - - - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/reusable/MyParentException.java b/src/com/ibm/jbatch/tck/artifacts/reusable/MyParentException.java deleted file mode 100644 index e2da684cbb..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/reusable/MyParentException.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright 2012 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.reusable; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -public class MyParentException extends Exception { - - public MyParentException(){ - super(); - } - - public MyParentException(String s) { - super (s); - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/reusable/MyPersistentRestartUserData.java b/src/com/ibm/jbatch/tck/artifacts/reusable/MyPersistentRestartUserData.java deleted file mode 100644 index 90cd751598..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/reusable/MyPersistentRestartUserData.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2012 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.reusable; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; -import java.io.Externalizable; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; - - public class MyPersistentRestartUserData implements Externalizable { - int executionNumber = 0; - String nextWritePoints = null; - long serialVersionUID = 0L; - - public MyPersistentRestartUserData() { - - } - - public MyPersistentRestartUserData(int execution, String nextWritePts) { - this.executionNumber = execution; - this.nextWritePoints = nextWritePts; - } - - public int getExecutionNumber(){ - return this.executionNumber; - } - - public String getNextWritePoints(){ - return this.nextWritePoints; - } - - @Override - public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { - this.executionNumber = in.readInt(); - this.nextWritePoints = (String)in.readObject(); - } - - @Override - public void writeExternal(ObjectOutput out) throws IOException { - out.writeInt(this.executionNumber); - out.writeObject(this.nextWritePoints); - } - - } \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/artifacts/reusable/MyPersistentUserData.java b/src/com/ibm/jbatch/tck/artifacts/reusable/MyPersistentUserData.java deleted file mode 100644 index 7b1a3a485b..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/reusable/MyPersistentUserData.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2012 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.reusable; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; -import java.io.Externalizable; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; - - public class MyPersistentUserData implements Externalizable { - int data = 0; - boolean fail = false; - long serialVersionUID = 0L; - - public MyPersistentUserData() { - - } - - public MyPersistentUserData(int x, boolean fail) { - data = x; - this.fail = fail; - } - - @Override - public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { - data = in.readInt(); - fail = in.readBoolean(); - - } - @Override - public void writeExternal(ObjectOutput out) throws IOException { - out.writeInt(data); - out.writeBoolean(this.fail); - - } - - public int getData() { - return data; - } - - public boolean getFail(){ - return this.fail; - } - - } \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/artifacts/reusable/SimpleJobListener.java b/src/com/ibm/jbatch/tck/artifacts/reusable/SimpleJobListener.java deleted file mode 100644 index 4e977df53d..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/reusable/SimpleJobListener.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.reusable; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.logging.Logger; - -import jakarta.batch.api.BatchProperty; -import jakarta.batch.api.listener.AbstractJobListener; -import jakarta.batch.runtime.context.JobContext; -import jakarta.inject.Inject; -import jakarta.inject.Named; - -@Named -public class SimpleJobListener extends AbstractJobListener { - - private final static Logger logger = Logger.getLogger(SimpleJobListener.class.getName()); - - @Inject - private JobContext jobCtx = null; - - @Inject - @BatchProperty(name="setTransientData") - String setTransientDataString; - - @Override - public void beforeJob() throws Exception { - if (setTransientDataString.equals("true")) { - logger.fine("Setting transient data: "); - jobCtx.setTransientUserData("FROM_BEFORE_JOB"); - } else { - logger.fine("setTransientDataString prop = " + setTransientDataString + "; Not setting transient data."); - } - } - - @Override - public void afterJob() throws Exception { - Object transientData = jobCtx.getTransientUserData(); - if (transientData instanceof String) { - logger.fine("Found String transient data, setting into exit status"); - jobCtx.setExitStatus((String)transientData); - } else { - logger.fine("Found non-String transient data, leaving exit status alone"); - } - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/reusable/StopOnBulletinBoardTestData.java b/src/com/ibm/jbatch/tck/artifacts/reusable/StopOnBulletinBoardTestData.java deleted file mode 100644 index 6ea2e3c74d..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/reusable/StopOnBulletinBoardTestData.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2012 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.ibm.jbatch.tck.artifacts.reusable; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; -import java.io.Serializable; - -import java.util.ArrayList; -import java.util.List; - -public class StopOnBulletinBoardTestData implements Serializable { - - private static final long serialVersionUID = 1L; - - List threadIdArrayList = new ArrayList(); - - public StopOnBulletinBoardTestData() { - super(); - } - - - public List getThreadIdArrayList() { - return threadIdArrayList; - } - - public void addThreadIdToList(long id) { - threadIdArrayList.add(id); - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/reusable/TransitionTrackerBatchlet.java b/src/com/ibm/jbatch/tck/artifacts/reusable/TransitionTrackerBatchlet.java deleted file mode 100644 index 35b1a729a3..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/reusable/TransitionTrackerBatchlet.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.reusable; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.io.Externalizable; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.ArrayList; - -import jakarta.batch.api.AbstractBatchlet; -import jakarta.batch.runtime.context.JobContext; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - -@jakarta.inject.Named("transitionTrackerBatchlet") -public class TransitionTrackerBatchlet extends AbstractBatchlet { - - public static String GOOD_EXIT_STATUS = "VERY GOOD INVOCATION"; - - @Inject - JobContext jobCtx; - - @Inject - StepContext stepCtx = null; - - @Override - public String process() throws Exception { - - TransitionListPersistent data = (TransitionListPersistent)jobCtx.getTransientUserData(); - if( data != null) { - data.getTransitionList().add(stepCtx.getStepName()); - } else { - jobCtx.setTransientUserData(new TransitionListPersistent(stepCtx.getStepName())); - } - - String transitionList = ((TransitionListPersistent)jobCtx.getTransientUserData()).getTransitionList().toString(); - - // toString() returns string surrounded by brackets, remove them. - jobCtx.setExitStatus(transitionList.substring(1, transitionList.length()-1)); - - return GOOD_EXIT_STATUS; - } - - private class TransitionListPersistent implements Externalizable { - - ArrayList transitionList = new ArrayList(); - - public TransitionListPersistent() {} - - public TransitionListPersistent(String stepId) { - transitionList.add(stepId); - } - - public ArrayList getTransitionList() { - return transitionList; - } - - @Override - public void writeExternal(ObjectOutput out) throws IOException { - out.writeObject(transitionList); - } - - @Override - public void readExternal(ObjectInput in) throws IOException, - ClassNotFoundException { - transitionList = (ArrayList) in.readObject(); - } - - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/ArtifactInstanceTestChunkListener.java b/src/com/ibm/jbatch/tck/artifacts/specialized/ArtifactInstanceTestChunkListener.java deleted file mode 100644 index a392c76ca2..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/ArtifactInstanceTestChunkListener.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.Map; - -import jakarta.batch.api.BatchProperty; -import jakarta.batch.api.chunk.listener.ChunkListener; -import jakarta.batch.runtime.context.JobContext; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; -import jakarta.inject.Named; - -@Named -public class ArtifactInstanceTestChunkListener implements ChunkListener { - - @Inject - JobContext jobCtx; - - @Inject - StepContext stepCtx; - - @Inject - @BatchProperty(name="chunk.property") - String chunkPropertyString; - - static String prop1 = "chunkListenerA"; - static String prop2 = "chunkListenerB"; - - int instance1Count = 0; - int instance2Count = 0; - - boolean uniqueInstance1 = false; - boolean uniqueInstance2 = false; - - private boolean saw2Listeners = false; - - @Override - public void beforeChunk() throws Exception { - - Map instanceData = (Map) stepCtx.getTransientUserData(); - - if (chunkPropertyString.equals(prop1)) { - instanceData.put("sawChunkProp1", true); - - instance1Count++; - - } else if (chunkPropertyString.equals(prop2)) { - instanceData.put("sawChunkProp2", true); - instance2Count++; - } - - - } - - @Override - public void afterChunk() throws Exception { - - - Map instanceData = (Map) stepCtx.getTransientUserData(); - - if (instanceData.get("sawChunkProp1") && instanceData.get("sawChunkProp2")) { - saw2Listeners = true; - } - - - if ((chunkPropertyString.equals(prop1)) && instance1Count == 1) { - uniqueInstance1 = true; - } - - if ((chunkPropertyString.equals(prop2)) && instance2Count == 1) { - uniqueInstance2 = true; - } - - String currentStatus = jobCtx.getExitStatus(); - - if (currentStatus != null && currentStatus.equals("BAD")) { - return; - } - - if (saw2Listeners && (uniqueInstance1 ^ uniqueInstance2)) { - jobCtx.setExitStatus(jobCtx.getExitStatus() + "ChunkListener"); - } else { - jobCtx.setExitStatus("CHUNK_BAD"); - } - - } - - @Override - public void onError(Exception e) throws Exception { - // TODO Auto-generated method stub - - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/ArtifactInstanceTestJobListener.java b/src/com/ibm/jbatch/tck/artifacts/specialized/ArtifactInstanceTestJobListener.java deleted file mode 100644 index dbe8b08f48..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/ArtifactInstanceTestJobListener.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import jakarta.batch.api.BatchProperty; -import jakarta.batch.api.listener.JobListener; -import jakarta.batch.runtime.context.JobContext; -import jakarta.inject.Inject; -import jakarta.inject.Named; - -@Named -public class ArtifactInstanceTestJobListener implements JobListener { - - @Inject - JobContext jobCtx; - - @Inject - @BatchProperty(name="job.property") - String jobPropertyString; - - public final static String prop1 = "jobListenerA"; - public final static String prop2 = "jobListenerB"; - - int instance1Count = 0; - int instance2Count = 0; - - boolean saw2Listeners = false; - - boolean uniqueInstance1 = false; - boolean uniqueInstance2 = false; - - @Override - public void beforeJob() throws Exception { - - synchronized(jobCtx) { - //initialize map - if (jobCtx.getTransientUserData() == null) { - - Map dataMap = new ConcurrentHashMap(); - dataMap.put("sawProp1", false); - dataMap.put("sawProp2", false); - - jobCtx.setTransientUserData(dataMap); - } - } - - Map instanceData = (Map) jobCtx.getTransientUserData(); - - if (jobPropertyString.equals(prop1)) { - instanceData.put("sawProp1", true); - instance1Count++; - - } else if (jobPropertyString.equals(prop2)) { - instanceData.put("sawProp2", true); - instance2Count++; - } - - } - - @Override - public void afterJob() throws Exception { - Map instanceData = (Map) jobCtx.getTransientUserData(); - - - if (instanceData.get("sawProp1") && instanceData.get("sawProp2")) { - saw2Listeners = true; - } - - if ((jobPropertyString.equals(prop1)) && instance1Count == 1) { - uniqueInstance1 = true; - } - - if ((jobPropertyString.equals(prop2)) && instance2Count == 1) { - uniqueInstance2 = true; - } - - String currentStatus = jobCtx.getExitStatus(); - - if (currentStatus != null && currentStatus.equals("BAD")) { - return; - } - - if (saw2Listeners && (uniqueInstance1 ^ uniqueInstance2)) { - jobCtx.setExitStatus(jobCtx.getExitStatus() + "JobListener"); - } else { - jobCtx.setExitStatus("JOB_BAD"); - } - - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/ArtifactInstanceTestReader.java b/src/com/ibm/jbatch/tck/artifacts/specialized/ArtifactInstanceTestReader.java deleted file mode 100644 index ef58a1ad60..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/ArtifactInstanceTestReader.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.io.Serializable; - -import jakarta.batch.api.chunk.ItemReader; - -@jakarta.inject.Named("artifactInstanceTestReader") -public class ArtifactInstanceTestReader implements ItemReader { - - @Override - public void open(Serializable checkpoint) throws Exception { - // TODO Auto-generated method stub - - } - - @Override - public void close() throws Exception { - // TODO Auto-generated method stub - - } - - @Override - public String readItem() throws Exception { - // TODO Auto-generated method stub - return null; - } - - @Override - public Serializable checkpointInfo() throws Exception { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/ArtifactInstanceTestStepListener.java b/src/com/ibm/jbatch/tck/artifacts/specialized/ArtifactInstanceTestStepListener.java deleted file mode 100644 index 0db7ab6592..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/ArtifactInstanceTestStepListener.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import jakarta.batch.api.BatchProperty; -import jakarta.batch.api.listener.StepListener; -import jakarta.batch.runtime.context.JobContext; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; -import jakarta.inject.Named; - -@Named -public class ArtifactInstanceTestStepListener implements StepListener { - - @Inject - JobContext jobCtx; - - @Inject - StepContext stepCtx; - - @Inject - @BatchProperty(name = "step.property") - String stepPropertyString; - - public static final String prop1 = "stepListenerA"; - public static final String prop2 = "stepListenerB"; - - int instance1Count = 0; - int instance2Count = 0; - - boolean uniqueInstance1 = false; - boolean uniqueInstance2 = false; - - private boolean saw2Listeners = false; - - - String passedInProp; - - @Override - public void beforeStep() throws Exception { - - synchronized(stepCtx) { - if (stepCtx.getTransientUserData() == null) { - Map dataMap = new ConcurrentHashMap(); - dataMap.put("sawProp1", false); - dataMap.put("sawProp2", false); - - //init the chunk listener props here too. We init here because we know we - //are the first listener since the transient data is null. - dataMap.put("sawChunkProp1", false); - dataMap.put("sawChunkProp2", false); - - stepCtx.setTransientUserData(dataMap); - } - } - - Map instanceData = (Map) stepCtx.getTransientUserData(); - - if (stepPropertyString.equals(prop1)) { - instanceData.put("sawProp1", true); - - instance1Count++; - - } else if (stepPropertyString.equals(prop2)) { - instanceData.put("sawProp2", true); - instance2Count++; - } - } - - @Override - public void afterStep() throws Exception { - Map instanceData = (Map) stepCtx.getTransientUserData(); - - if (instanceData.get("sawProp1") && instanceData.get("sawProp2")) { - saw2Listeners = true; - } - - - if ((stepPropertyString.equals(prop1)) && instance1Count == 1) { - uniqueInstance1 = true; - } - - if ((stepPropertyString.equals(prop2)) && instance2Count == 1) { - uniqueInstance2 = true; - } - - String currentStatus = jobCtx.getExitStatus(); - - if (currentStatus != null && currentStatus.equals("BAD")) { - return; - } - - if (saw2Listeners && (uniqueInstance1 ^ uniqueInstance2)) { - jobCtx.setExitStatus(jobCtx.getExitStatus() + "StepListener"); - } else { - jobCtx.setExitStatus("STEP_BAD"); - } - - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/ArtifactInstanceTestWriter.java b/src/com/ibm/jbatch/tck/artifacts/specialized/ArtifactInstanceTestWriter.java deleted file mode 100644 index e986c098cc..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/ArtifactInstanceTestWriter.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; -import java.io.Serializable; -import java.util.List; - -import jakarta.batch.api.chunk.ItemWriter; - -@jakarta.inject.Named("artifactInstanceTestWriter") -public class ArtifactInstanceTestWriter implements ItemWriter { - - @Override - public void open(Serializable checkpoint) throws Exception { - // TODO Auto-generated method stub - } - - @Override - public void close() throws Exception { - // TODO Auto-generated method stub - - } - - @Override - public void writeItems(List items) throws Exception { - // TODO Auto-generated method stub - - } - - @Override - public Serializable checkpointInfo() throws Exception { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/BatchletRestartStateMachineImpl.java b/src/com/ibm/jbatch/tck/artifacts/specialized/BatchletRestartStateMachineImpl.java deleted file mode 100644 index 78bb4b5fc7..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/BatchletRestartStateMachineImpl.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.Random; -import java.util.logging.Logger; - -import jakarta.batch.api.AbstractBatchlet; -import jakarta.batch.api.BatchProperty; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - -@jakarta.inject.Named("batchletRestartStateMachineImpl") -public class BatchletRestartStateMachineImpl extends AbstractBatchlet { - - private final static String sourceClass = BatchletRestartStateMachineImpl.class.getName(); - private final static Logger logger = Logger.getLogger(sourceClass); - - @Inject - StepContext stepCtx; - - @Inject - @BatchProperty(name="execution.number") - String executionNumberString; - - @Override - public String process() throws Exception { - logger.fine(sourceClass + ".process()"); - - ClassLoader cl = BatchletRestartStateMachineImpl.class.getClassLoader(); - - // Do something a bit "compute-intensive". - Random r = new Random(); - int x = r.nextInt(); - int y = r.nextInt(); - logger.fine(sourceClass + ".process(); Before (x,y)=(" + x + "," + y + ")"); - for (int i = 0 ; i < 10; i++) { - x = (y * x) % 3469; - y = (x * y) % 3491; - } - logger.fine(sourceClass + ".process(); After (x,y)=(" + x + "," + y + ")"); - - String exitStatus = calculateExitStatus(); - - logger.fine(sourceClass + ".process(); Exiting with exitStatus = " + exitStatus); - - return exitStatus; - } - - @Override - public void stop() throws Exception { - // Do nothing since this is too quick to bother canceling. - logger.fine(sourceClass + ".cancel()"); - } - - - private String calculateExitStatus() { - - logger.fine(sourceClass + ".calculateExitStatus(), executionNumberString = " + executionNumberString); - - int execNum = Integer.parseInt(executionNumberString); - - String stepId = stepCtx.getStepName(); - - logger.fine(sourceClass + ".calculateExitStatus(), execution # = " + execNum + ", stepId = " + stepId); - - if (stepId.equals("step1")) { - switch (execNum) { - case 1: return "STOP.1"; - case 2: return "STOP.2"; - case 4: return "GO"; - case 5: return "STOP.5"; - default: return "ILLEGAL.STATE"; - } - } else if (stepId.equals("step2")) { - switch (execNum) { - case 3: return "GO"; - default: return "ILLEGAL.STATE"; - } - } else if (stepId.equals("step3")) { - switch (execNum) { - case 3: return "STOP.3"; - case 4: return "STOP.4"; - case 6: return "GO"; - default: return "ILLEGAL.STATE"; - } - } else if (stepId.equals("step4")) { - switch (execNum) { - case 6: return "GO"; - default: return "ILLEGAL.STATE"; - } - } else { - return "ILLEGAL.STATE"; - } - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/BatchletUsingStepContextImpl.java b/src/com/ibm/jbatch/tck/artifacts/specialized/BatchletUsingStepContextImpl.java deleted file mode 100644 index b879b8a089..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/BatchletUsingStepContextImpl.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.logging.Logger; - -import jakarta.batch.api.AbstractBatchlet; -import jakarta.batch.api.BatchProperty; -import jakarta.batch.runtime.BatchStatus; -import jakarta.batch.runtime.context.JobContext; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - -import com.ibm.jbatch.tck.artifacts.reusable.MyPersistentUserData; - -@jakarta.inject.Named("batchletUsingStepContextImpl") -public class BatchletUsingStepContextImpl extends AbstractBatchlet{ - - private final static Logger logger = Logger.getLogger(BatchletUsingStepContextImpl.class.getName()); - - @Inject - private StepContext stepCtx = null; - - @Inject - private JobContext jobCtx = null; - - private String BEGAN = "MadeItToBegin"; - private String CANCEL = "Cancelled"; - private String PROCESSED = "Processed"; - - - @Inject - @BatchProperty(name="force.failure") - String forceFailureProp; - private boolean forceFailure = false; - - - - private void begin() throws Exception { - logger.fine("BatchletUsingStepContextImpl - @BeginStep"); - assert stepCtx.getExitStatus()==null; - stepCtx.setExitStatus(BEGAN); - - if ("true".equalsIgnoreCase(forceFailureProp)) { - forceFailure = true; - } - } - - public static String GOOD_STEP_EXIT_STATUS = "VERY GOOD INVOCATION"; - public static String GOOD_JOB_EXIT_STATUS = "JOB: " + GOOD_STEP_EXIT_STATUS; - - @Override - public String process() throws Exception { - this.begin(); - - logger.fine("BatchletUsingStepContextImpl - @Process"); - assert stepCtx.getExitStatus().equals(BEGAN); - - MyPersistentUserData myData = null; - if ((myData = (MyPersistentUserData)stepCtx.getPersistentUserData()) != null) { - if (forceFailure){ - forceFailure = false; - stepCtx.setPersistentUserData(new MyPersistentUserData(myData.getData() + 1, forceFailure)); - } - } else { - if (forceFailure){ - stepCtx.setPersistentUserData(new MyPersistentUserData(4, forceFailure)); - } - } - stepCtx.setTransientUserData(new MyTransient(3)); - stepCtx.setExitStatus(PROCESSED); - end(); - - if (forceFailure) { - throw new Exception("Fail on purpose in BatchletUsingStepContextImpl.process()"); - } - - return BatchStatus.COMPLETED.name(); - } - - @Override - public void stop() throws Exception { - logger.fine("BatchletUsingStepContextImpl - @Cancel"); - stepCtx.setExitStatus(CANCEL); - } - - private void end() throws Exception { - logger.fine("BatchletUsingStepContextImpl - formerly @EndStep"); - MyPersistentUserData p = (MyPersistentUserData)stepCtx.getPersistentUserData(); - MyTransient t = (MyTransient)stepCtx.getTransientUserData(); - - assert stepCtx.getExitStatus().equals(PROCESSED); - stepCtx.setExitStatus(GOOD_STEP_EXIT_STATUS); - jobCtx.setExitStatus(GOOD_JOB_EXIT_STATUS); - } - - private class MyTransient { - int data = 0; - MyTransient(int x) { - data = x; - } - } - - - -} - diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/ChunkOnErrorCheckpointListener.java b/src/com/ibm/jbatch/tck/artifacts/specialized/ChunkOnErrorCheckpointListener.java deleted file mode 100644 index 987d5af6d8..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/ChunkOnErrorCheckpointListener.java +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ - -import java.util.logging.Logger; - -import jakarta.batch.api.chunk.listener.AbstractChunkListener; -import jakarta.batch.runtime.context.JobContext; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - - - -@jakarta.inject.Named("chunkOnErrorCheckpointListener") -public class ChunkOnErrorCheckpointListener extends AbstractChunkListener { - - private final static String sourceClass = MyCustomCheckpointListener.class.getName(); - private final static Logger logger = Logger.getLogger(sourceClass); - - @Inject - JobContext jobCtx; - - @Inject - StepContext stepCtx; - - @Override - public void beforeChunk() { - logger.fine("CUSTOMCHKPTLISTENER: beforeCheckpoint"); - } - - @Override - public void afterChunk() { - logger.fine("CUSTOMCHKPTLISTENER: afterCheckpoint"); - } - - @Override - public void onError(Exception e) { - logger.fine("CUSTOMCHKPTLISTENER: onError"); - - jobCtx.setExitStatus("Chunk onError invoked"); - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/ContextsGetIdJobContextTestBatchlet.java b/src/com/ibm/jbatch/tck/artifacts/specialized/ContextsGetIdJobContextTestBatchlet.java deleted file mode 100644 index c7904c059a..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/ContextsGetIdJobContextTestBatchlet.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import jakarta.batch.api.AbstractBatchlet; -import jakarta.batch.runtime.context.JobContext; -import jakarta.inject.Inject; - -@jakarta.inject.Named("contextsGetIdJobContextTestBatchlet") -public class ContextsGetIdJobContextTestBatchlet extends AbstractBatchlet { - - public static String GOOD_EXIT_STATUS = "VERY GOOD INVOCATION"; - - @Inject - JobContext jobCtx; - - @Override - public String process() throws Exception { - - jobCtx.setExitStatus(jobCtx.getJobName()); - return GOOD_EXIT_STATUS; - } - - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/ContextsGetIdStepContextTestBatchlet.java b/src/com/ibm/jbatch/tck/artifacts/specialized/ContextsGetIdStepContextTestBatchlet.java deleted file mode 100644 index 4f3b3730a4..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/ContextsGetIdStepContextTestBatchlet.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import jakarta.batch.api.AbstractBatchlet; -import jakarta.batch.runtime.context.JobContext; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - -@jakarta.inject.Named("contextsGetIdStepContextTestBatchlet") -public class ContextsGetIdStepContextTestBatchlet extends AbstractBatchlet { - - public static String GOOD_EXIT_STATUS = "VERY GOOD INVOCATION"; - - @Inject - JobContext jobCtx; - - @Inject - StepContext stepCtx; - - @Override - public String process() throws Exception { - - jobCtx.setExitStatus(stepCtx.getStepName()); - return GOOD_EXIT_STATUS; - } - - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/DeciderTestsBatchlet.java b/src/com/ibm/jbatch/tck/artifacts/specialized/DeciderTestsBatchlet.java deleted file mode 100644 index 7a02301887..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/DeciderTestsBatchlet.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.logging.Logger; - -import jakarta.batch.api.AbstractBatchlet; -import jakarta.batch.api.BatchProperty; -import jakarta.batch.runtime.context.JobContext; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - -import com.ibm.jbatch.tck.artifacts.common.StatusConstants; - -@jakarta.inject.Named("deciderTestsBatchlet") -public class DeciderTestsBatchlet extends AbstractBatchlet implements StatusConstants { - - public final static String NORMAL_VALUE = "21"; - public final static String SPECIAL_VALUE = "25"; - public final static String ACTUAL_VALUE = "actualValue"; - public final static String ACTION = "action"; - public final static String SPECIAL_EXIT_STATUS = "SpecialExitStatus"; - - private final static String sourceClass = DeciderTestsBatchlet.class.getName(); - private final static Logger logger = Logger.getLogger(sourceClass); - - @Inject - StepContext stepCtx; - - @Inject - JobContext jobCtx; - - @Inject - @BatchProperty(name=ACTION) - String action; - - // Take a shortcut and use a String rather than an int. - @Inject - @BatchProperty(name=ACTUAL_VALUE) - String value1; - - /** - * The idea here is that the decider will act on a combination of the 'action' - * property and the exit status. - */ - @Override - public String process() { - if (action != null) { - stepCtx.setPersistentUserData(action); - } - if (value1.equals(SPECIAL_VALUE)) { - after(); - return SPECIAL_EXIT_STATUS; - } else { - after(); - return GOOD_STEP_EXIT_STATUS; - } - } - - @Override - public void stop(){ - // Do nothing since this is too quick to bother canceling. - logger.fine(sourceClass + ".cancel()"); - } - - /* - * Allow us to count how many times this step has run. - */ - private void after() { - Integer count = (Integer)jobCtx.getTransientUserData(); - if (count == null) { - count = new Integer(1); - } else { - count++; - } - jobCtx.setTransientUserData(count); - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/DeciderTestsDecider.java b/src/com/ibm/jbatch/tck/artifacts/specialized/DeciderTestsDecider.java deleted file mode 100644 index 4f640698bc..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/DeciderTestsDecider.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import jakarta.batch.api.BatchProperty; -import jakarta.batch.api.Decider; -import jakarta.batch.runtime.BatchStatus; -import jakarta.batch.runtime.StepExecution; -import jakarta.batch.runtime.context.JobContext; -import jakarta.inject.Inject; - -import com.ibm.jbatch.tck.artifacts.common.StatusConstants; - -@jakarta.inject.Named -public class DeciderTestsDecider implements Decider, StatusConstants { - - public final static String SPECIAL_EXIT_STATUS = "SpecialExitStatus"; - - /* - * Since this is a job involving repeated uses of the same step, let's include - * a count to ensure we don't wrongly re-run a step multiple times. - */ - @Inject - JobContext jobCtx; - - @Inject - @BatchProperty(name=SPECIAL_EXIT_STATUS) - String specialExitStatus; - - @Override - public String decide(StepExecution[] stepExecutions) throws Exception { - if (stepExecutions.length != 1) { - throw new IllegalStateException("Expecting stepExecutions array of size 1, found one of size = " + stepExecutions.length); - } - - for (StepExecution stepExec : stepExecutions) { - if (stepExec == null) { - throw new Exception("Null StepExecution from split."); - } - - if (!stepExec.getBatchStatus().equals(BatchStatus.COMPLETED)) { - throw new Exception("All step executions must be compelete before transitioning to a decider."); - } - } - - StepExecution stepExec = stepExecutions[0]; - String coreExitStatus = coreExitStatus(stepExec); - Integer count = (Integer)jobCtx.getTransientUserData(); - String retVal = count.toString() + ":" + coreExitStatus; - return retVal; - } - - private String coreExitStatus(StepExecution stepExec) { - String action = (String)stepExec.getPersistentUserData(); - String currentExitStatus = stepExec.getExitStatus(); - - // "Normally" we just pass set 'normalExitStatus' as exit status. - if (currentExitStatus.equals(GOOD_STEP_EXIT_STATUS)) { - return action; - // But if it's the magic number then we return our "SpecialExitStatus". - } else { - return specialExitStatus; - } - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/DeciderTestsJobListener.java b/src/com/ibm/jbatch/tck/artifacts/specialized/DeciderTestsJobListener.java deleted file mode 100644 index c6e17cec89..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/DeciderTestsJobListener.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import jakarta.batch.api.listener.AbstractJobListener; -import jakarta.batch.runtime.context.JobContext; -import jakarta.inject.Inject; - -import com.ibm.jbatch.tck.artifacts.common.StatusConstants; - -@jakarta.inject.Named -public class DeciderTestsJobListener extends AbstractJobListener implements StatusConstants { - - public static final String SUCCESS = "SUCCESS"; - - @Inject - JobContext jobCtx; - - @Override - public void afterJob() { - Integer count = (Integer)jobCtx.getTransientUserData(); - if (!count.equals(new Integer(2))) { - jobCtx.setExitStatus(UNEXPECTED); - throw new IllegalStateException("TCK Test Failure: Expecting two steps to have run."); - } else { - jobCtx.setExitStatus(GOOD_JOB_EXIT_STATUS); - } - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/DefaultValueArrayWriter.java b/src/com/ibm/jbatch/tck/artifacts/specialized/DefaultValueArrayWriter.java deleted file mode 100644 index c21ffee79e..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/DefaultValueArrayWriter.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.io.Serializable; -import java.util.List; -import java.util.logging.Logger; - -import jakarta.batch.api.BatchProperty; -import jakarta.batch.api.chunk.AbstractItemWriter; -import jakarta.batch.runtime.context.JobContext; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - -import com.ibm.jbatch.tck.artifacts.chunktypes.ArrayIndexCheckpointData; -import com.ibm.jbatch.tck.artifacts.chunktypes.ReadRecord; -import com.ibm.jbatch.tck.artifacts.reusable.MyPersistentRestartUserData; - -@jakarta.inject.Named("defaultValueArrayWriter") -public class DefaultValueArrayWriter extends AbstractItemWriter { - - private final static Logger logger = Logger.getLogger(DefaultValueArrayWriter.class.getName()); - - private int[] writerDataArray = new int[30]; - //private int[] checkArray; - private int idx = 0; - private int chkArraySize; - int chunkWriteIteration = 0; - - @Inject - @BatchProperty(name="app.arraysize") - String appArraySizeString; - - @Inject - JobContext jobCtx; - - @Inject - private StepContext stepCtx = null; - - int arraysize; - - @Override - public void open(Serializable cpd) throws Exception { - logger.fine("openWriter"); - - MyPersistentRestartUserData myData = null; - if ((myData = (MyPersistentRestartUserData)stepCtx.getPersistentUserData()) != null) { - stepCtx.setPersistentUserData(new MyPersistentRestartUserData(myData.getExecutionNumber()+1, null)); - logger.fine("AJM: iteration = " + ((MyPersistentRestartUserData)stepCtx.getPersistentUserData()).getExecutionNumber()); - } else { - stepCtx.setPersistentUserData(new MyPersistentRestartUserData(1, null)); - } - - ArrayIndexCheckpointData checkpointData = (ArrayIndexCheckpointData)cpd; - - arraysize = Integer.parseInt(appArraySizeString); - - if (checkpointData == null){ - //position at the beginning - idx = 0; - logger.fine("WRITE: chkpt data = null, so idx = " + idx); - } - else { - // position at index held in the cpd - idx = checkpointData.getCurrentIndex(); - - logger.fine("WRITE: chkpt data was valid, so idx = " + idx); - logger.fine("WRITE: chunkWriteIteration = " + chunkWriteIteration); - } - - for (int i = 0; i myData) throws Exception { - logger.fine("writeMyData receives chunk size=" + myData.size()); - for (int i = 0; i< myData.size(); i++) { - logger.fine("myData=" + ((ReadRecord)myData.get(i)).getCount()); - } - } - - @Override - public CheckpointData checkpointInfo() throws Exception { - return new CheckpointData(); - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/DoSomethingSimpleArrayWriter.java b/src/com/ibm/jbatch/tck/artifacts/specialized/DoSomethingSimpleArrayWriter.java deleted file mode 100644 index fac91faaae..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/DoSomethingSimpleArrayWriter.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.io.Serializable; -import java.util.List; -import java.util.logging.Logger; - -import jakarta.batch.api.BatchProperty; -import jakarta.batch.api.chunk.AbstractItemWriter; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - -import com.ibm.jbatch.tck.artifacts.chunktypes.ArrayIndexCheckpointData; -import com.ibm.jbatch.tck.artifacts.chunktypes.ReadRecord; -import com.ibm.jbatch.tck.artifacts.reusable.MyPersistentRestartUserData; - -@jakarta.inject.Named("doSomethingSimpleArrayWriter") -public class DoSomethingSimpleArrayWriter extends AbstractItemWriter { - - private final static Logger logger = Logger.getLogger(DoSomethingSimpleArrayWriter.class.getName()); - - private int[] writerDataArray = new int[30]; - //private int[] checkArray; - private int idx = 0; - private int chkArraySize; - int chunkWriteIteration = 0; - - @Inject - @BatchProperty(name="app.arraysize") - String appArraySizeString; - - @Inject - @BatchProperty(name="app.writepoints") - String writePointsString; - - @Inject - @BatchProperty(name="app.next.writepoints") - String nextWritePointsString; - - @Inject - private StepContext stepCtx = null; - - @Inject - @BatchProperty(name="app.checkpoint.position") - String appCheckpointPositionString; - - int arraysize; - int [] writePoints; - int checkpointPosition; - - @Override - public void open(Serializable cpd) throws Exception { - logger.fine("openWriter"); - - MyPersistentRestartUserData myData = null; - if ((myData = (MyPersistentRestartUserData)stepCtx.getPersistentUserData()) != null) { - stepCtx.setPersistentUserData(new MyPersistentRestartUserData(myData.getExecutionNumber()+1, nextWritePointsString)); - logger.fine("AJM: iteration = " + ((MyPersistentRestartUserData)stepCtx.getPersistentUserData()).getExecutionNumber()); - writePointsString = ((MyPersistentRestartUserData)stepCtx.getPersistentUserData()).getNextWritePoints(); - } else { - stepCtx.setPersistentUserData(new MyPersistentRestartUserData(1, nextWritePointsString)); - } - - ArrayIndexCheckpointData checkpointData = (ArrayIndexCheckpointData)cpd; - - arraysize = Integer.parseInt(appArraySizeString); - - String[] writePointsStrArr = writePointsString.split(","); - writePoints = new int[writePointsString.length()]; - - logger.fine("AJM: writePointsStrArr.length() = " + writePointsStrArr.length); - - if (appCheckpointPositionString != null) { - checkpointPosition = Integer.parseInt(appCheckpointPositionString); - } - - for (int i = 0; i" + idx); - } - else { - logger.fine("WRITE: we have an issue! throw exception here"); - throw new Exception("WRITE: the chunk write did not at the correct boundary (idx) ->" + idx); - } - chunkWriteIteration++; - - for (i = 0; i < myData.size(); i++) { - writerDataArray[idx] = ((ReadRecord)myData.get(i)).getCount(); - idx++; - } - for (i = 0; i < arraysize; i++){ - logger.fine("WRITE: writerDataArray[" + i + "] = " + writerDataArray[i]); - } - logger.fine("WRITE: idx = " + idx + " and i = " + i); - logger.fine("WRITE: chunkWriteIteration= "+ chunkWriteIteration); - logger.fine("WRITE: size of writePoints->" + writePoints.length); - //if (checkArray[chunkWriteIteration] == (chunkWriteIteration+1)*chunksize ) { - } - - @Override - public ArrayIndexCheckpointData checkpointInfo() throws Exception { - ArrayIndexCheckpointData _chkptData = new ArrayIndexCheckpointData(); - _chkptData.setCurrentIndex(idx); - return _chkptData; - } - - private class MyTransient { - int data = 0; - MyTransient(int x) { - data = x; - } - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/DoSomethingSimpleTimeArrayReader.java b/src/com/ibm/jbatch/tck/artifacts/specialized/DoSomethingSimpleTimeArrayReader.java deleted file mode 100644 index 63381cc599..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/DoSomethingSimpleTimeArrayReader.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.io.Serializable; -import java.util.logging.Logger; - -import jakarta.batch.api.BatchProperty; -import jakarta.batch.api.chunk.AbstractItemReader; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - -import com.ibm.jbatch.tck.artifacts.chunktypes.ArrayIndexCheckpointData; -import com.ibm.jbatch.tck.artifacts.chunktypes.ReadRecord; -import com.ibm.jbatch.tck.artifacts.reusable.MyPersistentRestartUserData; - -@jakarta.inject.Named("doSomethingSimpleTimeArrayReader") -public class DoSomethingSimpleTimeArrayReader extends AbstractItemReader { - - private final static Logger logger = Logger.getLogger(DoSomethingSimpleTimeArrayReader.class.getName()); - - private int count = 0; - private int[] readerDataArray; - private int idx; - ArrayIndexCheckpointData _cpd = new ArrayIndexCheckpointData(); - - @Inject - @BatchProperty(name="readrecord.fail") - String readrecordfailNumberString; - - @Inject - @BatchProperty(name="execution.number") - String executionNumberString; - - @Inject - @BatchProperty(name="app.arraysize") - String appArraySizeString; - - @Inject - @BatchProperty(name="app.sleeptime") - String sleeptimeString; - - @Inject - private StepContext stepCtx = null; - - int execnum; - int failnum; - int arraysize; - int sleeptime; - - @Override - public void open(Serializable cpd) { - - ArrayIndexCheckpointData checkpointData = (ArrayIndexCheckpointData)cpd; - - failnum = Integer.parseInt(readrecordfailNumberString); - execnum = Integer.parseInt(executionNumberString); - arraysize = Integer.parseInt(appArraySizeString); - - sleeptime = Integer.parseInt(sleeptimeString); - - - readerDataArray = new int[arraysize]; - - for (int i = 0; i " + diff + " which is: " + timeinterval + " +/- 2 seconds"); - //} - //else { - // logger.fine("WRITE: we have an issue! throw exception here"); - // throw new Exception("WRITE: the chunk write did not occur at the correct time boundary -> "+ diff + " which is: " + timeinterval + "+/- 2 seconds"); - //} - chunkWriteIteration++; - //date = new java.util.Date(); - //ts = date.getTime(); - - for (i = 0; i < myData.size(); i++) { - writerDataArray[idx] = ((ReadRecord)myData.get(i)).getCount(); - idx++; - } - for (i = 0; i < arraysize; i++){ - logger.fine("WRITE: writerDataArray[" + i + "] = " + writerDataArray[i]); - } - logger.fine("WRITE: idx = " + idx + " and i = " + i); - logger.fine("WRITE: chunkWriteIteration= "+ chunkWriteIteration); - //if (checkArray[chunkWriteIteration] == (chunkWriteIteration+1)*chunksize ) { - } - - @Override - public ArrayIndexCheckpointData checkpointInfo() throws Exception { - ArrayIndexCheckpointData _chkptData = new ArrayIndexCheckpointData(); - _chkptData.setCurrentIndex(idx); - return _chkptData; - } - - private class MyTransient { - int data = 0; - MyTransient(int x) { - data = x; - } - } -} - diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/FailRestartBatchlet.java b/src/com/ibm/jbatch/tck/artifacts/specialized/FailRestartBatchlet.java deleted file mode 100644 index ec87098d1c..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/FailRestartBatchlet.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import jakarta.batch.api.BatchProperty; -import jakarta.batch.api.Batchlet; -import jakarta.inject.Inject; - -@jakarta.inject.Named("failRestartBatchlet") -public class FailRestartBatchlet implements Batchlet { - - @Inject - @BatchProperty(name="execution.number") - String executionNumberString; - - @Inject - @BatchProperty(name="sleep.time") - String sleepTimeString; - - boolean init = false; - int executionNum = 0; - int sleeptime; - - @Override - public String process() throws Exception { - - if (!init) { - init(); - } - - if (executionNum == 1){ - throw new Exception("fail on purpose, execution1"); - } - else if (executionNum == 2){ - Thread.sleep(sleeptime); - } - return "FailRestartBatchlet Done"; - } - - @Override - public void stop() throws Exception { - // TODO Auto-generated method stub - - } - - private void init(){ - if (executionNumberString != null) { - executionNum = Integer.parseInt(executionNumberString); - } - if (executionNumberString != null) { - sleeptime = Integer.parseInt(sleepTimeString); - } - - init = true; - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/FlowTransitionToDecisionTestBatchlet.java b/src/com/ibm/jbatch/tck/artifacts/specialized/FlowTransitionToDecisionTestBatchlet.java deleted file mode 100644 index eed8e7e417..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/FlowTransitionToDecisionTestBatchlet.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import jakarta.batch.api.AbstractBatchlet; - -@jakarta.inject.Named("flowTransitionToDecisionTestBatchlet") -public class FlowTransitionToDecisionTestBatchlet extends AbstractBatchlet { - - public static String GOOD_EXIT_STATUS = "VERY GOOD INVOCATION"; - - - @Override - public String process() throws Exception { - - return GOOD_EXIT_STATUS; - } - - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/FlowTransitionToDecisionTestDecider.java b/src/com/ibm/jbatch/tck/artifacts/specialized/FlowTransitionToDecisionTestDecider.java deleted file mode 100644 index cb33aceb3e..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/FlowTransitionToDecisionTestDecider.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import jakarta.batch.api.Decider; -import jakarta.batch.runtime.BatchStatus; -import jakarta.batch.runtime.StepExecution; - -import com.ibm.jbatch.tck.artifacts.common.StatusConstants; - -@jakarta.inject.Named -public class FlowTransitionToDecisionTestDecider implements Decider, StatusConstants { - - public final static String DECIDER_EXIT_STATUS = "DECIDER_EXIT_STATUS"; - - @Override - public String decide(StepExecution[] stepExecutions) throws Exception { - if (stepExecutions.length != 1) { - throw new IllegalStateException("Expecting stepExecutions array of size 1, found one of size = " + stepExecutions.length); - } - - StepExecution stepExecution = stepExecutions[0]; - - for (StepExecution stepExec : stepExecutions) { - if (stepExec == null) { - throw new Exception("Null StepExecution after flow."); - } - - if (!stepExec.getBatchStatus().equals(BatchStatus.COMPLETED)) { - throw new Exception("All step executions must be compelete before transitioning to a decider."); - } - - } - - // for our test - // - return DECIDER_EXIT_STATUS + "*" + stepExecution.getExitStatus(); - } - - - - - - - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/FlowTransitionWithinFlowTestBatchlet.java b/src/com/ibm/jbatch/tck/artifacts/specialized/FlowTransitionWithinFlowTestBatchlet.java deleted file mode 100644 index 3892a45ada..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/FlowTransitionWithinFlowTestBatchlet.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.io.Externalizable; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.ArrayList; - -import jakarta.batch.api.AbstractBatchlet; -import jakarta.batch.runtime.context.JobContext; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - -@jakarta.inject.Named("flowTransitionWithinFlowTestBatchlet") -public class FlowTransitionWithinFlowTestBatchlet extends AbstractBatchlet { - - public static String GOOD_EXIT_STATUS = "VERY GOOD INVOCATION"; - - @Inject - JobContext jobCtx; - - @Inject - StepContext stepCtx = null; - - @Override - public String process() throws Exception { - - TransitionListPersistent data = (TransitionListPersistent) jobCtx.getTransientUserData(); - if( data != null) { - data.getTransitionList().add(stepCtx.getStepName()); - } else { - jobCtx.setTransientUserData(new TransitionListPersistent(stepCtx.getStepName())); - } - - String transitionList = ((TransitionListPersistent)jobCtx.getTransientUserData()).getTransitionList().toString(); - - // toString() returns string surrounded by brackets, remove them. - jobCtx.setExitStatus(transitionList.substring(1, transitionList.length()-1)); - - return GOOD_EXIT_STATUS; - } - - private class TransitionListPersistent implements Externalizable { - - ArrayList transitionList = new ArrayList(); - - public TransitionListPersistent() {} - - public TransitionListPersistent(String stepId) { - transitionList.add(stepId); - } - - public ArrayList getTransitionList() { - return transitionList; - } - - @Override - public void writeExternal(ObjectOutput out) throws IOException { - out.writeObject(transitionList); - } - - @Override - public void readExternal(ObjectInput in) throws IOException, - ClassNotFoundException { - transitionList = (ArrayList) in.readObject(); - } - - - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/InventoryCheckpointAlgorithmNoOverride.java b/src/com/ibm/jbatch/tck/artifacts/specialized/InventoryCheckpointAlgorithmNoOverride.java deleted file mode 100644 index d98477ba84..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/InventoryCheckpointAlgorithmNoOverride.java +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.logging.Level; -import java.util.logging.Logger; - -import jakarta.batch.api.BatchProperty; -import jakarta.batch.api.chunk.AbstractCheckpointAlgorithm; -import jakarta.inject.Inject; - -/* -* Copyright 2012, 2020 International Business Machines Corp. -* -* See the NOTICE file distributed with this work for additional information -* regarding copyright ownership. Licensed under the Apache License, -* Version 2.0 (the "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - - - -@jakarta.inject.Named("inventoryCheckpointAlgorithmNoOverride") -public class InventoryCheckpointAlgorithmNoOverride extends AbstractCheckpointAlgorithm { - - private static final String className = InventoryCheckpointAlgorithmNoOverride.class.getName(); - private static Logger logger = Logger.getLogger(InventoryCheckpointAlgorithmNoOverride.class.getPackage().getName()); - - boolean inCheckpoint = false; - int checkpointIterations; - - boolean init = false; - - @Inject - @BatchProperty(name="commitInterval") - String commitIntervalString; - int commitInterval; - - @Override - public boolean isReadyToCheckpoint() throws Exception { - String method = "isReadyToCheckpoint"; - if(logger.isLoggable(Level.FINER)) { logger.entering(className, method); } - - if (!init){ - - commitInterval = Integer.parseInt(commitIntervalString); - checkpointIterations = 0; - init = true; - } - - checkpointIterations++; - boolean ready = (checkpointIterations == commitInterval); - - if ( ready) { - checkpointIterations = 0; - } - - return ready; - } - -} - diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/InventoryCheckpointAlgorithmOverride150.java b/src/com/ibm/jbatch/tck/artifacts/specialized/InventoryCheckpointAlgorithmOverride150.java deleted file mode 100644 index ab46ec4703..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/InventoryCheckpointAlgorithmOverride150.java +++ /dev/null @@ -1,92 +0,0 @@ -/** - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.logging.Level; -import java.util.logging.Logger; - -import jakarta.batch.api.BatchProperty; -import jakarta.batch.api.chunk.AbstractCheckpointAlgorithm; -import jakarta.inject.Inject; - -/* -* Copyright 2012, 2020 International Business Machines Corp. -* -* See the NOTICE file distributed with this work for additional information -* regarding copyright ownership. Licensed under the Apache License, -* Version 2.0 (the "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - - - -@jakarta.inject.Named("inventoryCheckpointAlgorithmOverride150") -public class InventoryCheckpointAlgorithmOverride150 extends AbstractCheckpointAlgorithm { - - private static final String className = InventoryCheckpointAlgorithmNoOverride.class.getName(); - private static Logger logger = Logger.getLogger(InventoryCheckpointAlgorithmNoOverride.class.getPackage().getName()); - - boolean inCheckpoint = false; - int checkpointIterations; - - boolean init = false; - - @Inject - @BatchProperty(name="commitInterval") - String commitIntervalString; - int commitInterval; - - @Override - public boolean isReadyToCheckpoint() throws Exception { - String method = "isReadyToCheckpoint"; - if(logger.isLoggable(Level.FINER)) { logger.entering(className, method); } - - if (!init){ - - commitInterval = Integer.parseInt(commitIntervalString); - checkpointIterations = 0; - init = true; - } - - checkpointIterations++; - boolean ready = (checkpointIterations == commitInterval); - - if ( ready) { - checkpointIterations = 0; - } - - return ready; - } - - @Override - public int checkpointTimeout() throws Exception { - return 150; - } - -} - diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/InventoryCheckpointAlgorithmOverride2.java b/src/com/ibm/jbatch/tck/artifacts/specialized/InventoryCheckpointAlgorithmOverride2.java deleted file mode 100644 index 31846a6b64..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/InventoryCheckpointAlgorithmOverride2.java +++ /dev/null @@ -1,92 +0,0 @@ -/** - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.logging.Level; -import java.util.logging.Logger; - -import jakarta.batch.api.BatchProperty; -import jakarta.batch.api.chunk.AbstractCheckpointAlgorithm; -import jakarta.inject.Inject; - -/* -* Copyright 2012, 2020 International Business Machines Corp. -* -* See the NOTICE file distributed with this work for additional information -* regarding copyright ownership. Licensed under the Apache License, -* Version 2.0 (the "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - - - -@jakarta.inject.Named("inventoryCheckpointAlgorithmOverride2") -public class InventoryCheckpointAlgorithmOverride2 extends AbstractCheckpointAlgorithm { - - private static final String className = InventoryCheckpointAlgorithmNoOverride.class.getName(); - private static Logger logger = Logger.getLogger(InventoryCheckpointAlgorithmNoOverride.class.getPackage().getName()); - - boolean inCheckpoint = false; - int checkpointIterations; - - boolean init = false; - - @Inject - @BatchProperty(name="commitInterval") - String commitIntervalString; - int commitInterval; - - @Override - public boolean isReadyToCheckpoint() throws Exception { - String method = "isReadyToCheckpoint"; - if(logger.isLoggable(Level.FINER)) { logger.entering(className, method); } - - if (!init){ - - commitInterval = Integer.parseInt(commitIntervalString); - checkpointIterations = 0; - init = true; - } - - checkpointIterations++; - boolean ready = (checkpointIterations == commitInterval); - - if ( ready) { - checkpointIterations = 0; - } - - return ready; - } - - @Override - public int checkpointTimeout() throws Exception { - return 2; - } - -} - diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/JobAttributesTestBatchlet.java b/src/com/ibm/jbatch/tck/artifacts/specialized/JobAttributesTestBatchlet.java deleted file mode 100644 index 777b527bfb..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/JobAttributesTestBatchlet.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.logging.Logger; - -import jakarta.batch.api.AbstractBatchlet; -import jakarta.batch.api.BatchProperty; -import jakarta.inject.Inject; - -@jakarta.inject.Named("jobAttributesTestBatchlet") -public class JobAttributesTestBatchlet extends AbstractBatchlet { - - private final static String sourceClass = JobAttributesTestBatchlet.class.getName(); - private final static Logger logger = Logger.getLogger(sourceClass); - - public static String GOOD_EXIT_STATUS = "VERY GOOD INVOCATION"; - public static String BAD_EXIT_STATUS = "VERY BAD INVOCATION"; - - @Inject - @BatchProperty(name="execution.number") - String executionNumberString; - - - @Inject - @BatchProperty(name="execution") - String executionString; - - @Override - public String process() throws Exception { - - int execNum = Integer.parseInt(executionNumberString); - - if (execNum == 1) { - logger.fine(sourceClass + ".process(); Purposefully failing on execution == 1"); - throw new IllegalArgumentException("Purposefully failing on execution == 1"); - } else if (execNum == 2) { - logger.fine(sourceClass + ".process(); Success...exit normally"); - return GOOD_EXIT_STATUS; - } else { - logger.fine(sourceClass + ".process(); Unexpected count, return bad exit status"); - return BAD_EXIT_STATUS; - } - } - - @Override - public void stop() throws Exception { - super.stop(); - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/JobContextTestBatchlet.java b/src/com/ibm/jbatch/tck/artifacts/specialized/JobContextTestBatchlet.java deleted file mode 100644 index 517829df69..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/JobContextTestBatchlet.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import jakarta.batch.api.Batchlet; -import jakarta.batch.runtime.context.JobContext; -import jakarta.inject.Inject; - -@jakarta.inject.Named("jobContextTestBatchlet") -public class JobContextTestBatchlet implements Batchlet { - - @Inject - JobContext jobCtx; - - @Override - public String process() throws Exception { - jobCtx.setExitStatus("JobName=" + jobCtx.getJobName() + ";JobInstanceId=" + jobCtx.getInstanceId() + ";JobExecutionId=" + jobCtx.getExecutionId()); - return "GOOD"; - } - - @Override - public void stop() throws Exception { - // TODO Auto-generated method stub - - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/JobLevelPropertiesCountBatchlet.java b/src/com/ibm/jbatch/tck/artifacts/specialized/JobLevelPropertiesCountBatchlet.java deleted file mode 100644 index b66308e78a..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/JobLevelPropertiesCountBatchlet.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.Iterator; -import java.util.Properties; - -import jakarta.batch.api.AbstractBatchlet; -import jakarta.batch.runtime.context.JobContext; -import jakarta.inject.Inject; - -@jakarta.inject.Named("jobLevelPropertiesCountBatchlet") -public class JobLevelPropertiesCountBatchlet extends AbstractBatchlet { - - @Inject - JobContext JobCtx; - - public static String GOOD_EXIT_STATUS = "VERY GOOD INVOCATION"; - public static final String SHOULD_BE_UNAVAILABLE_PROP_PREFIX = "com.ibm.jbatch.tck.tests.jslxml.JobLevelPropertiesTests"; - - @Override - public String process() throws Exception { - - StringBuffer badExitStatus = new StringBuffer(); - - Properties properties = JobCtx.getProperties(); - - /* - - - - - - */ - - /* - * Verify that all three job-level properties were seen. - */ - - int found = 0; - String[] propNames = new String[] { "foo", "super", "me" }; - String[] propVals = new String[] { "bar", "hero", "too" }; - for (int i = 0 ; i < 3 ; i++) { - String val = properties.getProperty(propNames[i]); - if (propVals[i].equals(val)) { - found++; - } else { - badExitStatus.append("For " + propNames[0] + ", found: " + val + ":"); - } - } - - /** - * Verify that none of the TCK-set properties were seen (from job parameters or other - * level of nesting of JSL properties) - */ - boolean seenBadProp = false; - - Iterator iter = properties.keySet().iterator(); - while (iter.hasNext()) { - String nextProp = (String)iter.next(); - if (nextProp.startsWith(SHOULD_BE_UNAVAILABLE_PROP_PREFIX)) { - seenBadProp = true; - badExitStatus.append("Saw unexpected property: " + nextProp); - } - } - - - if (found == 3 && !seenBadProp) { - JobCtx.setExitStatus(GOOD_EXIT_STATUS); - } else { - JobCtx.setExitStatus(badExitStatus.toString()); - } - - return "GOOD"; - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/JobLevelPropertiesPropertyValueBatchlet.java b/src/com/ibm/jbatch/tck/artifacts/specialized/JobLevelPropertiesPropertyValueBatchlet.java deleted file mode 100644 index c20a44a730..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/JobLevelPropertiesPropertyValueBatchlet.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.Properties; - -import jakarta.batch.api.AbstractBatchlet; -import jakarta.batch.runtime.context.JobContext; -import jakarta.inject.Inject; - -@jakarta.inject.Named("jobLevelPropertiesPropertyValueBatchlet") -public class JobLevelPropertiesPropertyValueBatchlet extends AbstractBatchlet { - - @Inject - JobContext JobCtx; - - public static String GOOD_EXIT_STATUS = "VERY GOOD INVOCATION"; - - @Override - public String process() throws Exception { - - Properties properties = JobCtx.getProperties(); - String foo = properties.getProperty("foo"); - - JobCtx.setExitStatus(foo); - - return GOOD_EXIT_STATUS; - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/JobLevelPropertiesShouldNotBeAvailableThroughStepContextBatchlet.java b/src/com/ibm/jbatch/tck/artifacts/specialized/JobLevelPropertiesShouldNotBeAvailableThroughStepContextBatchlet.java deleted file mode 100644 index bd05e80fa5..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/JobLevelPropertiesShouldNotBeAvailableThroughStepContextBatchlet.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.Properties; - -import jakarta.batch.api.AbstractBatchlet; -import jakarta.batch.runtime.context.JobContext; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - -@jakarta.inject.Named("jobLevelPropertiesShouldNotBeAvailableThroughStepContextBatchlet") -public class JobLevelPropertiesShouldNotBeAvailableThroughStepContextBatchlet extends AbstractBatchlet{ - @Inject - JobContext JobCtx; - - @Inject - StepContext StepCtx; - - public static String GOOD_EXIT_STATUS = "VERY GOOD INVOCATION"; - - @Override - public String process() throws Exception { - - // foo is a job level properties, it should not be avail in the step context - Properties properties = StepCtx.getProperties(); - // should be null - String foo = properties.getProperty("foo"); - - // the exit status defaults to COMPLETED since foo must be null - // Note the Javadoc for JobContext.setExitStatus() does say that - // "If setExitStatus was not called or was called with a null - // value, then the exit status defaults to the batch status of the job." - - JobCtx.setExitStatus(foo); - - return GOOD_EXIT_STATUS; - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/ListenerOnErrorProcessor.java b/src/com/ibm/jbatch/tck/artifacts/specialized/ListenerOnErrorProcessor.java deleted file mode 100644 index a02353e904..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/ListenerOnErrorProcessor.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; -import jakarta.batch.api.BatchProperty; -import jakarta.batch.api.chunk.ItemProcessor; -import jakarta.inject.Inject; -import jakarta.inject.Named; - -import com.ibm.jbatch.tck.artifacts.chunktypes.ReadRecord; - -@Named -public class ListenerOnErrorProcessor implements - ItemProcessor { - - @Inject - @BatchProperty(name="process.fail.immediate") - String failImmediateString; - - boolean failimmediate = false; - - - @Override - public ReadRecord processItem(Object item) throws Exception { - // TODO Auto-generated method stub - - if (failImmediateString!=null){ - failimmediate = Boolean.parseBoolean(failImmediateString); - } - - if (failimmediate){ - throw new Exception("process fail immediate"); - } - else return new ReadRecord(); - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/ListenerOnErrorReader.java b/src/com/ibm/jbatch/tck/artifacts/specialized/ListenerOnErrorReader.java deleted file mode 100644 index 1f23464abb..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/ListenerOnErrorReader.java +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.io.Serializable; - -import jakarta.batch.api.BatchProperty; -import jakarta.batch.api.chunk.ItemReader; -import jakarta.inject.Inject; -import jakarta.inject.Named; - -import com.ibm.jbatch.tck.artifacts.chunktypes.ReadRecord; - -@Named -public class ListenerOnErrorReader implements ItemReader { - - @Inject - @BatchProperty(name="read.fail.immediate") - String failImmediateString; - boolean failimmediate = false; - - @Override - public void open(Serializable checkpoint) throws Exception { - if (failImmediateString!=null){ - failimmediate = Boolean.parseBoolean(failImmediateString); - } - } - - @Override - public void close() throws Exception { - // TODO Auto-generated method stub - - } - - @Override - public ReadRecord readItem() throws Exception { - // TODO Auto-generated method stub - if (failimmediate){ - throw new Exception("read fail immediate"); - } - else { - return new ReadRecord(); - } - } - - @Override - public Serializable checkpointInfo() throws Exception { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/ListenerOnErrorWriter.java b/src/com/ibm/jbatch/tck/artifacts/specialized/ListenerOnErrorWriter.java deleted file mode 100644 index db39dd3430..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/ListenerOnErrorWriter.java +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.io.Serializable; -import java.util.List; - -import jakarta.batch.api.BatchProperty; -import jakarta.batch.api.chunk.ItemWriter; -import jakarta.inject.Inject; -import jakarta.inject.Named; - -@Named -public class ListenerOnErrorWriter implements ItemWriter { - - @Inject - @BatchProperty(name="write.fail.immediate") - String failImmediateString; - boolean failimmediate = false; - - @Override - public void open(Serializable checkpoint) throws Exception { - // TODO Auto-generated method stub - if (failImmediateString!=null){ - failimmediate = Boolean.parseBoolean(failImmediateString); - } - - } - - @Override - public void close() throws Exception { - // TODO Auto-generated method stub - - } - - @Override - public void writeItems(List items) throws Exception { - // TODO Auto-generated method stub - if (failimmediate){ - throw new Exception("writer fail immediate"); - } - - } - - @Override - public Serializable checkpointInfo() throws Exception { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/MetricsStepListener.java b/src/com/ibm/jbatch/tck/artifacts/specialized/MetricsStepListener.java deleted file mode 100644 index f3183cbe1c..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/MetricsStepListener.java +++ /dev/null @@ -1,122 +0,0 @@ -/** - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.logging.Logger; - -import jakarta.batch.api.BatchProperty; -import jakarta.batch.api.listener.AbstractStepListener; -import jakarta.batch.runtime.Metric; -import jakarta.batch.runtime.context.JobContext; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - -@jakarta.inject.Named("metricsStepListener") -public class MetricsStepListener extends AbstractStepListener { - - @Inject - StepContext stepCtx; - - @Inject - JobContext JobCtx; - - @Inject - @BatchProperty(name="numberOfSkips") - String skipNumberString; - - @Inject - @BatchProperty(name="ReadProcessWrite") - String RPWString; - - private final static String sourceClass = MetricsStepListener.class.getName(); - private final static Logger logger = Logger.getLogger(sourceClass); - - public static final String GOOD_EXIT_STATUS_READ = "GOOD READ METRICS RESULT"; - public static final String GOOD_EXIT_STATUS_PROCESS = "GOOD PROCESS METRICS RESULT"; - public static final String GOOD_EXIT_STATUS_WRITE = "GOOD PROCESS METRICS RESULT"; - - public static final String GOOD_EXIT_STATUS = "GOOD METRICS RESULT"; - public static final String BAD_EXIT_STATUS = "BAD RESULT"; - - int skipNum; - - @Override - public void beforeStep() { - logger.finer("In before()"); - skipNum = Integer.parseInt(skipNumberString); - } - - @Override - public void afterStep() { - logger.finer("In after()"); - - Metric[] metrics = stepCtx.getMetrics(); - for (int i = 0; i < metrics.length; i++) { - if (RPWString.equals("READ")) { - if (metrics[i].getType().equals(Metric.MetricType.READ_COUNT)) { - if (metrics[i].getValue() == 30) { - - JobCtx.setExitStatus(GOOD_EXIT_STATUS_READ); - } else { - JobCtx.setExitStatus(BAD_EXIT_STATUS); - } - } - } else if (RPWString.equals("READ_SKIP")) { - if (metrics[i].getType().equals(Metric.MetricType.READ_SKIP_COUNT)) { - if (metrics[i].getValue() == skipNum) { - - JobCtx.setExitStatus(GOOD_EXIT_STATUS_READ); - } else { - JobCtx.setExitStatus(BAD_EXIT_STATUS); - } - } - } else if (RPWString.equals("PROCESS")) { - if (metrics[i].getType().equals(Metric.MetricType.PROCESS_SKIP_COUNT)) { - if (metrics[i].getValue() == (skipNum)) { - - JobCtx.setExitStatus(GOOD_EXIT_STATUS_PROCESS); - } else { - JobCtx.setExitStatus(BAD_EXIT_STATUS); - } - } - } else if (RPWString.equals("WRITE")) { - if (metrics[i].getType().equals(Metric.MetricType.WRITE_COUNT)) { - if (metrics[i].getValue() == (30 - skipNum)) { - - JobCtx.setExitStatus(GOOD_EXIT_STATUS); - } else { - JobCtx.setExitStatus(BAD_EXIT_STATUS); - } - } - - } else if (RPWString.equals("WRITE_SKIP")) { - if (metrics[i].getType().equals(Metric.MetricType.WRITE_SKIP_COUNT)) { - if (metrics[i].getValue() == skipNum) { - - JobCtx.setExitStatus(GOOD_EXIT_STATUS); - } else { - JobCtx.setExitStatus(BAD_EXIT_STATUS); - } - } - } - } - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/MultipleExitStatusBatchlet.java b/src/com/ibm/jbatch/tck/artifacts/specialized/MultipleExitStatusBatchlet.java deleted file mode 100644 index bab955d3e1..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/MultipleExitStatusBatchlet.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import jakarta.batch.api.AbstractBatchlet; -import jakarta.batch.api.BatchProperty; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - -@jakarta.inject.Named("multipleExitStatusBatchlet") -public class MultipleExitStatusBatchlet extends AbstractBatchlet { - - @Inject - StepContext stepCtx; - - @Inject - @BatchProperty(name = "stop.job.after.this.step") - String stop_job_after_this_step; - - @Inject - @BatchProperty(name = "stop.job.after.this.step2") - String stop_job_after_this_step2; - - @Inject - @BatchProperty(name = "fail.job.after.this.step") - String fail_job_after_this_step; - - @Inject - @BatchProperty(name = "step.complete.but.force.job.stopped.status") - String step_complete_but_force_job_stopped_status; - - @Inject - @BatchProperty(name = "step.complete.but.force.job.failed.status") - String step_complete_but_force_job_failed_status; - - @Override - public String process() throws Exception { - - if (stepCtx.getStepName().equalsIgnoreCase(stop_job_after_this_step) - || stepCtx.getStepName().equalsIgnoreCase(stop_job_after_this_step2)) { - - stepCtx.setExitStatus(step_complete_but_force_job_stopped_status); - return step_complete_but_force_job_stopped_status; - } - - if (stepCtx.getStepName().equalsIgnoreCase(fail_job_after_this_step)) { - stepCtx.setExitStatus(step_complete_but_force_job_failed_status); - return step_complete_but_force_job_failed_status; - } - - return stepCtx.getStepName() + "_CONTINUE"; - - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/MyBatchletWithPropertiesImpl.java b/src/com/ibm/jbatch/tck/artifacts/specialized/MyBatchletWithPropertiesImpl.java deleted file mode 100644 index 784c370302..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/MyBatchletWithPropertiesImpl.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.lang.reflect.Field; -import java.util.logging.Logger; - -import jakarta.batch.api.AbstractBatchlet; -import jakarta.batch.api.BatchProperty; -import jakarta.inject.Inject; - -@jakarta.inject.Named("myBatchletWithPropertiesImpl") -public class MyBatchletWithPropertiesImpl extends AbstractBatchlet { - - private final static Logger logger = Logger.getLogger(MyBatchletWithPropertiesImpl.class.getName()); - - private static int count = 1; - - public static String GOOD_EXIT_CODE = "VERY GOOD INVOCATION"; - - @Inject - @BatchProperty - private String myProperty1; - - @Inject - @BatchProperty - public String myProperty2 = "This EYECATCHER should get overwritten from the job xml!!"; - - @Inject - @BatchProperty - public String myDefaultProp1 = "Should get overwritten by default value"; - - @Inject - @BatchProperty - public String mySubmittedProp = "This EYECATCHER should get overwritten by a submitted prop."; - - @Inject - @BatchProperty - public String batchletProp = "This EYECATCHER should get overwritten."; - - @Inject - @BatchProperty - private String javaDefaultValueProp = "JAVA DEFAULT INITIALIZER"; - - @Inject - @BatchProperty(name="myProperty4") - private String property4; - - @Inject - @BatchProperty - String myConcatProp; - - @Inject - @BatchProperty - String myJavaSystemProp; - - @Inject - @BatchProperty - String defaultPropName1; - - @Inject - @BatchProperty - String defaultPropName2; - - @Override - public String process() throws Exception { - - //FIXME use a submitted job parameter here instead so all tests are independent of each other. - String propName = System.getProperty("property.junit.propName"); - String propertyValue = this.getBatchPropertyValue(propName); - - if (propertyValue == null) { - System.clearProperty("property.junit.result"); - } else { - System.setProperty("property.junit.result", "" + propertyValue); - } - - return this.getBatchPropertyValue(propName); - - - } - - - @Override - public void stop() throws Exception { - logger.fine("MyBatchletWithProperties.cancel() - @Cancel #" + count); - } - - - - private String getBatchPropertyValue(String name) throws IllegalArgumentException, IllegalAccessException { - Field[] fields = MyBatchletWithPropertiesImpl.class.getDeclaredFields(); - - for (Field field: fields) { - BatchProperty batchProperty = field.getAnnotation(BatchProperty.class); - if (batchProperty != null) { - if (!batchProperty.name().equals("") && batchProperty.name().equals(name)){ - return (String)field.get(this); - } else if (field.getName().equals(name)){ - return (String)field.get(this); - } - } - } - - return null; - - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/MyChunkListener.java b/src/com/ibm/jbatch/tck/artifacts/specialized/MyChunkListener.java deleted file mode 100644 index 545fe19e4d..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/MyChunkListener.java +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import jakarta.batch.api.BatchProperty; -import jakarta.batch.api.chunk.listener.AbstractChunkListener; -import jakarta.batch.api.listener.StepListener; -import jakarta.batch.runtime.context.JobContext; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - -import com.ibm.jbatch.tck.artifacts.reusable.MyParentException; - -/** - * Originally this class was going to be used to check that we could view an earlier-thrown - * exception via StepContext.getException() in each of afterChunk(), onError(Exception). - * - * After a mailing list comment that we should relax the requirements on the implementation - * to make the exception immediately visible to other artifacts, we agreed to only check - * that we saw the expected exception in afterStep(). - * - * The quick change then was to recast this MyChunkListener as both a ChunkListener and - * StepListener. - * - */ -@jakarta.inject.Named("myChunkListener") -public class MyChunkListener extends AbstractChunkListener implements StepListener { - - @Inject - StepContext stepCtx; - - @Inject - JobContext jobCtx; - - @Inject - @BatchProperty(name="fail.immediate") - String failImmediateString; - - boolean failThrowEx = false; - - @Override - public void beforeChunk() throws Exception { - - if (failImmediateString!=null){ - failThrowEx = Boolean.parseBoolean(failImmediateString); - } - - if (failThrowEx){ - throw new MyParentException("Testing getException"); - } - } - - @Override - public void beforeStep() throws Exception { - // No-op - } - - @Override - public void afterStep() throws Exception { - Exception ex = stepCtx.getException(); - if (ex == null) { - jobCtx.setExitStatus("MyChunkListener: error, didn't find an exception."); - } else if (ex instanceof MyParentException){ - jobCtx.setExitStatus("MyChunkListener: found instanceof MyParentException"); - } else { - jobCtx.setExitStatus("MyChunkListener: did not find instanceof MyParentException, but found another exception"); - } - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/MyCustomCheckpointAlgorithm.java b/src/com/ibm/jbatch/tck/artifacts/specialized/MyCustomCheckpointAlgorithm.java deleted file mode 100644 index 7db495a2d3..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/MyCustomCheckpointAlgorithm.java +++ /dev/null @@ -1,160 +0,0 @@ -/** - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.Date; -import java.util.logging.Level; -import java.util.logging.Logger; - -import jakarta.batch.api.BatchProperty; -import jakarta.batch.api.chunk.AbstractCheckpointAlgorithm; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - -import com.ibm.jbatch.tck.artifacts.reusable.MyPersistentRestartUserData; - -/* -* Copyright 2012, 2020 International Business Machines Corp. -* -* See the NOTICE file distributed with this work for additional information -* regarding copyright ownership. Licensed under the Apache License, -* Version 2.0 (the "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - - - -@jakarta.inject.Named("myCustomCheckpointAlgorithm") -public class MyCustomCheckpointAlgorithm extends AbstractCheckpointAlgorithm { - - private static final String className = MyCustomCheckpointAlgorithm.class.getName(); - private static Logger logger = Logger.getLogger(MyCustomCheckpointAlgorithm.class.getPackage().getName()); - - boolean inCheckpoint = false; - int checkpointIterations = 1; - - int threshold; - long timeStarted = 0; - int requests; - - @Inject - private StepContext stepCtx = null; - - @Inject - @BatchProperty(name="writepoints") - String writePointsString; - - @Inject - @BatchProperty(name="next.writepoints") - String nextWritePointsString; - - int [] writePoints; - - boolean init = false; - - public void init(){ - - MyPersistentRestartUserData myData = null; - if ((myData = (MyPersistentRestartUserData)stepCtx.getPersistentUserData()) != null) { - stepCtx.setPersistentUserData(new MyPersistentRestartUserData(myData.getExecutionNumber() + 1, null)); - logger.fine("AJM: iteration = " + ((MyPersistentRestartUserData)stepCtx.getPersistentUserData()).getExecutionNumber()); - writePointsString = ((MyPersistentRestartUserData)stepCtx.getPersistentUserData()).getNextWritePoints(); - } else { - stepCtx.setPersistentUserData(new MyPersistentRestartUserData(1, nextWritePointsString)); - } - - String[] writePointsStrArr = writePointsString.split(","); - writePoints = new int[writePointsString.length()]; - - for (int i = 0; i items) throws Exception { - if (items != null && ("WRITE").equals(applistenerTest)){ - logger.finer("In beforeWrite()"); - beforecounter++; - logger.fine("AJM: beforecounter = " + beforecounter); - - } - } - - @Override - public void afterWrite(List items) throws Exception { - - logger.fine("AJM: applistenerTest = " + applistenerTest); - - if (items != null && ("WRITE").equals(applistenerTest)){ - logger.finer("In afterWrite()"); - - aftercounter++; - logger.fine("AJM: aftercounter = " + aftercounter); - - if (beforecounter == aftercounter) { - jobCtx.setExitStatus(GOOD_EXIT_STATUS); - } else - jobCtx.setExitStatus(BAD_EXIT_STATUS); - } - } - - @Override - public void onWriteError(List items, Exception e) throws Exception { - logger.finer("In onWriteError()" + e); - jobCtx.setExitStatus("MyItemWriteListenerImpl.onWriteError"); - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/MyLongRunningBatchletImpl.java b/src/com/ibm/jbatch/tck/artifacts/specialized/MyLongRunningBatchletImpl.java deleted file mode 100644 index a54c000fa9..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/MyLongRunningBatchletImpl.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.Random; -import java.util.logging.Logger; - -import jakarta.batch.api.AbstractBatchlet; -import jakarta.batch.api.BatchProperty; -import jakarta.batch.runtime.context.JobContext; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - -import com.ibm.jbatch.tck.artifacts.reusable.StopOnBulletinBoardTestData; - -// NOTE: We do NOT use the default @Named value in this special case, like we usually do. -// Be careful generating the batch.xml !! -@jakarta.inject.Named("myLongRunningBatchlet") -public class MyLongRunningBatchletImpl extends AbstractBatchlet { - - @Inject - JobContext jobCtx; - - @Inject - @BatchProperty(name="run.indefinitely") - private String runIndefinitelyString = null; - private boolean runIndefinitely = false; - - @Inject - @BatchProperty(name="throw.exc.on.number.3") - private String throwExcOnThreeString = null; - private boolean throwExcOnThree = false; - - @Inject - private StepContext stepCtx = null; - - private final static String sourceClass = MyLongRunningBatchletImpl.class.getName(); - private final static Logger logger = Logger.getLogger(sourceClass); - - // I think we need this to be volatile so the value doesn't get cached on the Thread. - // Not 100% sure. - private volatile boolean stopped = false; - - private void begin() throws Exception { - logger.fine("MyLongRunningBatchletImpl.begin()"); - - StopOnBulletinBoardTestData testData = (StopOnBulletinBoardTestData) stepCtx.getPersistentUserData(); - if (testData == null) { - testData = new StopOnBulletinBoardTestData(); - stepCtx.setPersistentUserData(testData); - } - - // Currently we don't use this in the validation logic, it's only a - // debugging tool. It's OK to reuse a thread for multiple partitions - // so we wouldn't want to simply blow up if we found we were reusing a thread. - long currentThreadId = Thread.currentThread().getId(); - testData.addThreadIdToList(currentThreadId); - logger.fine("Running on thread: " + currentThreadId); - logger.finer("Complete list of threads for this partition:"); - for (long l : testData.getThreadIdArrayList()) { - logger.finer("Next thread = " + l); - } - - - if ("true".equalsIgnoreCase(runIndefinitelyString)) { - runIndefinitely = true; - } - - if ("true".equalsIgnoreCase(throwExcOnThreeString)) { - throwExcOnThree = true; - } - - } - - @Override - public String process() throws Exception { - logger.fine("MyLongRunningBatchLetImpl.process(); current ExitStatus = " + jobCtx.getExitStatus()); - - this.begin(); - - int i = 0; - int numTimesToRun = 500; - boolean maxTimesReached = false; - - while (!stopped) { - if (i % 100000 == 0) { - logger.fine("i=" + i++); - } else { - logger.finest("i=" + i++); - } - if (i==3 && throwExcOnThree) { - logger.fine("Throwing exception to confirm fail+restart handling on unchecked exceptions."); - throw new RuntimeException("Throwing exception to confirm fail+restart handling on unchecked exceptions."); - } - - for (int k = 0; k < 100; k++) { - Random r = new Random(k); - r.nextInt(); - } - if ((!runIndefinitely) && (i >= numTimesToRun)) { - maxTimesReached = true; - break; - } - } - - if (maxTimesReached) { - - - String currentExitStatus = jobCtx.getExitStatus(); - if (currentExitStatus != null) { - jobCtx.setExitStatus("GOOD.STEP." + currentExitStatus); - } else { - // Throw this in there in case anyone could somehow think the first setExitStatus wins. - // This makes it crystal clear this isn't the case. - jobCtx.setExitStatus("NOT.FINAL.ONE.SHOULD.HAVE.NO.EFFECT"); - jobCtx.setExitStatus("GOOD.STEP"); - } - return "BATCHLET RAN TO COMPLETION"; - } else { - jobCtx.setExitStatus("BATCHLET CANCELED BEFORE COMPLETION"); - return "BATCHLET CANCELED BEFORE COMPLETION"; - } - } - - @Override - public void stop() throws Exception { - logger.fine("MyLongRunningBatchLetImpl.cancel()"); - this.stopped = true; - } - - private class MyTransient { - int data = 0; - MyTransient(int x) { - data = x; - } - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/MyMultipleExceptionsRetryReadListener.java b/src/com/ibm/jbatch/tck/artifacts/specialized/MyMultipleExceptionsRetryReadListener.java deleted file mode 100644 index 41ec88df4a..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/MyMultipleExceptionsRetryReadListener.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.logging.Logger; - -import jakarta.batch.api.chunk.listener.RetryReadListener; -import jakarta.batch.runtime.context.JobContext; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - - - -import com.ibm.jbatch.tck.artifacts.reusable.MyParentException; - -@jakarta.inject.Named("myMultipleExceptionsRetryReadListener") -public class MyMultipleExceptionsRetryReadListener implements RetryReadListener { - - @Inject - JobContext jobCtx; - - @Inject - StepContext stepCtx; - - private final static String sourceClass = MySkipReadListener.class.getName(); - private final static Logger logger = Logger.getLogger(sourceClass); - - public static final String GOOD_EXIT_STATUS = "MyMultipleExceptionsRetryReadListener: GOOD STATUS"; - public static final String BAD_EXIT_STATUS = "MyMultipleExceptionsRetryReadListener: BAD STATUS"; - - - @Override - public void onRetryReadException(Exception ex) throws Exception { - TestUtil.logMsg("In onSkipReadItem" + ex + "

"); - - if (ex instanceof MyParentException) { - TestUtil.logMsg("SKIPLISTENER: onSkipReadItem, exception is an instance of: MyParentException

"); - jobCtx.setExitStatus(GOOD_EXIT_STATUS); - } else { - TestUtil.logMsg("SKIPLISTENER: onSkipReadItem, exception is NOT an instance of: MyParentException

"); - jobCtx.setExitStatus(BAD_EXIT_STATUS); - } - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/MyPartitionAnalyzer.java b/src/com/ibm/jbatch/tck/artifacts/specialized/MyPartitionAnalyzer.java deleted file mode 100644 index 2b1ba60ef0..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/MyPartitionAnalyzer.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.io.Serializable; - -import jakarta.batch.api.partition.AbstractPartitionAnalyzer; -import jakarta.batch.runtime.BatchStatus; -import jakarta.batch.runtime.context.JobContext; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - -import com.ibm.jbatch.tck.artifacts.reusable.ExternalizableString; - -@jakarta.inject.Named -public class MyPartitionAnalyzer extends AbstractPartitionAnalyzer { - - private volatile String analyzedData = ""; - - private volatile String analyzedStatus = ""; - - @Inject - JobContext jobCtx; - - @Inject - StepContext stepCtx; - - @Override - public void analyzeCollectorData(Serializable data) throws Exception { - - analyzedData = analyzedData + ((ExternalizableString)data).getString() + "A"; - - } - - @Override - public void analyzeStatus(BatchStatus batchStatus, String exitStatus)throws Exception { - analyzedStatus = analyzedStatus + "S"; - - //If this method is called the partition is complete. So we should expect analyzedData to - //have a 'CA' for each completed partition. - - String expectedString = ""; - - for (int i = 0; i < analyzedStatus.length(); i++){ - expectedString = expectedString + "CA"; - } - - if (!analyzedData.startsWith(expectedString)) { - throw new Exception("analyzeStatus was called at an unexpected time. Expected String to have at least=" +expectedString + " ActualData=" + analyzedData); - } - - - stepCtx.setExitStatus(analyzedData); - - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/MyPartitionCollector.java b/src/com/ibm/jbatch/tck/artifacts/specialized/MyPartitionCollector.java deleted file mode 100644 index 9f29082e25..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/MyPartitionCollector.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - - -import java.io.Externalizable; - -import jakarta.batch.api.partition.PartitionCollector; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - -import com.ibm.jbatch.tck.artifacts.reusable.ExternalizableString; - -@jakarta.inject.Named -public class MyPartitionCollector implements PartitionCollector { - - @Inject - StepContext ctx; - - @Override - public Externalizable collectPartitionData() throws Exception { - - ExternalizableString eString = new ExternalizableString("C"); - - return eString; - - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/MyPartitionMapper.java b/src/com/ibm/jbatch/tck/artifacts/specialized/MyPartitionMapper.java deleted file mode 100644 index 43cff5f1d0..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/MyPartitionMapper.java +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.Properties; - -import jakarta.batch.api.BatchProperty; -import jakarta.batch.api.partition.PartitionMapper; -import jakarta.batch.api.partition.PartitionPlan; -import jakarta.inject.Inject; - -import com.ibm.jbatch.tck.artifacts.specialized.MyPartitionPlan; - -@jakarta.inject.Named -public class MyPartitionMapper implements PartitionMapper { - - - private static final String GOOD_EXIT_STATUS = "good.partition.status"; - - @Inject - @BatchProperty - private String numPartitionsProp = null; - private int numPartitions; - - - @Inject - @BatchProperty - private String failThisPartition = "-1"; - - @Inject - @BatchProperty - private String partitionsOverride = null; - - - @Override - public PartitionPlan mapPartitions() throws Exception { - - numPartitions = Integer.parseInt(numPartitionsProp); - - Properties[] props = new Properties[numPartitions]; - - Integer i; - for (i = 0; i < numPartitions; i++) { - props[i] = new Properties(); - props[i].setProperty(GOOD_EXIT_STATUS, "MapperProp" + Integer.toString(i)); - - if (i.toString().equals(failThisPartition)) { - props[i].setProperty("fail.this.partition", "true"); - } else{ - props[i].setProperty("fail.this.partition", "false"); - } - } - - PartitionPlan partitionPlan = new MyPartitionPlan(); - partitionPlan.setPartitions(numPartitions); - partitionPlan.setPartitionProperties(props); - if ("true".equals(partitionsOverride)) { - partitionPlan.setPartitionsOverride(true); - } else { - partitionPlan.setPartitionsOverride(false); - } - - return partitionPlan; - - } - - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/MyPartitionPlan.java b/src/com/ibm/jbatch/tck/artifacts/specialized/MyPartitionPlan.java deleted file mode 100644 index edec2bcfbb..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/MyPartitionPlan.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import jakarta.batch.api.partition.PartitionPlanImpl; - -@jakarta.inject.Named("myPartitionPlan") -public class MyPartitionPlan extends PartitionPlanImpl { - - - -} \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/MyPartitionReducer.java b/src/com/ibm/jbatch/tck/artifacts/specialized/MyPartitionReducer.java deleted file mode 100644 index 24d436a4aa..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/MyPartitionReducer.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import jakarta.batch.api.partition.PartitionReducer; -import jakarta.batch.runtime.context.JobContext; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - -@jakarta.inject.Named("myPartitionReducer") -public class MyPartitionReducer implements PartitionReducer { - - - String history; - - @Inject - StepContext stepCtx; - - @Inject - JobContext jobCtx; - - @Override - public void beginPartitionedStep() throws Exception { - - String exitStatus = stepCtx.getExitStatus(); - - history = exitStatus + "Begin"; - - } - - @Override - public void beforePartitionedStepCompletion() throws Exception { - String exitStatus = stepCtx.getExitStatus(); - - stepCtx.setExitStatus(history + exitStatus + "Before"); - - } - - @Override - public void rollbackPartitionedStep() throws Exception { - String exitStatus = stepCtx.getExitStatus(); - - stepCtx.setExitStatus(history + exitStatus + "Rollback"); - - } - - @Override - public void afterPartitionedStepCompletion(PartitionStatus status) throws Exception { - String exitStatus = stepCtx.getExitStatus(); - - stepCtx.setExitStatus(exitStatus + "After"); - - jobCtx.setExitStatus(stepCtx.getExitStatus()); - - } - - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/MyPartitionedBatchletImpl.java b/src/com/ibm/jbatch/tck/artifacts/specialized/MyPartitionedBatchletImpl.java deleted file mode 100644 index 70ba6aae5b..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/MyPartitionedBatchletImpl.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.logging.Logger; - -import jakarta.batch.api.AbstractBatchlet; -import jakarta.batch.api.BatchProperty; -import jakarta.batch.runtime.context.JobContext; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - -@jakarta.inject.Named("myPartitionedBatchletImpl") -public class MyPartitionedBatchletImpl extends AbstractBatchlet { - - private final static Logger logger = Logger.getLogger(MyPartitionedBatchletImpl.class.getName()); - - private static int count = 1; - - @Inject - @BatchProperty(name="good.partition.status") - private String good_partition_status; - - @Inject - @BatchProperty(name="fail.this.partition") - private String fail_this_partition; - - @Inject - private JobContext jobCtx; - - @Inject - private StepContext stepCtx = null; - - @Override - public String process() throws Exception { - - if ("true".equals(fail_this_partition)){ - throw new Exception("Fail this partition on purpose in MyPartitionedBatchlet.process()"); - } - - //Check that job level properties were propagated to the partitioned or split step's context - if (!jobCtx.getProperties().getProperty("job.level.prop").equals("job.prop.value")) { - jobCtx.setExitStatus("Job level properties not set from parent context"); - throw new Exception("This test will not pass because the job level properties are not set in the partition or split level jobcontext"); - } - - //Check that step level properties were propagated to the partitioned or split step's context - if (!stepCtx.getProperties().getProperty("step.level.prop").equals("step.prop.value")) { - stepCtx.setExitStatus("Step level properties not set from parent context"); - throw new Exception("This test will not pass because the step level properties are not set in the partition or split level stepcontext"); - } - - return this.good_partition_status; - - } - - @Override - public void stop() throws Exception { - logger.fine("MyPartitionedBatchletImpl() - @Cancel #" + count); - } - - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/MyRetryProcessListener.java b/src/com/ibm/jbatch/tck/artifacts/specialized/MyRetryProcessListener.java deleted file mode 100644 index 0451b108ff..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/MyRetryProcessListener.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.logging.Logger; - -import jakarta.batch.api.chunk.listener.RetryProcessListener; -import jakarta.batch.runtime.context.JobContext; -import jakarta.inject.Inject; - - - - -@jakarta.inject.Named("myRetryProcessListener") -public class MyRetryProcessListener implements RetryProcessListener { - private final static String sourceClass = MyRetryProcessListener.class.getName(); - private final static Logger logger = Logger.getLogger(sourceClass); - - @Inject - JobContext jobCtx; - - @Override - public void onRetryProcessException(Object o, Exception e) { - TestUtil.logMsg("In onRetryProcessException()" + e); - jobCtx.setExitStatus("Retry listener invoked"); - } -} - diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/MyRetryReadListener.java b/src/com/ibm/jbatch/tck/artifacts/specialized/MyRetryReadListener.java deleted file mode 100644 index aabaaf3ee3..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/MyRetryReadListener.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.logging.Logger; - -import jakarta.batch.api.chunk.listener.RetryReadListener; -import jakarta.batch.runtime.context.JobContext; -import jakarta.inject.Inject; - - - -@jakarta.inject.Named("myRetryReadListener") -public class MyRetryReadListener implements RetryReadListener { - private final static String sourceClass = MyRetryReadListener.class.getName(); - private final static Logger logger = Logger.getLogger(sourceClass); - - @Inject - JobContext jobCtx; - - @Override - public void onRetryReadException(Exception e) { - TestUtil.logMsg("In onRetryReadException()" + e); - jobCtx.setExitStatus("Retry listener invoked"); - } -} - diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/MyRetryWriteListener.java b/src/com/ibm/jbatch/tck/artifacts/specialized/MyRetryWriteListener.java deleted file mode 100644 index 9156dbba77..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/MyRetryWriteListener.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.logging.Logger; -import java.util.List; - -import jakarta.batch.api.chunk.listener.RetryWriteListener; -import jakarta.batch.runtime.context.JobContext; -import jakarta.inject.Inject; - - - - -@jakarta.inject.Named("myRetryWriteListener") -public class MyRetryWriteListener implements RetryWriteListener { - private final static String sourceClass = MyRetryWriteListener.class.getName(); - private final static Logger logger = Logger.getLogger(sourceClass); - - @Inject - JobContext jobCtx; - - @Override - public void onRetryWriteException(List w, Exception e) { - TestUtil.logMsg("In onRetryWriteException()" + e); - jobCtx.setExitStatus("Retry listener invoked"); - } -} - diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/MySimpleCustomCheckpointAlgorithm.java b/src/com/ibm/jbatch/tck/artifacts/specialized/MySimpleCustomCheckpointAlgorithm.java deleted file mode 100644 index 6283eb5e4e..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/MySimpleCustomCheckpointAlgorithm.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -/* -* Copyright 2012, 2020 International Business Machines Corp. -* -* See the NOTICE file distributed with this work for additional information -* regarding copyright ownership. Licensed under the Apache License, -* Version 2.0 (the "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -import java.util.logging.Level; -import java.util.logging.Logger; - -import jakarta.batch.api.chunk.AbstractCheckpointAlgorithm; - -@jakarta.inject.Named("mySimpleCustomCheckpointAlgorithm") -public class MySimpleCustomCheckpointAlgorithm extends AbstractCheckpointAlgorithm { - - private static final String className = MyCustomCheckpointAlgorithm.class.getName(); - private static Logger logger = Logger.getLogger(MyCustomCheckpointAlgorithm.class.getPackage().getName()); - - - @Override - public boolean isReadyToCheckpoint() throws Exception { - String method = "isReadyToCheckpoint"; - if(logger.isLoggable(Level.FINER)) { logger.entering(className, method); } - - return false; - } - -} - diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/MySkipProcessListener.java b/src/com/ibm/jbatch/tck/artifacts/specialized/MySkipProcessListener.java deleted file mode 100644 index 78e36a63f5..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/MySkipProcessListener.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.logging.Logger; - -import jakarta.batch.api.chunk.listener.SkipProcessListener; -import jakarta.batch.runtime.context.JobContext; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - - - -import com.ibm.jbatch.tck.artifacts.chunktypes.ReadRecord; -import com.ibm.jbatch.tck.artifacts.reusable.MyParentException; - -@jakarta.inject.Named("mySkipProcessListener") -public class MySkipProcessListener implements SkipProcessListener { - - @Inject - JobContext jobCtx; - - @Inject - StepContext stepCtx; - - private final static String sourceClass = MySkipProcessListener.class.getName(); - private final static Logger logger = Logger.getLogger(sourceClass); - - public static final String GOOD_EXIT_STATUS = "MySkipProcessListener: GOOD STATUS, GOOD OBJ PASSED"; - public static final String BAD_EXIT_STATUS = "MySkipProcessListener: BAD STATUS"; - - @Override - public void onSkipProcessItem(Object item, Exception e) { - TestUtil.logMsg("In onSkipProcessItem()" + e + "

"); - - ReadRecord input = (ReadRecord)item; - - if (item != null){ - logger.finer("In onSkipProcessItem(), item count = " + input.getCount()); - - if (e instanceof MyParentException) { - TestUtil.logMsg("SKIPLISTENER: onSkipProcessItem, exception is an instance of: MyParentException

"); - jobCtx.setExitStatus(GOOD_EXIT_STATUS); - } else { - TestUtil.logMsg("SKIPLISTENER: onSkipProcessItem, exception is NOT an instance of: MyParentException

"); - jobCtx.setExitStatus(BAD_EXIT_STATUS); - } - } - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/MySkipReadListener.java b/src/com/ibm/jbatch/tck/artifacts/specialized/MySkipReadListener.java deleted file mode 100644 index 9ea3e915e4..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/MySkipReadListener.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.logging.Logger; - -import jakarta.batch.api.chunk.listener.SkipReadListener; -import jakarta.batch.runtime.context.JobContext; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - - - -import com.ibm.jbatch.tck.artifacts.reusable.MyParentException; - -@jakarta.inject.Named("mySkipReadListener") -public class MySkipReadListener implements SkipReadListener { - - @Inject - JobContext jobCtx; - - @Inject - StepContext stepCtx; - - private final static String sourceClass = MySkipReadListener.class.getName(); - private final static Logger logger = Logger.getLogger(sourceClass); - - public static final String GOOD_EXIT_STATUS = "MySkipReadListener: GOOD STATUS"; - public static final String BAD_EXIT_STATUS = "MySkipReadListener: BAD STATUS"; - - @Override - public void onSkipReadItem(Exception e) { - TestUtil.logMsg("In onSkipReadItem" + e + "

"); - - if (e instanceof MyParentException) { - TestUtil.logMsg("SKIPLISTENER: onSkipReadItem, exception is an instance of: MyParentException

"); - jobCtx.setExitStatus(GOOD_EXIT_STATUS); - } else { - TestUtil.logMsg("SKIPLISTENER: onSkipReadItem, exception is NOT an instance of: MyParentException

"); - jobCtx.setExitStatus(BAD_EXIT_STATUS); - } - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/MySkipReaderExceedListener.java b/src/com/ibm/jbatch/tck/artifacts/specialized/MySkipReaderExceedListener.java deleted file mode 100644 index e0c153a9df..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/MySkipReaderExceedListener.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.logging.Logger; - -import jakarta.batch.api.chunk.listener.SkipReadListener; -import jakarta.batch.runtime.context.JobContext; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - - - -import com.ibm.jbatch.tck.artifacts.reusable.MyParentException; - -@jakarta.inject.Named("mySkipReaderExceedListener") -public class MySkipReaderExceedListener implements SkipReadListener { - - @Inject - JobContext jobCtx; - - @Inject - StepContext stepCtx; - - private final static String sourceClass = MySkipReadListener.class.getName(); - private final static Logger logger = Logger.getLogger(sourceClass); - - public static final String GOOD_EXIT_STATUS = "MySkipReadListener: GOOD STATUS"; - public static final String BAD_EXIT_STATUS_INCORRECT_NUMBER_SKIPS = "MySkipReadListener: BAD STATUS_INCORRECT_NUMBER_SKIPS"; - public static final String BAD_EXIT_STATUS_WRONG_EXCEPTION = "MySkipReadListener: BAD STATUS_WRONG_EXCEPTION"; - - int count = 0; - - @Override - public void onSkipReadItem(Exception e) { - TestUtil.logMsg("In onSkipReadItem" + e + "

"); - - count++; - - if (e instanceof MyParentException) { - if (count == 1){ - TestUtil.logMsg("SKIPLISTENER: onSkipReadItem, exception is an instance of: MyParentException and number of skips is equal to 1

"); - jobCtx.setExitStatus(GOOD_EXIT_STATUS); - } - else { - TestUtil.logMsg("SKIPLISTENER: onSkipReadItem invoked more than expected and/or wrong exception skipped"); - jobCtx.setExitStatus(BAD_EXIT_STATUS_INCORRECT_NUMBER_SKIPS); - } - } - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/MySkipWriteListener.java b/src/com/ibm/jbatch/tck/artifacts/specialized/MySkipWriteListener.java deleted file mode 100644 index 24500fc72e..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/MySkipWriteListener.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.List; -import java.util.logging.Logger; - -import jakarta.batch.api.chunk.listener.SkipWriteListener; -import jakarta.batch.runtime.context.JobContext; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - - - -import com.ibm.jbatch.tck.artifacts.chunktypes.ReadRecord; -import com.ibm.jbatch.tck.artifacts.reusable.MyParentException; - -@jakarta.inject.Named("mySkipWriteListener") -public class MySkipWriteListener implements SkipWriteListener { - - @Inject - JobContext jobCtx; - - @Inject - StepContext stepCtx; - - private final static String sourceClass = MySkipWriteListener.class.getName(); - private final static Logger logger = Logger.getLogger(sourceClass); - - public static final String GOOD_EXIT_STATUS = "MySkipWriteListener: GOOD STATUS, GOOD OBJS PASSED IN"; - public static final String BAD_EXIT_STATUS = "MySkipWriteListener: BAD STATUS"; - - @Override - public void onSkipWriteItem(List items, Exception e) { - TestUtil.logMsg("In onSkipWriteItem()" + e + "

"); - ReadRecord input = null; - boolean inputOK = false; - - for (Object obj : items) { - input = (ReadRecord)obj; - - if (obj != null){ - logger.finer("In onSkipProcessItem(), item count = " + input.getCount()); - inputOK = true; - } - } - - if (e instanceof MyParentException && inputOK) { - TestUtil.logMsg("SKIPLISTENER: onSkipWriteItem, exception is an instance of: MyParentException

"); - jobCtx.setExitStatus(GOOD_EXIT_STATUS); - } else { - TestUtil.logMsg("SKIPLISTENER: onSkipWriteItem, exception is NOT an instance of: MyParentException

"); - jobCtx.setExitStatus(BAD_EXIT_STATUS); - } - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/MyTimeCheckpointListener.java b/src/com/ibm/jbatch/tck/artifacts/specialized/MyTimeCheckpointListener.java deleted file mode 100644 index 1992591106..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/MyTimeCheckpointListener.java +++ /dev/null @@ -1,130 +0,0 @@ -/** - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ - -import java.util.logging.Logger; - -import jakarta.batch.api.BatchProperty; -import jakarta.batch.api.chunk.listener.AbstractChunkListener; -import jakarta.batch.runtime.context.JobContext; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - - - -@jakarta.inject.Named("myTimeCheckpointListener") -public class MyTimeCheckpointListener extends AbstractChunkListener { - - private final static String sourceClass = MyCustomCheckpointListener.class.getName(); - private final static Logger logger = Logger.getLogger(sourceClass); - - java.util.Date date; - long ts; - int timeinterval; - boolean init=true; - - long startTime = 0; - long endTime = 0; - - @Inject - @BatchProperty(name="timeinterval") - String timeintervalString; - - @Inject - JobContext jobCtx; - - @Inject - StepContext stepCtx; - - public MyTimeCheckpointListener(){ - - } - - @Override - public void beforeChunk() { - logger.fine("CHUNKLISTENER: beforeChunk"); - - timeinterval = Integer.parseInt(timeintervalString); - - logger.fine("CHUNKLISTENER: got the timeinterval: " + timeinterval); - logger.fine("CHUNKLISTENER: startTime: " + startTime); - logger.fine("CHUNKLISTENER: endTime: " + endTime); - - - - long curdiff = endTime - startTime; - logger.fine("CHUNKLISTENER: curdiff: " + curdiff); - int diff = 0; - if (curdiff == 0){ - diff = 0; - } - else { - diff = (int)((int)endTime - startTime)/1000; - } - - logger.fine("AJM: time diff =" + diff); - - if ((diff >= timeinterval-1) && (diff <= timeinterval+1)) { - logger.fine("CHUNKLISTENER: the checkpoint is occuring at the correct time -> " + diff + " which is: " + timeinterval + " +/- 1 second"); - jobCtx.setExitStatus("TRUE: " + diff); - } - else { - logger.fine("CHUNKLISTENER: checkpoint outside the window surrounding the time interval of " + timeinterval); - jobCtx.setExitStatus("FALSE: " + diff); - //throw new Exception("WRITE: the chunk write did not occur at the correct time boundry -> "+ diff + " which is: " + timeinterval + "+/- 1 second"); - } - - startTime = System.currentTimeMillis(); - } - - - @Override - public void afterChunk() { - logger.fine("CHUNKLISTENER: afterChunk"); - - date = new java.util.Date(); - ts = date.getTime(); - - endTime = System.currentTimeMillis(); - } - - @Override - public void onError(Exception e) { - logger.fine("CHUNKLISTENER: onError"); - } - -} \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/MyUniversalListener.java b/src/com/ibm/jbatch/tck/artifacts/specialized/MyUniversalListener.java deleted file mode 100644 index f9c11b47a8..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/MyUniversalListener.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - - -import java.util.logging.Logger; - -import jakarta.batch.api.BatchProperty; -import jakarta.batch.api.listener.JobListener; -import jakarta.batch.api.listener.StepListener; -import jakarta.batch.runtime.context.JobContext; -import jakarta.inject.Inject; - -@jakarta.inject.Named("myUniversalListener") -public class MyUniversalListener implements JobListener, StepListener { - - private final static Logger logger = Logger.getLogger(MyUniversalListener.class.getName()); - - @Inject - private JobContext jobCtx = null; - - @Inject - @BatchProperty(name="app.timeinterval") - String timeintervalString; - - int timeinterval = 0; - - @Override - public void beforeJob() { - String cur = jobCtx.getExitStatus(); - String status = (cur == null ? "BeforeJob" : cur + "BeforeJob"); - jobCtx.setExitStatus(status); - } - - @Override - public void afterJob() { - String cur = jobCtx.getExitStatus(); - jobCtx.setExitStatus(cur + "AfterJob"); - } - - @Override - public void beforeStep() { - timeinterval = Integer.parseInt(timeintervalString); - String cur = jobCtx.getExitStatus(); - jobCtx.setExitStatus(cur + "BeforeStep"); - } - - @Override - public void afterStep() { - logger.fine("AJM: gonna sleep for " + timeinterval); - try { - Thread.sleep(timeinterval); - } catch (Exception e){ - e.printStackTrace(); - } - String cur = jobCtx.getExitStatus(); - jobCtx.setExitStatus(cur + "AfterStep"); - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/NullChkPtInfoReader.java b/src/com/ibm/jbatch/tck/artifacts/specialized/NullChkPtInfoReader.java deleted file mode 100644 index 9ad27cbdf5..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/NullChkPtInfoReader.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.io.Serializable; -import java.util.logging.Logger; - -import jakarta.batch.api.chunk.ItemReader; -import jakarta.batch.runtime.context.JobContext; -import jakarta.inject.Inject; - -@jakarta.inject.Named("nullChkPtInfoReader") -public class NullChkPtInfoReader implements ItemReader { - - private final static Logger logger = Logger.getLogger(DoSomethingSimpleArrayWriter.class.getName()); - - @Inject - JobContext jobCtx; - - @Override - public void open(Serializable checkpoint) throws Exception { - - logger.fine("AJM: reader.open(checkpoint)"); - - if (checkpoint == null){ - jobCtx.setExitStatus("checkpointInfo is null in reader.open"); - } - } - - @Override - public void close() throws Exception { - logger.fine("AJM: reader.close()"); - - } - - @Override - public String readItem() throws Exception { - logger.fine("AJM: in reader.readItem(), returning a null to shut down the app"); - return null; - } - - @Override - public Serializable checkpointInfo() throws Exception { - logger.fine("AJM: returning null from reader.checkpointInfo()"); - return null; - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/NullChkPtInfoWriter.java b/src/com/ibm/jbatch/tck/artifacts/specialized/NullChkPtInfoWriter.java deleted file mode 100644 index 383d616b95..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/NullChkPtInfoWriter.java +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.io.Serializable; -import java.util.List; -import java.util.logging.Logger; - -import jakarta.batch.api.chunk.ItemWriter; -import jakarta.batch.runtime.context.JobContext; -import jakarta.inject.Inject; - -@jakarta.inject.Named("nullChkPtInfoWriter") -public class NullChkPtInfoWriter implements ItemWriter { - - private final static Logger logger = Logger.getLogger(DoSomethingSimpleArrayWriter.class.getName()); - - @Inject - JobContext jobCtx; - - @Override - public void open(Serializable checkpoint) throws Exception { - logger.fine("AJM: writer.open(checkpoint)"); - - - if (checkpoint == null){ - jobCtx.setExitStatus(jobCtx.getExitStatus()+"...checkpointInfo is null in writer.open"); - } - - } - - @Override - public void close() throws Exception { - // TODO Auto-generated method stub - logger.fine("AJM: writer.close()"); - - } - - @Override - public Serializable checkpointInfo() throws Exception { - // TODO Auto-generated method stub - logger.fine("AJM: returing null from writer.checkpointInfo()"); - return null; - } - - @Override - public void writeItems(List items) throws Exception { - // TODO Auto-generated method stub - logger.fine("AJM: writer.writeItems()"); - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/NumbersRetryProcessListener.java b/src/com/ibm/jbatch/tck/artifacts/specialized/NumbersRetryProcessListener.java deleted file mode 100644 index f6fd828d0c..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/NumbersRetryProcessListener.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.Properties; -import java.util.logging.Logger; - -import jakarta.batch.api.chunk.listener.RetryProcessListener; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - - - -import com.ibm.jbatch.tck.artifacts.reusable.MyParentException; - -@jakarta.inject.Named("numbersRetryProcessListener") -public class NumbersRetryProcessListener implements RetryProcessListener { - private final static String sourceClass = NumbersRetryProcessListener.class.getName(); - private final static Logger logger = Logger.getLogger(sourceClass); - - @Inject - StepContext stepCtx; - - @Override - public void onRetryProcessException(Object o, Exception e) { - TestUtil.logMsg("In onRetryProcessException()" + e + "

"); - logger.finer("In onRetryProcessException()" + e); - ((Properties)stepCtx.getTransientUserData()).setProperty("retry.process.exception.invoked", "true"); - if (e instanceof MyParentException){ - ((Properties)stepCtx.getTransientUserData()).setProperty("retry.process.exception.match", "true"); - } - else { - ((Properties)stepCtx.getTransientUserData()).setProperty("retry.process.exception.match", "false"); - } - } -} - diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/NumbersRetryReadListener.java b/src/com/ibm/jbatch/tck/artifacts/specialized/NumbersRetryReadListener.java deleted file mode 100644 index c4f3bfc3ff..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/NumbersRetryReadListener.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.Properties; -import java.util.logging.Logger; - -import jakarta.batch.api.chunk.listener.RetryReadListener; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - - - -import com.ibm.jbatch.tck.artifacts.reusable.MyParentException; - -@jakarta.inject.Named("numbersRetryReadListener") -public class NumbersRetryReadListener implements RetryReadListener { - private final static String sourceClass = NumbersRetryReadListener.class.getName(); - private final static Logger logger = Logger.getLogger(sourceClass); - - @Inject - StepContext stepCtx; - - @Override - public void onRetryReadException(Exception e) { - TestUtil.logMsg("In onRetryReadException()" + e); - logger.finer("In onRetryReadException()" + e); - ((Properties)stepCtx.getTransientUserData()).setProperty("retry.read.exception.invoked", "true"); - if (e instanceof MyParentException){ - ((Properties)stepCtx.getTransientUserData()).setProperty("retry.read.exception.match", "true"); - } - else { - ((Properties)stepCtx.getTransientUserData()).setProperty("retry.read.exception.match", "false"); - } - } -} - diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/NumbersRetryWriteListener.java b/src/com/ibm/jbatch/tck/artifacts/specialized/NumbersRetryWriteListener.java deleted file mode 100644 index 2e70a00d32..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/NumbersRetryWriteListener.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.List; -import java.util.Properties; -import java.util.logging.Logger; - -import jakarta.batch.api.chunk.listener.RetryWriteListener; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - - - -import com.ibm.jbatch.tck.artifacts.reusable.MyParentException; - -@jakarta.inject.Named("numbersRetryWriteListener") -public class NumbersRetryWriteListener implements RetryWriteListener { - private final static String sourceClass = NumbersRetryWriteListener.class.getName(); - private final static Logger logger = Logger.getLogger(sourceClass); - - @Inject - StepContext stepCtx; - - @Override - public void onRetryWriteException(List w, Exception e) { - TestUtil.logMsg("In onRetryWriteException()" + e); - logger.finer("In onRetryWriteException()" + e); - ((Properties)stepCtx.getTransientUserData()).setProperty("retry.write.exception.invoked", "true"); - if (e instanceof MyParentException){ - ((Properties)stepCtx.getTransientUserData()).setProperty("retry.write.exception.match", "true"); - } - else { - ((Properties)stepCtx.getTransientUserData()).setProperty("retry.write.exception.match", "false"); - } - } -} - diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/NumbersSkipProcessListener.java b/src/com/ibm/jbatch/tck/artifacts/specialized/NumbersSkipProcessListener.java deleted file mode 100644 index c515ee2d52..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/NumbersSkipProcessListener.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.Properties; -import java.util.logging.Logger; - -import jakarta.batch.api.chunk.listener.SkipProcessListener; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - - - -import com.ibm.jbatch.tck.artifacts.reusable.MyParentException; - -@jakarta.inject.Named("numbersSkipProcessListener") -public class NumbersSkipProcessListener implements SkipProcessListener { - - @Inject - StepContext stepCtx; - - private final static String sourceClass = NumbersSkipProcessListener.class.getName(); - private final static Logger logger = Logger.getLogger(sourceClass); - - @Override - public void onSkipProcessItem(Object o, Exception e) { - TestUtil.logMsg("In onSkipProcessItem" + e + "

"); - - ((Properties)stepCtx.getTransientUserData()).setProperty("skip.process.item.invoked", "true"); - if (e instanceof MyParentException){ - ((Properties)stepCtx.getTransientUserData()).setProperty("skip.process.item.match", "true"); - } - else { - ((Properties)stepCtx.getTransientUserData()).setProperty("skip.process.item.match", "false"); - } - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/NumbersSkipReadListener.java b/src/com/ibm/jbatch/tck/artifacts/specialized/NumbersSkipReadListener.java deleted file mode 100644 index f305373717..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/NumbersSkipReadListener.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.Properties; -import java.util.logging.Logger; - -import jakarta.batch.api.chunk.listener.SkipReadListener; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - - - -import com.ibm.jbatch.tck.artifacts.reusable.MyParentException; - -@jakarta.inject.Named("numbersSkipReadListener") -public class NumbersSkipReadListener implements SkipReadListener { - - @Inject - StepContext stepCtx; - - private final static String sourceClass = NumbersSkipReadListener.class.getName(); - private final static Logger logger = Logger.getLogger(sourceClass); - - @Override - public void onSkipReadItem(Exception e) { - TestUtil.logMsg("In onSkipReadItem" + e + "

"); - - ((Properties)stepCtx.getTransientUserData()).setProperty("skip.read.item.invoked", "true"); - if (e instanceof MyParentException){ - ((Properties)stepCtx.getTransientUserData()).setProperty("skip.read.item.match", "true"); - } - else { - ((Properties)stepCtx.getTransientUserData()).setProperty("skip.read.item.match", "false"); - } - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/NumbersSkipWriteListener.java b/src/com/ibm/jbatch/tck/artifacts/specialized/NumbersSkipWriteListener.java deleted file mode 100644 index 4711bf23a0..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/NumbersSkipWriteListener.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.List; -import java.util.Properties; -import java.util.logging.Logger; - -import jakarta.batch.api.chunk.listener.SkipWriteListener; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - - - -import com.ibm.jbatch.tck.artifacts.reusable.MyParentException; - -@jakarta.inject.Named("numbersSkipWriteListener") -public class NumbersSkipWriteListener implements SkipWriteListener { - - @Inject - StepContext stepCtx; - - private final static String sourceClass = NumbersSkipWriteListener.class.getName(); - private final static Logger logger = Logger.getLogger(sourceClass); - - @Override - public void onSkipWriteItem(List w, Exception e) { - TestUtil.logMsg("In onSkipWriteItem" + e + "

"); - - ((Properties)stepCtx.getTransientUserData()).setProperty("skip.write.item.invoked", "true"); - if (e instanceof MyParentException){ - ((Properties)stepCtx.getTransientUserData()).setProperty("skip.write.item.match", "true"); - } - else { - ((Properties)stepCtx.getTransientUserData()).setProperty("skip.write.item.match", "false"); - } - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/OverrideOnAttributeValuesUponRestartBatchlet.java b/src/com/ibm/jbatch/tck/artifacts/specialized/OverrideOnAttributeValuesUponRestartBatchlet.java deleted file mode 100644 index befef27888..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/OverrideOnAttributeValuesUponRestartBatchlet.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.logging.Logger; - -import jakarta.batch.api.AbstractBatchlet; -import jakarta.batch.api.BatchProperty; -import jakarta.batch.runtime.context.JobContext; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - -@jakarta.inject.Named("overrideOnAttributeValuesUponRestartBatchlet") -public class OverrideOnAttributeValuesUponRestartBatchlet extends AbstractBatchlet{ - - private final static String sourceClass = OverrideOnAttributeValuesUponRestartBatchlet.class.getName(); - private final static Logger logger = Logger.getLogger(sourceClass); - - @Inject - StepContext stepCtx; - - @Inject - JobContext jobCtx; - - @Inject - @BatchProperty(name="execution.number") - String executionNumberString; - - int execNum; - String stepName; - - /* - * Appends "intended.exit.status" property to the current Job-level ExitStatus - */ - @Override - public String process() throws Exception { - execNum = Integer.parseInt(executionNumberString); - stepName = stepCtx.getStepName(); - - logger.fine("execution # = " + execNum + ", step = " + stepName); - - String exitStatus = calculateExitStatus(); - - logger.fine("Exiting with exitStatus = " + exitStatus); - return exitStatus; - } - - private String calculateExitStatus() { - /* - * Tests that stop @on and end @on don't result in re-running already completed steps. - */ - if (stepName.equals("step1")) { - switch (execNum) { - case 1: return "ES.STEP1"; - default: return "ILLEGAL.STATE"; - } - } else if (stepName.equals("step2")) { - switch (execNum) { - case 2: return "ES.STEP2"; - default: return "ILLEGAL.STATE"; - } - } else if (stepName.equals("step3")) { - switch (execNum) { - case 3: return "ES.STEP3"; - default: return "ILLEGAL.STATE"; - } - } else { - return "ILLEGAL.STATE"; - } - } - - @Override - public void stop() throws Exception { - // Do nothing since this is too quick to bother canceling. - logger.fine(sourceClass + ".cancel()"); - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/ParsingPartitionAnalyzer.java b/src/com/ibm/jbatch/tck/artifacts/specialized/ParsingPartitionAnalyzer.java deleted file mode 100644 index bc117ebb75..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/ParsingPartitionAnalyzer.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import jakarta.batch.api.partition.AbstractPartitionAnalyzer; -import jakarta.batch.runtime.BatchStatus; -import jakarta.batch.runtime.context.JobContext; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; -import jakarta.inject.Named; - -import com.ibm.jbatch.tck.artifacts.reusable.MyParallelSubJobsExitStatusBatchlet; - -@Named -public class ParsingPartitionAnalyzer extends AbstractPartitionAnalyzer { - - @Inject - JobContext jobCtx; - - @Inject - StepContext stepCtx; - - private int counter = 0; - - @Override - public void analyzeStatus(BatchStatus batchStatus, String exitStatus) - throws Exception { - - counter++; - - String goodPrefix = MyParallelSubJobsExitStatusBatchlet.GOOD_EXIT_STATUS; - int idx = goodPrefix.length() + 1; - if (!exitStatus.startsWith(goodPrefix)) { - throw new IllegalStateException("Expected exit status to start with: " + goodPrefix + ", but found :" + exitStatus); - } - - jobCtx.setExitStatus("JOB EXIT STATUS: " + counter); - stepCtx.setExitStatus("STEP EXIT STATUS: " + counter); - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/SkipProcessor.java b/src/com/ibm/jbatch/tck/artifacts/specialized/SkipProcessor.java deleted file mode 100644 index 35afb50671..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/SkipProcessor.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.logging.Logger; - -import jakarta.batch.api.BatchProperty; -import jakarta.batch.api.chunk.ItemProcessor; -import jakarta.inject.Inject; - -import com.ibm.jbatch.tck.artifacts.chunktypes.ReadRecord; -import com.ibm.jbatch.tck.artifacts.reusable.MyParentException; - - -@jakarta.inject.Named("skipProcessor") -public class SkipProcessor implements ItemProcessor { - - private final static Logger logger = Logger.getLogger(SkipProcessor.class.getName()); - - @Inject - @BatchProperty(name="execution.number") - String executionNumberString; - - @Inject - @BatchProperty(name="processrecord.fail") - String processrecordfailNumberString = null; - - boolean init = true; - boolean threwSkipException = false; - private int update = 10; - - int [] failnum; - int execnum; - boolean inited = false; - int processIteration = 0; - - @Override - public ReadRecord processItem(Object record) throws Exception { - - if (!inited){ - if (!(processrecordfailNumberString == null)) { - String[] processFailPointsStrArr = processrecordfailNumberString.split(","); - failnum = new int[processFailPointsStrArr.length]; - for (int i = 0; i < processFailPointsStrArr.length; i++) { - failnum[i] = Integer.parseInt(processFailPointsStrArr[i]); - } - } - else { - failnum = new int[1]; - failnum[0] = -1; - } - inited = true; - logger.fine("AJM: PROCESSOR - failnum = " + failnum); - } - - if (threwSkipException){ - update++; - processIteration++; - threwSkipException = false; - } - - logger.fine("AJM: PROCESSOR: failnum = " + failnum); - logger.fine("AJM: PROCESSOR: processIteration = " + processIteration); - - ReadRecord processedRecord = null; - - if (isFailnum(processIteration)){ - logger.fine("READ: got the fail num..." + failnum); - threwSkipException = true; - throw new MyParentException("fail on purpose on idx = " + failnum); - } - - processedRecord = (ReadRecord) record; - processedRecord.setRecord(update); - update = update +1; - processIteration++; - return processedRecord; - } - - private boolean isFailnum(int idxIn) { - - boolean ans = false; - for (int i = 0; i < failnum.length; i++) { - if (idxIn == failnum[i]){ - ans = true; - } - } - return ans; - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/SkipReader.java b/src/com/ibm/jbatch/tck/artifacts/specialized/SkipReader.java deleted file mode 100644 index 987f51af7f..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/SkipReader.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.io.Serializable; -import java.util.logging.Logger; - -import jakarta.batch.api.BatchProperty; -import jakarta.batch.api.chunk.AbstractItemReader; -import jakarta.inject.Inject; - -import com.ibm.jbatch.tck.artifacts.chunktypes.ArrayIndexCheckpointData; -import com.ibm.jbatch.tck.artifacts.chunktypes.ReadRecord; -import com.ibm.jbatch.tck.artifacts.reusable.MyChildException; -import com.ibm.jbatch.tck.artifacts.reusable.MyParentException; - -@jakarta.inject.Named("skipReader") -public class SkipReader extends AbstractItemReader { - - private final static Logger logger = Logger.getLogger(SkipReader.class.getName()); - - private int count = 0; - private int[] readerDataArray; - private int idx; - private boolean threwSkipException = false; - boolean throwChildEx = false; - ArrayIndexCheckpointData _cpd = new ArrayIndexCheckpointData(); - - @Inject - @BatchProperty(name = "readrecord.fail") - String readrecordfailNumberString = null; - - @Inject - @BatchProperty(name = "execution.number") - String executionNumberString; - - @Inject - @BatchProperty(name = "app.arraysize") - String appArraySizeString; - - int[] failnum; - int execnum; - int arraysize; - - public SkipReader() { - - } - - - @Override - public void open(Serializable cpd) { - - if (!(readrecordfailNumberString == null)) { - String[] readFailPointsStrArr = readrecordfailNumberString.split(","); - failnum = new int[readFailPointsStrArr.length]; - for (int i = 0; i < readFailPointsStrArr.length; i++) { - failnum[i] = Integer.parseInt(readFailPointsStrArr[i]); - } - } else { - failnum = new int[1]; - failnum[0] = -1; - } - - execnum = Integer.parseInt(executionNumberString); - - arraysize = Integer.parseInt(appArraySizeString); - readerDataArray = new int[arraysize]; - - for (int i = 0; i < arraysize; i++) { - // init the data array - readerDataArray[i] = i; - } - - if (cpd == null) { - // position at the beginning - idx = 0; - } else { - // position at index held in the cpd - idx = ((ArrayIndexCheckpointData)cpd).getCurrentIndex() + 1; - } - logger.fine("READ: starting at index: " + idx); - } - - @Override - public ReadRecord readItem() throws Exception { - - if (threwSkipException) { - count++; - idx++; - threwSkipException = false; - throwChildEx = true; - } - - int i = idx; - - if (i == arraysize) { - return null; - } - if (execnum == 2) { - failnum[0] = -1; - } - - if (isFailnum(idx)) { - logger.fine("READ: got the fail num..." + failnum); - threwSkipException = true; - if (!throwChildEx) { - throw new MyParentException("fail on purpose with MyParentException"); - } else { - throwChildEx = false; - throw new MyChildException("fail on purpose with MyChildException"); - } - } - count = count + 1; - idx = idx + 1; - _cpd.setCurrentIndex(i); - return new ReadRecord(readerDataArray[i]); - } - - @Override - public ArrayIndexCheckpointData checkpointInfo() { - - logger.fine("READ: in getCPD cpd index from store: " + _cpd.getCurrentIndex()); - logger.fine("READ: in getCPD idx : " + idx); - - return _cpd; - } - - private boolean isFailnum(int idxIn) { - - boolean ans = false; - for (int i = 0; i < failnum.length; i++) { - if (idxIn == failnum[i]) { - ans = true; - } - } - return ans; - } -} \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/SkipReaderMultipleExceptions.java b/src/com/ibm/jbatch/tck/artifacts/specialized/SkipReaderMultipleExceptions.java deleted file mode 100644 index c61810dd15..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/SkipReaderMultipleExceptions.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.io.Serializable; -import java.util.logging.Logger; - -import jakarta.batch.api.BatchProperty; -import jakarta.batch.api.chunk.AbstractItemReader; -import jakarta.inject.Inject; - -import com.ibm.jbatch.tck.artifacts.chunktypes.ArrayIndexCheckpointData; -import com.ibm.jbatch.tck.artifacts.chunktypes.ReadRecord; -import com.ibm.jbatch.tck.artifacts.reusable.MyChildException; -import com.ibm.jbatch.tck.artifacts.reusable.MyGrandchildException; -import com.ibm.jbatch.tck.artifacts.reusable.MyParentException; - -@jakarta.inject.Named("skipReaderMultipleExceptions") -public class SkipReaderMultipleExceptions extends AbstractItemReader { - - private final static Logger logger = Logger.getLogger(SkipReaderMultipleExceptions.class.getName()); - - private int count = 0; - private int exceptionCount = 0; - private int[] readerDataArray; - private int idx; - private boolean threwSkipException = false; - boolean throwChildEx = false; - ArrayIndexCheckpointData _cpd = new ArrayIndexCheckpointData(); - - @Inject - @BatchProperty(name = "readrecord.fail") - String readrecordfailNumberString = null; - - @Inject - @BatchProperty(name = "execution.number") - String executionNumberString; - - @Inject - @BatchProperty(name = "app.arraysize") - String appArraySizeString; - - int[] failnum; - int execnum; - int arraysize; - - public SkipReaderMultipleExceptions() { - - } - - - @Override - public void open(Serializable cpd) { - - if (!(readrecordfailNumberString == null)) { - String[] readFailPointsStrArr = readrecordfailNumberString.split(","); - failnum = new int[readFailPointsStrArr.length]; - for (int i = 0; i < readFailPointsStrArr.length; i++) { - failnum[i] = Integer.parseInt(readFailPointsStrArr[i]); - } - } else { - failnum = new int[1]; - failnum[0] = -1; - } - - execnum = Integer.parseInt(executionNumberString); - - arraysize = Integer.parseInt(appArraySizeString); - readerDataArray = new int[arraysize]; - - for (int i = 0; i < arraysize; i++) { - // init the data array - readerDataArray[i] = i; - } - - if (cpd == null) { - // position at the beginning - idx = 0; - } else { - // position at index held in the cpd - idx = ((ArrayIndexCheckpointData)cpd).getCurrentIndex() + 1; - } - logger.fine("READ: starting at index: " + idx); - } - - @Override - public ReadRecord readItem() throws Exception { - - if (threwSkipException) { - count++; - idx++; - threwSkipException = false; - exceptionCount++; - } - - int i = idx; - - if (i == arraysize) { - return null; - } - if (execnum == 2) { - failnum[0] = -1; - } - - if (isFailnum(idx)) { - logger.fine("READ: got the fail num..." + failnum); - threwSkipException = true; - if (exceptionCount == 0) { - throw new MyParentException("fail on purpose with MyParentException"); - } else if (exceptionCount == 1){ - throw new MyGrandchildException("fail on purpose with MyGrandchildException"); - } - else { - throw new MyChildException("fail on purpose with MyChildException"); - } - } - count = count + 1; - idx = idx + 1; - _cpd.setCurrentIndex(i); - return new ReadRecord(readerDataArray[i]); - } - - @Override - public ArrayIndexCheckpointData checkpointInfo() { - - logger.fine("READ: in getCPD cpd index from store: " + _cpd.getCurrentIndex()); - logger.fine("READ: in getCPD idx : " + idx); - - return _cpd; - } - - private boolean isFailnum(int idxIn) { - - boolean ans = false; - for (int i = 0; i < failnum.length; i++) { - if (idxIn == failnum[i]) { - ans = true; - } - } - return ans; - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/SkipWriter.java b/src/com/ibm/jbatch/tck/artifacts/specialized/SkipWriter.java deleted file mode 100644 index 689b68740b..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/SkipWriter.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.io.Serializable; -import java.util.List; -import java.util.logging.Logger; - -import jakarta.batch.api.BatchProperty; -import jakarta.batch.api.chunk.ItemWriter; -import jakarta.inject.Inject; - -import com.ibm.jbatch.tck.artifacts.chunktypes.ArrayIndexCheckpointData; -import com.ibm.jbatch.tck.artifacts.chunktypes.ReadRecord; -import com.ibm.jbatch.tck.artifacts.reusable.MyParentException; - -@jakarta.inject.Named("skipWriter") -public class SkipWriter implements ItemWriter { - - private final static Logger logger = Logger.getLogger(SkipWriter.class.getName()); - - private int[] writerDataArray = new int[30]; - private int idx = 0; - - int chunkWriteIteration = 0; - - @Inject - @BatchProperty(name="app.arraysize") - String appArraySizeString; - - @Inject - @BatchProperty(name="writerecord.fail") - String writeRecordFailNumberString = null; - - int arraysize; - int [] failnum; - int [] writePoints; - - @Override - public void open(Serializable cpd) throws Exception { - logger.fine("openWriter"); - - ArrayIndexCheckpointData checkpointData = (ArrayIndexCheckpointData)cpd; - - arraysize = Integer.parseInt(appArraySizeString); - - if (! (writeRecordFailNumberString == null)) { - String[] writeFailPointsStrArr = writeRecordFailNumberString.split(","); - failnum = new int[writeFailPointsStrArr.length]; - for (int i = 0; i < writeFailPointsStrArr.length; i++) { - failnum[i] = Integer.parseInt(writeFailPointsStrArr[i]); - } - } - else { - failnum = new int[1]; - failnum[0] = -1; - } - - if (checkpointData == null){ - //position at the beginning - idx = 0; - logger.fine("WRITE: chkpt data = null, so idx = " + idx); - } - else { - // position at index held in the cpd - idx = checkpointData.getCurrentIndex(); - //for (int i = 0; i stepsInJob = new ArrayList(); - stepsInJob.add("split1FlowStep1"); - stepsInJob.add("split1FlowStep2"); - stepsInJob.add("split1FlowSplitFlow1Step"); - stepsInJob.add("split1FlowSplitFlow2Step"); - stepsInJob.add("flow2step1"); - stepsInJob.add("flow2step2"); - - if (!stepsInJob.contains(stepCtx.getStepName())) { - throw new Exception("Failed to assert steps id"); - } - - return GOOD_EXIT_STATUS; - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/SplitTransitionToDecisionTestBatchlet.java b/src/com/ibm/jbatch/tck/artifacts/specialized/SplitTransitionToDecisionTestBatchlet.java deleted file mode 100644 index 2704262616..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/SplitTransitionToDecisionTestBatchlet.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import jakarta.batch.api.AbstractBatchlet; - -@jakarta.inject.Named("splitTransitionToDecisionTestBatchlet") -public class SplitTransitionToDecisionTestBatchlet extends AbstractBatchlet { - - public static String GOOD_EXIT_STATUS = "VERY GOOD INVOCATION"; - - - @Override - public String process() throws Exception { - - return GOOD_EXIT_STATUS; - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/SplitTransitionToDecisionTestDecider.java b/src/com/ibm/jbatch/tck/artifacts/specialized/SplitTransitionToDecisionTestDecider.java deleted file mode 100644 index 777731a6df..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/SplitTransitionToDecisionTestDecider.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import jakarta.batch.api.Decider; -import jakarta.batch.runtime.BatchStatus; -import jakarta.batch.runtime.StepExecution; - -import com.ibm.jbatch.tck.artifacts.common.StatusConstants; - -@jakarta.inject.Named -public class SplitTransitionToDecisionTestDecider implements Decider, StatusConstants { - - public final static String DECIDER_EXIT_STATUS = "DECIDER_EXIT_STATUS"; - - @Override - public String decide(StepExecution[] stepExecutions) throws Exception { - - if (stepExecutions.length != 2) { - throw new IllegalStateException("Expecting stepExecutions array of size 2, found one of size = " + stepExecutions.length); - } - - for (StepExecution stepExec : stepExecutions) { - if (stepExec == null) { - throw new Exception("Null StepExecution after split."); - } - - if (!stepExec.getBatchStatus().equals(BatchStatus.COMPLETED)) { - throw new Exception("All step executions must be compelete before transitioning to a decider."); - } - - } - - // - return DECIDER_EXIT_STATUS + "*" + stepExecutions.length; - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/SplitTransitionToStepTestBatchlet.java b/src/com/ibm/jbatch/tck/artifacts/specialized/SplitTransitionToStepTestBatchlet.java deleted file mode 100644 index 8a8994aa7f..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/SplitTransitionToStepTestBatchlet.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.io.Externalizable; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.ArrayList; - -import jakarta.batch.api.AbstractBatchlet; -import jakarta.batch.runtime.context.JobContext; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - -@jakarta.inject.Named("splitTransitionToStepTestBatchlet") -public class SplitTransitionToStepTestBatchlet extends AbstractBatchlet { - - public static String GOOD_EXIT_STATUS = "VERY GOOD INVOCATION"; - - @Inject - JobContext jobCtx; - - @Inject - StepContext stepCtx = null; - - @Override - public String process() throws Exception { - - TransitionListPersistent data = (TransitionListPersistent) jobCtx.getTransientUserData(); - if( data != null) { - data.getTransitionList().add(stepCtx.getStepName()); - } else { - jobCtx.setTransientUserData(new TransitionListPersistent(stepCtx.getStepName())); - } - - String transitionList = ((TransitionListPersistent)jobCtx.getTransientUserData()).getTransitionList().toString(); - - // toString() returns string surrounded by brackets, remove them. - jobCtx.setExitStatus(transitionList.substring(1, transitionList.length()-1)); - - return GOOD_EXIT_STATUS; - } - - private class TransitionListPersistent implements Externalizable { - - ArrayList transitionList = new ArrayList(); - - public TransitionListPersistent() {} - - public TransitionListPersistent(String stepId) { - transitionList.add(stepId); - } - - public ArrayList getTransitionList() { - return transitionList; - } - - @Override - public void writeExternal(ObjectOutput out) throws IOException { - out.writeObject(transitionList); - } - - @Override - public void readExternal(ObjectInput in) throws IOException, - ClassNotFoundException { - transitionList = (ArrayList) in.readObject(); - } - - - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/StartLimitJobListener.java b/src/com/ibm/jbatch/tck/artifacts/specialized/StartLimitJobListener.java deleted file mode 100644 index ee6af74262..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/StartLimitJobListener.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.logging.Logger; - -import jakarta.batch.api.BatchProperty; -import jakarta.batch.api.listener.AbstractJobListener; -import jakarta.batch.runtime.context.JobContext; -import jakarta.inject.Inject; -import jakarta.inject.Named; - -@Named -public class StartLimitJobListener extends AbstractJobListener { - - private final static String sourceClass = StartLimitJobListener.class.getName(); - private final static Logger logger = Logger.getLogger(sourceClass); - - @Inject - JobContext jobCtx; - - @Inject - @BatchProperty(name="ExitCodeAppend") - String errorExitStatusCode; - - @Override - public void beforeJob() throws Exception { - jobCtx.setTransientUserData(errorExitStatusCode); - logger.fine("Setting error exit status Code = " + errorExitStatusCode); - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/StartLimitStateMachineVariation1Batchlet.java b/src/com/ibm/jbatch/tck/artifacts/specialized/StartLimitStateMachineVariation1Batchlet.java deleted file mode 100644 index b48359d0e3..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/StartLimitStateMachineVariation1Batchlet.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.Random; -import java.util.logging.Logger; - -import jakarta.batch.api.AbstractBatchlet; -import jakarta.batch.api.BatchProperty; -import jakarta.batch.runtime.context.JobContext; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - -@jakarta.inject.Named("startLimitStateMachineVariation1Batchlet") -public class StartLimitStateMachineVariation1Batchlet extends AbstractBatchlet { - - private final static String sourceClass = StartLimitStateMachineVariation1Batchlet.class.getName(); - private final static Logger logger = Logger.getLogger(sourceClass); - - @Inject - JobContext jobCtx; - - @Inject - StepContext stepCtx; - - @Inject - @BatchProperty(name="runNumber") - String runNumberString; - - @Override - public String process() throws Exception { - logger.fine(sourceClass + ".process()"); - - // Do something a bit "compute-intensive". - Random r = new Random(); - int x = r.nextInt(); int y = r.nextInt(); - for (int i = 0 ; i < 10; i++) { - x = (y * x) % 3469; - y = (x * y) % 3491; - } - - String exitStatus = null; - try { - exitStatus = contributeToExitStatus(); - appendToJobContext(exitStatus); - } catch (FailViaException e) { - logger.fine(sourceClass + ".process(); Exiting with exitStatus = " + exitStatus); - String errorAppend = (String)jobCtx.getTransientUserData(); - appendToJobContext(errorAppend); - throw new RuntimeException("Throwing exception on purpose"); - } - - logger.fine(sourceClass + ".process(); Exiting with exitStatus = " + exitStatus); - return null; - } - - private void appendToJobContext(String exitStatus) { - String es = jobCtx.getExitStatus(); - if (es == null) { - logger.fine("First addition to Job ExitStatus = " + es); - jobCtx.setExitStatus(exitStatus); - } else { - String newExitStatus = es.concat(",").concat(exitStatus); - logger.fine("Existing Job ExitStatus = " + es + " ; Updating to : " + newExitStatus); - jobCtx.setExitStatus(newExitStatus); - } - } - - @Override - public void stop() throws Exception { - // Do nothing since this is too quick to bother canceling. - logger.fine(sourceClass + ".cancel()"); - } - - private String contributeToExitStatus() throws FailViaException { - - logger.fine(sourceClass + ".calculateExitStatus(), runNumberString = " + runNumberString); - - // runNumberString = runNumber.N - int execNum = Integer.parseInt(runNumberString.substring(new String("runNumber.").length())); - - String stepId = stepCtx.getStepName(); - - logger.fine(sourceClass + ".calculateExitStatus(), execution # = " + execNum + ", stepId = " + stepId); - - if (stepId.equals("step1")) { - switch (execNum) { - case 1: return "c1"; - case 2: return "c1"; - case 3: return "c1"; - case 4: return "c1"; - default: return "ILLEGAL.STATE"; - } - } else if (stepId.equals("step2")) { - switch (execNum) { - case 1: return "c2"; - case 2: return "c2"; - case 3: return "c2"; - case 4: return "c2"; - default: return "ILLEGAL.STATE"; - } - } else if (stepId.equals("step3")) { - switch (execNum) { - case 1: throw new FailViaException(); - case 2: throw new FailViaException(); - case 3: throw new FailViaException(); - default: return "ILLEGAL.STATE"; - } - } else { - return "ILLEGAL.STATE"; - } - } - - private class FailViaException extends Exception { - private FailViaException() { - super(); - } - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/StartLimitStateMachineVariation2Batchlet.java b/src/com/ibm/jbatch/tck/artifacts/specialized/StartLimitStateMachineVariation2Batchlet.java deleted file mode 100644 index ad4faddc12..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/StartLimitStateMachineVariation2Batchlet.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.Random; -import java.util.logging.Logger; - -import jakarta.batch.api.AbstractBatchlet; -import jakarta.batch.api.BatchProperty; -import jakarta.batch.runtime.context.JobContext; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - -@jakarta.inject.Named("startLimitStateMachineVariation2Batchlet") -public class StartLimitStateMachineVariation2Batchlet extends AbstractBatchlet { - - private final static String sourceClass = StartLimitStateMachineVariation2Batchlet.class.getName(); - private final static Logger logger = Logger.getLogger(sourceClass); - - private final static String JSL_STOP_TRANSITION = "JSL.STOP"; - private final static String JSL_FAIL_TRANSITION = "JSL.FAIL"; - - @Inject - JobContext jobCtx; - - @Inject - StepContext stepCtx; - - @Inject - @BatchProperty(name="runNumber") - String runNumberString; - - @Override - public String process() throws Exception { - logger.fine(sourceClass + ".process()"); - - // Do something a bit "compute-intensive". - Random r = new Random(); - int x = r.nextInt(); int y = r.nextInt(); - for (int i = 0 ; i < 10; i++) { - x = (y * x) % 3469; - y = (x * y) % 3491; - } - - // This is the ongoing appending to the JOB exit status - String exitStatus = null; - try { - exitStatus = contributeToExitStatus(); - appendToJobContext(exitStatus); - } catch (FailViaException e) { - logger.fine(sourceClass + ".process(); Exiting with exitStatus = " + exitStatus); - String errorAppend = (String)jobCtx.getTransientUserData(); - appendToJobContext(errorAppend); - throw new RuntimeException("Throwing exception on purpose"); - } - - logger.fine(sourceClass + ".process(); exitStatus = " + exitStatus); - - // Now we're going to switch gears and consider the step exit Status - if (exitStatus.startsWith("s")) { - logger.fine("For step exitStatus for step: " + stepCtx.getStepName() + " , return: " + JSL_STOP_TRANSITION); - return JSL_STOP_TRANSITION; - } else if (exitStatus.startsWith("f")) { - logger.fine("For step exitStatus for step: " + stepCtx.getStepName() + " , return: " + JSL_FAIL_TRANSITION); - return JSL_FAIL_TRANSITION; - } else { - logger.fine("For step exitStatus for step: " + stepCtx.getStepName() + " , don't return value"); - return null; - } - } - - private void appendToJobContext(String exitStatus) { - String es = jobCtx.getExitStatus(); - if (es == null) { - logger.fine("First addition to Job ExitStatus = " + es); - jobCtx.setExitStatus(exitStatus); - } else { - String newExitStatus = es.concat(",").concat(exitStatus); - logger.fine("Existing Job ExitStatus = " + es + " ; Updating to : " + newExitStatus); - jobCtx.setExitStatus(newExitStatus); - } - } - - @Override - public void stop() throws Exception { - // Do nothing since this is too quick to bother canceling. - logger.fine(sourceClass + ".cancel()"); - } - - private String contributeToExitStatus() throws FailViaException { - logger.fine(sourceClass + ".calculateExitStatus(), runNumberString = " + runNumberString); - - // runNumberString = runNumber.N - int execNum = Integer.parseInt(runNumberString.substring(new String("runNumber.").length())); - - String stepId = stepCtx.getStepName(); - - logger.fine(sourceClass + ".calculateExitStatus(), execution # = " + execNum + ", stepId = " + stepId); - - if (stepId.equals("step1")) { - switch (execNum) { - case 1: return "c1"; - case 2: return "c1"; - case 3: return "c1"; - case 4: return "c1"; - case 5: return "ILLEGAL.STATE"; - case 6: return "c1"; - case 7: return "c1"; - default: return "ILLEGAL.STATE"; - } - } else if (stepId.equals("step2")) { - switch (execNum) { - case 1: return "c2"; - case 2: return "c2"; - case 3: return "c2"; - case 4: return "c2"; - case 5: return "ILLEGAL.STATE"; - case 6: return "c2"; - case 7: return "c2"; - default: return "ILLEGAL.STATE"; - } - } else if (stepId.equals("step3")) { - switch (execNum) { - case 1: throw new FailViaException(); - case 2: throw new FailViaException(); - case 3: return "s3"; - case 4: return "ILLEGAL.STATE"; - case 5: return "ILLEGAL.STATE"; - case 6: return "ILLEGAL.STATE"; - case 7: return "ILLEGAL.STATE"; - default: return "ILLEGAL.STATE"; - } - } else if (stepId.equals("step4")) { - switch (execNum) { - case 1: return "ILLEGAL.STATE"; - case 2: return "ILLEGAL.STATE"; - case 3: return "ILLEGAL.STATE"; - case 4: return "s4"; - case 5: return "f4"; - case 6: return "c4"; - // Should not be able to rexecute a fourth time on run 7 - default: return "ILLEGAL.STATE"; - } - } else if (stepId.equals("step5")) { - switch (execNum) { - // Only gets to run on run #6 - case 6: return "f5"; - default: return "ILLEGAL.STATE"; - } - } else { - return "ILLEGAL.STATE"; - } - } - - private class FailViaException extends Exception { - private FailViaException() { - super(); - } - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/StartLimitStateMachineVariation3Batchlet.java b/src/com/ibm/jbatch/tck/artifacts/specialized/StartLimitStateMachineVariation3Batchlet.java deleted file mode 100644 index 58d4b68d7b..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/StartLimitStateMachineVariation3Batchlet.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.logging.Logger; - -import jakarta.batch.api.AbstractBatchlet; -import jakarta.batch.api.BatchProperty; -import jakarta.batch.runtime.context.JobContext; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - -@jakarta.inject.Named("startLimitStateMachineVariation3Batchlet") -public class StartLimitStateMachineVariation3Batchlet extends AbstractBatchlet { - - private final static String sourceClass = StartLimitStateMachineVariation3Batchlet.class.getName(); - private final static Logger logger = Logger.getLogger(sourceClass); - - private final static String JSL_STOP_TRANSITION = "JSL.STOP"; - - private final static String JSL_FAIL_TRANSITION = "JSL.FAIL"; - - @Inject - JobContext jobCtx; - - @Inject - StepContext stepCtx; - - @Inject - @BatchProperty(name="runNumber") - String runNumberString; - - @Override - public String process() throws Exception { - logger.fine(sourceClass + ".process()"); - - // This is the ongoing appending to the JOB exit status - String exitStatus = null; - exitStatus = contributeToExitStatus(); - appendToJobContext(exitStatus); - - logger.fine(sourceClass + ".process(); exitStatus = " + exitStatus); - - // Now we're going to switch gears and consider the step exit Status - if (exitStatus.startsWith("s")) { - logger.fine("For step exitStatus for step: " + stepCtx.getStepName() + " , return: " + JSL_STOP_TRANSITION); - return JSL_STOP_TRANSITION; - } else if (exitStatus.startsWith("f")) { - logger.fine("For step exitStatus for step: " + stepCtx.getStepName() + " , return: " + JSL_FAIL_TRANSITION); - return JSL_FAIL_TRANSITION; - } else { - logger.fine("For step exitStatus for step: " + stepCtx.getStepName() + " , don't return value"); - return null; - } - } - - private void appendToJobContext(String exitStatus) { - String es = jobCtx.getExitStatus(); - if (es == null) { - logger.fine("First addition to Job ExitStatus = " + es); - jobCtx.setExitStatus(exitStatus); - } else { - String newExitStatus = es.concat(",").concat(exitStatus); - logger.fine("Existing Job ExitStatus = " + es + " ; Updating to : " + newExitStatus); - jobCtx.setExitStatus(newExitStatus); - } - } - - @Override - public void stop() throws Exception { - // Do nothing since this is too quick to bother canceling. - logger.fine(sourceClass + ".cancel()"); - } - - private String contributeToExitStatus() { - logger.fine(sourceClass + ".calculateExitStatus(), runNumberString = " + runNumberString); - - // runNumberString = runNumber.N - int execNum = Integer.parseInt(runNumberString.substring(new String("runNumber.").length())); - - String stepId = stepCtx.getStepName(); - - logger.fine(sourceClass + ".calculateExitStatus(), execution # = " + execNum + ", stepId = " + stepId); - - /* - * Run 1 - c1, c2, c3, c4, s5,restart=5 - * Run 2 - f5 - * Run 3 - c1, c2, c4 c5 - */ - if (stepId.equals("step1")) { - switch (execNum) { - case 1: return "c1"; - case 3: return "c1"; - default: return "ILLEGAL.STATE"; - } - } else if (stepId.equals("step2")) { - switch (execNum) { - case 1: return "c2"; - case 3: return "c2"; - default: return "ILLEGAL.STATE"; - } - } else if (stepId.equals("step3")) { - switch (execNum) { - case 1: return "c3"; - default: return "ILLEGAL.STATE"; - } - } else if (stepId.equals("step4")) { - switch (execNum) { - case 1: return "c4"; - case 3: return "c4"; - default: return "ILLEGAL.STATE"; - } - } else if (stepId.equals("step5")) { - switch (execNum) { - case 1: return "s5"; - case 2: return "f5"; - case 3: return "c5"; - default: return "ILLEGAL.STATE"; - } - } else { - return "ILLEGAL.STATE"; - } - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/StepContextTestBatchlet.java b/src/com/ibm/jbatch/tck/artifacts/specialized/StepContextTestBatchlet.java deleted file mode 100644 index 483f63ac15..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/StepContextTestBatchlet.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import jakarta.batch.api.Batchlet; -import jakarta.batch.runtime.context.JobContext; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - -@jakarta.inject.Named("stepContextTestBatchlet") -public class StepContextTestBatchlet implements Batchlet { - - @Inject - JobContext jobCtx; - - @Inject - StepContext stepCtx; - - @Override - public String process() throws Exception { - jobCtx.setExitStatus("StepName=" + stepCtx.getStepName() + ";StepExecutionId=" + stepCtx.getStepExecutionId()); - return "GOOD"; - } - - @Override - public void stop() throws Exception { - // TODO Auto-generated method stub - - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/StepLevelPropertiesCountBatchlet.java b/src/com/ibm/jbatch/tck/artifacts/specialized/StepLevelPropertiesCountBatchlet.java deleted file mode 100644 index 705d45539f..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/StepLevelPropertiesCountBatchlet.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.Iterator; -import java.util.Properties; - -import jakarta.batch.api.AbstractBatchlet; -import jakarta.batch.runtime.context.JobContext; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - -@jakarta.inject.Named("stepLevelPropertiesCountBatchlet") -public class StepLevelPropertiesCountBatchlet extends AbstractBatchlet { - - @Inject - JobContext JobCtx; - - @Inject - StepContext StepCtx; - - public static final String SHOULD_BE_UNAVAILABLE_PROP_PREFIX = "com.ibm.jbatch.tck.tests.jslxml.StepLevelPropertiesTests"; - - public static String GOOD_EXIT_STATUS = "VERY GOOD INVOCATION"; - - @Override - public String process() throws Exception { - - Properties properties = StepCtx.getProperties(); - - StringBuffer badExitStatus = new StringBuffer(); - - JobCtx.setExitStatus(String.valueOf(properties.size())); - - /* - * Verify that all three step-level properties were seen. - */ - - int found = 0; - String[] propNames = new String[] { "foo", "super", "me" }; - String[] propVals = new String[] { "bar", "hero", "too" }; - for (int i = 0 ; i < 3 ; i++) { - String val = properties.getProperty(propNames[i]); - if (propVals[i].equals(val)) { - found++; - } else { - badExitStatus.append("For " + propNames[0] + ", found: " + val + ":"); - } - } - - /** - * Verify that none of the TCK-set properties were seen - */ - boolean seenBadProp = false; - - Iterator iter = properties.keySet().iterator(); - while (iter.hasNext()) { - String nextProp = (String)iter.next(); - if (nextProp.startsWith(SHOULD_BE_UNAVAILABLE_PROP_PREFIX)) { - seenBadProp = true; - badExitStatus.append("Saw unexpected property: " + nextProp); - } - } - - if (found == 3 && !seenBadProp) { - JobCtx.setExitStatus(GOOD_EXIT_STATUS); - } else { - JobCtx.setExitStatus(badExitStatus.toString()); - } - - return GOOD_EXIT_STATUS; - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/StepLevelPropertiesPropertyValueBatchlet.java b/src/com/ibm/jbatch/tck/artifacts/specialized/StepLevelPropertiesPropertyValueBatchlet.java deleted file mode 100644 index 5578af885b..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/StepLevelPropertiesPropertyValueBatchlet.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.Properties; - -import jakarta.batch.api.AbstractBatchlet; -import jakarta.batch.runtime.context.JobContext; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - -@jakarta.inject.Named("stepLevelPropertiesPropertyValueBatchlet") -public class StepLevelPropertiesPropertyValueBatchlet extends AbstractBatchlet { - - @Inject - JobContext JobCtx; - - @Inject - StepContext StepCtx; - - public static String GOOD_EXIT_STATUS = "VERY GOOD INVOCATION"; - - @Override - public String process() throws Exception { - - Properties properties = StepCtx.getProperties(); - String foo = properties.getProperty("foo"); - - JobCtx.setExitStatus(foo); - - return GOOD_EXIT_STATUS; - } - -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/StepLevelPropertiesShouldNotBeAvailableThroughJobContextBatchlet.java b/src/com/ibm/jbatch/tck/artifacts/specialized/StepLevelPropertiesShouldNotBeAvailableThroughJobContextBatchlet.java deleted file mode 100644 index 45baf509e2..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/StepLevelPropertiesShouldNotBeAvailableThroughJobContextBatchlet.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.Properties; - -import jakarta.batch.api.AbstractBatchlet; -import jakarta.batch.runtime.context.JobContext; -import jakarta.batch.runtime.context.StepContext; -import jakarta.inject.Inject; - -@jakarta.inject.Named("stepLevelPropertiesShouldNotBeAvailableThroughJobContextBatchlet") -public class StepLevelPropertiesShouldNotBeAvailableThroughJobContextBatchlet extends AbstractBatchlet{ - @Inject - JobContext JobCtx; - - @Inject - StepContext StepCtx; - - public static String GOOD_EXIT_STATUS = "VERY GOOD INVOCATION"; - - @Override - public String process() throws Exception { - - // frozz is a step level properties, it should not be avail in the job context - Properties properties = JobCtx.getProperties(); - // should be null - String frozz = properties.getProperty("frozz"); - - // the exit status should be COMPLETED since frozz must be null - JobCtx.setExitStatus(frozz); - - return GOOD_EXIT_STATUS; - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/ThreadTrackingJobListener.java b/src/com/ibm/jbatch/tck/artifacts/specialized/ThreadTrackingJobListener.java deleted file mode 100644 index ce8568daa4..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/ThreadTrackingJobListener.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.logging.Logger; - -import jakarta.batch.api.listener.AbstractJobListener; -import jakarta.batch.runtime.context.JobContext; -import jakarta.inject.Inject; -import jakarta.inject.Named; - -@Named -public class ThreadTrackingJobListener extends AbstractJobListener { - - private final static Logger logger = Logger.getLogger(ThreadTrackingJobListener.class.getName()); - - public final static String GOOD_EXIT = "GOOD_EXIT"; - - @Inject - private JobContext jobCtx = null; - - @Override - public void beforeJob() throws Exception { - jobCtx.setTransientUserData(Thread.currentThread()); - } - - @Override - public void afterJob() throws Exception { - Thread t = (Thread)jobCtx.getTransientUserData(); - if (t == null) { - jobCtx.setExitStatus(GOOD_EXIT); - } else { - logger.warning("Failing test in current thread:" + Thread.currentThread()); - throw new IllegalStateException("Failing test in current thread:" + Thread.currentThread()); - } - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/ThreadTrackingStepListener.java b/src/com/ibm/jbatch/tck/artifacts/specialized/ThreadTrackingStepListener.java deleted file mode 100644 index 5da28a9c15..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/ThreadTrackingStepListener.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import jakarta.batch.api.listener.AbstractStepListener; -import jakarta.batch.runtime.context.JobContext; -import jakarta.inject.Inject; -import jakarta.inject.Named; - -@Named -public class ThreadTrackingStepListener extends AbstractStepListener { - - @Inject - private JobContext jobCtx = null; - - @Override - public void beforeStep() throws Exception { - Thread t = (Thread)jobCtx.getTransientUserData(); - if (t == null) { - throw new IllegalStateException("In beforeStep() expected job listener to have already set this. Are we not on the same thread?"); - } else if (!t.equals(Thread.currentThread())) { - throw new IllegalStateException("Current thread = " + Thread.currentThread().toString() + ", but in transient data found " + t); - } - } - - @Override - public void afterStep() throws Exception { - Thread t = (Thread)jobCtx.getTransientUserData(); - if (t == null) { - throw new IllegalStateException("In afterStep() expected job listener to have already set this. Are we not on the same thread?"); - } else if (!t.equals(Thread.currentThread())) { - throw new IllegalStateException("Current thread = " + Thread.currentThread().toString() + ", but in transient data found " + t); - } - jobCtx.setTransientUserData(null); - } -} diff --git a/src/com/ibm/jbatch/tck/artifacts/specialized/TransitionDecider.java b/src/com/ibm/jbatch/tck/artifacts/specialized/TransitionDecider.java deleted file mode 100644 index 7b5d09812e..0000000000 --- a/src/com/ibm/jbatch/tck/artifacts/specialized/TransitionDecider.java +++ /dev/null @@ -1,78 +0,0 @@ -/** - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.artifacts.specialized; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import jakarta.batch.api.BatchProperty; -import jakarta.batch.api.Decider; -import jakarta.batch.runtime.StepExecution; -import jakarta.batch.runtime.context.JobContext; -import jakarta.inject.Inject; - -@jakarta.inject.Named("transitionDecider") -public class TransitionDecider implements Decider { - - @Inject - JobContext jobCtx; - - @Inject - @BatchProperty(name="is.restart") - String isRestart; - - @Override - public String decide(StepExecution[] executions) throws Exception { - - String stepExitStatus = ""; - String stepName = ""; - - - for (StepExecution stepExec : executions) { - String tempExitStatus = stepExec.getExitStatus(); - String tempStepName = stepExec.getStepName(); - - //Always choose the alphabetically later step name and exit status so we can end the test deterministically - if (stepExitStatus.compareTo(tempExitStatus) < 0) { - stepExitStatus = tempExitStatus; - } - - // - if (stepName.compareTo(tempStepName) < 0){ - stepName = tempStepName; - } - } - - Integer deciderCount = jobCtx.getTransientUserData() == null ? 0 : (Integer)jobCtx.getTransientUserData(); - //This will provide a count for how many times the decider is called. - deciderCount++; - jobCtx.setTransientUserData(deciderCount); - - String deciderExitStatus = null; - - //On a restart we always want everything to continue to the end. - if ("true".equals(isRestart)){ - deciderExitStatus = deciderCount + ":" + stepName + "_CONTINUE"; - } else{ - deciderExitStatus = deciderCount + ":" + stepExitStatus; - } - - return deciderExitStatus; - - } - -} diff --git a/src/com/ibm/jbatch/tck/build.xml b/src/com/ibm/jbatch/tck/build.xml deleted file mode 100644 index dc133e363e..0000000000 --- a/src/com/ibm/jbatch/tck/build.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - diff --git a/src/com/ibm/jbatch/tck/polling/TCKPollingExecutionWaiterFactory.java b/src/com/ibm/jbatch/tck/polling/TCKPollingExecutionWaiterFactory.java deleted file mode 100644 index 1ff479e9c3..0000000000 --- a/src/com/ibm/jbatch/tck/polling/TCKPollingExecutionWaiterFactory.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.polling; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import jakarta.batch.operations.JobOperator; -import jakarta.batch.operations.JobSecurityException; -import jakarta.batch.operations.NoSuchJobExecutionException; -import jakarta.batch.runtime.BatchStatus; -import jakarta.batch.runtime.JobExecution; -import java.lang.IllegalStateException; -import java.util.HashSet; -import java.util.Set; -import java.util.logging.Logger; - -import com.ibm.jbatch.tck.spi.JobExecutionWaiter; -import com.ibm.jbatch.tck.spi.JobExecutionWaiterFactory; -import com.ibm.jbatch.tck.spi.JobExecutionTimeoutException; - -public class TCKPollingExecutionWaiterFactory implements JobExecutionWaiterFactory { - - private final static String sourceClass = TCKPollingExecutionWaiterFactory.class.getName(); - private final static Logger logger = Logger.getLogger(sourceClass); - - private final int POLL_INTERVAL = 100; // .1 second - - /** - * This implementation does no pooling of any kind, it just creates a new instance with new thread each time. - * - * @param executionId - * @param JobOperator - * @param timeout In milliseconds - * @return JobExecutionWaiter - */ - @Override - public JobExecutionWaiter createWaiter(long executionId, JobOperator jobOp, long timeout) { - return new TCKPollingExecutionWaiter(executionId, jobOp, timeout); - } - - private class TCKPollingExecutionWaiter implements JobExecutionWaiter { - - private long executionId; - private JobOperator jobOp; - private long timeout; - - private TCKPollingExecutionWaiter(long executionId, JobOperator jobOp, long timeout) { - logger.fine("Creating waiter for executionId = " + executionId + ", jobOp = " + jobOp + ", timeout = " + timeout); - this.executionId = executionId; - this.jobOp = jobOp; - this.timeout = timeout; - } - - @Override - - /** - * Wait for - * 1) BatchStatus to be one of: STOPPED ,FAILED , COMPLETED, ABANDONED - * AND - * 2) exitStatus to be non-null - * @return JobExceution - */ - public JobExecution awaitTermination() throws JobExecutionTimeoutException { - logger.fine("Entering awaitTermination for executionId = " + executionId); - JobExecution jobExecution = null; - - long startTime = System.currentTimeMillis(); - - while (true) { - try { - logger.finer("Sleeping for " + POLL_INTERVAL); - long curTime = System.currentTimeMillis(); - timeOutIfExpired(startTime, curTime); - Thread.sleep(POLL_INTERVAL); - logger.finer("Wake up, check for termination."); - jobExecution = jobOp.getJobExecution(executionId); - if (isTerminated(jobExecution)) { - break; - } - } catch (InterruptedException e) { - throw new IllegalStateException("Aborting on interrupt", e); - } catch (JobSecurityException e) { - throw new IllegalStateException("Aborting on security (authorization) exception", e); - } catch (NoSuchJobExecutionException e) { - throw new IllegalStateException("JobExecution disappeared for exec id =" + executionId); - } - } - return jobExecution; - } - - private boolean isTerminated(JobExecution jobExecution) { - boolean retVal = false; - BatchStatus bs = jobExecution.getBatchStatus(); - if (terminatedStatuses.contains(bs)) { - logger.fine("Found terminating batch status of: " + jobExecution.getBatchStatus().name()); - if (jobExecution.getExitStatus() != null) { - logger.fine("Found exit status of: " + jobExecution.getExitStatus()); - retVal = true; - } else { - logger.fine("Exit status is still 'null'. Poll again."); - retVal = false; - } - } else { - logger.finer("Found non-terminating batch status of: " + jobExecution.getBatchStatus().name()); - retVal = false; - } - return retVal; - } - private void timeOutIfExpired(long startTime, long curTime) { - long diff = curTime - startTime; - if (diff > timeout) { - logger.warning("Timed out waiting for TCK Job Execution to reach terminated status. Time elapsed (long msec) = " + diff + ", and timeout = " + timeout); - throw new IllegalStateException("Timed out waiting for TCK Job Execution to reach terminated status. Time elapsed (long msec) = " + diff + ", and timeout = " + timeout); - } else { - logger.finer("Still waiting for TCK Job Execution to reach terminated status. Time elapsed (long msec) = " + diff + ", and timeout = " + timeout); - } - } - - - } - // Full list: - //public enum BatchStatus {STARTING, STARTED, STOPPING, STOPPED, FAILED, COMPLETED, ABANDONED } - private static Set terminatedStatuses = new HashSet(); - static { - terminatedStatuses.add(BatchStatus.STOPPED); - terminatedStatuses.add(BatchStatus.FAILED); - terminatedStatuses.add(BatchStatus.COMPLETED); - terminatedStatuses.add(BatchStatus.ABANDONED); - } - -} diff --git a/src/com/ibm/jbatch/tck/spi/JobExecutionTimeoutException.java b/src/com/ibm/jbatch/tck/spi/JobExecutionTimeoutException.java deleted file mode 100644 index d98c01ec8f..0000000000 --- a/src/com/ibm/jbatch/tck/spi/JobExecutionTimeoutException.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2013 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.spi; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -public class JobExecutionTimeoutException extends Exception { - - /** - * - */ - private static final long serialVersionUID = 1L; - - public JobExecutionTimeoutException() { - // TODO Auto-generated constructor stub - } - - public JobExecutionTimeoutException(String message) { - super(message); - // TODO Auto-generated constructor stub - } - - public JobExecutionTimeoutException(Throwable cause) { - super(cause); - // TODO Auto-generated constructor stub - } - - public JobExecutionTimeoutException(String message, Throwable cause) { - super(message, cause); - // TODO Auto-generated constructor stub - } - -} diff --git a/src/com/ibm/jbatch/tck/spi/JobExecutionWaiter.java b/src/com/ibm/jbatch/tck/spi/JobExecutionWaiter.java deleted file mode 100644 index 6e0ae378b0..0000000000 --- a/src/com/ibm/jbatch/tck/spi/JobExecutionWaiter.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.spi; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import jakarta.batch.runtime.JobExecution; - -public interface JobExecutionWaiter { - JobExecution awaitTermination() throws JobExecutionTimeoutException; -} diff --git a/src/com/ibm/jbatch/tck/spi/JobExecutionWaiterFactory.java b/src/com/ibm/jbatch/tck/spi/JobExecutionWaiterFactory.java deleted file mode 100644 index 44a43d90b4..0000000000 --- a/src/com/ibm/jbatch/tck/spi/JobExecutionWaiterFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.spi; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import jakarta.batch.operations.JobOperator; - -public interface JobExecutionWaiterFactory { - public JobExecutionWaiter createWaiter(long executionId, JobOperator jobOp, long sleepTime); -} diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/JobContextTestBatchlet.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/JobContextTestBatchlet.xml deleted file mode 100644 index f76cca2456..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/JobContextTestBatchlet.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/StepContextTestBatchlet.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/StepContextTestBatchlet.xml deleted file mode 100644 index 1875412669..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/StepContextTestBatchlet.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/abandonActiveRestart.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/abandonActiveRestart.xml deleted file mode 100644 index 45adfdee46..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/abandonActiveRestart.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/batchletRestartStateMachine.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/batchletRestartStateMachine.xml deleted file mode 100644 index a38bb408c9..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/batchletRestartStateMachine.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkCustomCheckpoint.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkCustomCheckpoint.xml deleted file mode 100644 index 0693571df5..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkCustomCheckpoint.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkCustomCheckpointDEFAULTcommitInterval.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkCustomCheckpointDEFAULTcommitInterval.xml deleted file mode 100644 index 2bcd9cf297..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkCustomCheckpointDEFAULTcommitInterval.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkListenerTest.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkListenerTest.xml deleted file mode 100644 index d9638a488b..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkListenerTest.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkNoProcessorDefined.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkNoProcessorDefined.xml deleted file mode 100644 index 702b460e70..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkNoProcessorDefined.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkRetryInitialTest.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkRetryInitialTest.xml deleted file mode 100644 index 3e168049eb..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkRetryInitialTest.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkRetryMultipleExceptions.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkRetryMultipleExceptions.xml deleted file mode 100644 index 94d18e5fd4..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkRetryMultipleExceptions.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkRetryOnError.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkRetryOnError.xml deleted file mode 100644 index 2ba35626af..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkRetryOnError.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkSkipExceededTest.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkSkipExceededTest.xml deleted file mode 100644 index e849e1a707..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkSkipExceededTest.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkSkipInitialTest.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkSkipInitialTest.xml deleted file mode 100644 index 21ff11bf82..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkSkipInitialTest.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkSkipMultipleExceptions.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkSkipMultipleExceptions.xml deleted file mode 100644 index bcd71901a7..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkSkipMultipleExceptions.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkSkipNoSkipChildExTest.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkSkipNoSkipChildExTest.xml deleted file mode 100644 index 58b433b03b..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkSkipNoSkipChildExTest.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkSkipOnErrorCallTest.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkSkipOnErrorCallTest.xml deleted file mode 100644 index af443880de..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkSkipOnErrorCallTest.xml +++ /dev/null @@ -1,18 +0,0 @@ - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkSkipOnErrorTest.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkSkipOnErrorTest.xml deleted file mode 100644 index 0e94f4bfdb..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkSkipOnErrorTest.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkStopOnEndOn.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkStopOnEndOn.xml deleted file mode 100644 index 7b9eb45781..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkStopOnEndOn.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkTimeBasedCheckpoint.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkTimeBasedCheckpoint.xml deleted file mode 100644 index f14f57e5a6..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkTimeBasedCheckpoint.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkTimeBasedDefaultCheckpoint.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkTimeBasedDefaultCheckpoint.xml deleted file mode 100644 index 6e0c87f464..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkTimeBasedDefaultCheckpoint.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkTimeLimit0.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkTimeLimit0.xml deleted file mode 100644 index 9092247823..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkTimeLimit0.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkrestartCheckpt10.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkrestartCheckpt10.xml deleted file mode 100644 index c295d3f537..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkrestartCheckpt10.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkrestartPartitionedCheckpt10.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkrestartPartitionedCheckpt10.xml deleted file mode 100644 index 1da4633dec..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunkrestartPartitionedCheckpt10.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunksize5commitinterval3.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunksize5commitinterval3.xml deleted file mode 100644 index dcef8a22dd..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunksize5commitinterval3.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunksize5commitinterval5.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunksize5commitinterval5.xml deleted file mode 100644 index dcb2dbf4aa..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunksize5commitinterval5.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunksizeDEFAULTcommitIntervalDEFAULT.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunksizeDEFAULTcommitIntervalDEFAULT.xml deleted file mode 100644 index 636aa1c656..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/chunksizeDEFAULTcommitIntervalDEFAULT.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/contexts_getid_jobcontext.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/contexts_getid_jobcontext.xml deleted file mode 100644 index c7407f678f..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/contexts_getid_jobcontext.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/contexts_getid_stepcontext.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/contexts_getid_stepcontext.xml deleted file mode 100644 index 5167c8c81b..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/contexts_getid_stepcontext.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/decider_as_first_job_element_fails.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/decider_as_first_job_element_fails.xml deleted file mode 100644 index 91d4dce378..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/decider_as_first_job_element_fails.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/decider_transitions_from_split_on_restart.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/decider_transitions_from_split_on_restart.xml deleted file mode 100644 index 116d464943..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/decider_transitions_from_split_on_restart.xml +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/decider_transitions_on_restart.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/decider_transitions_on_restart.xml deleted file mode 100644 index b2429d6a13..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/decider_transitions_on_restart.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/flow_transition_to_decision.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/flow_transition_to_decision.xml deleted file mode 100644 index 520a1d8ace..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/flow_transition_to_decision.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/flow_transition_to_step.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/flow_transition_to_step.xml deleted file mode 100644 index dd3c651922..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/flow_transition_to_step.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/flow_transition_to_step_out_of_scope.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/flow_transition_to_step_out_of_scope.xml deleted file mode 100644 index 8600b58a5b..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/flow_transition_to_step_out_of_scope.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/flow_transition_within_flow.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/flow_transition_within_flow.xml deleted file mode 100644 index a7e4e55b2b..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/flow_transition_within_flow.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_and_step_listeners.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_and_step_listeners.xml deleted file mode 100644 index 3719657e92..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_and_step_listeners.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_attributes_restart_true_test.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_attributes_restart_true_test.xml deleted file mode 100644 index 3a80663089..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_attributes_restart_true_test.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_1step.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_1step.xml deleted file mode 100644 index e1b6cabb47..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_1step.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_2steps.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_2steps.xml deleted file mode 100644 index 63c03b72a4..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_2steps.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_4steps.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_4steps.xml deleted file mode 100644 index 05373ea184..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_4steps.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_endElement.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_endElement.xml deleted file mode 100644 index 55f8223854..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_endElement.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_failElement.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_failElement.xml deleted file mode 100644 index 20e04b2be5..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_failElement.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_longrunning.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_longrunning.xml deleted file mode 100644 index d96860fa17..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_longrunning.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_longrunning_partitioned.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_longrunning_partitioned.xml deleted file mode 100644 index 32174cf2ec..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_longrunning_partitioned.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_longrunning_partitioned_inflow.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_longrunning_partitioned_inflow.xml deleted file mode 100644 index 2248d7beac..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_longrunning_partitioned_inflow.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_nextElement.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_nextElement.xml deleted file mode 100644 index 6ed546fbaa..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_nextElement.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_persistedData.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_persistedData.xml deleted file mode 100644 index 6499c6f1da..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_persistedData.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_step_listener.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_step_listener.xml deleted file mode 100644 index e1dfd5cac3..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_step_listener.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_stopElement.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_stopElement.xml deleted file mode 100644 index 345bd88e2c..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_batchlet_stopElement.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_chunk_checkpoint.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_chunk_checkpoint.xml deleted file mode 100644 index b8d024549b..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_chunk_checkpoint.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_chunk_full_attributes.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_chunk_full_attributes.xml deleted file mode 100644 index 51a62c4c52..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_chunk_full_attributes.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_chunk_getException.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_chunk_getException.xml deleted file mode 100644 index 79c24a2bff..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_chunk_getException.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_chunk_getExceptionListeners.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_chunk_getExceptionListeners.xml deleted file mode 100644 index 007d4e2ff8..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_chunk_getExceptionListeners.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_chunk_globaltran.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_chunk_globaltran.xml deleted file mode 100644 index 51da25b092..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_chunk_globaltran.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_chunk_globaltran_default.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_chunk_globaltran_default.xml deleted file mode 100644 index b972d49078..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_chunk_globaltran_default.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_chunk_globaltran_multiple_steps-customCA.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_chunk_globaltran_multiple_steps-customCA.xml deleted file mode 100644 index d875a7347e..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_chunk_globaltran_multiple_steps-customCA.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_chunk_globaltran_multiple_steps.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_chunk_globaltran_multiple_steps.xml deleted file mode 100644 index 9c5878311a..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_chunk_globaltran_multiple_steps.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_chunk_retryskip_rollback.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_chunk_retryskip_rollback.xml deleted file mode 100644 index 6d7d87dbc3..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_chunk_retryskip_rollback.xml +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_chunk_simple.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_chunk_simple.xml deleted file mode 100644 index b0103bc335..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_chunk_simple.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_decider_completerun.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_decider_completerun.xml deleted file mode 100644 index aa5e03df74..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_decider_completerun.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_decider_incompleterun.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_decider_incompleterun.xml deleted file mode 100644 index bf8196eba9..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_decider_incompleterun.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_executable_sequence_invalid.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_executable_sequence_invalid.xml deleted file mode 100644 index 7ebfffcd8c..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_executable_sequence_invalid.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_flow_batchlet_4steps.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_flow_batchlet_4steps.xml deleted file mode 100644 index f20a970321..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_flow_batchlet_4steps.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_level_properties_count.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_level_properties_count.xml deleted file mode 100644 index 074106598e..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_level_properties_count.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_level_properties_count_zero.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_level_properties_count_zero.xml deleted file mode 100644 index 9925253e45..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_level_properties_count_zero.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_level_properties_scope.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_level_properties_scope.xml deleted file mode 100644 index 679e2aabd3..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_level_properties_scope.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_level_properties_value.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_level_properties_value.xml deleted file mode 100644 index 23980c50c5..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_level_properties_value.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_partitioned_1step.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_partitioned_1step.xml deleted file mode 100644 index 031fb14348..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_partitioned_1step.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_partitioned_1step_exitStatusTest.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_partitioned_1step_exitStatusTest.xml deleted file mode 100644 index 792f7438ee..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_partitioned_1step_exitStatusTest.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_partitioned_artifacts.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_partitioned_artifacts.xml deleted file mode 100644 index 16dfd842b5..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_partitioned_artifacts.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_properties2.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_properties2.xml deleted file mode 100644 index f823e43b41..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_properties2.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_retry_listener_test.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_retry_listener_test.xml deleted file mode 100644 index a0ab9608e0..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_retry_listener_test.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_split_batchlet_4steps.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_split_batchlet_4steps.xml deleted file mode 100644 index 5f130eadd6..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_split_batchlet_4steps.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_unique_get_job_names.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_unique_get_job_names.xml deleted file mode 100644 index 7c0e251191..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/job_unique_get_job_names.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/nullChkPtInfo.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/nullChkPtInfo.xml deleted file mode 100644 index 17c1faa06f..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/nullChkPtInfo.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/oneArtifactIsJobAndStepListener.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/oneArtifactIsJobAndStepListener.xml deleted file mode 100644 index 16f07ddd6b..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/oneArtifactIsJobAndStepListener.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/overrideOnAttributeValuesUponRestartBatchlet.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/overrideOnAttributeValuesUponRestartBatchlet.xml deleted file mode 100644 index 5ff2c3e005..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/overrideOnAttributeValuesUponRestartBatchlet.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/partitioned_thread_tracking_job_and_step_listeners.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/partitioned_thread_tracking_job_and_step_listeners.xml deleted file mode 100644 index d18e0ced74..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/partitioned_thread_tracking_job_and_step_listeners.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/split_batchlet_4steps.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/split_batchlet_4steps.xml deleted file mode 100644 index db7bb906ca..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/split_batchlet_4steps.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/split_flow_transition_loop_splitflowsplit.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/split_flow_transition_loop_splitflowsplit.xml deleted file mode 100644 index 87178a5910..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/split_flow_transition_loop_splitflowsplit.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/split_level_flow_tries_its_own_transition.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/split_level_flow_tries_its_own_transition.xml deleted file mode 100644 index 505b9aa5b3..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/split_level_flow_tries_its_own_transition.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/split_transition_to_decision.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/split_transition_to_decision.xml deleted file mode 100644 index 5d4e37b2e0..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/split_transition_to_decision.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/split_transition_to_step.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/split_transition_to_step.xml deleted file mode 100644 index 83f5d8d3ec..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/split_transition_to_step.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/split_transition_to_step_out_of_scope.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/split_transition_to_step_out_of_scope.xml deleted file mode 100644 index 8917dbefb7..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/split_transition_to_step_out_of_scope.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/startLimitTests.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/startLimitTests.xml deleted file mode 100644 index f6df933f3a..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/startLimitTests.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/step_level_properties_count.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/step_level_properties_count.xml deleted file mode 100644 index 3e3c325fef..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/step_level_properties_count.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/step_level_properties_count_zero.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/step_level_properties_count_zero.xml deleted file mode 100644 index c64c40655b..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/step_level_properties_count_zero.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/step_level_properties_scope.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/step_level_properties_scope.xml deleted file mode 100644 index 959d0010f8..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/step_level_properties_scope.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/step_level_properties_value.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/step_level_properties_value.xml deleted file mode 100644 index 6ee646e259..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/step_level_properties_value.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/testChunkMetrics.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/testChunkMetrics.xml deleted file mode 100644 index 43a4bee775..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/testChunkMetrics.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/testListeners.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/testListeners.xml deleted file mode 100644 index 0f970a3621..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/testListeners.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/testListenersOnError.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/testListenersOnError.xml deleted file mode 100644 index 53cbb9c623..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/testListenersOnError.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/testMetricCount.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/testMetricCount.xml deleted file mode 100644 index 35bcc947fb..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/testMetricCount.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/testMetricsCommitCount.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/testMetricsCommitCount.xml deleted file mode 100644 index 11dca8e959..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/testMetricsCommitCount.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/testMetricsFilterCount.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/testMetricsFilterCount.xml deleted file mode 100644 index e3e622b66c..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/testMetricsFilterCount.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/testMetricsSkipCount.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/testMetricsSkipCount.xml deleted file mode 100644 index 989d16d138..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/testMetricsSkipCount.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/testMetricsSkipWriteCount.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/testMetricsSkipWriteCount.xml deleted file mode 100644 index b1593191bd..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/testMetricsSkipWriteCount.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/test_artifact_load_classloader.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/test_artifact_load_classloader.xml deleted file mode 100644 index 58c353d3b4..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/test_artifact_load_classloader.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/test_batchlet_stepCtx.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/test_batchlet_stepCtx.xml deleted file mode 100644 index 7cd3ad667e..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/test_batchlet_stepCtx.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/uniqueInstanceTest.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/uniqueInstanceTest.xml deleted file mode 100644 index a6a5ee78aa..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch-jobs/uniqueInstanceTest.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch.xml b/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch.xml deleted file mode 100644 index efe547b398..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/batch.xml +++ /dev/null @@ -1,167 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/testJobXml/META-INF/services/com.ibm.jbatch.tck.spi.JobExecutionWaiterFactory b/src/com/ibm/jbatch/tck/testJobXml/META-INF/services/com.ibm.jbatch.tck.spi.JobExecutionWaiterFactory deleted file mode 100644 index 82c00f72db..0000000000 --- a/src/com/ibm/jbatch/tck/testJobXml/META-INF/services/com.ibm.jbatch.tck.spi.JobExecutionWaiterFactory +++ /dev/null @@ -1,6 +0,0 @@ -# -# This implementation is provided by the TCK itself, and should probably work for any implementation. -# -com.ibm.jbatch.tck.polling.TCKPollingExecutionWaiterFactory - - diff --git a/src/com/ibm/jbatch/tck/tests/build.xml b/src/com/ibm/jbatch/tck/tests/build.xml deleted file mode 100644 index 77a337a1ee..0000000000 --- a/src/com/ibm/jbatch/tck/tests/build.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/tests/ee/TransactionTests.java b/src/com/ibm/jbatch/tck/tests/ee/TransactionTests.java deleted file mode 100644 index 59cf0f704d..0000000000 --- a/src/com/ibm/jbatch/tck/tests/ee/TransactionTests.java +++ /dev/null @@ -1,648 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.tests.ee; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import static com.ibm.jbatch.tck.utils.AssertionUtils.assertObjEquals; -import static com.ibm.jbatch.tck.utils.AssertionUtils.assertWithMessage; - -import java.util.List; -import java.util.Properties; -import java.util.logging.Logger; - -import jakarta.batch.runtime.BatchStatus; -import jakarta.batch.runtime.JobExecution; -import jakarta.batch.runtime.StepExecution; - -import com.ibm.jbatch.tck.utils.JobOperatorBridge; -import com.ibm.jbatch.tck.utils.TCKJobExecutionWrapper; - - - - - - - - -// Since we don't want to run these in SE, and are only really running TestNG in EE, we -// can safely do a JUnit - -public class TransactionTests extends ServiceEETest { - - private final static Logger logger = Logger.getLogger(TransactionTests.class.getName()); - - private static JobOperatorBridge jobOp; - - public static void setup(String[] args, Properties props) throws Fault { - String METHOD = "setup"; -TestUtil.logTrace(METHOD); - - try { - jobOp = new JobOperatorBridge(); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - - - public static void setUp() throws Fault { - jobOp = new JobOperatorBridge(); - } - - - public static void cleanup() throws Fault { - } - - private void begin(String str) { - TestUtil.logMsg("Begin test method: " + str + ""); - } - - - /* - * @testName: testTranRollbackRetryReadSkipRead - * - * @assertion: Test will finish in COMPLETED status, with the onRetryReadException and onSkipItem listener invoked. - * - * @test_Strategy: - * Test that the onRetryReadException listener is invoked when a retryable exception occurs on a read. - * The transaction will rollback and the chunk will be retried with an item-count of 1 (one) - * Test that the item is skipped, and onSkipReadItem listener is invoked, when the same exception occurs on the retry - * - */ - - - public void testTranRollbackRetryReadSkipRead() throws Fault { - String METHOD = "testTranRollbackRetryReadSkipRead"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - Integer initNumbers = 10; - Integer forcedFailCountRead = 8; - Integer forcedFailCountProcess = 0; - Integer forcedFailCountWrite = 0; - Integer dummyDelay = 0; - Boolean rollback = true; - Boolean autoCommit = false; - - Properties jobParams = new Properties(); - - jobParams.put("jakarta.transaction.global.mode", "true"); - jobParams.put("jakarta.transaction.global.timeout", "20"); - jobParams.put("init.numbers.quantity", initNumbers.toString()); - jobParams.put("forced.fail.count.read", forcedFailCountRead.toString()); - jobParams.put("forced.fail.count.write", forcedFailCountWrite.toString()); - jobParams.put("forced.fail.count.process", forcedFailCountProcess.toString()); - jobParams.put("dummy.delay.seconds", dummyDelay.toString()); - jobParams.put("rollback", rollback.toString()); - jobParams.put("auto.commit", autoCommit.toString()); - - TestUtil.logMsg("Locate job XML file: job_chunk_retryskip_rollback.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_chunk_retryskip_rollback",jobParams); - assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testTranRollbackRetryProcessSkipProcess - * - * @assertion: Test will finish in COMPLETED status, with the onRetryProcessException and onSkipProcess listener invoked. - * - * @test_Strategy: - * Test that the onRetryProcessException listener is invoked when a retryable exception occurs on a process. - * The transaction will rollback and the chunk will be retried with an item-count of 1 (one) - * Test that the item is skipped, and onSkipProcessItem listener is invoked, when the same exception occurs on the retry - * - */ - - - public void testTranRollbackRetryProcessSkipProcess() throws Fault { - String METHOD = "testTranRollbackRetryProcessSkipProcess"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - Integer initNumbers = 10; - Integer forcedFailCountRead = 0; - Integer forcedFailCountProcess = 8; - Integer forcedFailCountWrite = 0; - Integer dummyDelay = 0; - Boolean rollback = true; - Boolean autoCommit = false; - - Properties jobParams = new Properties(); - - jobParams.put("jakarta.transaction.global.mode", "true"); - jobParams.put("jakarta.transaction.global.timeout", "20"); - jobParams.put("init.numbers.quantity", initNumbers.toString()); - jobParams.put("forced.fail.count.read", forcedFailCountRead.toString()); - jobParams.put("forced.fail.count.write", forcedFailCountWrite.toString()); - jobParams.put("forced.fail.count.process", forcedFailCountProcess.toString()); - jobParams.put("dummy.delay.seconds", dummyDelay.toString()); - jobParams.put("rollback", rollback.toString()); - jobParams.put("auto.commit", autoCommit.toString()); - - TestUtil.logMsg("Locate job XML file: job_chunk_retryskip_rollback.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_chunk_retryskip_rollback",jobParams); - assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testTranRollbackRetryWriteSkipWrite - * - * @assertion: Test will finish in COMPLETED status, with the onRetryWriteException and onSkipWriteItem listener invoked. - * - * @test_Strategy: - * Test that the onRetryWriteException listener is invoked when a retryable exception occurs on a write. - * The transaction will rollback and the chunk will be retried with an item-count of 1 (one) - * Test that the item is skipped, and onSkipWriteItem listener is invoked, when the same exception occurs on the retry - * - */ - - - public void testTranRollbackRetryWriteSkipWrite() throws Fault { - String METHOD = "testTranRollbackRetryWriteSkipWrite"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - Integer initNumbers = 10; - Integer forcedFailCountRead = 0; - Integer forcedFailCountProcess = 0; - Integer forcedFailCountWrite = 8; - Integer dummyDelay = 0; - Boolean rollback = true; - Boolean autoCommit = false; - - Properties jobParams = new Properties(); - - jobParams.put("jakarta.transaction.global.mode", "true"); - jobParams.put("jakarta.transaction.global.timeout", "20"); - jobParams.put("init.numbers.quantity", initNumbers.toString()); - jobParams.put("forced.fail.count.read", forcedFailCountRead.toString()); - jobParams.put("forced.fail.count.write", forcedFailCountWrite.toString()); - jobParams.put("forced.fail.count.process", forcedFailCountProcess.toString()); - jobParams.put("dummy.delay.seconds", dummyDelay.toString()); - jobParams.put("rollback", rollback.toString()); - jobParams.put("auto.commit", autoCommit.toString()); - - TestUtil.logMsg("Locate job XML file: job_chunk_retryskip_rollback.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_chunk_retryskip_rollback",jobParams); - assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testGlobalTranNoExceptions - * @assertion: FIXME - * @test_Strategy: FIXME - */ - - - public void testGlobalTranNoExceptions() throws Fault { - String METHOD = "testGlobalTranNoExceptions"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - String DEFAULT_SLEEP_TIME = "0"; - - try { - Integer initInventory = 99; - Integer forcedFailCount = 0; - Integer itemCount = 5; - Integer dummyDelay = - Integer.parseInt(System.getProperty("TransactionTests.testGlobalTranNoExceptions.sleep",DEFAULT_SLEEP_TIME)); - - - Integer expectedInventory = this.calculateGlobalTranExpectedInventory(initInventory, forcedFailCount, itemCount); - Integer expectedCompletedOrders = this.calculateExpectedCompleteOrders(initInventory, forcedFailCount, itemCount); - - Properties jobParams = new Properties(); - TestUtil.logMsg("Create job parameters for execution #1:"); - TestUtil.logMsg("jakarta.transaction.global.timeout=300"); - TestUtil.logMsg("commit.interval="+itemCount.toString()); - TestUtil.logMsg("init.inventory.quantity="+initInventory.toString()); - TestUtil.logMsg("forced.fail.count="+forcedFailCount.toString()); - TestUtil.logMsg("dummy.delay.seconds="+dummyDelay.toString()); - TestUtil.logMsg("expected.inventory="+expectedInventory.toString()); - jobParams.put("jakarta.transaction.global.timeout", "300"); - jobParams.put("commit.interval", itemCount.toString()); - jobParams.put("init.inventory.quantity", initInventory.toString()); - jobParams.put("forced.fail.count", forcedFailCount.toString()); - jobParams.put("dummy.delay.seconds", dummyDelay.toString()); - jobParams.put("expected.inventory", expectedInventory.toString()); - - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_chunk_globaltran",jobParams); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+jobExec.getBatchStatus()); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()="+jobExec.getExitStatus()); - assertObjEquals("Inventory=" +expectedInventory + " InitialCheckpoint=" + null +" OrderCount="+ expectedCompletedOrders , jobExec.getExitStatus()); - assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - - /* - * @testName: testGlobalTranForcedExceptionWithRollback - * @assertion: FIXME - * @test_Strategy: FIXME - */ - - - public void testGlobalTranForcedExceptionWithRollback() throws Fault { - String METHOD = "testGlobalTranForcedExceptionWithRollback"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - String DEFAULT_SLEEP_TIME = "0"; - - try { - Integer initInventory = 99; - Integer forcedFailCount = 20; - Integer itemCount = 9; - Integer dummyDelay = - Integer.parseInt(System.getProperty("TransactionTests.testGlobalTranForcedExceptionWithRollback.sleep",DEFAULT_SLEEP_TIME)); - - Integer expectedInventory = TransactionTests.calculateGlobalTranExpectedInventory(initInventory, forcedFailCount, itemCount); - Integer expectedCompletedOrders = this.calculateExpectedCompleteOrders(initInventory, forcedFailCount, itemCount); - - Properties jobParams = new Properties(); - - TestUtil.logMsg("Create job parameters for execution #1:"); - TestUtil.logMsg("jakarta.transaction.global.timeout=300"); - TestUtil.logMsg("commit.interval="+itemCount.toString()); - TestUtil.logMsg("init.inventory.quantity="+initInventory.toString()); - TestUtil.logMsg("forced.fail.count="+forcedFailCount.toString()); - TestUtil.logMsg("dummy.delay.seconds="+dummyDelay.toString()); - TestUtil.logMsg("expected.inventory="+expectedInventory.toString()); - jobParams.put("jakarta.transaction.global.timeout", "300"); - jobParams.put("commit.interval", itemCount.toString()); - jobParams.put("init.inventory.quantity", initInventory.toString()); - jobParams.put("forced.fail.count", forcedFailCount.toString()); - jobParams.put("dummy.delay.seconds", dummyDelay.toString()); - jobParams.put("expected.inventory", expectedInventory.toString()); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_chunk_globaltran",jobParams); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+jobExec.getBatchStatus()); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()="+jobExec.getExitStatus()); - assertObjEquals("Inventory=" +expectedInventory + " InitialCheckpoint=" + null +" OrderCount="+ expectedCompletedOrders , jobExec.getExitStatus()); - assertObjEquals(BatchStatus.FAILED, jobExec.getBatchStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testGlobalTranForcedExceptionCheckpointRestart - * @assertion: FIXME - * @test_Strategy: FIXME - */ - - - public void testGlobalTranForcedExceptionCheckpointRestart() throws Fault { - String METHOD = "testGlobalTranForcedExceptionCheckpointRestart"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - String DEFAULT_SLEEP_TIME = "0"; - - try { - Integer initInventory = 99; - Integer forcedFailCount = 20; - Integer itemCount = 9; - Integer dummyDelay = - Integer.parseInt(System.getProperty("TransactionTests.testGlobalTranForcedExceptionCheckpointRestart.sleep",DEFAULT_SLEEP_TIME)); - - Integer expectedInventory = TransactionTests.calculateGlobalTranExpectedInventory(initInventory, forcedFailCount, itemCount); - Integer expectedCompletedOrders = TransactionTests.calculateExpectedCompleteOrders(initInventory, forcedFailCount, itemCount); - - Properties jobParams = new Properties(); - - TestUtil.logMsg("Create job parameters for execution #1:"); - TestUtil.logMsg("jakarta.transaction.global.timeout=300"); - TestUtil.logMsg("commit.interval="+itemCount.toString()); - TestUtil.logMsg("init.inventory.quantity="+initInventory.toString()); - TestUtil.logMsg("forced.fail.count="+forcedFailCount.toString()); - TestUtil.logMsg("dummy.delay.seconds="+dummyDelay.toString()); - TestUtil.logMsg("expected.inventory="+expectedInventory.toString()); - jobParams.put("jakarta.transaction.global.timeout", "300"); - jobParams.put("commit.interval", itemCount.toString()); - jobParams.put("init.inventory.quantity", initInventory.toString()); - jobParams.put("forced.fail.count", forcedFailCount.toString()); - jobParams.put("dummy.delay.seconds", dummyDelay.toString()); - jobParams.put("expected.inventory", expectedInventory.toString()); - - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - TCKJobExecutionWrapper jobExec = jobOp.startJobAndWaitForResult("job_chunk_globaltran",jobParams); - long jobInstanceId = jobExec.getInstanceId(); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+jobExec.getBatchStatus()); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()="+jobExec.getExitStatus()); - assertObjEquals(BatchStatus.FAILED, jobExec.getBatchStatus()); - assertObjEquals("Inventory=" +expectedInventory + " InitialCheckpoint=" + null +" OrderCount="+ expectedCompletedOrders , jobExec.getExitStatus()); - - forcedFailCount = 0; - jobParams.put("forced.fail.count", forcedFailCount.toString()); - - expectedInventory = TransactionTests.calculateGlobalTranExpectedInventory(expectedInventory, forcedFailCount, itemCount); - Integer expectedCompletedOrders2 = TransactionTests.calculateExpectedCompleteOrders(initInventory, forcedFailCount, itemCount); - - TestUtil.logMsg("Invoke restartJobAndWaitForResult with id: " + jobInstanceId + ""); - JobExecution restartedJobExec = jobOp.restartJobAndWaitForResult(jobExec.getExecutionId(), jobParams); - - TestUtil.logMsg("restarted job JobExecution getBatchStatus()="+restartedJobExec.getBatchStatus()); - TestUtil.logMsg("restarted job JobExecution getExitStatus()="+restartedJobExec.getExitStatus()); - assertObjEquals("Inventory=" +expectedInventory + " InitialCheckpoint=" + expectedCompletedOrders+" OrderCount="+ expectedCompletedOrders2, restartedJobExec.getExitStatus()); - assertObjEquals(BatchStatus.COMPLETED, restartedJobExec.getBatchStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testGlobalTranNoDelayLongTimeout - * @assertion: Step-level property of 'jakarta.transaction.global.timeout' - * _Strategy: This test sets a long (180 sec.) checkpoint timeout explicitly in the JSL, and it does not - * use any delay or sleep, so it just confirms that the timeout doesn't hit and the chunk completes - * normally. - */ - - - public void testGlobalTranNoDelayLongTimeout() throws Fault { - String METHOD = "testGlobalTranNoDelayLongTimeout"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - String DEFAULT_SLEEP_TIME = "0"; - - try { - - Integer initInventory = 99; - // set to zero - Integer forcedFailCount = 0; - Integer itemCount = 9; - // set to zero - Integer dummyDelay = - Integer.parseInt(System.getProperty("TransactionTests.testGlobalTranNoDelayLongTimeout.sleep",DEFAULT_SLEEP_TIME)); - - Integer expectedInventory = TransactionTests.calculateGlobalTranExpectedInventory(initInventory, forcedFailCount, itemCount); - Integer expectedCompletedOrders = TransactionTests.calculateExpectedCompleteOrders(initInventory, forcedFailCount, itemCount); - - Properties jobParams = new Properties(); - - TestUtil.logMsg("Create job parameters for execution #1:"); - TestUtil.logMsg("commit.interval="+itemCount.toString()); - TestUtil.logMsg("init.inventory.quantity="+initInventory.toString()); - TestUtil.logMsg("forced.fail.count="+forcedFailCount.toString()); - TestUtil.logMsg("dummy.delay.seconds="+dummyDelay.toString()); - TestUtil.logMsg("expected.inventory="+expectedInventory.toString()); - jobParams.put("commit.interval", itemCount.toString()); - jobParams.put("init.inventory.quantity", initInventory.toString()); - jobParams.put("forced.fail.count", forcedFailCount.toString()); - jobParams.put("dummy.delay.seconds", dummyDelay.toString()); - jobParams.put("expected.inventory", expectedInventory.toString()); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - TCKJobExecutionWrapper jobExec = jobOp.startJobAndWaitForResult("job_chunk_globaltran_default",jobParams); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+jobExec.getBatchStatus()); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()="+jobExec.getExitStatus()); - assertObjEquals("Inventory=" +expectedInventory + " InitialCheckpoint=" + null +" OrderCount="+ expectedCompletedOrders , jobExec.getExitStatus()); - assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus()); - - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * (this test name is now a misnomer since we changed the test logic to exclude the "short timeout") - * - * @testName: testGlobalTranLongDelayMixOfLongTimeoutStepsAndShortTimeoutSteps - * @assertion: Step-level property of 'jakarta.transaction.global.timeout', including defaults. Also shows that - * job-level property is ignored. - * _Strategy: This test uses three steps that are basically the same, reading and writing from the same tables - * (along with some helper steps in between to init the tables). - * Two of the steps are configured with long timeouts, and one with a short timeout. - * The long timeouts involve variations: - * - step 2 : - * (shows that '0' means indefinite timeout) - * - step 3 : No property specified - * (shows that the default is 180 seconds). - * - * The long timeouts are longer than the "long" delay, so these steps complete successfully. - * - * Obviously this doesn't prove that the exact default timeout value is 180 seconds (for step 3), - * or that the value of '0' means unlimited. We don't try to prove that conclusively but just - * to hint at it and possibly catch an implementation doing something completely off-base. - */ - - - public void testGlobalTranLongDelayMixOfLongTimeoutStepsAndShortTimeoutSteps() throws Fault { - String METHOD = "testGlobalTranLongDelayMixOfLongTimeoutStepsAndShortTimeoutSteps"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - String DEFAULT_SLEEP_TIME = "10000"; - - try { - Integer initInventory = 99; - Integer forcedFailCount = 15; - Integer itemCount = 9; - Integer dummyDelay = - Integer.parseInt(System.getProperty("TransactionTests.testGlobalTranLongDelayMixOfLongTimeoutStepsAndShortTimeoutSteps.sleep",DEFAULT_SLEEP_TIME)); - - Properties jobParams = new Properties(); - - TestUtil.logMsg("Create job parameters for execution #1:"); - TestUtil.logMsg("commit.interval="+itemCount.toString()); - TestUtil.logMsg("init.inventory.quantity="+initInventory.toString()); - TestUtil.logMsg("forced.fail.count="+forcedFailCount.toString()); - TestUtil.logMsg("dummy.delay.seconds="+dummyDelay.toString()); - jobParams.put("commit.interval", itemCount.toString()); - jobParams.put("init.inventory.quantity", initInventory.toString()); - jobParams.put("forced.fail.count", forcedFailCount.toString()); - jobParams.put("dummy.delay.seconds", dummyDelay.toString()); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - TCKJobExecutionWrapper jobExec = jobOp.startJobAndWaitForResult("job_chunk_globaltran_multiple_steps",jobParams); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+jobExec.getBatchStatus()); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()="+jobExec.getExitStatus()); - assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus()); - // With test refactoring all orders will be processed, and all inventory depleted. - assertObjEquals("Inventory=0 InitialCheckpoint=null OrderCount="+ initInventory, jobExec.getExitStatus()); - - List stepExecutions = jobOp.getStepExecutions(jobExec.getExecutionId()); - - boolean seen2 = false; boolean seen3 = false; - for (StepExecution s : stepExecutions) { - if (s.getStepName().equals("step2")) { - assertObjEquals(BatchStatus.COMPLETED, s.getBatchStatus()); - seen2 = true; - } else if (s.getStepName().equals("step3")) { - assertObjEquals(BatchStatus.COMPLETED, s.getBatchStatus()); - seen3 = true; - } - } - assertWithMessage("Step2 execution seen", true, seen2); - assertWithMessage("Step3 execution seen", true, seen3); - - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testGlobalTranLongDelayMixOfLongTimeoutStepsAndShortTimeoutStepsCustomCheckpointAlgorithm - * @assertion: Tests the CheckpointAlgorithm interface, with three - * job-level property is ignored. - * _Strategy: This test uses three steps that are basically the same, reading and writing from the same tables - * (along with some helper steps in between to init the tables). - * - * All three use a custom checkpoint algorithm, which are identical except for their - * behavior with respect to timeout. - * - * step2 : checkpointTimeout - Don't override, pickup AbstractCheckpointAlgorithm's returning '0' = - * unlimited. - * step3 : checkpointTimeout - Return a long value - * - * The long timeouts are longer than the "long" delay, so steps 2, 3 complete successfully. - */ - - - public void testGlobalTranLongDelayMixOfLongTimeoutStepsAndShortTimeoutStepsCustomCheckpointAlgorithm() throws Fault { - String METHOD = "testGlobalTranLongDelayMixOfLongTimeoutStepsAndShortTimeoutStepsCustomCheckpointAlgorithm"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - String DEFAULT_SLEEP_TIME = "10000"; - - try { - Integer initInventory = 99; - Integer forcedFailCount = 15; - Integer itemCount = 9; - Integer dummyDelay = - Integer.parseInt(System.getProperty("TransactionTests.testGlobalTranLongDelayMixOfLongTimeoutStepsAndShortTimeoutStepsCustomCheckpointAlgorithm.sleep",DEFAULT_SLEEP_TIME)); - - Properties jobParams = new Properties(); - - TestUtil.logMsg("Create job parameters for execution #1:"); - TestUtil.logMsg("commit.interval="+itemCount.toString()); - TestUtil.logMsg("init.inventory.quantity="+initInventory.toString()); - TestUtil.logMsg("forced.fail.count="+forcedFailCount.toString()); - TestUtil.logMsg("dummy.delay.seconds="+dummyDelay.toString()); - jobParams.put("commit.interval", itemCount.toString()); - jobParams.put("init.inventory.quantity", initInventory.toString()); - jobParams.put("forced.fail.count", forcedFailCount.toString()); - jobParams.put("dummy.delay.seconds", dummyDelay.toString()); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - TCKJobExecutionWrapper jobExec = jobOp.startJobAndWaitForResult("job_chunk_globaltran_multiple_steps-customCA",jobParams); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+jobExec.getBatchStatus()); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()="+jobExec.getExitStatus()); - assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus()); - assertObjEquals("Inventory=0 InitialCheckpoint=null OrderCount="+ initInventory, jobExec.getExitStatus()); - - List stepExecutions = jobOp.getStepExecutions(jobExec.getExecutionId()); - - boolean seen2 = false; boolean seen3 = false; - for (StepExecution s : stepExecutions) { - if (s.getStepName().equals("step2")) { - assertObjEquals(BatchStatus.COMPLETED, s.getBatchStatus()); - seen2 = true; - } else if (s.getStepName().equals("step3")) { - assertObjEquals(BatchStatus.COMPLETED, s.getBatchStatus()); - seen3 = true; - } - } - assertWithMessage("Step2 execution seen", true, seen2); - assertWithMessage("Step3 execution seen", true, seen3); - - } catch (Exception e) { - handleException(METHOD, e); - } - } - - - - /** - * Calculates how many items should be left in the inventory table after all commits and rollbacks. - */ - private static int calculateGlobalTranExpectedInventory(int initInventory, int forcedFailCount, int commitInterval) { - int expectedResult; - - if (forcedFailCount <= 0 ){ - expectedResult = 0; - } else { - expectedResult = (initInventory - forcedFailCount ) + (forcedFailCount % commitInterval); - } - - return expectedResult; - } - - - /** - * Calculates how many orders should in the orders table after all commits and rollbacks. - */ - private static int calculateExpectedCompleteOrders(int initInventory, int forcedFailCount, int commitInterval) { - int expectedResult; - if (forcedFailCount <= 0 ){ - expectedResult = initInventory; - } else { - expectedResult = (forcedFailCount / commitInterval ) * commitInterval; //integer arithmetic, so we drop the remainder - } - - - return expectedResult; - } - - private static void handleException(String methodName, Exception e) throws Fault { -TestUtil.logErr("Caught exception: " + e.getMessage()); -TestUtil.printStackTrace(e); -throw new Fault(methodName + " failed", e);} - -} diff --git a/src/com/ibm/jbatch/tck/tests/ee/beans.xml b/src/com/ibm/jbatch/tck/tests/ee/beans.xml deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/com/ibm/jbatch/tck/tests/ee/build.xml b/src/com/ibm/jbatch/tck/tests/ee/build.xml deleted file mode 100644 index be6d4232fa..0000000000 --- a/src/com/ibm/jbatch/tck/tests/ee/build.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/tests/ee/ee_ejb_vehicle_client.jar.sun-application-client.xml b/src/com/ibm/jbatch/tck/tests/ee/ee_ejb_vehicle_client.jar.sun-application-client.xml deleted file mode 100644 index 150a9188ac..0000000000 --- a/src/com/ibm/jbatch/tck/tests/ee/ee_ejb_vehicle_client.jar.sun-application-client.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - ejb/EJBVehicle - ee_ejb_vehicle - - diff --git a/src/com/ibm/jbatch/tck/tests/ee/ee_ejb_vehicle_ejb.jar.sun-ejb-jar.xml b/src/com/ibm/jbatch/tck/tests/ee/ee_ejb_vehicle_ejb.jar.sun-ejb-jar.xml deleted file mode 100644 index 961af8092e..0000000000 --- a/src/com/ibm/jbatch/tck/tests/ee/ee_ejb_vehicle_ejb.jar.sun-ejb-jar.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - 0 - - com_sun_ts_tests_common_vehicle_ejb_EJBVehicle - ee_ejb_vehicle - - java:module/env/jdbc/orderDB - jdbc/orderDB - - user1 - password1 - - - false - - - supported - supported - supported - supported - - - username_password - default - false - - - supported - - - false - -1 - - - - diff --git a/src/com/ibm/jbatch/tck/tests/ee/ee_web_vehicle_web.war.sun-web.xml b/src/com/ibm/jbatch/tck/tests/ee/ee_web_vehicle_web.war.sun-web.xml deleted file mode 100644 index 7522110816..0000000000 --- a/src/com/ibm/jbatch/tck/tests/ee/ee_web_vehicle_web.war.sun-web.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - java:module/env/jdbc/orderDB - jdbc/orderDB - - user1 - password1 - - - diff --git a/src/com/ibm/jbatch/tck/tests/ee/ejb_vehicle_ejb.xml b/src/com/ibm/jbatch/tck/tests/ee/ejb_vehicle_ejb.xml deleted file mode 100644 index 322d92ee60..0000000000 --- a/src/com/ibm/jbatch/tck/tests/ee/ejb_vehicle_ejb.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - Ejb1 - - - com_sun_ts_tests_common_vehicle_ejb_EJBVehicle - com.sun.ts.tests.common.vehicle.ejb.EJBVehicleHome - com.sun.ts.tests.common.vehicle.ejb.EJBVehicleRemote - com.sun.ts.tests.common.vehicle.ejb.EJBVehicle - Stateful - Container - - description - java:module/env/jdbc/orderDB - javax.sql.DataSource - Container - Shareable - - - - - - - - - - com_sun_ts_tests_common_vehicle_ejb_EJBVehicle - Remote - runTest - - Supports - - - diff --git a/src/com/ibm/jbatch/tck/tests/ee/web_vehicle_web.xml b/src/com/ibm/jbatch/tck/tests/ee/web_vehicle_web.xml deleted file mode 100644 index 2ef879c9e4..0000000000 --- a/src/com/ibm/jbatch/tck/tests/ee/web_vehicle_web.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - web_vehicle - - Servlet_VehicleLogicalName - com.sun.ts.tests.common.vehicle.servlet.ServletVehicle - - - jsp_vehicle - /jsp_vehicle.jsp - 0 - - - Servlet_VehicleLogicalName - /servlet_vehicle - - - 54 - - - java:module/env/jdbc/orderDB - javax.sql.DataSource - Container - Shareable - - diff --git a/src/com/ibm/jbatch/tck/tests/jslxml/BatchletRestartStateMachineTests.java b/src/com/ibm/jbatch/tck/tests/jslxml/BatchletRestartStateMachineTests.java deleted file mode 100644 index 9798768808..0000000000 --- a/src/com/ibm/jbatch/tck/tests/jslxml/BatchletRestartStateMachineTests.java +++ /dev/null @@ -1,284 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.tests.jslxml; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import static com.ibm.jbatch.tck.utils.AssertionUtils.assertWithMessage; - -import java.util.Properties; - -import jakarta.batch.runtime.BatchStatus; - - - - - - -import com.ibm.jbatch.tck.utils.JobOperatorBridge; -import com.ibm.jbatch.tck.utils.TCKJobExecutionWrapper; - -public class BatchletRestartStateMachineTests extends ServiceEETest { - - private static JobOperatorBridge jobOp = null; - - public static void setup(String[] args, Properties props) throws Fault { - - String METHOD = "setup"; -TestUtil.logTrace(METHOD); - - try { - jobOp = new JobOperatorBridge(); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - - - public static void setUp() throws Fault { - jobOp = new JobOperatorBridge(); - } - - /* cleanup */ - public void cleanup() - { - - } - - /* - * @testName: testTransitionElementOnAttrValuesWithRestartJobParamOverrides - * @assertion: 1) Tests Exit Status globbing against transition elements @on value - * 2) Shows that the @on values are overrideable on restart, and the persisted exit status in matched against the @on values coming - * from the restart job parameters. - * 3) Also by using the same exit-status in execution 2 for step 2 for and we verify that the globbing is done in - * sequential order (resulting in batch status = FAILED). - * 4) Also tests that for allow-start if complete we don't rerun just because we failed or stopped the job AFTER - * completing a step using the , transition elements. - * In this test, step1 is complete after execution 1 and does not reexecute on executions 2 or 3, in spite - * of the fact that the job was stopped by step1's element on execution 1. - * Likewise step2 is complete after execution 2 and does not reexecute on execution 3 in spite of the - * fact that execution 2 is failed by step2's element on execution 2. - * - * @test_Strategy: Reproduce a simplified form of the JSL here: - * - *---------------------------------------------------------------------------- - * - * - * - * [ ES.STEP1, ES.STOP, ES.STOP ] - * [ ES.XXX, ES.STEP1, ES.STEP1 ] - * - * - * - * [ES.STEP2, ES.STEP2, ES.FAIL] - * [ES.XXX, ES.STEP2, ES.STEP2] - * - * - * - * - * - * - * ---------------------------------------------------------------------------- - * On first execution, stop after step1. - * - * On second execution, step1 is already complete with allow-start-if-complete=false (by default), so the first execution is step2. - * This executes, and then the step2 exit status matches the value, resulting in job execution FAILED and - * a JSL-specified (via the element's exit-status="EXPECTED_FAILURE" job exit status. - * - * On the third execution, we this time do not execuute step1, or step 2, so we transition past each - * and the first step we execute is step 3. - * ---------------------------------------------------------------------------- - * - * Note that because we reuse the same batchlet across the three steps we perform some validation in - * the batchlet, using the stepName and the execution number (as restart parameter), so that we validate we're never called - * in the wrong step in the wrong execution (e.g. in execution.number N we shouldn't be in step S). - */ - - - public void testTransitionElementOnAttrValuesWithRestartJobParamOverrides() throws Fault { - - String METHOD = "testTransitionElementOnAttrValuesWithRestartJobParamOverrides"; -TestUtil.logTrace(METHOD); - - String EXECUTION2_EXPECTED_EXIT_STATUS_FROM_JSL_ATTRIBUTE = "EXPECTED_FAILURE"; - try { - - TCKJobExecutionWrapper execution1 = null; - TCKJobExecutionWrapper execution2 = null; - TCKJobExecutionWrapper execution3 = null; - - // Create new block to facilitate copy-pasting without inadvertent errors - { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - jobParams.setProperty("execution.number", "1"); - jobParams.setProperty("step1.stop", "ES.STEP1"); - jobParams.setProperty("step1.next", "ES.XXX"); - jobParams.setProperty("step2.fail", "ES.STEP2"); - jobParams.setProperty("step2.next", "ES.XXX"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - execution1 = jobOp.startJobAndWaitForResult("overrideOnAttributeValuesUponRestartBatchlet", jobParams); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+execution1.getBatchStatus()); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()="+execution1.getExitStatus()); - assertWithMessage("Testing execution #1", BatchStatus.STOPPED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", "STOPPED", execution1.getExitStatus()); - } - - { - TestUtil.logMsg("Create job parameters for execution #2:"); - Properties restartJobParameters = new Properties(); - TestUtil.logMsg("execution.number=2"); - TestUtil.logMsg("step1.stop=ES.STOP"); - TestUtil.logMsg("step1.next=ES.STEP1"); - restartJobParameters.setProperty("execution.number", "2"); - restartJobParameters.setProperty("step1.stop", "ES.STOP"); - restartJobParameters.setProperty("step1.next", "ES.STEP1"); - restartJobParameters.setProperty("step2.fail", "ES.STEP2"); - restartJobParameters.setProperty("step2.next", "ES.STEP2"); - TestUtil.logMsg("Invoke restartJobAndWaitForResult with executionId: " + execution1.getExecutionId() + ""); - execution2 = jobOp.restartJobAndWaitForResult(execution1.getExecutionId(),restartJobParameters); - TestUtil.logMsg("execution #2 JobExecution getBatchStatus()="+execution2.getBatchStatus()); - TestUtil.logMsg("execution #2 JobExecution getExitStatus()="+execution2.getExitStatus()); - assertWithMessage("Testing execution #2", BatchStatus.FAILED, execution2.getBatchStatus()); - // See JSL snippet above for where "SUCCESS" comes from - assertWithMessage("Testing execution #2", EXECUTION2_EXPECTED_EXIT_STATUS_FROM_JSL_ATTRIBUTE, execution2.getExitStatus()); - } - - { - TestUtil.logMsg("Create job parameters for execution #3:"); - Properties restartJobParameters = new Properties(); - TestUtil.logMsg("execution.number=3"); - TestUtil.logMsg("step1.stop=ES.STOP"); - TestUtil.logMsg("step1.next=ES.STEP1"); - TestUtil.logMsg("step2.fail=ES.FAIL"); - TestUtil.logMsg("step2.next=ES.STEP2"); - restartJobParameters.setProperty("execution.number", "3"); - restartJobParameters.setProperty("step1.stop", "ES.STOP"); - restartJobParameters.setProperty("step1.next", "ES.STEP1"); - restartJobParameters.setProperty("step2.fail", "ES.FAIL"); - restartJobParameters.setProperty("step2.next", "ES.STEP2"); - TestUtil.logMsg("Invoke restartJobAndWaitForResult with executionId: " + execution2.getExecutionId() + ""); - execution3 = jobOp.restartJobAndWaitForResult(execution2.getExecutionId(),restartJobParameters); - TestUtil.logMsg("execution #3 JobExecution getBatchStatus()="+execution3.getBatchStatus()); - TestUtil.logMsg("execution #3 JobExecution getExitStatus()="+execution3.getExitStatus()); - assertWithMessage("Testing execution #3", BatchStatus.COMPLETED, execution3.getBatchStatus()); - assertWithMessage("Testing execution #3", "COMPLETED", execution3.getExitStatus()); - } - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * Obviously would be nicer to have more granular tests for some of this function, - * but here we're going a different route and saying, if it's going to require - * restart it will have some complexity, so let's test a few different functions - * in one longer restart scenario. - */ - /* - * @testName: testAllowStartIfCompleteRestartExecution - * @assertion: 1. @restart attribute on transition element - * : 2. tests difference between allow-start-if-complete = true or false (default) - * @test_Strategy: - * - * For N in (1,2,3,4,5), we expect executions 1-5 to each end in batch status of STOPPED, - * with exit status EXECUTION.N - * - * This simplified JSL (end tags not shown) makes this clear. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * Note that because we reuse the same batchlet across the three steps we perform some validation in - * the batchlet, using the stepName and the execution number (as restart parameter), so that we validate we're never called - * in the wrong step in the wrong execution (e.g. in execution.number N we shouldn't be in step S). - */ - - - public void testAllowStartIfCompleteRestartExecution() throws Fault { - - String METHOD = "testAllowStartIfCompleteRestartExecution"; -TestUtil.logTrace(METHOD); - - try { - long lastExecutionId = 0L; - TCKJobExecutionWrapper exec = null; - - for (int i = 1; i <= 6; i++) { - String execString = new Integer(i).toString(); - Properties jobParameters = new Properties(); - jobParameters.put("execution.number", execString); - if (i == 1) { - TestUtil.logMsg("Invoking startJobAndWaitForResult for Execution #1"); - exec = jobOp.startJobAndWaitForResult("batchletRestartStateMachine", jobParameters); - } else { - TestUtil.logMsg("Invoke restartJobAndWaitForResult"); - exec = jobOp.restartJobAndWaitForResult(lastExecutionId, jobParameters); - } - lastExecutionId = exec.getExecutionId(); - - TestUtil.logMsg("Execution #" + i + " JobExecution getBatchStatus()="+exec.getBatchStatus()); - TestUtil.logMsg("Execution #" + i + " JobExecution getExitStatus()="+exec.getExitStatus()); - if (i == 6) { - assertWithMessage("Testing execution #" + i, BatchStatus.COMPLETED, exec.getBatchStatus()); - } else { - assertWithMessage("Testing execution #" + i, BatchStatus.STOPPED, exec.getBatchStatus()); - } - assertWithMessage("Testing execution #" + i, "EXECUTION." + execString, exec.getExitStatus()); - } - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - private static void handleException(String methodName, Exception e) throws Fault { -TestUtil.logErr("Caught exception: " + e.getMessage()); -TestUtil.printStackTrace(e); -throw new Fault(methodName + " failed", e);} - -} diff --git a/src/com/ibm/jbatch/tck/tests/jslxml/ChunkTests.java b/src/com/ibm/jbatch/tck/tests/jslxml/ChunkTests.java deleted file mode 100644 index 5b77fb2150..0000000000 --- a/src/com/ibm/jbatch/tck/tests/jslxml/ChunkTests.java +++ /dev/null @@ -1,1742 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.tests.jslxml; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import static com.ibm.jbatch.tck.utils.AssertionUtils.assertWithMessage; - -import java.util.List; -import java.util.Properties; - -import jakarta.batch.runtime.BatchStatus; -import jakarta.batch.runtime.JobExecution; -import jakarta.batch.runtime.JobInstance; -import jakarta.batch.runtime.Metric; -import jakarta.batch.runtime.StepExecution; - -import com.ibm.jbatch.tck.artifacts.reusable.MyPersistentRestartUserData; -import com.ibm.jbatch.tck.artifacts.specialized.MyItemProcessListenerImpl; -import com.ibm.jbatch.tck.artifacts.specialized.MyItemReadListenerImpl; -import com.ibm.jbatch.tck.artifacts.specialized.MyItemWriteListenerImpl; -import com.ibm.jbatch.tck.artifacts.specialized.MyMultipleExceptionsRetryReadListener; -import com.ibm.jbatch.tck.artifacts.specialized.MySkipProcessListener; -import com.ibm.jbatch.tck.artifacts.specialized.MySkipReadListener; -import com.ibm.jbatch.tck.artifacts.specialized.MySkipWriteListener; -import com.ibm.jbatch.tck.utils.JobOperatorBridge; -import com.ibm.jbatch.tck.utils.TCKJobExecutionWrapper; - - - - - - - -public class ChunkTests extends ServiceEETest { - - private static JobOperatorBridge jobOp = null; - - public static void setup(String[] args, Properties props) throws Fault { - String METHOD = "setup"; -TestUtil.logTrace(METHOD); - - try { - jobOp = new JobOperatorBridge(); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - - - public static void setUp() throws Fault { - jobOp = new JobOperatorBridge(); - } - - /* cleanup */ - public void cleanup() { - - } - - /* - * @testName: testChunkNoProcessorDefined - * @assertion: job will finish successfully with COMPLETED and buffer size = default value of 10 is recognized - * 5.2.1.1 - Reader, 5.2.1.1.1 - Reader Properties, - * 5.2.1.2 - Processor - * 5.2.1.3 - Writer, 5.2.1.3.1 - Writer Properties - * 5.2.1 - Chunk, item-count default value - * 5.2.1 - Chunk item checkpointing/restart - * - * @test_Strategy: start a job with no item-count specified. - * Batch artifact checks that the checkpointing occurs at the default item-count (10). Test that the - * job completes successfully. - */ - - - public void testChunkNoProcessorDefined() throws Fault { - String METHOD = "testChunkDefaultItemCount"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("readrecord.fail=40"); - TestUtil.logMsg("app.arraysize=30"); - jobParams.put("execution.number", "1"); - jobParams.put("app.checkpoint.position" , "0"); - jobParams.put("readrecord.fail", "40"); - jobParams.put("app.arraysize", "30"); - - TestUtil.logMsg("Locate job XML file: chunkNoProcessorDefined.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("chunkNoProcessorDefined", jobParams); - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.COMPLETED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", "buffer size = 10", execution1.getExitStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testChunkNullCheckpointInfo - * @assertion: job will finish successfully with COMPLETED and buffer size = default value of 10 is recognized - * 5.2.1.1 - Reader, 5.2.1.1.1 - Reader Properties, - * 5.2.1.2 - Processor - * 5.2.1.3 - Writer, 5.2.1.3.1 - Writer Properties - * 5.2.1 - Chunk, item-count default value - * 5.2.1 - Chunk item checkpointing/restart - * - * @test_Strategy: start a job with no item-count specified. - * Batch artifact checks that the checkpointing occurs at the default item-count (10). Test that the - * job completes successfully. - */ - - - public void testChunkNullCheckpointInfo() throws Fault { - String METHOD = "testChunkDefaultItemCount"; -TestUtil.logTrace(METHOD); - - try { - - TestUtil.logMsg("Locate job XML file: nullChkPtInfo.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("nullChkPtInfo", null); - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.COMPLETED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", "checkpointInfo is null in reader.open...checkpointInfo is null in writer.open", execution1.getExitStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testChunkArtifactInstanceUniqueness - * @assertion: job will finish successfully with COMPLETED and 2 unique listener lifecycles will be reported in the exit status - * 5.2.1.1 - Reader, 5.2.1.1.1 - Reader Properties, - * 5.2.1.2 - Processor - * 5.2.1.3 - Writer, 5.2.1.3.1 - Writer Properties - * 5.2.1 - Chunk, item-count default value - * 5.2.1 - Chunk item checkpointing/restart - * - * @test_Strategy: start a job with no item-count specified. - * Two unique Batch artifact Chunk, Step and Job listeners are defined. - * Each listener contains validation logic to determine that separate instances of - * the listeners are being produced by the runtime. Test finishes in COMPLETED state and - * the before/after lifecycle of each listener is contained in the exit status. - */ - - - public void testChunkArtifactInstanceUniqueness() throws Fault { - String METHOD = "testChunkDefaultItemCount"; -TestUtil.logTrace(METHOD); - - try { - - TestUtil.logMsg("Locate job XML file: uniqueInstanceTest.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("uniqueInstanceTest", null); - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.COMPLETED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", "nullChunkListenerChunkListenerStepListenerStepListenerJobListenerJobListener", execution1.getExitStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * Obviously would be nicer to have more granular tests for some of this - * function, but here we're going a different route and saying, if it's - * going to require restart it will have some complexity, so let's test a - * few different functions in one longer restart scenario. - */ - - /* - * @testName: testChunkOnErrorListener - * - * @assertion: Test will finish in FAILED status, with the onError chunk listener invoked - * - * @test_Strategy: Test that the ChunkListener.onError method is driven for an exception occurring - * during the read-write-process batch loop - */ - - - public void testChunkOnErrorListener() throws Fault { - - String METHOD = "testChunkOnErrorListener"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("readrecord.fail=5"); - TestUtil.logMsg("app.arraysize=30"); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "5"); - jobParams.put("app.writepoints", "0,10"); - jobParams.put("app.arraysize", "30"); - - TestUtil.logMsg("Locate job XML file: chunkListenerTest.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("chunkListenerTest", jobParams); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.FAILED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", "Chunk onError invoked", execution1.getExitStatus()); - - } catch (Exception e) { - handleException(METHOD, e); - } - } - - - /* - * @testName: testChunkRestartItemCount7 - * @assertion: first job started will finish as FAILED. Restart of job will finish successfully with COMPLETED. - * 5.2.1.1 - Reader, 5.2.1.1.1 - Reader Properties, - * 5.2.1.2 - Processor - * 5.2.1.3 - Writer, 5.2.1.3.1 - Writer Properties - * 5.2.1 - Chunk, item-count - * 5.2.1 - Chunk item checkpointing - * - * @test_Strategy: start a job configured to a item-count of 7 configured to fail on the 12 item read. Restart job and - * test that the processing begins at last recorded check point (item 7) prior to previous failure - */ - - - public void testChunkRestartItemCount7() throws Fault { - String METHOD = "testChunkRestartItemCount7"; -TestUtil.logTrace(METHOD); - - try { - - TestUtil.logMsg("Create job parameters for execution #1:"); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("readrecord.fail=12"); - TestUtil.logMsg("app.arraysize=30"); - TestUtil.logMsg("app.chunksize=7"); - TestUtil.logMsg("app.commitinterval=10"); - Properties jobParams = new Properties(); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "12"); - jobParams.put("app.arraysize", "30"); - jobParams.put("app.checkpoint.position" , "0"); - jobParams.put("app.writepoints", "0,7,14,21,28,30"); - jobParams.put("app.next.writepoints", "7,14,21,28,30"); - - TestUtil.logMsg("Locate job XML file: chunkStopOnEndOn.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - TCKJobExecutionWrapper execution1 = jobOp.startJobAndWaitForResult("chunkStopOnEndOn", jobParams); - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.FAILED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", "FAILED", execution1.getExitStatus()); - - long jobInstanceId = execution1.getInstanceId(); - long lastExecutionId = execution1.getExecutionId(); - TestUtil.logMsg("Got Job instance id: " + jobInstanceId + ""); - TestUtil.logMsg("Got Job execution id: " + lastExecutionId + ""); - { - TestUtil.logMsg("Create job parameters for execution #2:"); - TestUtil.logMsg("execution.number=2"); - TestUtil.logMsg("app.arraysize=30"); - TestUtil.logMsg("app.chunksize=7"); - TestUtil.logMsg("app.commitinterval=10"); - Properties restartJobParameters = new Properties(); - restartJobParameters.put("execution.number", "2"); - restartJobParameters.put("app.arraysize", "30"); - jobParams.put("app.checkpoint.position" , "7"); - TestUtil.logMsg("Invoke restartJobAndWaitForResult with executionId: " + lastExecutionId + ""); - TCKJobExecutionWrapper exec = jobOp.restartJobAndWaitForResult(lastExecutionId, jobParams); - lastExecutionId = exec.getExecutionId(); - TestUtil.logMsg("execution #2 JobExecution getBatchStatus()=" + exec.getBatchStatus() + ""); - TestUtil.logMsg("execution #2 JobExecution getExitStatus()=" + exec.getExitStatus() + ""); - TestUtil.logMsg("execution #2 Job instance id=" + exec.getInstanceId() + ""); - assertWithMessage("Testing execution #2", BatchStatus.COMPLETED, exec.getBatchStatus()); - assertWithMessage("Testing execution #2", "COMPLETED", exec.getExitStatus()); - assertWithMessage("Testing execution #2", jobInstanceId, exec.getInstanceId()); - } - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testChunkRestartItemCount10 - * @assertion: first job started will finish as FAILED. Restart of job will finish successfully with COMPLETED. - * 5.2.1.1 - Reader, 5.2.1.1.1 - Reader Properties, - * 5.2.1.2 - Processor - * 5.2.1.3 - Writer, 5.2.1.3.1 - Writer Properties - * 5.2.1 - Chunk, item-count - * 5.2.1 - Chunk item checkpointing - * - * @test_Strategy: start a job configured to a item-count of 10 configured to fail on the 12 item read. Restart job and - * test that the processing begins at last recorded check point (item 10) prior to previous failure - */ - - - public void testChunkRestartItemCount10() throws Fault { - - String METHOD = "testChunkRestartItemCount10"; -TestUtil.logTrace(METHOD); - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("readrecord.fail=12"); - TestUtil.logMsg("app.arraysize=30"); - TestUtil.logMsg("app.writepoints=0,5,10,15,20,25,30"); - TestUtil.logMsg("app.next.writepoints=0,5,10,15,20,25,30"); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "12"); - jobParams.put("app.arraysize", "30"); - jobParams.put("app.checkpoint.position" , "0"); - jobParams.put("app.writepoints", "0,10,20,30"); - jobParams.put("app.next.writepoints", "10,20,30"); - - TestUtil.logMsg("Locate job XML file: chunkrestartCheckpt10.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - TCKJobExecutionWrapper execution1 = jobOp.startJobAndWaitForResult("chunkrestartCheckpt10", jobParams); - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.FAILED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", "FAILED", execution1.getExitStatus()); - - long jobInstanceId = execution1.getInstanceId(); - long lastExecutionId = execution1.getExecutionId(); - TestUtil.logMsg("Got Job instance id: " + jobInstanceId + ""); - TestUtil.logMsg("Got Job execution id: " + lastExecutionId + ""); - - { - TestUtil.logMsg("Create job parameters for execution #2:"); - Properties restartJobParameters = new Properties(); - TestUtil.logMsg("execution.number=2"); - TestUtil.logMsg("app.arraysize=30"); - TestUtil.logMsg("app.writepoints=0,5,10,15,20,25,30"); - restartJobParameters.put("execution.number", "2"); - jobParams.put("app.arraysize", "30"); - jobParams.put("app.checkpoint.position" , "10"); - jobParams.put("app.writepoints", "0,5,10,15,20,25,30"); - TestUtil.logMsg("Invoke restartJobAndWaitForResult with execution id: " + lastExecutionId + ""); - TCKJobExecutionWrapper exec = jobOp.restartJobAndWaitForResult(lastExecutionId, jobParams); - lastExecutionId = exec.getExecutionId(); - TestUtil.logMsg("execution #2 JobExecution getBatchStatus()=" + exec.getBatchStatus() + ""); - TestUtil.logMsg("execution #2 JobExecution getExitStatus()=" + exec.getExitStatus() + ""); - TestUtil.logMsg("execution #2 Job instance id=" + exec.getInstanceId() + ""); - assertWithMessage("Testing execution #2", BatchStatus.COMPLETED, exec.getBatchStatus()); - assertWithMessage("Testing execution #2", "COMPLETED", exec.getExitStatus()); - assertWithMessage("Testing execution #2", jobInstanceId, exec.getInstanceId()); - } - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testChunkRestartChunk5 - * @assertion: first job started will finish as FAILED. Restart of job will finish successfully with COMPLETED. - * 5.2.1.1 - Reader, 5.2.1.1.1 - Reader Properties, - * 5.2.1.2 - Processor - * 5.2.1.3 - Writer, 5.2.1.3.1 - Writer Properties - * 5.2.1 - Chunk, item-count - * 5.2.1 - Chunk item checkpointing/restart - * - * @test_Strategy: start a job configured to a item-count of 5 configured to fail on the 12 item read. Restart job and - * test that the processing begins at last recorded check point (item 10) prior to previous failure - */ - - - public void testChunkRestartChunk5() throws Fault { - - String METHOD = "testChunkRestartChunk5"; -TestUtil.logTrace(METHOD); - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("readrecord.fail=12"); - TestUtil.logMsg("app.arraysize=30"); - TestUtil.logMsg("app.writepoints=0,3,6,9,12,15,18,21,24,27,30"); - TestUtil.logMsg("app.next.writepoints=9,12,15,18,21,24,27,30"); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "12"); - jobParams.put("app.arraysize", "30"); - jobParams.put("app.checkpoint.position" , "0"); - jobParams.put("app.writepoints", "0,5,10,15,20,25,30"); - jobParams.put("app.next.writepoints", "10,15,20,25,30"); - - TestUtil.logMsg("Locate job XML file: chunksize5commitinterval3.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResul for execution #1"); - TCKJobExecutionWrapper execution1 = jobOp.startJobAndWaitForResult("chunksize5commitinterval3", jobParams); - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.FAILED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", "FAILED", execution1.getExitStatus()); - - long jobInstanceId = execution1.getInstanceId(); - long lastExecutionId = execution1.getExecutionId(); - TestUtil.logMsg("Got Job instance id: " + jobInstanceId + ""); - TestUtil.logMsg("Got Job execution id: " + lastExecutionId + ""); - { - TestUtil.logMsg("Create job parameters for execution #2:"); - Properties restartJobParameters = new Properties(jobParams); - TestUtil.logMsg("execution.number=2"); - TestUtil.logMsg("app.arraysize=30"); - - restartJobParameters.put("execution.number", "2"); - restartJobParameters.put("app.checkpoint.position" , "10"); - restartJobParameters.put("app.arraysize", "30"); - TestUtil.logMsg("Invoke restartJobAndWaitForResult with execution id: " + lastExecutionId + ""); - TCKJobExecutionWrapper exec = jobOp.restartJobAndWaitForResult(lastExecutionId, restartJobParameters); - lastExecutionId = exec.getExecutionId(); - TestUtil.logMsg("execution #2 JobExecution getBatchStatus()=" + exec.getBatchStatus() + ""); - TestUtil.logMsg("execution #2 JobExecution getExitStatus()=" + exec.getExitStatus() + ""); - TestUtil.logMsg("execution #2 Job instance id=" + exec.getInstanceId() + ""); - assertWithMessage("Testing execution #2", BatchStatus.COMPLETED, exec.getBatchStatus()); - assertWithMessage("Testing execution #2", "COMPLETED", exec.getExitStatus()); - assertWithMessage("Testing execution #2", jobInstanceId, exec.getInstanceId()); - } - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testChunkDefaultItemCount - * @assertion: job will finish successfully with COMPLETED and buffer size = default value of 10 is recognized - * 5.2.1.1 - Reader, 5.2.1.1.1 - Reader Properties, - * 5.2.1.2 - Processor - * 5.2.1.3 - Writer, 5.2.1.3.1 - Writer Properties - * 5.2.1 - Chunk, item-count default value - * 5.2.1 - Chunk item checkpointing/restart - * - * @test_Strategy: start a job with no item-count specified. - * Batch artifact checks that the checkpointing occurs at the default item-count (10). Test that the - * job completes successfully. - */ - - - public void testChunkDefaultItemCount() throws Fault { - String METHOD = "testChunkDefaultItemCount"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("readrecord.fail=40"); - TestUtil.logMsg("app.arraysize=30"); - jobParams.put("execution.number", "1"); - jobParams.put("app.checkpoint.position" , "0"); - jobParams.put("readrecord.fail", "40"); - jobParams.put("app.arraysize", "30"); - - TestUtil.logMsg("Locate job XML file: chunksizeDEFAULTcommitIntervalDEFAULT.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("chunksizeDEFAULTcommitIntervalDEFAULT", jobParams); - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.COMPLETED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", "buffer size = 10", execution1.getExitStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testChunkRestartCustomCheckpoint - * @assertion: first job start will finish with FAILED. restart of job will finish successfully with COMPLETED. - * 5.2.1.1 - Reader, 5.2.1.1.1 - Reader Properties, - * 5.2.1.2 - Processor - * 5.2.1.3 - Writer, 5.2.1.3.1 - Writer Properties - * 5.2.1 - Chunk, item-count, checkpoint-policy - * 5.2.1 - Chunk item checkpointing/restart - * 5.2.1.7 - Custom Checkpoint Algorithm - * 5.2.1.7.1 - Custom Checkpoint Algorithm Properties - * - * @test_Strategy: start a job with item-count specified, checkpoint-policy set to 'custom' and configured to fail on the 12 item read. Restart job. - * Batch artifact enforces that the checkpointing occurs at the custom defined checkpointing points and that - * reading/writing resumes at last good custom defined checkpoint. - * test that the job completes successfully. - */ - - - public void testChunkRestartCustomCheckpoint() throws Fault { - String METHOD = "testChunkRestartCustomCheckpoint"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=2"); - TestUtil.logMsg("readrecord.fail=12"); - TestUtil.logMsg("app.arraysize=30"); - TestUtil.logMsg("app.writepoints=0,4,9,13,15,20,22,27,30"); - TestUtil.logMsg("app.next.writepoints=9,13,15,20,22,27,30"); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "12"); - jobParams.put("app.checkpoint.position" , "0"); - jobParams.put("app.arraysize", "30"); - jobParams.put("app.writepoints", "0,4,9,13,15,20,22,27,30"); - jobParams.put("app.next.writepoints", "9,13,15,20,22,27,30"); - - TestUtil.logMsg("Locate job XML file: chunkCustomCheckpoint.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - TCKJobExecutionWrapper execution1 = jobOp.startJobAndWaitForResult("chunkCustomCheckpoint", jobParams); - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.FAILED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", "FAILED", execution1.getExitStatus()); - - long jobInstanceId = execution1.getInstanceId(); - long lastExecutionId = execution1.getExecutionId(); - TestUtil.logMsg("Got Job instance id: " + jobInstanceId + ""); - TestUtil.logMsg("Got Job execution id: " + lastExecutionId + ""); - { - TestUtil.logMsg("Create job parameters for execution #2:"); - Properties restartJobParameters = new Properties(jobParams); - TestUtil.logMsg("execution.number=2"); - TestUtil.logMsg("app.arraysize=30"); - TestUtil.logMsg("app.writepoints=9,13,15,20,22,27,30"); - restartJobParameters.put("execution.number", "2"); - restartJobParameters.put("app.checkpoint.position" , "9"); - restartJobParameters.put("app.arraysize", "30"); - restartJobParameters.put("app.writepoints", "9,13,15,20,22,27,30"); - TestUtil.logMsg("Invoke restartJobAndWaitForResult with execution id: " + lastExecutionId + ""); - TCKJobExecutionWrapper exec = jobOp.restartJobAndWaitForResult(lastExecutionId, restartJobParameters); - lastExecutionId = exec.getExecutionId(); - TestUtil.logMsg("execution #2 JobExecution getBatchStatus()=" + exec.getBatchStatus() + ""); - TestUtil.logMsg("execution #2 JobExecution getExitStatus()=" + exec.getExitStatus() + ""); - TestUtil.logMsg("execution #2 Job instance id=" + exec.getInstanceId() + ""); - assertWithMessage("Testing execution #2", BatchStatus.COMPLETED, exec.getBatchStatus()); - assertWithMessage("Testing execution #2", "COMPLETED", exec.getExitStatus()); - assertWithMessage("Testing execution #2", jobInstanceId, exec.getInstanceId()); - } - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testChunkTimeBasedDefaultCheckpoint - * @assertion: job will finish successfully with COMPLETED and the default time-limit of 10 seconds recognized - * 5.2.1.1 - Reader, 5.2.1.1.1 - Reader Properties, - * 5.2.1.2 - Processor - * 5.2.1.3 - Writer, 5.2.1.3.1 - Writer Properties - * 5.2.1 - Chunk, item-count, time-limit default - * 5.2.1 - Chunk item checkpointing - * - * @test_Strategy: start a job with item-count specified at a value greater than the read data set. time-limit not specified so as to default to 10. - * Batch artifact enforces that the checkpointing occurs at the default time-limit boundary (10 seconds) . - * test that the job completes successfully. - */ - - - public void testChunkTimeBasedDefaultCheckpoint() throws Fault { - String METHOD = "testChunkTimeBasedDefaultCheckpoint"; -TestUtil.logTrace(METHOD); - - String DEFAULT_SLEEP_TIME = "500"; - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("readrecord.fail=31"); - TestUtil.logMsg("app.arraysize=30"); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "31"); - jobParams.put("app.arraysize", "30"); - jobParams.put("app.sleeptime", System.getProperty("ChunkTests.testChunkTimeBasedDefaultCheckpoint.sleep",DEFAULT_SLEEP_TIME)); - - TestUtil.logMsg("Locate job XML file: chunkTimeBasedDefaultCheckpoint.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("chunkTimeBasedDefaultCheckpoint", jobParams); - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.COMPLETED, execution1.getBatchStatus()); - String exitStatus = execution1.getExitStatus(); - assertWithMessage("Testing execution #1", (exitStatus.equals("TRUE: 0") || exitStatus.equals("TRUE: 1"))); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testChunkTimeBasedTimeLimit0 - * @assertion: job will finish successfully with COMPLETED and the default time-limit of 10 seconds recognized - * 5.2.1.1 - Reader, 5.2.1.1.1 - Reader Properties, - * 5.2.1.2 - Processor - * 5.2.1.3 - Writer, 5.2.1.3.1 - Writer Properties - * 5.2.1 - Chunk, item-count, time-limit default - * 5.2.1 - Chunk item checkpointing - * - * @test_Strategy: start a job with item-count specified at a value greater than the read data set. time-limit not specified so as to default to 10. - * Batch artifact enforces that the checkpointing occurs at the default time-limit boundary (10 seconds) . - * test that the job completes successfully. - */ - - - public void testChunkTimeBasedTimeLimit0() throws Fault { - String METHOD = "testChunkTimeBasedDefaultCheckpoint"; -TestUtil.logTrace(METHOD); - - String DEFAULT_SLEEP_TIME = "500"; - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("readrecord.fail=31"); - TestUtil.logMsg("app.arraysize=30"); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "31"); - jobParams.put("app.arraysize", "30"); - - jobParams.put("app.sleeptime", System.getProperty("ChunkTests.testChunkTimeBasedTimeLimit0.sleep",DEFAULT_SLEEP_TIME)); - - TestUtil.logMsg("Locate job XML file: chunkTimeLimit0.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("chunkTimeLimit0", jobParams); - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.COMPLETED, execution1.getBatchStatus()); - String exitStatus = execution1.getExitStatus(); - assertWithMessage("Testing execution #1", (exitStatus.equals("TRUE: 0") || exitStatus.equals("TRUE: 1"))); - - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testChunkTimeBased10Seconds - * @assertion: job will finish successfully with COMPLETED and the time-limit of 10 seconds recognized - * 5.2.1.1 - Reader, 5.2.1.1.1 - Reader Properties, - * 5.2.1.2 - Processor - * 5.2.1.3 - Writer, 5.2.1.3.1 - Writer Properties - * 5.2.1 - Chunk, item-count, time-limit - * 5.2.1 - Chunk item checkpointing/restart - * - * @test_Strategy: start a job with item-count specified at a value greater than the read data set. time-limit specified as 10. - * and configured to fail on the 12 item read. Restart job. - * Batch artifact enforces that the checkpointing occurs at the specified time-limit boundary (10 seconds) and that - * reading/writing resumes at last good checkpoint. - * test that the job completes successfully. - */ - - - public void testChunkTimeBased10Seconds() throws Fault { - - String METHOD = "testChunkTimeBased10Seconds"; -TestUtil.logTrace(METHOD); - - String DEFAULT_SLEEP_TIME = "500"; - - try { - Properties jobParams = new Properties(); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "31"); - jobParams.put("app.arraysize", "30"); - jobParams.put("app.sleeptime", System.getProperty("ChunkTests.testChunkTimeBased10Seconds.sleep",DEFAULT_SLEEP_TIME)); - - - JobExecution execution1 = jobOp.startJobAndWaitForResult("chunkTimeBasedCheckpoint", jobParams); - assertWithMessage("Testing execution #1", BatchStatus.COMPLETED, execution1.getBatchStatus()); - String exitStatus = execution1.getExitStatus(); - assertWithMessage("Testing execution #1", (exitStatus.equals("TRUE: 9") || exitStatus.equals("TRUE: 10") || exitStatus.equals("TRUE: 11"))); - - TestUtil.logMsg("exit status = " + execution1.getExitStatus() + ""); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testChunkRestartTimeBasedCheckpoint - * @assertion: first job start will finishas FAILED. Restart of job will finish successfully as COMPLETED - * and the time-limit of 10 seconds recognized - * 5.2.1.1 - Reader, 5.2.1.1.1 - Reader Properties, - * 5.2.1.2 - Processor - * 5.2.1.3 - Writer, 5.2.1.3.1 - Writer Properties - * 5.2.1 - Chunk, item-count, time-limit - * 5.2.1 - Chunk item checkpointing/restart - * - * @test_Strategy: start a job with item-count specified at a value greater than the read data set. time-limit specified as 10. - * and configured to fail on the 12 item read. Restart job. - * Batch artifact enforces that the checkpointing occurs at the specified time-limit boundary (10 seconds) and that - * reading/writing resumes at last good checkpoint. - * test that the job completes successfully. - */ - - - public void testChunkRestartTimeBasedCheckpoint() throws Fault { - String METHOD = "testChunkRestartTimeBasedCheckpoint"; -TestUtil.logTrace(METHOD); - - String DEFAULT_SLEEP_TIME = "500"; - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("readrecord.fail=12"); - TestUtil.logMsg("app.arraysize=30"); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "12"); - jobParams.put("app.arraysize", "30"); - jobParams.put("app.sleeptime", System.getProperty("ChunkTests.testChunkRestartTimeBasedCheckpoint.sleep",DEFAULT_SLEEP_TIME)); - - - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - TCKJobExecutionWrapper execution1 = jobOp.startJobAndWaitForResult("chunkTimeBasedCheckpoint", jobParams); - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.FAILED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", "FALSE: 0", execution1.getExitStatus()); - - long jobInstanceId = execution1.getInstanceId(); - long lastExecutionId = execution1.getExecutionId(); - TestUtil.logMsg("Got Job instance id: " + jobInstanceId + ""); - TestUtil.logMsg("Got Job execution id: " + lastExecutionId + ""); - - { - TestUtil.logMsg("Invoke restartJobAndWaitForResult with execution id: " + lastExecutionId + ""); - TCKJobExecutionWrapper exec = jobOp.restartJobAndWaitForResult(lastExecutionId, jobParams); - lastExecutionId = exec.getExecutionId(); - TestUtil.logMsg("execution #2 JobExecution getBatchStatus()=" + exec.getBatchStatus() + ""); - TestUtil.logMsg("execution #2 JobExecution getExitStatus()=" + exec.getExitStatus() + ""); - TestUtil.logMsg("execution #2 Job instance id=" + exec.getInstanceId() + ""); - assertWithMessage("Testing execution #2", BatchStatus.COMPLETED, exec.getBatchStatus()); - String exitStatus = exec.getExitStatus(); - assertWithMessage("Testing execution #2", (exitStatus.equals("TRUE: 9") || exitStatus.equals("TRUE: 10") || exitStatus.equals("TRUE: 11"))); - - assertWithMessage("Testing execution #2", jobInstanceId, exec.getInstanceId()); - } - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testChunkRestartTimeBasedDefaultCheckpoint - * @assertion: first job start will finishas FAILED. Restart of job will finish successfully as COMPLETED - * and the default time-limit of 10 seconds recognized - * 5.2.1.1 - Reader, 5.2.1.1.1 - Reader Properties, - * 5.2.1.2 - Processor - * 5.2.1.3 - Writer, 5.2.1.3.1 - Writer Properties - * 5.2.1 - Chunk, item-count, time-limit - * 5.2.1 - Chunk item checkpointing/restart - * - * @test_Strategy: start a job with item-count specified at a value greater than the read data set. time-limit not specified so as to default to 10. - * and configured to fail on the 12 item read. Restart job. - * Batch artifact enforces that the checkpointing occurs at the default time-limit boundary (10 seconds) and that - * reading/writing resumes at last good checkpoint. - * test that the job completes successfully. - */ - - - public void testChunkRestartTimeBasedDefaultCheckpoint() throws Fault { - - String METHOD = "testChunkRestartTimeBasedDefaultCheckpoint"; -TestUtil.logTrace(METHOD); - - String DEFAULT_SLEEP_TIME = "500"; - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("readrecord.fail=2"); - TestUtil.logMsg("app.arraysize=30"); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "2"); - jobParams.put("app.arraysize", "30"); - jobParams.put("app.sleeptime", System.getProperty("ChunkTests.testChunkRestartTimeBasedDefaultCheckpoint.sleep",DEFAULT_SLEEP_TIME)); - - TestUtil.logMsg("Locate job XML file: chunkTimeBasedDefaultCheckpoint.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - TCKJobExecutionWrapper execution1 = jobOp.startJobAndWaitForResult("chunkTimeBasedDefaultCheckpoint", jobParams); - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.FAILED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", "TRUE: 0", execution1.getExitStatus()); - - long jobInstanceId; - JobInstance jobInstance = jobOp.getJobInstance(execution1.getExecutionId()); - jobInstanceId = jobInstance.getInstanceId(); - long lastExecutionId = execution1.getExecutionId(); - TestUtil.logMsg("Got Job instance id: " + jobInstanceId + ""); - TestUtil.logMsg("Got Job execution id: " + lastExecutionId + ""); - { - - TestUtil.logMsg("Invoke restartJobAndWaitForResult with execution id: " + lastExecutionId + ""); - TCKJobExecutionWrapper exec = jobOp.restartJobAndWaitForResult(lastExecutionId, jobParams); - lastExecutionId = exec.getExecutionId(); - TestUtil.logMsg("execution #2 JobExecution getBatchStatus()=" + exec.getBatchStatus() + ""); - TestUtil.logMsg("execution #2 JobExecution getExitStatus()=" + exec.getExitStatus() + ""); - TestUtil.logMsg("execution #2 Job instance id=" + exec.getInstanceId() + ""); - assertWithMessage("Testing execution #2", BatchStatus.COMPLETED, exec.getBatchStatus()); - assertWithMessage("Testing execution #2", "TRUE: 0", exec.getExitStatus()); - assertWithMessage("Testing execution #2", jobInstanceId, exec.getInstanceId()); - } - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - - /* - * testName: testChunkSkipMultipleExceptions - * @assertion: job will finish successfully as COMPLETED and skippable exceptions will be recognized - * 5.2.1.1 - Reader, 5.2.1.1.1 - Reader Properties, - * 5.2.1.2 - Processor - * 5.2.1.3 - Writer, 5.2.1.3.1 - Writer Properties - * 5.2.1 - Chunk, item-count, skip-limit - * 5.2.1.4 - Exception Handling - skippable-exception-classes - * - * @test_Strategy: start a job with item-count specified at 3. - * Application is configured to encounter a read error on two separate reads, at which point - * different instances of exceptions are thrown by the application at the fail points. - * The application is configured with two skippable exceptions and one un-skippable exception. - * the 2nd skippable exception extends the unskippable exception. Batch Application enforces that - * if the skippable exception which extends the unskippable is encountered, it is treated as unskippable itself. - * test that the job completes fails and that the application recognized the skippable exception - * that extends the unskippable is not treated as skippable. - * - * Disabling per Bug 5403 (https://java.net/bugzilla/show_bug.cgi?id=5403) - * New tracking Bug 26611303 - */ - - - public void testChunkSkipMultipleExceptions() throws Fault { - - String METHOD = "testChunkSkipRead"; -TestUtil.logTrace(METHOD); - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("readrecord.fail=1,3"); - TestUtil.logMsg("app.arraysize=30"); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "1,3"); - jobParams.put("app.arraysize", "30"); - - TestUtil.logMsg("Locate job XML file: chunkSkipMultipleExceptions.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("chunkSkipMultipleExceptions", jobParams); - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.FAILED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", MySkipReadListener.GOOD_EXIT_STATUS, execution1.getExitStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testChunkSkipRead - * @assertion: job will finish successfully as COMPLETED and skippable exceptions will be recognized - * 5.2.1.1 - Reader, 5.2.1.1.1 - Reader Properties, - * 5.2.1.2 - Processor - * 5.2.1.3 - Writer, 5.2.1.3.1 - Writer Properties - * 5.2.1 - Chunk, item-count, skip-limit - * 5.2.1.4 - Exception Handling - skippable-exception-classes - * - * @test_Strategy: start a job with item-count specified at 3. - * Application is configured to encounter an error on two separate reads, at which point - * a skippable exception is thrown by the application. Batch Application enforces that the exceptions - * were recognized as skippable. - * test that the job completes successfully and that the application recognized the exceptions as skippable - */ - - - public void testChunkSkipRead() throws Fault { - - String METHOD = "testChunkSkipRead"; -TestUtil.logTrace(METHOD); - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("readrecord.fail=1,3"); - TestUtil.logMsg("app.arraysize=30"); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "1,3"); - jobParams.put("app.arraysize", "30"); - - TestUtil.logMsg("Locate job XML file: chunkSkipInitialTest.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("chunkSkipInitialTest", jobParams); - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.COMPLETED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", MySkipReadListener.GOOD_EXIT_STATUS, execution1.getExitStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testChunkSkipProcess - * @assertion: job will finish successfully as COMPLETED and skippable exceptions will be recognized - * 5.2.1.1 - Reader, 5.2.1.1.1 - Reader Properties, - * 5.2.1.2 - Processor - * 5.2.1.3 - Writer, 5.2.1.3.1 - Writer Properties - * 5.2.1 - Chunk, item-count, skip-limit - * 5.2.1.4 - Exception Handling - skippable-exception-classes - * - * @test_Strategy: start a job with item-count specified as 3. skip-limit is set to 1000. - * Application is configured to encounter an error on two separate processing actions, at which point - * a skippable exception is thrown by the application. Batch Application enforces that the exceptions - * were recognized as skippable. Batch Application also ensures that the item being processed is passed to the skip listener. - * test that the job completes successfully and that the application recognized the exception as skippable - * and that the item was passed to the skip listener. - */ - - - public void testChunkSkipProcess() throws Fault { - String METHOD = "testChunkSkipProcess"; -TestUtil.logTrace(METHOD); - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("processrecord.fail=7,13"); - TestUtil.logMsg("app.arraysize=30"); - jobParams.put("execution.number", "1"); - jobParams.put("processrecord.fail", "7,13"); - jobParams.put("app.arraysize", "30"); - - TestUtil.logMsg("Locate job XML file: chunkSkipInitialTest.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("chunkSkipInitialTest", jobParams); - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.COMPLETED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", MySkipProcessListener.GOOD_EXIT_STATUS, execution1.getExitStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testChunkSkipWrite - * @assertion: job will finish successfully as COMPLETED and skippable exceptions will be recognized - * 5.2.1.1 - Reader, 5.2.1.1.1 - Reader Properties, - * 5.2.1.2 - Processor - * 5.2.1.3 - Writer, 5.2.1.3.1 - Writer Properties - * 5.2.1 - Chunk, item-count, skip-limit - * 5.2.1.4 - Exception Handling - skippable-exception-classes - * - * @test_Strategy: start a job with item-count specified as 3. skip-limit set to 1000 - * Application is configured to encounter an error on two separate writes, at which point - * a skippable exception is thrown by the application. Batch Application enforces that the exceptions - * were recognized as skippable. Batch Application also ensures that the item being processed is passed to the skip listener. - * test that the job completes successfully and that the application recognized the exceptions as skippable - * and that the item was passed to the skip listener. - */ - - - public void testChunkSkipWrite() throws Fault { - String METHOD = "testChunkSkipWrite"; -TestUtil.logTrace(METHOD); - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("writerecord.fail=1,3"); - TestUtil.logMsg("app.arraysize=30"); - jobParams.put("execution.number", "1"); - jobParams.put("writerecord.fail", "1,3"); - jobParams.put("app.arraysize", "30"); - - TestUtil.logMsg("Locate job XML file: chunkSkipInitialTest.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("chunkSkipInitialTest", jobParams); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.COMPLETED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", MySkipWriteListener.GOOD_EXIT_STATUS, execution1.getExitStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testChunkSkipOnError - * @assertion: job will finish successfully as COMPLETED and skippable exceptions will be recognized - * 5.2.1.1 - Reader, 5.2.1.1.1 - Reader Properties, - * 5.2.1.2 - Processor - * 5.2.1.3 - Writer, 5.2.1.3.1 - Writer Properties - * 5.2.1 - Chunk, item-count, skip-limit - * 5.2.1.4 - Exception Handling - skippable-exception-classes - * - * @test_Strategy: start a job with item-count specified at 3. - * Application is configured to encounter an error on two separate reads, at which point - * a skippable exception is thrown by the application. Batch Application enforces that the exceptions - * were recognized as skippable. - * test that the job completes successfully and that the application recognized the exceptions as skippable - */ - - - public void testChunkSkipOnError() throws Fault { - - String METHOD = "testChunkSkipOnError"; -TestUtil.logTrace(METHOD); - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("readrecord.fail=1,3"); - TestUtil.logMsg("app.arraysize=30"); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "1,3"); - jobParams.put("app.arraysize", "30"); - - TestUtil.logMsg("Locate job XML file: chunkSkipOnErrorTest.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("chunkSkipOnErrorTest", jobParams); - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.COMPLETED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", "MyItemReadListenerImpl.onReadError", execution1.getExitStatus()); - - //process skip - jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("processrecord.fail=7,13"); - TestUtil.logMsg("app.arraysize=30"); - jobParams.put("execution.number", "1"); - jobParams.put("processrecord.fail", "7,13"); - jobParams.put("app.arraysize", "30"); - - TestUtil.logMsg("Locate job XML file: chunkSkipOnErrorTest.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution2 = jobOp.startJobAndWaitForResult("chunkSkipOnErrorTest", jobParams); - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + execution2.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + execution2.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.COMPLETED, execution2.getBatchStatus()); - assertWithMessage("Testing execution #1", "MyItemProcessListenerImpl.onProcessError", execution2.getExitStatus()); - - //write skip - jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("writerecord.fail=1,3"); - TestUtil.logMsg("app.arraysize=30"); - jobParams.put("execution.number", "1"); - jobParams.put("writerecord.fail", "1,3"); - jobParams.put("app.arraysize", "30"); - - TestUtil.logMsg("Locate job XML file: chunkSkipOnErrorTest.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution3 = jobOp.startJobAndWaitForResult("chunkSkipOnErrorTest", jobParams); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + execution3.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + execution3.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.COMPLETED, execution3.getBatchStatus()); - assertWithMessage("Testing execution #1", "MyItemWriteListenerImpl.onWriteError", execution3.getExitStatus()); - - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testChunkRetryOnError - * @assertion: job will finish successfully as COMPLETED and skippable exceptions will be recognized - * 5.2.1.1 - Reader, 5.2.1.1.1 - Reader Properties, - * 5.2.1.2 - Processor - * 5.2.1.3 - Writer, 5.2.1.3.1 - Writer Properties - * 5.2.1 - Chunk, item-count, skip-limit - * 5.2.1.4 - Exception Handling - skippable-exception-classes - * - * @test_Strategy: start a job with item-count specified at 3. - * Application is configured to encounter an error on two separate reads, at which point - * a retry exception is thrown by the application. Batch Application enforces that the exceptions - * were recognized as retryable and that the listener's onError method is coalled correctly. - * test that the job completes successfully and that the listener's onError method is called by the runtime. - */ - - - public void testChunkRetryOnError() throws Fault { - - String METHOD = "testChunkRetryOnError"; -TestUtil.logTrace(METHOD); - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("readrecord.fail=1,3"); - TestUtil.logMsg("app.arraysize=30"); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "1,3"); - jobParams.put("app.arraysize", "30"); - - TestUtil.logMsg("Locate job XML file: chunkRetryOnError.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("chunkRetryOnError", jobParams); - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.COMPLETED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", "MyItemReadListenerImpl.onReadError", execution1.getExitStatus()); - - //process skip - jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("processrecord.fail=7,13"); - TestUtil.logMsg("app.arraysize=30"); - jobParams.put("execution.number", "1"); - jobParams.put("processrecord.fail", "7,13"); - jobParams.put("app.arraysize", "30"); - - TestUtil.logMsg("Locate job XML file: chunkRetryOnError.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution2 = jobOp.startJobAndWaitForResult("chunkRetryOnError", jobParams); - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + execution2.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + execution2.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.COMPLETED, execution2.getBatchStatus()); - assertWithMessage("Testing execution #1", "MyItemProcessListenerImpl.onProcessError", execution2.getExitStatus()); - - //write skip - jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("writerecord.fail=1,3"); - TestUtil.logMsg("app.arraysize=30"); - jobParams.put("execution.number", "1"); - jobParams.put("writerecord.fail", "1,3"); - jobParams.put("app.arraysize", "30"); - - TestUtil.logMsg("Locate job XML file: chunkRetryOnError.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution3 = jobOp.startJobAndWaitForResult("chunkRetryOnError", jobParams); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + execution3.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + execution3.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.COMPLETED, execution3.getBatchStatus()); - assertWithMessage("Testing execution #1", "MyItemWriteListenerImpl.onWriteError", execution3.getExitStatus()); - - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testChunkSkipReadExceedSkip - * @assertion: job will finish as FAILED and exceeded skippable exceptions will be recognized - * 5.2.1.1 - Reader, 5.2.1.1.1 - Reader Properties, - * 5.2.1.2 - Processor - * 5.2.1.3 - Writer, 5.2.1.3.1 - Writer Properties - * 5.2.1 - Chunk, item-count, skip-limit - * 5.2.1.4 - Exception Handling - skippable-exception-classes - * - * @test_Strategy: start a job with item-count specified at a value greater than the read data set and skip-limit set to 1. - * Application is configured to encounter an error on two separate reads, at which point - * a skippable exception is thrown by the application. Batch Application enforces that the exceptions - * were recognized as skippable and that the second exception exceeded the skip-limit - * test that the job fails but the skip-limit was recognized. - */ - - - public void testChunkSkipReadExceedSkip() throws Fault { - String METHOD = "testChunkSkipReadExceedSkip"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("processrecord.fail=1,2"); - TestUtil.logMsg("app.arraysize=30"); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "1,2"); - jobParams.put("app.arraysize", "30"); - - TestUtil.logMsg("Locate job XML file: chunkSkipExceededTest.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("chunkSkipExceededTest", jobParams); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.FAILED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", MySkipReadListener.GOOD_EXIT_STATUS, execution1.getExitStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testChunkSkipProcessExceedSkip - * @assertion: job will finish as FAILED and exceeded skippable exceptions will be recognized - * 5.2.1.1 - Reader, 5.2.1.1.1 - Reader Properties, - * 5.2.1.2 - Processor - * 5.2.1.3 - Writer, 5.2.1.3.1 - Writer Properties - * 5.2.1 - Chunk, item-count, skip-limit - * 5.2.1.4 - Exception Handling - skippable-exception-classes - * - * @test_Strategy: start a job with item-count specified at a value greater than the read data set and skip-limit set to 1. - * Application is configured to encounter an error on two processing actions, at which point - * a skippable exception is thrown by the application. Batch Application enforces that the exceptions - * were recognized as skippable and that the second exception exceeded the skip-limit - * test that the job fails but the skip-limit was recognized. - */ - - - public void testChunkSkipProcessExceedSkip() throws Fault { - - String METHOD = "testChunkSkipProcessExceedSkip"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("processrecord.fail=5,7"); - TestUtil.logMsg("app.arraysize=30"); - jobParams.put("execution.number", "1"); - jobParams.put("processrecord.fail", "5,7"); - jobParams.put("app.arraysize", "30"); - - TestUtil.logMsg("Locate job XML file: chunkSkipExceededTest.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("chunkSkipExceededTest", jobParams); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.FAILED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", MySkipProcessListener.GOOD_EXIT_STATUS, execution1.getExitStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testChunkSkipWriteExceedSkip - * @assertion: job will finish as FAILED and exceeded skippable exceptions will be recognized - * 5.2.1.1 - Reader, 5.2.1.1.1 - Reader Properties, - * 5.2.1.2 - Processor - * 5.2.1.3 - Writer, 5.2.1.3.1 - Writer Properties - * 5.2.1 - Chunk, item-count, skip-limit - * 5.2.1.4 - Exception Handling - skippable-exception-classes - * - * @test_Strategy: start a job with item-count specified at a value greater than the read data set and skip-limit set to 1. - * Application is configured to encounter an error on two separate writes, at which point - * a skippable exception is thrown by the application. Batch Application enforces that the exceptions - * were recognized as skippable and that the second exception exceeded the skip-limit - * test that the job fails but the skip-limit was recognized. - */ - - - public void testChunkSkipWriteExceedSkip() throws Fault { - String METHOD = "testChunkSkipWriteExceedSkip"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("writerecord.fail=2,8"); - TestUtil.logMsg("app.arraysize=30"); - jobParams.put("execution.number", "1"); - jobParams.put("writerecord.fail", "2,8"); - jobParams.put("app.arraysize", "30"); - - TestUtil.logMsg("Locate job XML file: chunkSkipExceededTest.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("chunkSkipExceededTest", jobParams); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.FAILED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", MySkipWriteListener.GOOD_EXIT_STATUS, execution1.getExitStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testChunkSkipReadNoSkipChildEx - * @assertion: job will finish as FAILED and excluded skippable exceptions will be recognized - * 5.2.1.1 - Reader, 5.2.1.1.1 - Reader Properties, - * 5.2.1.2 - Processor - * 5.2.1.3 - Writer, 5.2.1.3.1 - Writer Properties - * 5.2.1 - Chunk, item-count, skip-limit - * 5.2.1.4 - Exception Handling - skippable-exception-classes - * - * @test_Strategy: start a job with item-count specified at a value greater than the read data set and skip-limit set to 1000. - * Application is configured to encounter an error on three separate reads.On the first two fails, the application - * throws a skippable exception. On the third fail, the application throws a non-skippable exception. - * The Batch Application enforces that the final exception is non-skippable. - * were recognized as skippable and that the second exception exceeded the skip-limit - * test that the job fails but the final exception was non skippable was recognized. - */ - - - public void testChunkSkipReadNoSkipChildEx() throws Fault { - String METHOD = "testChunkSkipReadNoSkipChildEx"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("writerecord.fail=1,2,3"); - TestUtil.logMsg("app.arraysize=30"); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "1,2,3"); - jobParams.put("app.arraysize", "30"); - - TestUtil.logMsg("Locate job XML file: chunkSkipNoSkipChildExTest.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("chunkSkipNoSkipChildExTest", jobParams); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.FAILED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", MySkipReadListener.GOOD_EXIT_STATUS, execution1.getExitStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testChunkRetryRead - * @assertion: job will finish successfully as COMPLETED and retryable skippable exceptions will be recognized - * 5.2.1.1 - Reader, 5.2.1.1.1 - Reader Properties, - * 5.2.1.2 - Processor - * 5.2.1.3 - Writer, 5.2.1.3.1 - Writer Properties - * 5.2.1 - Chunk, item-count, retry-limit - * 5.2.1.5 - Exception Handling - retry-exception-classes - * - * @test_Strategy: start a job with item-count specified at a value greater than the read data set and retry-limit set to 4. - * Application is configured to encounter an error on three separate reads, at which point - * a retryable exception is thrown by the application. Batch Application enforces that the exceptions - * were recognized as retryable and that the processing retrys the execution. - * test that the job succeeds. - */ - - - public void testChunkRetryRead() throws Fault { - String METHOD = "testChunkRetryRead"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("writerecord.fail=8,13,22"); - TestUtil.logMsg("app.arraysize=30"); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "8,13,22"); - jobParams.put("app.arraysize", "30"); - - TestUtil.logMsg("Locate job XML file: chunkRetryInitialTest.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("chunkRetryInitialTest", jobParams); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.COMPLETED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", "COMPLETED", execution1.getExitStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * testName: testChunkRetryMultipleExceptions - * @assertion: job will finish successfully as COMPLETED and skippable exceptions will be recognized - * 5.2.1.1 - Reader, 5.2.1.1.1 - Reader Properties, - * 5.2.1.2 - Processor - * 5.2.1.3 - Writer, 5.2.1.3.1 - Writer Properties - * 5.2.1 - Chunk, item-count, skip-limit - * 5.2.1.4 - Exception Handling - retryable-exception-classes - * - * @test_Strategy: start a job with item-count specified at 3. - * Application is configured to encounter a read error on two separate reads, at which point - * different instances of exceptions are thrown by the application. The application is configured with two retryable exceptions and one un-retryable exception. - * the 2nd retryable exception extends the unretryable exception. Batch Application enforces that if the retryable exception which extends the unretryable is encountered, it is treated - * as unretryable itself. - * test that the job completes fails and that the application recognized the retryable exception that extends the unretryable is not treated as retryable. - * - * Disabling per Bug 5403 (https://java.net/bugzilla/show_bug.cgi?id=5403) - * New tracking Bug 26611303 - */ - - - public void testChunkRetryMultipleExceptions() throws Fault { - - String METHOD = "testChunkRetryMultipleExceptions"; -TestUtil.logTrace(METHOD); - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("readrecord.fail=1,3"); - TestUtil.logMsg("app.arraysize=30"); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "1,3,5"); - jobParams.put("app.arraysize", "30"); - - TestUtil.logMsg("Locate job XML file: chunkRetryMultipleExceptions.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("chunkRetryMultipleExceptions", jobParams); - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.FAILED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", MyMultipleExceptionsRetryReadListener.GOOD_EXIT_STATUS, execution1.getExitStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testChunkItemListeners - * @assertion: each job will finish successfully as COMPLETED and the invocation of each type of item listener - * will be recognized - * 5.2.1.1 - Reader, 5.2.1.1.1 - Reader Properties, - * 5.2.1.2 - Processor, 5.2.2.1 - Processor Properties - * 5.2.1.3 - Writer, 5.2.1.3.1 - Writer Properties - * 5.2.1 - Chunk, item-count, retry-limit - * 5.2.1.5 - Exception Handling - retry-exception-classes - * 6.2.4 - ItemReadListener - * 6.2.5 - ItemProcessListener - * 6.2.6 - ItemWriteListener - * - * @test_Strategy: start 3 separate jobs with item-count specified at a value greater than the read data set. - * Each job is configured to enable an itemreadlistener, and itemprocesslistener and an itemwritelistener - * batch artifact. - * The Batch Artifact enforces that each listener has been called correctly by the runtime. - * test that each job succeeds and that the appropriate listener was called. - */ - - - public void testChunkItemListeners() throws Fault { - String METHOD = "testChunkItemListeners"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("readrecord.fail=31"); - TestUtil.logMsg("app.arraysize=30"); - TestUtil.logMsg("app.writepoints=0,5,10,15,20,25,30"); - TestUtil.logMsg("app.listenertest=READ"); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "31"); - jobParams.put("app.arraysize", "30"); - jobParams.put("app.writepoints", "0,5,10,15,20,25,30"); - jobParams.put("app.listenertest", "READ"); - - TestUtil.logMsg("Locate job XML file: testListeners.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("testListeners", jobParams); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #1 for the READ LISTENER", BatchStatus.COMPLETED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1 for the READ LISTENER", MyItemReadListenerImpl.GOOD_EXIT_STATUS, - execution1.getExitStatus()); - - TestUtil.logMsg("Create job parameters for execution #2:"); - jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("readrecord.fail=31"); - TestUtil.logMsg("app.arraysize=30"); - TestUtil.logMsg("app.writepoints=0,5,10,15,20,25,30"); - TestUtil.logMsg("app.listenertest=PROCESS"); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "31"); - jobParams.put("app.arraysize", "30"); - jobParams.put("app.writepoints", "0,5,10,15,20,25,30"); - jobParams.put("app.listenertest", "PROCESS"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #2"); - JobExecution execution2 = jobOp.startJobAndWaitForResult("testListeners", jobParams); - TestUtil.logMsg("execution #2 JobExecution getBatchStatus()=" + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #2 JobExecution getExitStatus()=" + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #2 for the PROCESS LISTENER", BatchStatus.COMPLETED, execution2.getBatchStatus()); - assertWithMessage("Testing execution #2 for the PROCESS LISTENER", MyItemProcessListenerImpl.GOOD_EXIT_STATUS, - execution2.getExitStatus()); - - TestUtil.logMsg("Create job parameters for execution #3:"); - jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("readrecord.fail=31"); - TestUtil.logMsg("app.arraysize=30"); - TestUtil.logMsg("app.writepoints=0,5,10,15,20,25,30"); - TestUtil.logMsg("app.listenertest=WRITE"); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "31"); - jobParams.put("app.arraysize", "30"); - jobParams.put("app.writepoints", "0,5,10,15,20,25,30"); - jobParams.put("app.listenertest", "WRITE"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #3"); - JobExecution execution3 = jobOp.startJobAndWaitForResult("testListeners", jobParams); - TestUtil.logMsg("execution #3 JobExecution getBatchStatus()=" + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #3 JobExecution getExitStatus()=" + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #3 for the WRITE LISTENER", BatchStatus.COMPLETED, execution3.getBatchStatus()); - assertWithMessage("Testing execution #3 for the WRITE LISTENER", MyItemWriteListenerImpl.GOOD_EXIT_STATUS, - execution3.getExitStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testChunkItemListenersOnError - * @assertion: each job will finish successfully as COMPLETED and the invocation of each type of item listener - * will be recognized - * 5.2.1.1 - Reader, 5.2.1.1.1 - Reader Properties, - * 5.2.1.2 - Processor, 5.2.2.1 - Processor Properties - * 5.2.1.3 - Writer, 5.2.1.3.1 - Writer Properties - * 5.2.1 - Chunk, item-count, retry-limit - * 5.2.1.5 - Exception Handling - retry-exception-classes - * 6.2.4 - ItemReadListener - * 6.2.5 - ItemProcessListener - * 6.2.6 - ItemWriteListener - * - * @test_Strategy: start 3 separate jobs with item-count specified at a value greater than the read data set. - * Each job is configured to enable an itemreadlistener, and itemprocesslistener and an itemwritelistener - * batch artifact. The Batch artifact is configured to raise an exception on the read, process and write in that order. - * The Batch Artifact enforces that each listener (read, process and write) onError() methods are been called correctly by the runtime. - */ - - - public void testChunkItemListenersOnError() throws Fault { - String METHOD = "testChunkItemListeners"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - - TestUtil.logMsg("read.fail.immediate=true"); - - jobParams.put("read.fail.immediate", "true"); - - TestUtil.logMsg("Locate job XML file: testListeners.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("testListenersOnError", jobParams); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #1 for the READ LISTENER", BatchStatus.FAILED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1 for the READ LISTENER", "MyItemReadListenerImpl.onReadError", - execution1.getExitStatus()); - - TestUtil.logMsg("Create job parameters for execution #2:"); - jobParams = new Properties(); - TestUtil.logMsg("process.fail.immediate=true"); - - jobParams.put("process.fail.immediate", "true"); - - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #2"); - JobExecution execution2 = jobOp.startJobAndWaitForResult("testListenersOnError", jobParams); - TestUtil.logMsg("execution #2 JobExecution getBatchStatus()=" + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #2 JobExecution getExitStatus()=" + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #2 for the PROCESS LISTENER", BatchStatus.FAILED, execution2.getBatchStatus()); - assertWithMessage("Testing execution #2 for the PROCESS LISTENER", "MyItemProcessListenerImpl.onProcessError", - execution2.getExitStatus()); - - TestUtil.logMsg("Create job parameters for execution #3:"); - jobParams = new Properties(); - TestUtil.logMsg("write.fail.immediate=true"); - - jobParams.put("write.fail.immediate", "true"); - - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #3"); - JobExecution execution3 = jobOp.startJobAndWaitForResult("testListenersOnError", jobParams); - TestUtil.logMsg("execution #3 JobExecution getBatchStatus()=" + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #3 JobExecution getExitStatus()=" + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #3 for the WRITE LISTENER", BatchStatus.FAILED, execution3.getBatchStatus()); - assertWithMessage("Testing execution #3 for the WRITE LISTENER", "MyItemWriteListenerImpl.onWriteError", - execution3.getExitStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - - /* - * @testName: testUserDataIsPersistedAfterCheckpoint - * @assertion: - * - * @test_Strategy: start a job configured to a item-count of 10 configured to fail on the 12 item read. - * Verify that persisted step data is available even if step did not complete. - */ - - - public void testUserDataIsPersistedAfterCheckpoint() throws Fault { - - String METHOD = "testChunkRestartItemCount10"; -TestUtil.logTrace(METHOD); - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("readrecord.fail=12"); - TestUtil.logMsg("app.arraysize=30"); - TestUtil.logMsg("app.writepoints=0,5,10,15,20,25,30"); - TestUtil.logMsg("app.next.writepoints=0,5,10,15,20,25,30"); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "12"); - jobParams.put("app.arraysize", "30"); - jobParams.put("app.checkpoint.position" , "0"); - jobParams.put("app.writepoints", "0,10,20,30"); - jobParams.put("app.next.writepoints", "10,20,30"); - - TestUtil.logMsg("Locate job XML file: chunkrestartCheckpt10.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - TCKJobExecutionWrapper execution1 = jobOp.startJobAndWaitForResult("chunkrestartCheckpt10", jobParams); - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.FAILED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", "FAILED", execution1.getExitStatus()); - - List stepExecs = jobOp.getStepExecutions(execution1.getExecutionId()); - - MyPersistentRestartUserData persistedStepData = null; - for (StepExecution stepExec : stepExecs) { - if (stepExec.getStepName().equals("step1")) { - persistedStepData = (MyPersistentRestartUserData) stepExec.getPersistentUserData(); - break; - } - } - - assertWithMessage("Testing execution #1", 1, persistedStepData.getExecutionNumber()); - - - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - private void showStepState(StepExecution step) { - - TestUtil.logMsg("---------------------------"); - TestUtil.logMsg("getJobExecutionId(): " + step.getStepExecutionId() + " - "); - - Metric[] metrics = step.getMetrics(); - - for (int i = 0; i < metrics.length; i++) { - TestUtil.logMsg(metrics[i].getType() + ": " + metrics[i].getValue() + " - "); - } - - TestUtil.logMsg("getStartTime(): " + step.getStartTime() + " - "); - TestUtil.logMsg("getEndTime(): " + step.getEndTime() + " - "); - TestUtil.logMsg("getBatchStatus(): " + step.getBatchStatus() + " - "); - TestUtil.logMsg("getExitStatus(): " + step.getExitStatus()); - TestUtil.logMsg("---------------------------"); - } - - private static void handleException(String methodName, Exception e) throws Fault { -TestUtil.logErr("Caught exception: " + e.getMessage()); -TestUtil.printStackTrace(e); -throw new Fault(methodName + " failed", e);} - -} diff --git a/src/com/ibm/jbatch/tck/tests/jslxml/ContextAndListenerTests.java b/src/com/ibm/jbatch/tck/tests/jslxml/ContextAndListenerTests.java deleted file mode 100644 index fe777940dd..0000000000 --- a/src/com/ibm/jbatch/tck/tests/jslxml/ContextAndListenerTests.java +++ /dev/null @@ -1,361 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.tests.jslxml; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import static com.ibm.jbatch.tck.utils.AssertionUtils.assertObjEquals; -import static com.ibm.jbatch.tck.utils.AssertionUtils.assertWithMessage; - -import java.util.List; -import java.util.Properties; -import java.util.logging.Logger; - -import jakarta.batch.runtime.BatchStatus; -import jakarta.batch.runtime.JobExecution; -import jakarta.batch.runtime.StepExecution; - -import com.ibm.jbatch.tck.utils.JobOperatorBridge; - - - - - - - -public class ContextAndListenerTests extends ServiceEETest { - - private final static Logger logger = Logger.getLogger(ContextAndListenerTests.class.getName()); - private static JobOperatorBridge jobOp = null; - - - public static void setup(String[] args, Properties props) throws Fault { - - String METHOD = "setup"; -TestUtil.logTrace(METHOD); - - try { - jobOp = new JobOperatorBridge(); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - - - public static void setUp() throws Fault { - jobOp = new JobOperatorBridge(); - } - - /* - * @testName: testExamineJobContextInArtifact - * @assertion: FIXME - * @test_Strategy: FIXME - */ - - - public void testExamineJobContextInArtifact() throws Fault { - - String METHOD = "testExamineJobContextInArtifact()"; -TestUtil.logTrace(METHOD); - - try { - - TestUtil.logMsg("Locate job XML file: oneArtifactIsJobAndStepListener.xml"); - - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("app.timeinterval=10"); - jobParams.put("app.timeinterval", "10"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("JobContextTestBatchlet", jobParams); - - - String testString = "JobName=job1;JobInstanceId=" + jobOp.getJobInstance(execution1.getExecutionId()).getInstanceId() + ";JobExecutionId=" + execution1.getExecutionId(); - TestUtil.logMsg("EXPECTED JobExecution getBatchStatus()=COMPLETED"); - TestUtil.logMsg("ACTUAL JobExecution getBatchStatus()="+execution1.getBatchStatus()); - TestUtil.logMsg("EXPECTED JobExecution getExitStatus()="+testString); - TestUtil.logMsg("ACTUAL JobExecution getExitStatus()="+execution1.getExitStatus()); - assertWithMessage("Testing batch status", BatchStatus.COMPLETED, execution1.getBatchStatus()); - assertWithMessage("Testing exit status", testString, execution1.getExitStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testExamineStepContextInArtifact - * @assertion: FIXME - * @test_Strategy: FIXME - */ - - - public void testExamineStepContextInArtifact() throws Fault { - - String METHOD = "testExamineStepContextInArtifact()"; -TestUtil.logTrace(METHOD); - - try { - - TestUtil.logMsg("Locate job XML file: oneArtifactIsJobAndStepListener.xml"); - - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("app.timeinterval=10"); - jobParams.put("app.timeinterval", "10"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("StepContextTestBatchlet", jobParams); - - List steps = jobOp.getStepExecutions(execution1.getExecutionId()); - - assertWithMessage("list of step executions == 1", steps.size() == 1); - - String testString = "StepName=step1;StepExecutionId=" + steps.get(0).getStepExecutionId(); - TestUtil.logMsg("EXPECTED JobExecution getBatchStatus()=COMPLETED"); - TestUtil.logMsg("ACTUAL JobExecution getBatchStatus()="+execution1.getBatchStatus()); - TestUtil.logMsg("EXPECTED JobExecution getExitStatus()="+testString); - TestUtil.logMsg("ACTUAL JobExecution getExitStatus()="+execution1.getExitStatus()); - assertWithMessage("Testing batch status", BatchStatus.COMPLETED, execution1.getBatchStatus()); - assertWithMessage("Testing exit status", testString, execution1.getExitStatus()); - - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testOneArtifactIsJobAndStepListener - * @assertion: FIXME - * @test_Strategy: FIXME - */ - - - public void testOneArtifactIsJobAndStepListener() throws Fault { - - String METHOD = "testOneArtifactIsJobAndStepListener"; -TestUtil.logTrace(METHOD); - - try { - String expectedStr = "BeforeJob" + - "BeforeStep" + "UnusedExitStatusForPartitions" + "AfterStep" + - "BeforeStep" + "UnusedExitStatusForPartitions" + "AfterStep" + - "AfterJob"; - - TestUtil.logMsg("Locate job XML file: oneArtifactIsJobAndStepListener.xml"); - - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("app.timeinterval=10"); - jobParams.put("app.timeinterval", "10"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("oneArtifactIsJobAndStepListener", jobParams); - - TestUtil.logMsg("EXPECTED JobExecution getBatchStatus()=COMPLETED"); - TestUtil.logMsg("ACTUAL JobExecution getBatchStatus()="+execution1.getBatchStatus()); - TestUtil.logMsg("EXPECTED JobExecution getExitStatus()="+expectedStr); - TestUtil.logMsg("ACTUAL JobExecution getExitStatus()="+execution1.getExitStatus()); - assertWithMessage("Testing batch status", BatchStatus.COMPLETED, execution1.getBatchStatus()); - assertWithMessage("Testing exit status", expectedStr, execution1.getExitStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testgetException - * @assertion: FIXME - * @test_Strategy: FIXME - */ - - - public void testgetException() throws Fault { - - String METHOD = "testgetException"; -TestUtil.logTrace(METHOD); - - try { - String expectedStr = "MyChunkListener: found instanceof MyParentException"; - - TestUtil.logMsg("Locate job XML file: oneArtifactIsJobAndStepListener.xml"); - - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("fail.immediate=true"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("job_chunk_getException", jobParams); - - TestUtil.logMsg("EXPECTED JobExecution getBatchStatus()=FAILED"); - TestUtil.logMsg("ACTUAL JobExecution getBatchStatus()="+execution1.getBatchStatus()); - TestUtil.logMsg("EXPECTED JobExecution getExitStatus()="+expectedStr); - TestUtil.logMsg("ACTUAL JobExecution getExitStatus()="+execution1.getExitStatus()); - assertWithMessage("Testing batch status", BatchStatus.FAILED, execution1.getBatchStatus()); - assertWithMessage("Testing exit status", expectedStr, execution1.getExitStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testgetExceptionListenerBased - * @assertion: FIXME - * @test_Strategy: FIXME - */ - - - public void testgetExceptionListenerBased() throws Fault { - - String METHOD = "testgetExceptionListenerBased"; -TestUtil.logTrace(METHOD); - - try { - String expectedStr = "MyChunkListener: found instanceof MyParentException"; - - TestUtil.logMsg("Locate job XML file: oneArtifactIsJobAndStepListener.xml"); - - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("fail.immediate=true"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("job_chunk_getExceptionListeners", jobParams); - - TestUtil.logMsg("EXPECTED JobExecution getBatchStatus()=FAILED"); - TestUtil.logMsg("ACTUAL JobExecution getBatchStatus()="+execution1.getBatchStatus()); - TestUtil.logMsg("EXPECTED JobExecution getExitStatus()="+expectedStr); - TestUtil.logMsg("ACTUAL JobExecution getExitStatus()="+execution1.getExitStatus()); - assertWithMessage("Testing batch status", BatchStatus.FAILED, execution1.getBatchStatus()); - assertWithMessage("Testing exit status", expectedStr, execution1.getExitStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testJobContextIsUniqueForMainThreadAndPartitions - * - * @assertion: FIXME - * - * @test_Strategy: FIXME - */ - - - public void testJobContextIsUniqueForMainThreadAndPartitions() throws Fault { - - String METHOD = "testJobContextIsUniqueForMainThreadAndPartitions"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_partitioned_1step.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExecution = jobOp.startJobAndWaitForResult("job_partitioned_1step"); - - TestUtil.logMsg("JobExecution getBatchStatus()="+jobExecution.getBatchStatus()); - assertObjEquals(BatchStatus.COMPLETED, jobExecution.getBatchStatus()); - assertObjEquals("COMPLETED", jobExecution.getExitStatus()); - - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testJobContextIsUniqueForMainThreadAndFlowsInSplits - * - * @assertion: FIXME - * - * @test_Strategy: FIXME - */ - - - public void testJobContextIsUniqueForMainThreadAndFlowsInSplits() throws Fault { - - String METHOD = "testJobContextIsUniqueForMainThreadAndFlowsInSplits"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_split_batchlet_4steps.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution execution = jobOp.startJobAndWaitForResult("job_split_batchlet_4steps"); - - TestUtil.logMsg("JobExecution getBatchStatus()="+execution.getBatchStatus()); - assertObjEquals(BatchStatus.COMPLETED, execution.getBatchStatus()); - assertObjEquals("COMPLETED", execution.getExitStatus()); - - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testStepContextIsUniqueForMainThreadAndPartitions - * - * @assertion: FIXME - * - * @test_Strategy: FIXME - */ - - - public void testStepContextIsUniqueForMainThreadAndPartitions() throws Fault { - String METHOD = "testStepContextIsUniqueForMainThreadAndPartitions"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_partitioned_1step.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExecution = jobOp.startJobAndWaitForResult("job_partitioned_1step"); - - TestUtil.logMsg("JobExecution getBatchStatus()=" + jobExecution.getBatchStatus() + ""); - - assertObjEquals(BatchStatus.COMPLETED, jobExecution.getBatchStatus()); - - List stepExecs = jobOp.getStepExecutions(jobExecution.getExecutionId()); - - //only one step in job - StepExecution stepExec = stepExecs.get(0); - - //verify step context is defaulted because it was never set on main thread. - assertObjEquals("COMPLETED", stepExec.getExitStatus()); - - } catch (Exception e) { - handleException(METHOD, e); - } - } - - - public static void cleanup() throws Fault { - } - - private static void handleException(String methodName, Exception e) throws Fault { -TestUtil.logErr("Caught exception: " + e.getMessage()); -TestUtil.printStackTrace(e); -throw new Fault(methodName + " failed", e);} - - private void begin(String str) { - TestUtil.logMsg("Begin test method: " + str + ""); - } -} diff --git a/src/com/ibm/jbatch/tck/tests/jslxml/ContextsGetIdTests.java b/src/com/ibm/jbatch/tck/tests/jslxml/ContextsGetIdTests.java deleted file mode 100644 index ab34a3e6ba..0000000000 --- a/src/com/ibm/jbatch/tck/tests/jslxml/ContextsGetIdTests.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.tests.jslxml; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import static com.ibm.jbatch.tck.utils.AssertionUtils.assertWithMessage; - -import java.util.Properties; - -import jakarta.batch.runtime.BatchStatus; -import jakarta.batch.runtime.JobExecution; - - - - - - - -import com.ibm.jbatch.tck.utils.JobOperatorBridge; - -public class ContextsGetIdTests extends ServiceEETest { - - private JobOperatorBridge jobOp = null; - - /** - * @testName: testJobContextGetId - * @assertion: Section 7.7.2 JobContext - * @test_Strategy: 1. setup a simple job with one step - * 2. start job - * 3. set job exit status equals job id from JobContext in batchlet - * 4. compare job id 'job1' to job exit status - * - * - * - * - * - * - * - * @throws Fault - */ - - - public void testJobContextGetId() throws Fault { - - String METHOD = "testJobContextGetId"; -TestUtil.logTrace(METHOD); - - try { - - String jobId = "job1"; - - TestUtil.logMsg("starting job"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("contexts_getid_jobcontext", null); - TestUtil.logMsg("Job Status = " + jobExec.getBatchStatus()); - - assertWithMessage("job id equals job1", jobId, jobExec.getExitStatus()); - assertWithMessage("Job completed", BatchStatus.COMPLETED, jobExec.getBatchStatus()); - TestUtil.logMsg("job completed"); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /** - * @testName: testStepContextGetId - * @assertion: Section 7.7.2 StepContext - * @test_Strategy: 1. setup a simple job with one step - * 2. start job - * 3. set job exit status equals step id from StepContext in batchlet - * 4. compare step id 'step1' to job exit status - * - * - * - * - * - * - * - * @throws Fault - */ - - - public void testStepContextGetId() throws Fault { - - String METHOD = "testStepContextGetId"; -TestUtil.logTrace(METHOD); - - try { - String stepId = "step1"; - - TestUtil.logMsg("starting job"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("contexts_getid_stepcontext", null); - TestUtil.logMsg("Job Status = " + jobExec.getBatchStatus()); - - assertWithMessage("job id equals job1", stepId, jobExec.getExitStatus()); - - assertWithMessage("Job completed", BatchStatus.COMPLETED, jobExec.getBatchStatus()); - TestUtil.logMsg("job completed"); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - private static void handleException(String methodName, Exception e) throws Fault { -TestUtil.logErr("Caught exception: " + e.getMessage()); -TestUtil.printStackTrace(e); -throw new Fault(methodName + " failed", e);} - - public void setup(String[] args, Properties props) throws Fault { - - String METHOD = "setup"; -TestUtil.logTrace(METHOD); - - try { - jobOp = new JobOperatorBridge(); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* cleanup */ - public void cleanup() - { - - } - - - public void beforeTest() throws ClassNotFoundException { - jobOp = new JobOperatorBridge(); - } - - - public void afterTest() { - jobOp = null; - } -} diff --git a/src/com/ibm/jbatch/tck/tests/jslxml/DeciderTests.java b/src/com/ibm/jbatch/tck/tests/jslxml/DeciderTests.java deleted file mode 100644 index c1d5d0cd85..0000000000 --- a/src/com/ibm/jbatch/tck/tests/jslxml/DeciderTests.java +++ /dev/null @@ -1,956 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.tests.jslxml; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import static com.ibm.jbatch.tck.utils.AssertionUtils.assertObjEquals; -import static com.ibm.jbatch.tck.utils.AssertionUtils.assertWithMessage; - -import java.util.Properties; -import java.util.logging.Logger; - -import jakarta.batch.operations.JobStartException; -import jakarta.batch.runtime.BatchStatus; -import jakarta.batch.runtime.JobExecution; - - - - - - -import com.ibm.jbatch.tck.artifacts.common.StatusConstants; -import com.ibm.jbatch.tck.artifacts.specialized.DeciderTestsBatchlet; -import com.ibm.jbatch.tck.utils.JobOperatorBridge; - -public class DeciderTests extends ServiceEETest implements StatusConstants { - private final static Logger logger = Logger.getLogger(DeciderTests.class.getName()); - private static JobOperatorBridge jobOp = null; - - private final static String FORCE_STOP_EXITSTATUS = "STEP_COMPLETE_BUT_FORCE_JOB_STOPPED_STATUS"; - private final static String FORCE_FAIL_EXITSTATUS = "STEP_COMPLETE_BUT_FORCE_JOB_FAILED_STATUS"; - - - public static void setup(String[] args, Properties props) throws Fault { - String METHOD = "setup"; -TestUtil.logTrace(METHOD); - - try { - jobOp = new JobOperatorBridge(); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - - - public static void setUp() throws Fault { - jobOp = new JobOperatorBridge(); - } - - /* cleanup */ - public void cleanup() - { - - } - - /* - * @testName: testDeciderEndNormal - * @assertion: Tests that decision child elements: next, step, end, fail, all work as expected (by verifying batch status) - * Tests exit status globbing ('*' and '?') - * Tests StepExecution from previous step passed to Decider - * Tests that decider can be configured via property - * Tests that JobContext can be utilized in decider (the same instance as that of the earlier steps). - * Tests setting of , , @exit-status attribute value. - * - * @test_Strategy: The test methods in this class have a tighter coupling than usual. That's because they all use the - * same artifacts, the same basic JSL, and the same basic element (with the same set of glob - * patterns). We set up different "branches" in the job execution sequence depending on exit status, - * (e.g. stop vs. fail, end with one exit status vs. another), and we take the various branches in the - * various test methods. - * - * 1. Batchlet is coded to end with one of two different exit status values depending on @BatchProperty populated by job param set either to: - * jobParameters.setProperty(DeciderTestsBatchlet.ACTUAL_VALUE, DeciderTestsBatchlet.NORMAL_VALUE); - * OR - * jobParameters.setProperty(DeciderTestsBatchlet.ACTUAL_VALUE, DeciderTestsBatchlet.SPECIAL_VALUE); - * Batch status is tested as well - * 2. Decider returns value based on configured property, step execution exit status, and job context transient data. - * 3. JobContext utilized to adjust "core exit status" by prefixing the number of times the step has run. - * 4. Special globbing chars '*' and '?' are used in the @on values to test exit status globbing. - * 5. Test asserts specific exit status as well as batch status. In addition to testing the overall test flow this - * tests the @exit-status attributes of fail, stop, end. - * - */ - - - public void testDeciderEndNormal() throws Fault { - - String METHOD = "testDeciderEndNormal"; -TestUtil.logTrace(METHOD); - - try { - // 1. Here "EndSpecial" is the exit status the decider will return if the step exit status - // is the "special" exit status value. It is set as a property on the decider. - TestUtil.logMsg("Build job parameters for EndSpecial exit status"); - - Properties jobParameters = new Properties(); - - // 2. Here "EndNormal" is the exit status the decider will return if the step exit status - // is the "normal" exit status value. It is set as a property on the batchlet and passed - // along to the decider via stepContext.setTransientUserData(). - TestUtil.logMsg("Set job parameters property " + DeciderTestsBatchlet.ACTION + " with value EndNormal"); - jobParameters.setProperty(DeciderTestsBatchlet.ACTION, "EndNormal"); - // 3. This "ACTUAL_VALUE" is a property set on the batchlet. It will either indicate to end - // the step with a "normal" or "special" exit status. - TestUtil.logMsg("Set job parameters property " + DeciderTestsBatchlet.ACTUAL_VALUE + " with value " + DeciderTestsBatchlet.NORMAL_VALUE + ""); - jobParameters.setProperty(DeciderTestsBatchlet.ACTUAL_VALUE, DeciderTestsBatchlet.NORMAL_VALUE); - - TestUtil.logMsg("Set job parameters property " + DeciderTestsBatchlet.SPECIAL_EXIT_STATUS + " with value EndSpecial"); - jobParameters.setProperty(DeciderTestsBatchlet.SPECIAL_EXIT_STATUS, "EndSpecial"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_decider_incompleterun", jobParameters); - - TestUtil.logMsg("Expected JobExecution getExitStatus()=EndNormal"); - TestUtil.logMsg("Actual JobExecution getExitStatus()="+jobExec.getExitStatus()); - TestUtil.logMsg("Expected JobExecution getStatus()=COMPLETED"); - TestUtil.logMsg("Actual JobExecution getStatus()="+jobExec.getBatchStatus()); - assertObjEquals("EndNormal", jobExec.getExitStatus()); - assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus()); - } catch(Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testDeciderEndSpecial - * @assertion: see testDeciderEndNormal - * @test_Strategy: see testDeciderEndNormal - */ - - - public void testDeciderEndSpecial() throws Fault { - String METHOD = "testDeciderEndSpecial"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Build job parameters for EndSpecial exit status"); - - Properties jobParameters = new Properties(); - jobParameters.setProperty(DeciderTestsBatchlet.ACTION, "EndNormal"); - TestUtil.logMsg("Set job parameters property " + DeciderTestsBatchlet.ACTION + " with value EndNormal"); - // 1. This is the only test parameter that differs from testDeciderEndNormal(). - TestUtil.logMsg("Set job parameters property " + DeciderTestsBatchlet.ACTUAL_VALUE + " with value " + DeciderTestsBatchlet.SPECIAL_VALUE ); - jobParameters.setProperty(DeciderTestsBatchlet.ACTUAL_VALUE, DeciderTestsBatchlet.SPECIAL_VALUE); - TestUtil.logMsg("Set job parameters property " + DeciderTestsBatchlet.SPECIAL_EXIT_STATUS + " with value EndSpecial"); - jobParameters.setProperty(DeciderTestsBatchlet.SPECIAL_EXIT_STATUS, "EndSpecial"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_decider_incompleterun", jobParameters); - - // 2. And the job exit status differs accordingly. - TestUtil.logMsg("Expected JobExecution getExitStatus()=EndSpecial"); - TestUtil.logMsg("Actual JobExecution getExitStatus()="+jobExec.getExitStatus()); - TestUtil.logMsg("Expected JobExecution getBatchStatus()=COMPLETED"); - TestUtil.logMsg("Actual JobExecution getBatchStatus()="+jobExec.getBatchStatus()); - assertObjEquals("EndSpecial", jobExec.getExitStatus()); - assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus()); - } catch(Exception e) { - handleException(METHOD, e); - } - } - - // See the first two test methods for an explanation of parameter values. - /* - * @testName: testDeciderStopNormal - * @assertion: see testDeciderEndNormal - * @test_Strategy: see testDeciderEndNormal - */ - - - public void testDeciderStopNormal() throws Fault { - String METHOD = " testDeciderStopNormal"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Build job parameters for StopSpecial exit status"); - - Properties jobParameters = new Properties(); - TestUtil.logMsg("Set job parameters property " + DeciderTestsBatchlet.ACTION + " with value StopNormal"); - jobParameters.setProperty(DeciderTestsBatchlet.ACTION, "StopNormal"); - - TestUtil.logMsg("Set job parameters property " + DeciderTestsBatchlet.ACTUAL_VALUE + " with value " + DeciderTestsBatchlet.NORMAL_VALUE ); - jobParameters.setProperty(DeciderTestsBatchlet.ACTUAL_VALUE, DeciderTestsBatchlet.NORMAL_VALUE); - - TestUtil.logMsg("Set job parameters property " + DeciderTestsBatchlet.SPECIAL_EXIT_STATUS + " with value StopSpecial"); - jobParameters.setProperty(DeciderTestsBatchlet.SPECIAL_EXIT_STATUS, "StopSpecial"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_decider_incompleterun", jobParameters); - - TestUtil.logMsg("Expected JobExecution getExitStatus()=StopNormal"); - TestUtil.logMsg("Actual JobExecution getExitStatus()="+jobExec.getExitStatus()); - TestUtil.logMsg("Expected JobExecution getBatchStatus()=STOPPED"); - TestUtil.logMsg("Actual JobExecution getBatchStatus()="+jobExec.getBatchStatus()); - assertObjEquals("StopNormal", jobExec.getExitStatus()); - assertObjEquals(BatchStatus.STOPPED, jobExec.getBatchStatus()); - } catch(Exception e) { - handleException(METHOD, e); - } - - } - - // See the first two test methods for an explanation of parameter values. - /* - * @testName: testDeciderStopSpecial - * @assertion: see testDeciderEndNormal - * @test_Strategy: see testDeciderEndNormal - */ - - - public void testDeciderStopSpecial() throws Fault { - String METHOD = "testDeciderStopSpecial"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Build job parameters for StopSpecial exit status"); - - Properties jobParameters = new Properties(); - TestUtil.logMsg("Set job parameters property " + DeciderTestsBatchlet.ACTION + " with value StopNormal"); - jobParameters.setProperty(DeciderTestsBatchlet.ACTION, "StopNormal"); - - TestUtil.logMsg("Set job parameters property " + DeciderTestsBatchlet.ACTUAL_VALUE + " with value " + DeciderTestsBatchlet.SPECIAL_VALUE ); - jobParameters.setProperty(DeciderTestsBatchlet.ACTUAL_VALUE, DeciderTestsBatchlet.SPECIAL_VALUE); - - TestUtil.logMsg("Set job parameters property " + DeciderTestsBatchlet.SPECIAL_EXIT_STATUS + " with value StopSpecial"); - jobParameters.setProperty(DeciderTestsBatchlet.SPECIAL_EXIT_STATUS, "StopSpecial"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_decider_incompleterun", jobParameters); - - TestUtil.logMsg("Expected JobExecution getExitStatus()=StopSpecial"); - TestUtil.logMsg("Actual JobExecution getExitStatus()="+jobExec.getExitStatus()); - TestUtil.logMsg("Expected JobExecution getBatchStatus()=STOPPED"); - TestUtil.logMsg("Actual JobExecution getBatchStatus()="+jobExec.getBatchStatus()); - assertObjEquals("StopSpecial", jobExec.getExitStatus()); - assertObjEquals(BatchStatus.STOPPED, jobExec.getBatchStatus()); - } catch(Exception e) { - handleException(METHOD, e); - } - } - - // See the first two test methods for an explanation of parameter values. - /* - * @testName: testDeciderFailNormal - * @assertion: see testDeciderEndNormal - * @test_Strategy: see testDeciderEndNormal - */ - - - public void testDeciderFailNormal() throws Fault { - - String METHOD = "testDeciderFailNormal"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Build job parameters for FailSpecial exit status"); - - Properties jobParameters = new Properties(); - TestUtil.logMsg("Set job parameters property " + DeciderTestsBatchlet.ACTION + " with value FailNormal"); - jobParameters.setProperty(DeciderTestsBatchlet.ACTION, "FailNormal"); - - TestUtil.logMsg("Set job parameters property " + DeciderTestsBatchlet.ACTUAL_VALUE + " with value " + DeciderTestsBatchlet.NORMAL_VALUE ); - jobParameters.setProperty(DeciderTestsBatchlet.ACTUAL_VALUE, DeciderTestsBatchlet.NORMAL_VALUE); - - TestUtil.logMsg("Set job parameters property " + DeciderTestsBatchlet.SPECIAL_EXIT_STATUS + " with value FailSpecial"); - jobParameters.setProperty(DeciderTestsBatchlet.SPECIAL_EXIT_STATUS, "FailSpecial"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_decider_incompleterun", jobParameters); - - TestUtil.logMsg("Expected JobExecution getExitStatus()=FailNormal"); - TestUtil.logMsg("Actual JobExecution getExitStatus()="+jobExec.getExitStatus()); - TestUtil.logMsg("Expected JobExecution getBatchStatus()=FAILED"); - TestUtil.logMsg("Actual JobExecution getBatchStatus()="+jobExec.getBatchStatus()); - assertObjEquals("FailNormal", jobExec.getExitStatus()); - assertObjEquals(BatchStatus.FAILED, jobExec.getBatchStatus()); - } catch(Exception e) { - handleException(METHOD, e); - } - } - - // See the first two test methods for an explanation of parameter values. - /* - * @testName: testDeciderFailSpecial - * @assertion: see testDeciderEndNormal - * @test_Strategy: see testDeciderEndNormal - */ - - - public void testDeciderFailSpecial() throws Fault { - String METHOD = "testDeciderFailSpecial"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Build job parameters for FailSpecial exit status"); - - Properties jobParameters = new Properties(); - TestUtil.logMsg("Set job parameters property " + DeciderTestsBatchlet.ACTION + " with value FailNormal"); - jobParameters.setProperty(DeciderTestsBatchlet.ACTION, "FailNormal"); - - TestUtil.logMsg("Set job parameters property " + DeciderTestsBatchlet.ACTUAL_VALUE + " with value " + DeciderTestsBatchlet.SPECIAL_VALUE ); - jobParameters.setProperty(DeciderTestsBatchlet.ACTUAL_VALUE, DeciderTestsBatchlet.SPECIAL_VALUE); - - TestUtil.logMsg("Set job parameters property " + DeciderTestsBatchlet.SPECIAL_EXIT_STATUS + " with value FailSpecial"); - jobParameters.setProperty(DeciderTestsBatchlet.SPECIAL_EXIT_STATUS, "FailSpecial"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_decider_incompleterun", jobParameters); - - TestUtil.logMsg("Expected JobExecution getExitStatus()=FailSpecial"); - TestUtil.logMsg("Actual JobExecution getExitStatus()="+jobExec.getExitStatus()); - TestUtil.logMsg("Expected JobExecution getBatchStatus()=FAILED"); - TestUtil.logMsg("Actual JobExecution getBatchStatus()="+jobExec.getBatchStatus()); - assertObjEquals("FailSpecial", jobExec.getExitStatus()); - assertObjEquals(BatchStatus.FAILED, jobExec.getBatchStatus()); - } catch(Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testDeciderNextNormal - * @assertion: see testDeciderEndNormal - * @test_Strategy: see testDeciderEndNormal - */ - - - public void testDeciderNextNormal() throws Fault { - String METHOD = "testDeciderNextNormal"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Build job parameters for NextSpecial exit status"); - - Properties jobParameters = new Properties(); - TestUtil.logMsg("Set job parameters property " + DeciderTestsBatchlet.ACTION + " with value NextNormal"); - jobParameters.setProperty(DeciderTestsBatchlet.ACTION, "NextNormal"); - - TestUtil.logMsg("Set job parameters property " + DeciderTestsBatchlet.ACTUAL_VALUE + " with value " + DeciderTestsBatchlet.NORMAL_VALUE ); - jobParameters.setProperty(DeciderTestsBatchlet.ACTUAL_VALUE, DeciderTestsBatchlet.NORMAL_VALUE); - - TestUtil.logMsg("Set job parameters property " + DeciderTestsBatchlet.SPECIAL_EXIT_STATUS + " with value NextSpecial"); - jobParameters.setProperty(DeciderTestsBatchlet.SPECIAL_EXIT_STATUS, "NextSpecial"); - - TestUtil.logMsg("Create single job listener deciderTestJobListener and get JSL"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_decider_completerun", jobParameters); - - TestUtil.logMsg("Expected JobExecution getExitStatus()="+GOOD_JOB_EXIT_STATUS); - TestUtil.logMsg("Actual JobExecution getExitStatus()="+jobExec.getExitStatus()); - TestUtil.logMsg("Expected JobExecution getBatchStatus()=COMPLETED"); - TestUtil.logMsg("Actual JobExecution getBatchStatus()="+jobExec.getBatchStatus()); - assertObjEquals(GOOD_JOB_EXIT_STATUS, jobExec.getExitStatus()); - assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus()); - } catch(Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testDeciderNextSpecial - * @assertion: see testDeciderEndNormal - * @test_Strategy: see testDeciderEndNormal - */ - - - public void testDeciderNextSpecial() throws Fault { - String METHOD = "testDeciderNextSpecial"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Build job parameters for NextSpecial exit status"); - - Properties jobParameters = new Properties(); - - TestUtil.logMsg("Set job parameters property " + DeciderTestsBatchlet.ACTION + " with value NextNormal"); - jobParameters.setProperty(DeciderTestsBatchlet.ACTION, "NextNormal"); - - TestUtil.logMsg("Set job parameters property " + DeciderTestsBatchlet.ACTUAL_VALUE + " with value " + DeciderTestsBatchlet.SPECIAL_VALUE + ""); - jobParameters.setProperty(DeciderTestsBatchlet.ACTUAL_VALUE, DeciderTestsBatchlet.SPECIAL_VALUE); - - TestUtil.logMsg("Set job parameters property " + DeciderTestsBatchlet.SPECIAL_EXIT_STATUS + " with value NextSpecial"); - jobParameters.setProperty(DeciderTestsBatchlet.SPECIAL_EXIT_STATUS, "NextSpecial"); - - TestUtil.logMsg("Create single job listener deciderTestJobListener and get JSL"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_decider_completerun", jobParameters); - - // This actually exits with the exact same status as the "...NextNormal" test. - TestUtil.logMsg("Expected JobExecution getExitStatus()="+GOOD_JOB_EXIT_STATUS); - TestUtil.logMsg("Actual JobExecution getExitStatus()="+jobExec.getExitStatus()); - TestUtil.logMsg("Expected JobExecution getBatchStatus()=COMPLETED"); - TestUtil.logMsg("Actual JobExecution getBatchStatus()="+jobExec.getBatchStatus()); - assertObjEquals(GOOD_JOB_EXIT_STATUS, jobExec.getExitStatus()); - assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus()); - } catch(Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testDeciderExitStatusIsSetOnJobContext - * @assertion: Tests that the exit return value of Decider#decide is set as the value of the job's exit status. - * @test_Strategy: The exit status is not set via JobContext#setExitStatus or other means, but is asserted to - * be equal to the return value of the last decision (i.e. Decider#decide). Note the test doesn't necessarily - * confirm that the exit status is set on the JobContext directly, but this is the intent behind the test method name. - */ - - - public void testDeciderExitStatusIsSetOnJobContext() throws Fault { - - String METHOD = "testDeciderExitStatusIsSetOnJobContext"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Build job parameters."); - - Properties jobParameters = new Properties(); - jobParameters.setProperty("step.complete.but.force.job.stopped.status", FORCE_STOP_EXITSTATUS); - jobParameters.setProperty("step.complete.but.force.job.failed.status", FORCE_FAIL_EXITSTATUS); - - jobParameters.setProperty("allow.start.if.complete", "true"); - - jobParameters.setProperty("stop.job.after.this.step", "None"); - jobParameters.setProperty("fail.job.after.this.step", "step1"); - - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("decider_transitions_on_restart", jobParameters); - - assertObjEquals(BatchStatus.FAILED, jobExec.getBatchStatus()); - assertObjEquals("1:"+FORCE_FAIL_EXITSTATUS, jobExec.getExitStatus()); - } catch(Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testDeciderCannotbeFirstElementOnStart - * @assertion: Tests that the first execution element of a job cannot be a decision - * (it's a misnomer to say 'decider' but we'll leave the test name alone). - * @test_Strategy: Since an implementation may either throw a JobStartException or - * begin an execution which fails, we will pass the test if we see either JobStartException - * or BatchStatus of FAILED. - */ - - - public void testDeciderCannotbeFirstElementOnStart() throws Fault { - - String METHOD = "testDeciderCannotbeFirstElementOnStart"; -TestUtil.logTrace(METHOD); - - try { - boolean seenException = false; - JobExecution jobExec = null; - try { - jobExec = jobOp.startJobAndWaitForResult("decider_as_first_job_element_fails"); - } catch (JobStartException e) { - TestUtil.logMsg("Caught JobStartException: " + e.getLocalizedMessage()); - seenException = true; - } - - // If we caught an exception we'd expect that a JobExecution would not have been created, - // though we won't validate that it wasn't created. - - // If we didn't catch an exception that we require that the implementation fail the job execution. - if (!seenException) { - TestUtil.logMsg("Didn't catch JobStartException, Job Batch Status = " + jobExec.getBatchStatus()); - assertWithMessage("Job should have failed because of decision as first execution element.", BatchStatus.FAILED, jobExec.getBatchStatus()); - } - } catch(Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testDeciderTransitionFromStepAndAllowRestart - * @assertion: 1. Tests that the exit return value of Decider#decide is set as the value of the job's exit status. - * 2. Tests that the decider re-executes on a restart and the decide() method is passed the - * StepExecution corresponding to the new, restarted execution (not the original execution). - * (See Sec. 10.8 Restart Processing) - * @test_Strategy: 1. The exit status is not set via JobContext#setExitStatus or other means, but is asserted to - * be equal to the return value of the last decision (i.e. Decider#decide). - * 2. Steps are configured with allow-start-if-complete = true. Job parameter is used to vary - * exit status on original vs. restart execution and, on restart, the - * StepExecution exit status is asserted to be the one on the restarted execution. - * JobContext transient user data is used to assert the correct number of decider invocations have - * been performed. - */ - - - public void testDeciderTransitionFromStepAndAllowRestart() throws Fault { - String METHOD = "testDeciderTransitionFromStepAndAllowRestart"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Build job parameters."); - - Properties jobParameters = new Properties(); - jobParameters.setProperty("step.complete.but.force.job.stopped.status", FORCE_STOP_EXITSTATUS); - jobParameters.setProperty("step.complete.but.force.job.failed.status", FORCE_FAIL_EXITSTATUS); - - jobParameters.setProperty("allow.start.if.complete", "true"); - - jobParameters.setProperty("stop.job.after.this.step", "step1"); - jobParameters.setProperty("fail.job.after.this.step", "None"); - - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("decider_transitions_on_restart", jobParameters); - - assertObjEquals(BatchStatus.STOPPED, jobExec.getBatchStatus()); - assertObjEquals("1:"+FORCE_STOP_EXITSTATUS, jobExec.getExitStatus()); - - Properties restartJobParameters = new Properties(jobParameters); - restartJobParameters.setProperty("stop.job.after.this.step", "None"); - - TestUtil.logMsg("Invoke restartJobAndWaitForResult"); - JobExecution jobExec2 = jobOp.restartJobAndWaitForResult(jobExec.getExecutionId(), restartJobParameters); - - assertObjEquals("3:flow1step2_CONTINUE", jobExec2.getExitStatus()); - assertObjEquals(BatchStatus.COMPLETED, jobExec2.getBatchStatus()); - } catch(Exception e) { - handleException(METHOD, e); - } - - - } - - /* - * @testName: testDeciderTransitionFromStepWithinFlowAndAllowRestart - * @assertion: 1. Tests that the exit return value of Decider#decide is set as the value of the job's exit status. - * 2. Tests that the decider re-executes on a restart and the decide() method is passed the - * StepExecution corresponding to the new, restarted execution (not the original execution). - * (See Sec. 10.8 Restart Processing) - * 3. Tests that a decision within a flow can terminate the top-level job through appropriate transition elements - * @test_Strategy: 1. The exit status is not set via JobContext#setExitStatus or other means, but is asserted to - * be equal to the return value of the last decision (i.e. Decider#decide). - * 2. Steps are configured with allow-start-if-complete = true. Job parameter is used to vary - * exit status on original vs. restart execution and, on restart, the - * StepExecution exit status is asserted to be the one on the restarted execution. - * JobContext transient user data is used to assert the correct number of decider invocations have - * been performed. - * 3. A decision within a flow is configured to stop (based on exit status matching against a element). - */ - - - public void testDeciderTransitionFromStepWithinFlowAndAllowRestart() throws Fault { - - String METHOD = "testDeciderTransitionFromStepWithinFlowAndAllowRestart"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Build job parameters."); - - Properties jobParameters = new Properties(); - jobParameters.setProperty("step.complete.but.force.job.stopped.status", FORCE_STOP_EXITSTATUS); - jobParameters.setProperty("step.complete.but.force.job.failed.status", FORCE_FAIL_EXITSTATUS); - - jobParameters.setProperty("allow.start.if.complete", "true"); - - jobParameters.setProperty("stop.job.after.this.step", "flow1step1"); - jobParameters.setProperty("fail.job.after.this.step", "None"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("decider_transitions_on_restart", jobParameters); - - assertObjEquals(BatchStatus.STOPPED, jobExec.getBatchStatus()); - assertObjEquals("2:"+FORCE_STOP_EXITSTATUS, jobExec.getExitStatus()); - - Properties restartJobParameters = new Properties(jobParameters); - restartJobParameters.setProperty("stop.job.after.this.step", "None"); - - TestUtil.logMsg("Invoke restartJobAndWaitForResult"); - JobExecution jobExec2 = jobOp.restartJobAndWaitForResult(jobExec.getExecutionId(), restartJobParameters); - - assertObjEquals("3:flow1step2_CONTINUE", jobExec2.getExitStatus()); - assertObjEquals(BatchStatus.COMPLETED, jobExec2.getBatchStatus()); - } catch(Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testDeciderTransitionFromFlowAndAllowRestart - * @assertion: 1. Tests that the exit return value of Decider#decide is set as the value of the job's exit status. - * 2. Tests that the decider re-executes on a restart and the decide() method is passed the - * StepExecution corresponding to the new, restarted execution (not the original execution). - * (See Sec. 10.8 Restart Processing) - * 3. Tests that when a flow is followed by a decision, that the decision element's Decider#decide - * will be passed the StepExecution of the last step in the preceding flow. - * @test_Strategy: 1. The exit status is not set via JobContext#setExitStatus or other means, but is asserted to - * be equal to the return value of the last decision (i.e. Decider#decide). - * 2. Steps are configured with allow-start-if-complete = true. Job parameter is used to vary - * exit status on original vs. restart execution and, on restart, the - * StepExecution exit status is asserted to be the one on the restarted execution. - * JobContext transient user data is used to assert the correct number of decider invocations have - * been performed. - */ - - - public void testDeciderTransitionFromFlowAndAllowRestart() throws Fault { - - String METHOD = "testDeciderTransitionFromFlowAndAllowRestart"; -TestUtil.logTrace(METHOD); - - - try { - TestUtil.logMsg("Build job parameters."); - Properties jobParameters = new Properties(); - jobParameters.setProperty("step.complete.but.force.job.stopped.status", FORCE_STOP_EXITSTATUS); - jobParameters.setProperty("step.complete.but.force.job.failed.status", FORCE_FAIL_EXITSTATUS); - - jobParameters.setProperty("allow.start.if.complete", "true"); - - jobParameters.setProperty("stop.job.after.this.step", "flow1step2"); - jobParameters.setProperty("fail.job.after.this.step", "None"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("decider_transitions_on_restart", jobParameters); - - assertObjEquals(BatchStatus.STOPPED, jobExec.getBatchStatus()); - assertObjEquals("3:"+FORCE_STOP_EXITSTATUS, jobExec.getExitStatus()); - - Properties restartJobParameters = new Properties(jobParameters); - restartJobParameters.setProperty("stop.job.after.this.step", "None"); - - TestUtil.logMsg("Invoke restartJobAndWaitForResult"); - JobExecution jobExec2 = jobOp.restartJobAndWaitForResult(jobExec.getExecutionId(), restartJobParameters); - - assertObjEquals("3:flow1step2_CONTINUE", jobExec2.getExitStatus()); - assertObjEquals(BatchStatus.COMPLETED, jobExec2.getBatchStatus()); - } catch(Exception e) { - handleException(METHOD, e); - } - } - - - - /* - * @testName: testDeciderTransitionFromSplitAndAllowRestart - * @assertion: 1. Tests that the exit return value of Decider#decide is set as the value of the job's exit status. - * 2. Tests that the decider re-executes on a restart and the decide() method is passed StepExecution(s) - * corresponding to the new, restarted execution (not the original execution). - * (See Sec. 10.8 Restart Processing) - * 3. Tests that when a split is followed by a decision, that the decision element's Decider#decide - * will be passed the StepExecution(s) of each of the last steps of the member flows in the preceding split. - * @test_Strategy: 1. The exit status is not set via JobContext#setExitStatus or other means, but is asserted to - * be equal to the return value of the last decision (i.e. Decider#decide). - * 2. Steps are configured with allow-start-if-complete = true. Job parameter is used to vary - * exit status on original vs. restart execution and, on restart, the - * StepExecution exit status is asserted to be the one on the restarted execution. - * JobContext transient user data is used to assert the correct number of decider invocations have - * been performed. - * 3. NOTE: TODO for future - Perhaps the strategy in asserting that EACH StepExecution is passed should be - * tightened. We could go further to assert that the full list of StepExecution(s) is what we'd expect. - */ - - - public void testDeciderTransitionFromSplitAndAllowRestart() throws Fault { - - String METHOD = "testDeciderTransitionFromSplitAndAllowRestart"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Build job parameters."); - - Properties jobParameters = new Properties(); - jobParameters.setProperty("step.complete.but.force.job.stopped.status", FORCE_STOP_EXITSTATUS); - jobParameters.setProperty("step.complete.but.force.job.failed.status", FORCE_FAIL_EXITSTATUS); - - jobParameters.setProperty("allow.start.if.complete", "true"); - - jobParameters.setProperty("stop.job.after.this.step", "split1flow1step2"); - jobParameters.setProperty("stop.job.after.this.step2", "split1flow2step2"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("decider_transitions_from_split_on_restart", jobParameters); - - assertObjEquals(BatchStatus.STOPPED, jobExec.getBatchStatus()); - assertObjEquals("4:"+FORCE_STOP_EXITSTATUS, jobExec.getExitStatus()); - - Properties restartJobParameters = new Properties(jobParameters); - restartJobParameters.setProperty("stop.job.after.this.step", "None"); - jobParameters.setProperty("stop.job.after.this.step2", "None"); - - TestUtil.logMsg("Invoke restartJobAndWaitForResult"); - JobExecution jobExec2 = jobOp.restartJobAndWaitForResult(jobExec.getExecutionId(), restartJobParameters); - - assertObjEquals("4:split1flow2step2_CONTINUE", jobExec2.getExitStatus()); - assertObjEquals(BatchStatus.COMPLETED, jobExec2.getBatchStatus()); - } catch(Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testDeciderTransitionFromStepAndAllowRestartFalse - * @assertion: 1. Tests that the exit return value of Decider#decide is set as the value of the job's exit status. - * 2. Tests that the decider re-executes on a restart and the decide() method is passed the - * StepExecution corresponding to the original execution (since the step doesn't re-execute on the - * new, restart execution), with the original StepExecution's exit status. - * (See Sec. 10.8 Restart Processing) - * @test_Strategy: 1. The exit status is not set via JobContext#setExitStatus or other means, but is asserted to - * be equal to the return value of the last decision (i.e. Decider#decide). - * 2. Allow-start-if-complete for the steps is set to "false". (This is where the "False" in the - * test method name comes from). Decision is configured to expect the StepExecution exitStatus - * from the original execution, and the test will fail if not. I.e. the exit status from the earlier - * execution is confirmed to have been persisted. Job parameter is used to allow Decider#decide - * to return a different result on restart. - * JobContext transient user data is used to assert the correct number of decider invocations have - * been performed. - */ - - - public void testDeciderTransitionFromStepAndAllowRestartFalse() throws Fault { - - String METHOD = "testDeciderTransitionFromStepAndAllowRestartFalse"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Build job parameters."); - - Properties jobParameters = new Properties(); - jobParameters.setProperty("step.complete.but.force.job.stopped.status", FORCE_STOP_EXITSTATUS); - jobParameters.setProperty("step.complete.but.force.job.failed.status", FORCE_FAIL_EXITSTATUS); - - jobParameters.setProperty("allow.start.if.complete", "false"); - - jobParameters.setProperty("stop.job.after.this.step", "step1"); - jobParameters.setProperty("fail.job.after.this.step", "None"); - - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("decider_transitions_on_restart", jobParameters); - - assertObjEquals(BatchStatus.STOPPED, jobExec.getBatchStatus()); - assertObjEquals("1:"+FORCE_STOP_EXITSTATUS, jobExec.getExitStatus()); - - Properties restartJobParameters = new Properties(jobParameters); - restartJobParameters.setProperty("stop.job.after.this.step", "None"); - restartJobParameters.setProperty("is.restart", "true"); - - TestUtil.logMsg("Invoke restartJobAndWaitForResult"); - JobExecution jobExec2 = jobOp.restartJobAndWaitForResult(jobExec.getExecutionId(), restartJobParameters); - - assertObjEquals("3:flow1step2_CONTINUE", jobExec2.getExitStatus()); - assertObjEquals(BatchStatus.COMPLETED, jobExec2.getBatchStatus()); - } catch(Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testDeciderTransitionFromStepWithinFlowAndAllowRestartFalse - * @assertion: 1. Tests that the exit return value of Decider#decide is set as the value of the job's exit status. - * 2. Tests that the decider re-executes on a restart and the decide() method is passed the - * StepExecution corresponding to the original execution (since the step doesn't re-execute on the - * new, restart execution), with the original StepExecution's exit status. - * (See Sec. 10.8 Restart Processing) - * 3. Tests that a decision within a flow can terminate the top-level job through appropriate transition elements - * @test_Strategy: 1. The exit status is not set via JobContext#setExitStatus or other means, but is asserted to - * be equal to the return value of the last decision (i.e. Decider#decide). - * 2. Allow-start-if-complete for the steps is set to "false". (This is where the "False" in the - * test method name comes from). Decision is configured to expect the StepExecution exitStatus - * from the original execution, and the test will fail if not. I.e. the exit status from the earlier - * execution is confirmed to have been persisted. Job parameter is used to allow Decider#decide - * to return a different result on restart. - * JobContext transient user data is used to assert the correct number of decider invocations have - * been performed. - * 3. A decision within a flow is configured to stop (based on exit status matching against a element). - */ - - - public void testDeciderTransitionFromStepWithinFlowAndAllowRestartFalse() throws Fault { - - String METHOD = "testDeciderTransitionFromStepWithinFlowAndAllowRestartFalse"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Build job parameters."); - - Properties jobParameters = new Properties(); - jobParameters.setProperty("step.complete.but.force.job.stopped.status", FORCE_STOP_EXITSTATUS); - jobParameters.setProperty("step.complete.but.force.job.failed.status", FORCE_FAIL_EXITSTATUS); - - jobParameters.setProperty("allow.start.if.complete", "false"); - - jobParameters.setProperty("stop.job.after.this.step", "flow1step1"); - jobParameters.setProperty("fail.job.after.this.step", "None"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("decider_transitions_on_restart", jobParameters); - - assertObjEquals(BatchStatus.STOPPED, jobExec.getBatchStatus()); - assertObjEquals("2:"+FORCE_STOP_EXITSTATUS, jobExec.getExitStatus()); - - Properties restartJobParameters = new Properties(jobParameters); - restartJobParameters.setProperty("stop.job.after.this.step", "None"); - restartJobParameters.setProperty("is.restart", "true"); - - TestUtil.logMsg("Invoke restartJobAndWaitForResult"); - JobExecution jobExec2 = jobOp.restartJobAndWaitForResult(jobExec.getExecutionId(), restartJobParameters); - - assertObjEquals("3:flow1step2_CONTINUE", jobExec2.getExitStatus()); - assertObjEquals(BatchStatus.COMPLETED, jobExec2.getBatchStatus()); - } catch(Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testDeciderTransitionFromFlowAndAllowRestartFalse - * @assertion: 1. Tests that the exit return value of Decider#decide is set as the value of the job's exit status. - * 2. Tests that the decider re-executes on a restart and the decide() method is passed the - * StepExecution corresponding to the original execution (since the step doesn't re-execute on the - * new, restart execution), with the original StepExecution's exit status. - * (See Sec. 10.8 Restart Processing) - * 3. Tests that when a flow is followed by a decision, that the decision element's Decider#decide - * will be passed the StepExecution of the last step in the preceding flow. - * @test_Strategy: 1. The exit status is not set via JobContext#setExitStatus or other means, but is asserted to - * be equal to the return value of the last decision (i.e. Decider#decide). - * 2. Allow-start-if-complete for the steps is set to "false". (This is where the "False" in the - * test method name comes from). Decision is configured to expect the StepExecution exitStatus - * from the original execution, and the test will fail if not. I.e. the exit status from the earlier - * execution is confirmed to have been persisted. Job parameter is used to allow Decider#decide - * to return a different result on restart. - * JobContext transient user data is used to assert the correct number of decider invocations have - * been performed. - */ - - - public void testDeciderTransitionFromFlowAndAllowRestartFalse() throws Fault { - - String METHOD = "testDeciderTransitionFromFlowAndAllowRestartFalse"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Build job parameters."); - - Properties jobParameters = new Properties(); - jobParameters.setProperty("step.complete.but.force.job.stopped.status", FORCE_STOP_EXITSTATUS); - jobParameters.setProperty("step.complete.but.force.job.failed.status", FORCE_FAIL_EXITSTATUS); - - jobParameters.setProperty("allow.start.if.complete", "false"); - - jobParameters.setProperty("stop.job.after.this.step", "flow1step2"); - jobParameters.setProperty("fail.job.after.this.step", "None"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("decider_transitions_on_restart", jobParameters); - - assertObjEquals(BatchStatus.STOPPED, jobExec.getBatchStatus()); - assertObjEquals("3:"+FORCE_STOP_EXITSTATUS, jobExec.getExitStatus()); - - Properties restartJobParameters = new Properties(jobParameters); - restartJobParameters.setProperty("stop.job.after.this.step", "None"); - restartJobParameters.setProperty("is.restart", "true"); - - TestUtil.logMsg("Invoke restartJobAndWaitForResult"); - JobExecution jobExec2 = jobOp.restartJobAndWaitForResult(jobExec.getExecutionId(), restartJobParameters); - - assertObjEquals("3:flow1step2_CONTINUE", jobExec2.getExitStatus()); - assertObjEquals(BatchStatus.COMPLETED, jobExec2.getBatchStatus()); - } catch(Exception e) { - handleException(METHOD, e); - } - } - - - /* - * @testName: testDeciderTransitionFromSplitAndAllowRestartFalse - * @assertion: 1. Tests that the exit return value of Decider#decide is set as the value of the job's exit status. - * 2. Tests that the decider re-executes on a restart and the decide() method is passed the - * StepExecution corresponding to the original execution (since the step doesn't re-execute on the - * new, restart execution), with the original StepExecution's exit status. - * (See Sec. 10.8 Restart Processing) - * 3. Tests that when a split is followed by a decision, that the decision element's Decider#decide - * will be passed the StepExecution(s) of each of the last steps of the member flows in the preceding split. - * @test_Strategy: 1. The exit status is not set via JobContext#setExitStatus or other means, but is asserted to - * be equal to the return value of the last decision (i.e. Decider#decide). - * 2. Allow-start-if-complete for the steps is set to "false". (This is where the "False" in the - * test method name comes from). Decision is configured to expect the StepExecution exitStatus - * from the original execution, and the test will fail if not. I.e. the exit status from the earlier - * execution is confirmed to have been persisted. Job parameter is used to allow Decider#decide - * to return a different result on restart. - * JobContext transient user data is used to assert the correct number of decider invocations have - * been performed. - * 3. NOTE: TODO for future - Perhaps the strategy in asserting that EACH StepExecution is passed should be - * tightened. We could go further to assert that the full list of StepExecution(s) is what we'd expect. - */ - - - public void testDeciderTransitionFromSplitAndAllowRestartFalse() throws Fault { - - String METHOD = "testDeciderTransitionFromSplitAndAllowRestartFalse"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Build job parameters."); - - Properties jobParameters = new Properties(); - jobParameters.setProperty("step.complete.but.force.job.stopped.status", FORCE_STOP_EXITSTATUS); - jobParameters.setProperty("step.complete.but.force.job.failed.status", FORCE_FAIL_EXITSTATUS); - - jobParameters.setProperty("allow.start.if.complete", "false"); - - jobParameters.setProperty("stop.job.after.this.step", "split1flow1step2"); - jobParameters.setProperty("stop.job.after.this.step2", "split1flow2step2"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("decider_transitions_from_split_on_restart", jobParameters); - - assertObjEquals(BatchStatus.STOPPED, jobExec.getBatchStatus()); - assertObjEquals("4:"+FORCE_STOP_EXITSTATUS, jobExec.getExitStatus()); - - Properties restartJobParameters = new Properties(jobParameters); - restartJobParameters.setProperty("stop.job.after.this.step", "None"); - restartJobParameters.setProperty("is.restart", "true"); - - TestUtil.logMsg("Invoke restartJobAndWaitForResult"); - JobExecution jobExec2 = jobOp.restartJobAndWaitForResult(jobExec.getExecutionId(), restartJobParameters); - - assertObjEquals("4:split1flow2step2_CONTINUE", jobExec2.getExitStatus()); - assertObjEquals(BatchStatus.COMPLETED, jobExec2.getBatchStatus()); - } catch(Exception e) { - handleException(METHOD, e); - } - } - - - - private static void handleException(String methodName, Exception e) throws Fault { -TestUtil.logErr("Caught exception: " + e.getMessage()); -TestUtil.printStackTrace(e); -throw new Fault(methodName + " failed", e);} - -} diff --git a/src/com/ibm/jbatch/tck/tests/jslxml/ExecuteTests.java b/src/com/ibm/jbatch/tck/tests/jslxml/ExecuteTests.java deleted file mode 100644 index a8ef69605b..0000000000 --- a/src/com/ibm/jbatch/tck/tests/jslxml/ExecuteTests.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.tests.jslxml; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import static com.ibm.jbatch.tck.utils.AssertionUtils.assertObjEquals; - -import java.util.Properties; -import java.util.logging.Logger; - -import jakarta.batch.runtime.BatchStatus; -import jakarta.batch.runtime.JobExecution; - -import com.ibm.jbatch.tck.artifacts.specialized.BatchletUsingStepContextImpl; -import com.ibm.jbatch.tck.utils.JobOperatorBridge; - - - - - - -public class ExecuteTests extends ServiceEETest { - - private final static Logger logger = Logger.getLogger(ExecuteTests.class.getName()); - private static JobOperatorBridge jobOp = null; - - - public static void setup(String[] args, Properties props) throws Fault { - String METHOD = "setup"; -TestUtil.logTrace(METHOD); - - try { - jobOp = new JobOperatorBridge(); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - - - public static void setUp() throws Fault { - jobOp = new JobOperatorBridge(); - } - - /* cleanup */ - public void cleanup() - { - - } - - private static void handleException(String methodName, Exception e) throws Fault { -TestUtil.logErr("Caught exception: " + e.getMessage()); -TestUtil.printStackTrace(e); -throw new Fault(methodName + " failed", e);} - - /* - * @testName: testMyStepContextBatchlet - * @assertion: FIXME - * @test_Strategy: FIXME - */ - - - public void testMyStepContextBatchlet() throws Fault { - - String METHOD = "testMyStepContextBatchlet"; -TestUtil.logTrace(METHOD); - - try { - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - - JobExecution jobExec = jobOp.startJobAndWaitForResult("test_batchlet_stepCtx"); - - TestUtil.logMsg("EXPECTED JobExecution getExitStatus()="+BatchletUsingStepContextImpl.GOOD_JOB_EXIT_STATUS); - TestUtil.logMsg("ACTUAL JobExecution getExitStatus()="+jobExec.getExitStatus()); - TestUtil.logMsg("EXPECTED JobExecution getBatchStatus()=COMPLETED"); - TestUtil.logMsg("ACTUAL JobExecution getBatchStatus()="+jobExec.getBatchStatus()); - assertObjEquals(BatchletUsingStepContextImpl.GOOD_JOB_EXIT_STATUS, jobExec.getExitStatus()); - assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - - } - -} diff --git a/src/com/ibm/jbatch/tck/tests/jslxml/ExecutionTests.java b/src/com/ibm/jbatch/tck/tests/jslxml/ExecutionTests.java deleted file mode 100644 index cdc10c169a..0000000000 --- a/src/com/ibm/jbatch/tck/tests/jslxml/ExecutionTests.java +++ /dev/null @@ -1,386 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.tests.jslxml; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import static com.ibm.jbatch.tck.utils.AssertionUtils.assertObjEquals; - - -import java.util.Properties; -import java.util.logging.Logger; - -import jakarta.batch.runtime.BatchStatus; -import jakarta.batch.runtime.JobExecution; - -import com.ibm.jbatch.tck.utils.JobOperatorBridge; - - - - - - - - -public class ExecutionTests extends ServiceEETest { - - private final static Logger logger = Logger.getLogger(ExecutionTests.class.getName()); - - private static JobOperatorBridge jobOp; - - public static void setup(String[] args, Properties props) throws Fault { - String METHOD = "setup"; -TestUtil.logTrace(METHOD); - - try { - jobOp = new JobOperatorBridge(); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - - - public static void setUp() throws Fault { - jobOp = new JobOperatorBridge(); - } - - - public static void cleanup() throws Fault { - } - - private void begin(String str) { - TestUtil.logMsg("Begin test method: " + str); - } - - /* - * @testName: testInvokeJobWithOneBatchletStep - * @assertion: FIXME - * @test_Strategy: FIXME - */ - - - public void testInvokeJobWithOneBatchletStep() throws Fault { - String METHOD = "testInvokeJobWithOneBatchletStep"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_batchlet_1step.xml"); - - TestUtil.logMsg("Invoking startJobAndWaitForResult for Execution #1"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_batchlet_1step"); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+jobExec.getBatchStatus()); - assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testInvokeJobWithTwoStepSequenceOfBatchlets - * @assertion: FIXME - * @test_Strategy: FIXME - */ - - - public void testInvokeJobWithTwoStepSequenceOfBatchlets() throws Fault { - String METHOD = "testInvokeJobWithTwoStepSequenceOfBatchlets"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_batchlet_2steps.xml"); - - TestUtil.logMsg("Invoking startJobAndWaitForResult for Execution #1"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_batchlet_2steps"); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+jobExec.getBatchStatus()); - assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testInvokeJobWithFourStepSequenceOfBatchlets - * @assertion: FIXME - * @test_Strategy: FIXME - */ - - - public void testInvokeJobWithFourStepSequenceOfBatchlets() throws Fault { - String METHOD = "testInvokeJobWithFourStepSequenceOfBatchlets"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_batchlet_4steps.xml"); - - TestUtil.logMsg("Invoking startJobAndWaitForResult for Execution #1"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_batchlet_4steps"); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+jobExec.getBatchStatus()); - assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testInvokeJobWithNextElement - * @assertion: FIXME - * @test_Strategy: FIXME - */ - - - public void testInvokeJobWithNextElement() throws Fault { - String METHOD = "testInvokeJobWithNextElement"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_batchlet_nextElement.xml"); - - TestUtil.logMsg("Invoking startJobAndWaitForResult for Execution #1"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_batchlet_nextElement"); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+jobExec.getBatchStatus()); - assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testInvokeJobWithFailElement - * @assertion: FIXME - * @test_Strategy: FIXME - */ - - - public void testInvokeJobWithFailElement() throws Fault { - String METHOD = "testInvokeJobWithFailElement"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_batchlet_failElement.xml"); - - TestUtil.logMsg("Invoking startJobAndWaitForResult for Execution #1"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_batchlet_failElement"); - - TestUtil.logMsg("execution #1 JobExecution getExitStatus()="+jobExec.getExitStatus()); - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+jobExec.getBatchStatus()); - assertObjEquals("TEST_FAIL", jobExec.getExitStatus()); - assertObjEquals(BatchStatus.FAILED, jobExec.getBatchStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testInvokeJobWithStopElement - * @assertion: FIXME - * @test_Strategy: FIXME - */ - - - public void testInvokeJobWithStopElement() throws Fault { - String METHOD = "testInvokeJobWithStopElement"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_batchlet_stopElement.xml"); - - TestUtil.logMsg("Invoking startJobAndWaitForResult for Execution #1"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_batchlet_stopElement"); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+jobExec.getBatchStatus()); - assertObjEquals(BatchStatus.STOPPED, jobExec.getBatchStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testInvokeJobWithEndElement - * @assertion: FIXME - * @test_Strategy: FIXME - */ - - - public void testInvokeJobWithEndElement() throws Fault { - String METHOD = "testInvokeJobWithEndElement"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_batchlet_endElement.xml"); - - TestUtil.logMsg("Invoking startJobAndWaitForResult for Execution #1"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_batchlet_endElement"); - - TestUtil.logMsg("execution #1 JobExecution getExitStatus()="+jobExec.getExitStatus()); - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+jobExec.getBatchStatus()); - assertObjEquals("TEST_ENDED", jobExec.getExitStatus()); - assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testInvokeJobSimpleChunk - * @assertion: FIXME - * @test_Strategy: FIXME - */ - - - public void testInvokeJobSimpleChunk() throws Fault { - String METHOD = "testInvokeJobSimpleChunk"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_chunk_simple.xml"); - - TestUtil.logMsg("Invoking startJobAndWaitForResult for Execution #1"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_chunk_simple"); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+jobExec.getBatchStatus()); - assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * testName: testInvokeJobChunkWithFullAttributes - * @assertion: FIXME - * @test_Strategy: FIXME - * Disabling per Bug 5379 (https://java.net/bugzilla/show_bug.cgi?id=5379) - * New tracking Bug 26611303 - */ - - - - public void testInvokeJobChunkWithFullAttributes() throws Fault { - String METHOD = "testInvokeJobChunkWithFullAttributes"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_chunk_full_attributes.xml"); - - TestUtil.logMsg("Invoking startJobAndWaitForResult for Execution #1"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_chunk_full_attributes"); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+jobExec.getBatchStatus()); - assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testInvokeJobUsingTCCL - * @assertion: Section 10.5 Batch Artifact loading - * @test_Strategy: Implementation should attempt to load artifact using Thread Context Class Loader if implementation specific - * and archive loading are unable to find the specified artifact. - */ - - - public void testInvokeJobUsingTCCL() throws Fault { - String METHOD = "testInvokeJobUsingTCCL"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Run job using job XML file: test_artifact_load_classloader"); - - TestUtil.logMsg("Invoking startJobAndWaitForResult for Execution #1"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("test_artifact_load_classloader"); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+jobExec.getBatchStatus()); - assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testCheckpoint - * @assertion: FIXME - * @test_Strategy: FIXME - */ - - - public void testCheckpoint() throws Fault { - String METHOD = "testCheckpoint"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_chunk_checkpoint.xml"); - - TestUtil.logMsg("Invoking startJobAndWaitForResult for Execution #1"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_chunk_checkpoint"); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+jobExec.getBatchStatus()); - assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testSimpleFlow - * @assertion: FIXME - * @test_Strategy: FIXME - */ - - - public void testSimpleFlow() throws Fault { - String METHOD = "testSimpleFlow"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_flow_batchlet_4steps.xml"); - - TestUtil.logMsg("Invoking startJobAndWaitForResult for Execution #1"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_flow_batchlet_4steps"); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+jobExec.getBatchStatus()); - assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - - private static void handleException(String methodName, Exception e) throws Fault { -TestUtil.logErr("Caught exception: " + e.getMessage()); -TestUtil.printStackTrace(e); -throw new Fault(methodName + " failed", e);} - -} diff --git a/src/com/ibm/jbatch/tck/tests/jslxml/FlowTransitioningTests.java b/src/com/ibm/jbatch/tck/tests/jslxml/FlowTransitioningTests.java deleted file mode 100644 index e3578c7439..0000000000 --- a/src/com/ibm/jbatch/tck/tests/jslxml/FlowTransitioningTests.java +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.tests.jslxml; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import static com.ibm.jbatch.tck.utils.AssertionUtils.assertWithMessage; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.Properties; - -import jakarta.batch.operations.JobStartException; -import jakarta.batch.runtime.BatchStatus; -import jakarta.batch.runtime.JobExecution; - - - - - - - -import com.ibm.jbatch.tck.utils.JobOperatorBridge; - -public class FlowTransitioningTests extends ServiceEETest { - - private JobOperatorBridge jobOp = null; - - /** - * @testName: testFlowTransitionToStep - * @assertion: Section 5.3 Flow - * @test_Strategy: 1. setup a job consisting of one flow (w/ 3 steps) and one step - * 2. start job - * 3. create a list of step id's as they are processed - * 4. return the list from step 3 as job exit status - * 5. compare that list to our transition list - * 6. verify that in fact we transition from each step within the flow, then to the flow "next" step - * - * @throws JobStartException - * @throws FileNotFoundException - * @throws IOException - * @throws InterruptedException - */ - - public void testFlowTransitionToStep() throws Fault { - - String METHOD = "testFlowTransitionToStep"; -TestUtil.logTrace(METHOD); - - try { - - String[] transitionList = {"flow1step1", "flow1step2", "flow1step3", "step1"}; - TestUtil.logMsg("starting job"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("flow_transition_to_step", null); - TestUtil.logMsg("Job Status = " + jobExec.getBatchStatus()); - - String[] jobTransitionList = jobExec.getExitStatus().split(","); - assertWithMessage("transitioned to exact number of steps", transitionList.length, jobTransitionList.length); - for (int i = 0; i < jobTransitionList.length; i++) { - assertWithMessage("Flow transitions", transitionList[i], jobTransitionList[i].trim()); - } - - assertWithMessage("Job completed", BatchStatus.COMPLETED, jobExec.getBatchStatus()); - TestUtil.logMsg("Job completed"); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /** - * @testName: testFlowTransitionToStepOutOfScope - * @assertion: Section 5.3 Flow - * @test_Strategy: 1. setup a job consisting of one flow (w/ 3 steps) and one step - * 2. start job - * 3. this job should fail because the flow step flow1step2 next to outside the flow - * (Alternatively, the implementation may choose to validate and prevent this from starting, - * by throwing a JobStartException). - * - * - * - * - * - * - * - * - * - * - * - * - - * - * - * - * - * @throws JobStartException - * @throws FileNotFoundException - * @throws IOException - * @throws InterruptedException - */ - - - public void testFlowTransitionToStepOutOfScope() throws Fault { - - String METHOD = " testFlowTransitionToStepOutOfScope"; -TestUtil.logTrace(METHOD); - - try { - boolean seenException = false; - TestUtil.logMsg("starting job"); - JobExecution jobExec = null; - try { - jobExec = jobOp.startJobAndWaitForResult("flow_transition_to_step_out_of_scope", null); - } catch (JobStartException e) { - TestUtil.logMsg("Caught JobStartException: " + e.getLocalizedMessage()); - seenException = true; - } - - // If we caught an exception we'd expect that a JobExecution would not have been created, - // though we won't validate that it wasn't created. - - // If we didn't catch an exception that we require that the implementation fail the job execution. - if (!seenException) { - TestUtil.logMsg("Didn't catch JobStartException, Job Batch Status = " + jobExec.getBatchStatus()); - assertWithMessage("Job should have failed because of out of scope execution elements.", - BatchStatus.FAILED, jobExec.getBatchStatus()); - } - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /** - * @testName: testFlowTransitionToDecision - * @assertion: Section 5.3 Flow - * @test_Strategy: 1. setup a job consisting of one flow (w/ 3 steps) and one decision - * 2. start job - * 3. flow will transition to decider which will change the exit status - * 4. compare that the exit status set by the decider matches that of the job - * - * @throws JobStartException - * @throws FileNotFoundException - * @throws IOException - * @throws InterruptedException - */ - - public void testFlowTransitionToDecision() throws Fault { - - String METHOD = "testFlowTransitionToDecision"; -TestUtil.logTrace(METHOD); - - try { - String exitStatus = "ThatsAllFolks"; - // based on our decider exit status - /* - - - - */ - TestUtil.logMsg("starting job"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("flow_transition_to_decision", null); - TestUtil.logMsg("Job Status = " + jobExec.getBatchStatus()); - - assertWithMessage("Job Exit Status is from decider", exitStatus, jobExec.getExitStatus()); - assertWithMessage("Job completed", BatchStatus.COMPLETED, jobExec.getBatchStatus()); - TestUtil.logMsg("Job completed"); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /** - * @testName: testFlowTransitionWithinFlow - * @assertion: Section 5.3 Flow - * @test_Strategy: 1. setup a job consisting of one flow (w/ 3 steps and 1 decision) - * 2. start job - * 3. within the flow step1 will transition to decider then to step2 and finally step3. - * 4. create a list of step id's as they are processed - * 4. return the list from step 3 as job exit status - * 5. compare that list to our transition list - * 6. verify that in fact we transition from each step within the flow, then to the flow "next" step - * - * @throws JobStartException - * @throws FileNotFoundException - * @throws IOException - * @throws InterruptedException - */ - - public void testFlowTransitionWithinFlow() throws Fault { - - String METHOD = "testFlowTransitionWithinFlow"; -TestUtil.logTrace(METHOD); - - try { - String[] transitionList = {"flow1step1", "flow1step2", "flow1step3"}; - TestUtil.logMsg("starting job"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("flow_transition_within_flow", null); - TestUtil.logMsg("Job Status = " + jobExec.getBatchStatus()); - - String[] jobTransitionList = jobExec.getExitStatus().split(","); - assertWithMessage("transitioned to exact number of steps", transitionList.length, jobTransitionList.length); - for (int i = 0; i < jobTransitionList.length; i++) { - assertWithMessage("Flow transitions", transitionList[i], jobTransitionList[i].trim()); - } - - assertWithMessage("Job completed", BatchStatus.COMPLETED, jobExec.getBatchStatus()); - TestUtil.logMsg("Job completed"); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - private static void handleException(String methodName, Exception e) throws Fault { -TestUtil.logErr("Caught exception: " + e.getMessage()); -TestUtil.printStackTrace(e); -throw new Fault(methodName + " failed", e);} - - public void setup(String[] args, Properties props) throws Fault { - - String METHOD = "setup"; -TestUtil.logTrace(METHOD); - - try { - jobOp = new JobOperatorBridge(); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* cleanup */ - public void cleanup() - { - - } - - - public void beforeTest() throws ClassNotFoundException { - jobOp = new JobOperatorBridge(); - } - - - public void afterTest() { - jobOp = null; - } -} diff --git a/src/com/ibm/jbatch/tck/tests/jslxml/JobAttributeRestartTests.java b/src/com/ibm/jbatch/tck/tests/jslxml/JobAttributeRestartTests.java deleted file mode 100644 index 904c12f08b..0000000000 --- a/src/com/ibm/jbatch/tck/tests/jslxml/JobAttributeRestartTests.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.tests.jslxml; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import static com.ibm.jbatch.tck.utils.AssertionUtils.assertWithMessage; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.Properties; - -import jakarta.batch.operations.JobRestartException; -import jakarta.batch.operations.JobStartException; -import jakarta.batch.operations.NoSuchJobException; -import jakarta.batch.operations.NoSuchJobExecutionException; -import jakarta.batch.runtime.BatchStatus; -import jakarta.batch.runtime.JobExecution; - -import com.ibm.jbatch.tck.utils.JobOperatorBridge; - - - - - - - -public class JobAttributeRestartTests extends ServiceEETest { - - private JobOperatorBridge jobOp = null; - - private long TIMEOUT = 5000L; - - /** - * @testName: testJobAttributeRestartableTrue - * @assertion: Section 5.1 job attribute restartable - * @test_Strategy: set restartable true should allow job to restart - * - * @throws JobStartException - * @throws FileNotFoundException - * @throws IOException - * @throws InterruptedException - * @throws JobRestartException - * @throws NoSuchJobException - * @throws NoSuchJobExecutionException - * @throws JobInstanceAlreadyCompleteException - */ - - public void testJobAttributeRestartableTrue() throws Fault { - - String METHOD = "testJobAttributeRestartableTrue"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("starting job"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - jobParams.put("execution.number", "1"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_attributes_restart_true_test", jobParams); - - TestUtil.logMsg("Job Status = " + jobExec.getBatchStatus()); - assertWithMessage("Job failed ", BatchStatus.FAILED, jobExec.getBatchStatus()); - - TestUtil.logMsg("restarting job"); - Properties restartParams = new Properties(); - TestUtil.logMsg("execution.number=2"); - restartParams.put("execution.number", "2"); - JobExecution newJobExec = jobOp.restartJobAndWaitForResult(jobExec.getExecutionId(), restartParams); - - TestUtil.logMsg("Job Status = " + newJobExec.getBatchStatus()); - assertWithMessage("Job completed", BatchStatus.COMPLETED, newJobExec.getBatchStatus()); - TestUtil.logMsg("job completed"); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - - - private static void handleException(String methodName, Exception e) throws Fault { -TestUtil.logErr("Caught exception: " + e.getMessage()); -TestUtil.printStackTrace(e); -throw new Fault(methodName + " failed", e);} - - public void setup(String[] args, Properties props) throws Fault { - - String METHOD = "setup"; -TestUtil.logTrace(METHOD); - - try { - jobOp = new JobOperatorBridge(); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* cleanup */ - public void cleanup() - { - - } - - - public void beforeTest() throws ClassNotFoundException { - jobOp = new JobOperatorBridge(); - } - - - public void afterTest() { - jobOp = null; - } - -} diff --git a/src/com/ibm/jbatch/tck/tests/jslxml/JobExecutableSequenceTests.java b/src/com/ibm/jbatch/tck/tests/jslxml/JobExecutableSequenceTests.java deleted file mode 100644 index faf6df01bb..0000000000 --- a/src/com/ibm/jbatch/tck/tests/jslxml/JobExecutableSequenceTests.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.tests.jslxml; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import static com.ibm.jbatch.tck.utils.AssertionUtils.assertWithMessage; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.Properties; - -import jakarta.batch.operations.JobStartException; -import jakarta.batch.runtime.BatchStatus; -import jakarta.batch.runtime.JobExecution; - - - - - - - -import com.ibm.jbatch.tck.utils.JobOperatorBridge; - -public class JobExecutableSequenceTests extends ServiceEETest { - - private JobOperatorBridge jobOp = null; - - /** - * @testName: testJobExecutableSequenceToUnknown - * @assertion: Section 5.3 Flow - * @test_Strategy: 1. setup a job consisting of 3 steps (step1 next to step2, step2 next to unknown, step3 unreachable - * 2. start job - * 3. job should fail because it shouldn't be able to transition to unknown - * - * @throws JobStartException - * @throws FileNotFoundException - * @throws IOException - * @throws InterruptedException - */ - - - public void testJobExecutableSequenceToUnknown() throws Fault { - - String METHOD = "testJobExecutableSequenceToUnknown"; -TestUtil.logTrace(METHOD); - - try { - - TestUtil.logMsg("starting job"); - JobExecution jobExec = null; - boolean seenException = false; - try { - jobExec = jobOp.startJobAndWaitForResult("job_executable_sequence_invalid", null); - } catch (JobStartException e) { - TestUtil.logMsg("Caught JobStartException: " + e.getLocalizedMessage()); - seenException = true; - } - // If we caught an exception we'd expect that a JobExecution would not have been created, - // though we won't validate that it wasn't created. - // If we didn't catch an exception that we require that the implementation fail the job execution. - if (!seenException) { - TestUtil.logMsg("Didn't catch JobStartException, Job Batch Status = " + jobExec.getBatchStatus()); - assertWithMessage("Job should have failed because of out of scope execution elements.", BatchStatus.FAILED, jobExec.getBatchStatus()); - } - TestUtil.logMsg("job failed"); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - private static void handleException(String methodName, Exception e) throws Fault { -TestUtil.logErr("Caught exception: " + e.getMessage()); -TestUtil.printStackTrace(e); -throw new Fault(methodName + " failed", e);} - - public void setup(String[] args, Properties props) throws Fault { - - String METHOD = "setup"; -TestUtil.logTrace(METHOD); - - try { - jobOp = new JobOperatorBridge(); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* cleanup */ - public void cleanup() - { - - } - - - public void beforeTest() throws ClassNotFoundException { - jobOp = new JobOperatorBridge(); - } - - - public void afterTest() { - jobOp = null; - } -} diff --git a/src/com/ibm/jbatch/tck/tests/jslxml/JobLevelPropertiesTests.java b/src/com/ibm/jbatch/tck/tests/jslxml/JobLevelPropertiesTests.java deleted file mode 100644 index 48372c2725..0000000000 --- a/src/com/ibm/jbatch/tck/tests/jslxml/JobLevelPropertiesTests.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.tests.jslxml; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import static com.ibm.jbatch.tck.utils.AssertionUtils.assertWithMessage; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.Properties; - -import jakarta.batch.runtime.BatchStatus; -import jakarta.batch.runtime.JobExecution; - -import com.ibm.jbatch.tck.utils.JobOperatorBridge; - - - - - - - -public class JobLevelPropertiesTests extends ServiceEETest { - - private JobOperatorBridge jobOp = null; - - private String FOO_VALUE = "bar"; - - /** - * @testName: testJobLevelPropertiesCount - * @assertion: Section 5.1.3 Job Level Properties - * @test_Strategy: set a list of properties to job should add them to the job context properties. - * Also tests that job parameters and other JSL properties (from other levels of nested elements) do - * not appear in JobContext.getProperties(). A naming convention is used rather than counting - * so as not to prevent a runtime from adding some unknown-to-TCK impl-specific properties. - * @throws FileNotFoundException - * @throws IOException - * @throws InterruptedException - */ - - public void testJobLevelPropertiesCount() throws Fault { - - String METHOD = "testJobLevelPropertiesCount"; -TestUtil.logTrace(METHOD); - String SHOULD_BE_UNAVAILABLE_PROP_PREFIX = "com.ibm.jbatch.tck.tests.jslxml.JobLevelPropertiesTests"; - Properties jobParams = new Properties(); - jobParams.put(SHOULD_BE_UNAVAILABLE_PROP_PREFIX + ".parm1", "should.not.appear.in.job.context.properties"); - - try { - TestUtil.logMsg("starting job"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_level_properties_count", jobParams); - - TestUtil.logMsg("Job Status = " + jobExec.getBatchStatus()); - assertWithMessage("Job completed", BatchStatus.COMPLETED, jobExec.getBatchStatus()); - assertWithMessage("Job completed", "VERY GOOD INVOCATION", jobExec.getExitStatus()); - TestUtil.logMsg("job completed"); - - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /** - * @testName: testJobLevelPropertiesPropertyValue - * @assertion: Section 5.1.3 Job Level Properties - * @test_Strategy: set a job property value should equal value set on job context property. - * - * @throws FileNotFoundException - * @throws IOException - * @throws InterruptedException - */ - - public void testJobLevelPropertiesPropertyValue() throws Fault { - - String METHOD = "testJobLevelPropertiesPropertyValue"; -TestUtil.logTrace(METHOD); - - - try { - TestUtil.logMsg("starting job"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_level_properties_value"); - - TestUtil.logMsg("Job Status = " + jobExec.getBatchStatus()); - assertWithMessage("Job completed", BatchStatus.COMPLETED, jobExec.getBatchStatus()); - TestUtil.logMsg("job completed"); - - assertWithMessage("Property value", FOO_VALUE, jobExec.getExitStatus()); - - TestUtil.logMsg("Job batchlet return code is the job property foo value " + FOO_VALUE); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /** - * @testName: testJobLevelPropertiesShouldNotBeAvailableThroughStepContext - * @assertion: Section 5.1.3 Job Level Properties - * @test_Strategy: set a job property value should not be available to step context - * - * @throws InterruptedException - */ - - public void testJobLevelPropertiesShouldNotBeAvailableThroughStepContext() throws Fault { - - String METHOD = "testJobLevelPropertiesShouldNotBeAvailableThroughStepContext"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("starting job"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_level_properties_scope"); - - TestUtil.logMsg("Job Status = " + jobExec.getBatchStatus()); - assertWithMessage("Job completed", BatchStatus.COMPLETED, jobExec.getBatchStatus()); - TestUtil.logMsg("job completed"); - - assertWithMessage("Job Level Property is not available through step context", BatchStatus.COMPLETED.name(), jobExec.getExitStatus()); - TestUtil.logMsg("Job batchlet return code is the job.property read through step context (expected value=COMPLETED) " + jobExec.getExitStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - private static void handleException(String methodName, Exception e) throws Fault { -TestUtil.logErr("Caught exception: " + e.getMessage()); -TestUtil.printStackTrace(e); -throw new Fault(methodName + " failed", e);} - - public void setup(String[] args, Properties props) throws Fault { - - String METHOD = "setup"; -TestUtil.logTrace(METHOD); - - try { - jobOp = new JobOperatorBridge(); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* cleanup */ - public void cleanup() - { - - } - - - public void beforeTest() throws ClassNotFoundException { - jobOp = new JobOperatorBridge(); - - } - - - public void afterTest() { - jobOp = null; - } - -} diff --git a/src/com/ibm/jbatch/tck/tests/jslxml/JobOperatorTests.java b/src/com/ibm/jbatch/tck/tests/jslxml/JobOperatorTests.java deleted file mode 100644 index c2030cb72f..0000000000 --- a/src/com/ibm/jbatch/tck/tests/jslxml/JobOperatorTests.java +++ /dev/null @@ -1,1326 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.tests.jslxml; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import static com.ibm.jbatch.tck.utils.AssertionUtils.assertObjEquals; -import static com.ibm.jbatch.tck.utils.AssertionUtils.assertWithMessage; - -import java.util.List; -import java.util.Properties; -import java.util.logging.Logger; - -import jakarta.batch.operations.JobExecutionAlreadyCompleteException; -import jakarta.batch.operations.JobExecutionIsRunningException; -import jakarta.batch.operations.JobRestartException; -import jakarta.batch.operations.NoSuchJobException; -import jakarta.batch.runtime.BatchStatus; -import jakarta.batch.runtime.JobExecution; -import jakarta.batch.runtime.JobInstance; -import jakarta.batch.runtime.Metric; -import jakarta.batch.runtime.StepExecution; - - - - - - - -import com.ibm.jbatch.tck.utils.JobOperatorBridge; -import com.ibm.jbatch.tck.utils.TCKJobExecutionWrapper; - -public class JobOperatorTests extends ServiceEETest { - - private final static Logger logger = Logger.getLogger(JobOperatorTests.class.getName()); - - private static JobOperatorBridge jobOp; - - public static void setup(String[] args, Properties props) throws Fault { - - String METHOD = "setup"; -TestUtil.logTrace(METHOD); - - try { - jobOp = new JobOperatorBridge(); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* cleanup */ - public void cleanup() - { - - } - - - - public static void setUp() throws Fault { - jobOp = new JobOperatorBridge(); - } - - - public static void tearDown() throws Fault { - } - - private void begin(String str) { - TestUtil.logMsg("Begin test method: " + str); - } - - private static void handleException(String methodName, Exception e) throws Fault { -TestUtil.logErr("Caught exception: " + e.getMessage()); -TestUtil.printStackTrace(e); -throw new Fault(methodName + " failed", e);} - - /* - * @testName: testJobOperatorStart - * - * @assertion: Job Operator - start - * @test_Strategy: start a job that completes successfully with no exceptions thrown. - * @throws JobStartException - */ - - - public void testJobOperatorStart() throws Fault { - - String METHOD = "testJobOperatorStart"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_batchlet_1step.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_batchlet_1step"); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+jobExec.getBatchStatus()); - assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testJobOperatorRestart - * - * @assertion: Job Operator - restart. Tests also that a restart JobExecution is associated with the - * same JobInstance as the original execution. - * @test_Strategy: start a job that is configured to fail. Change configuration of job to ensure success. Restart job. - * Test that job completes successfully and no exceptions are thrown. - * @throws JobExecutionAlreadyCompleteException - * @throws NoSuchJobExecutionException - * @throws JobExecutionNotMostRecentException - * @throws JobRestartException - * - */ - - - public void testJobOperatorRestart() throws Fault { - - String METHOD = "testJobOperatorRestart"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("readrecord.fail=12"); - TestUtil.logMsg("app.arraysize=30"); - TestUtil.logMsg("app.writepoints=0,5,10,15,20,25,30"); - TestUtil.logMsg("app.next.writepoints=10,15,20,25,30"); - TestUtil.logMsg("app.commitinterval=5"); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "12"); - jobParams.put("app.arraysize", "30"); - jobParams.put("app.writepoints", "0,5,10,15,20,25,30"); - jobParams.put("app.next.writepoints", "10,15,20,25,30"); - jobParams.put("app.commitinterval", "5"); - - TestUtil.logMsg("Locate job XML file: chunksize5commitinterval5.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - TCKJobExecutionWrapper execution1 = jobOp.startJobAndWaitForResult("chunksize5commitinterval5", jobParams); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+execution1.getBatchStatus()); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()="+execution1.getExitStatus()); - assertWithMessage("Testing execution #1", BatchStatus.FAILED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", "FAILED", execution1.getExitStatus()); - - long jobInstanceId = execution1.getInstanceId(); - long lastExecutionId = execution1.getExecutionId(); - TCKJobExecutionWrapper exec = null; - TestUtil.logMsg("Got Job instance id: " + jobInstanceId + ""); - TestUtil.logMsg("Got Job execution id: " + lastExecutionId + ""); - { - TestUtil.logMsg("Invoke restartJobAndWaitForResult for execution id: " + lastExecutionId + ""); - exec = jobOp.restartJobAndWaitForResult(lastExecutionId, jobParams); - TestUtil.logMsg("execution #2 JobExecution getBatchStatus()="+exec.getBatchStatus()); - TestUtil.logMsg("execution #2 JobExecution getExitStatus()="+exec.getExitStatus()); - TestUtil.logMsg("execution #2 Job instance id="+exec.getInstanceId()); - assertWithMessage("Testing execution #2", BatchStatus.COMPLETED, exec.getBatchStatus()); - assertWithMessage("Testing execution #2", "COMPLETED", exec.getExitStatus()); - assertWithMessage("Testing execution #2", jobInstanceId, exec.getInstanceId()); - } - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testJobOperatorRestartAlreadyCompleteException - * - * @assertion: testJobOperatorRestartAlreadyCompleteException - * @test_Strategy: start a job that is configured to fail. Change configuration of job to ensure success. Restart job - * and let it run to completion. Then restart another time and confirm a JobExecutionAlreadyCompleteException - * is caught. - * - * The first start isn't serving a huge purpose, just making the end-to-end test slightly more interesting. - * - * Though it might be interesting to restart from the first executionId, this would force the issue - * as to whether the implementation throws JobExecutionAlreadyCompleteException or JobExecutionNotMostRecentException. - * We don't want to specify a behavior not in the spec, and the spec purposely avoids overspecifying exception behavior. - * The net is we only restart from the second id. - * - * @throws JobExecutionAlreadyCompleteException - * @throws NoSuchJobExecutionException - * @throws JobExecutionNotMostRecentException - * @throws JobRestartException - * - */ - - - public void testJobOperatorRestartAlreadyCompleteException() throws Fault { - - String METHOD = "testJobOperatorRestartAlreadyCompleteException"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("readrecord.fail=12"); - TestUtil.logMsg("app.arraysize=30"); - TestUtil.logMsg("app.writepoints=0,5,10,15,20,25,30"); - TestUtil.logMsg("app.next.writepoints=10,15,20,25,30"); - TestUtil.logMsg("app.commitinterval=5"); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "12"); - jobParams.put("app.arraysize", "30"); - jobParams.put("app.writepoints", "0,5,10,15,20,25,30"); - jobParams.put("app.next.writepoints", "10,15,20,25,30"); - jobParams.put("app.commitinterval", "5"); - - TestUtil.logMsg("Locate job XML file: chunksize5commitinterval5.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - TCKJobExecutionWrapper execution1 = jobOp.startJobAndWaitForResult("chunksize5commitinterval5", jobParams); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+execution1.getBatchStatus()); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()="+execution1.getExitStatus()); - assertWithMessage("Testing execution #1", BatchStatus.FAILED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", "FAILED", execution1.getExitStatus()); - - long jobInstanceId = execution1.getInstanceId(); - long firstExecutionId = execution1.getExecutionId(); - TCKJobExecutionWrapper exec = null; - TestUtil.logMsg("Got Job instance id: " + jobInstanceId + ""); - TestUtil.logMsg("Got Job execution id: " + firstExecutionId + ""); - { - TestUtil.logMsg("Invoke restartJobAndWaitForResult for execution id: " + firstExecutionId + ""); - exec = jobOp.restartJobAndWaitForResult(firstExecutionId, jobParams); - TestUtil.logMsg("execution #2 JobExecution getBatchStatus()="+exec.getBatchStatus()); - TestUtil.logMsg("execution #2 JobExecution getExitStatus()="+exec.getExitStatus()); - TestUtil.logMsg("execution #2 Job instance id="+exec.getInstanceId()); - assertWithMessage("Testing execution #2", BatchStatus.COMPLETED, exec.getBatchStatus()); - assertWithMessage("Testing execution #2", "COMPLETED", exec.getExitStatus()); - assertWithMessage("Testing execution #2", jobInstanceId, exec.getInstanceId()); - } - - long secondExecutionId = exec.getExecutionId(); - TestUtil.logMsg("execution #2 Job execution id="+ secondExecutionId); - - - // Restart from second execution id (not first, see strategy comment above). - TestUtil.logMsg("Now invoke restart again, expecting JobExecutionAlreadyCompleteException, for execution id: " + secondExecutionId + ""); - boolean seenException = false; - try { - jobOp.restartJobAndWaitForResult(secondExecutionId, jobParams); - } catch (JobExecutionAlreadyCompleteException e) { - TestUtil.logMsg("Caught JobExecutionAlreadyCompleteException as expected"); - seenException = true; - } - assertWithMessage("Caught JobExecutionAlreadyCompleteException for bad restart #2" , seenException); - - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testJobOperatorAbandonJobDuringARestart - * - * @assertion: testJobOperatorAbandonJobDuringARestart - * @test_Strategy: start a job that is configured to fail. Change configuration of job to cause the job to sleep for 5 seconds. Restart job - * and let it run without waiting for completion. Attempt to abandon the job and confirm a JobExecutionIsRunningException - * is caught. - * - * - * @throws JobExecutionAlreadyCompleteException - * @throws NoSuchJobExecutionException - * @throws JobExecutionNotMostRecentException - * @throws JobRestartException - * - */ - - - public void testJobOperatorAbandonJobDuringARestart() throws Fault { - - String METHOD = "testJobOperatorRestartAlreadyCompleteException"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - String DEFAULT_SLEEP_TIME = "5000"; - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - jobParams.put("execution.number", "1"); - TestUtil.logMsg("execution.number=1"); - String sleepTime = System.getProperty("JobOperatorTests.testJobOperatorTestAbandonActiveRestart.sleep",DEFAULT_SLEEP_TIME); - jobParams.put("sleep.time", sleepTime); - TestUtil.logMsg("sleep.time=" + sleepTime + ""); - - - TestUtil.logMsg("Locate job XML file: abandonActiveRestart.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - TCKJobExecutionWrapper execution1 = jobOp.startJobAndWaitForResult("abandonActiveRestart", jobParams); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+execution1.getBatchStatus()); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()="+execution1.getExitStatus()); - assertWithMessage("Testing execution #1", BatchStatus.FAILED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", "FAILED", execution1.getExitStatus()); - - long jobInstanceId = execution1.getInstanceId(); - long firstExecutionId = execution1.getExecutionId(); - TCKJobExecutionWrapper exec = null; - TestUtil.logMsg("Got Job instance id: " + jobInstanceId + ""); - TestUtil.logMsg("Got Job execution id: " + firstExecutionId + ""); - - jobParams = new Properties(); - jobParams.put("execution.number", "2"); - TestUtil.logMsg("execution.number=2"); - sleepTime = System.getProperty("JobOperatorTests.testJobOperatorTestAbandonActiveRestart.sleep",DEFAULT_SLEEP_TIME); - jobParams.put("sleep.time", sleepTime); - TestUtil.logMsg("sleep.time=" + sleepTime + ""); - - TestUtil.logMsg("Invoke restartJobWithoutWaitingForResult for execution id: " + firstExecutionId + ""); - exec = jobOp.restartJobWithoutWaitingForResult(firstExecutionId, jobParams); - long secondExecutionId = exec.getExecutionId(); - { - TestUtil.logMsg("Invoke restartJobAndWaitForResult for execution id: " + firstExecutionId + ""); - - boolean seen = false; - try { - jobOp.abandonJobExecution(secondExecutionId); - } - catch (JobExecutionIsRunningException jobRunningEx){ - TestUtil.logMsg("Caught JobExecutionIsRunningException as expected"); - seen = true; - } - assertWithMessage("Caught JobExecutionIsRunningException for abandon attempt during restart" , seen); - - } - - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testJobOperatorRestartJobAlreadyAbandoned - * - * @assertion: testJobOperatorRestartJobAlreadyAbandoned - * @test_Strategy: start a job that is configured to fail. Once Job fails, abandon it. - * Attempt to restart the already abandon the job and confirm a JobRestartException - * is caught. - * - * - * @throws JobExecutionAlreadyCompleteException - * @throws NoSuchJobExecutionException - * @throws JobExecutionNotMostRecentException - * @throws JobRestartException - * - */ - - - public void testJobOperatorRestartJobAlreadyAbandoned() throws Fault { - - String METHOD = "testJobOperatorRestartAlreadyCompleteException"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - String DEFAULT_SLEEP_TIME = "1"; - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - jobParams.put("execution.number", "1"); - TestUtil.logMsg("execution.number=1"); - String sleepTime = System.getProperty("JobOperatorTests.testJobOperatorTestRestartAlreadAbandonedJob.sleep",DEFAULT_SLEEP_TIME); - jobParams.put("sleep.time", sleepTime); - TestUtil.logMsg("sleep.time=" + sleepTime + ""); - - - TestUtil.logMsg("Locate job XML file: abandonActiveRestart.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - TCKJobExecutionWrapper execution1 = jobOp.startJobAndWaitForResult("abandonActiveRestart", jobParams); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+execution1.getBatchStatus()); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()="+execution1.getExitStatus()); - assertWithMessage("Testing execution #1", BatchStatus.FAILED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", "FAILED", execution1.getExitStatus()); - long jobInstanceId = execution1.getInstanceId(); - long firstExecutionId = execution1.getExecutionId(); - - jobOp.abandonJobExecution(firstExecutionId); - - TestUtil.logMsg("Got Job instance id: " + jobInstanceId + ""); - TestUtil.logMsg("Got Job execution id: " + firstExecutionId + ""); - - jobParams = new Properties(); - jobParams.put("execution.number", "2"); - TestUtil.logMsg("execution.number=2"); - - TestUtil.logMsg("Invoke restartJobWithoutWaitingForResult for execution id: " + firstExecutionId + ""); - - { - TestUtil.logMsg("Invoke restartJobAndWaitForResult for execution id: " + firstExecutionId + ""); - - boolean seen = false; - try { - jobOp.restartJobWithoutWaitingForResult(firstExecutionId, jobParams); - } - catch (JobRestartException jobRestartEx){ - TestUtil.logMsg("Caught JobRestartException as expected"); - seen = true; - } - assertWithMessage("Caught JobRestartException for abandon attempt during restart" , seen); - - } - - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testInvokeJobWithUserStop - * @assertion: The batch status of a job is set to stopped after it is stopped through the job operator - * @test_Strategy: Issue a job that runs in an infinite loop. Issue a job operator stop and verify the - * batch status. - */ - - - public void testInvokeJobWithUserStop() throws Fault { - String METHOD = "testInvokeJobWithUserStop"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - final String DEFAULT_SLEEP_TIME = "1000"; - - try { - TestUtil.logMsg("Locate job XML file: job_batchlet_longrunning.xml"); - - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParameters = new Properties(); - TestUtil.logMsg("run.indefinitely=true"); - jobParameters.setProperty("run.indefinitely" , "true"); - - TestUtil.logMsg("Invoking startJobWithoutWaitingForResult for Execution #1"); - JobExecution jobExec = jobOp.startJobWithoutWaitingForResult("job_batchlet_longrunning", jobParameters); - - int sleepTime = Integer.parseInt(System.getProperty("JobOperatorTests.testInvokeJobWithUserStop.sleep",DEFAULT_SLEEP_TIME)); - TestUtil.logMsg("Thread.sleep(" + sleepTime + ")"); - Thread.sleep(sleepTime); - - TestUtil.logMsg("Invoking stopJobAndWaitForResult for Execution #1"); - jobOp.stopJobAndWaitForResult(jobExec); - - JobExecution jobExec2 = jobOp.getJobExecution(jobExec.getExecutionId()); - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+jobExec2.getBatchStatus()); - assertObjEquals(BatchStatus.STOPPED, jobExec2.getBatchStatus()); - - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testJobOperatorGetStepExecutions - * - * @assertion: Job Operator - getStepExecutions - * @test_Strategy: start a job that completes successfully. Get the list of all StepException objects associated with job execution id. - * Test that all objects retrieved are of type StepExecution. - * @throws Fault - */ - - - public void testJobOperatorGetStepExecutions() throws Fault { - - String METHOD = "testJobOperatorGetStepExecutions"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_batchlet_1step.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_batchlet_1step"); - - TestUtil.logMsg("Obtaining StepExecutions for execution id: " + jobExec.getExecutionId() + ""); - List stepExecutions = jobOp.getStepExecutions(jobExec.getExecutionId()); - - assertObjEquals(1, stepExecutions.size()); - - for (StepExecution step : stepExecutions) { - // make sure all steps finish successfully - showStepState(step); - TestUtil.logMsg("Step status="+step.getBatchStatus()); - assertObjEquals(BatchStatus.COMPLETED, step.getBatchStatus()); - } - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+jobExec.getBatchStatus()); - assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testJobOpGetJobNames - * - * @assertion: Job Operator - getJobNames - * @test_Strategy: This test is a bit weak in that, while the first time it runs, - * it does perform a real validation that the newly-submitted job - * is added to the getJobNames() result set, on subsequent runs - * it may have already been there from before and so isn't newly - * verifying anything. This is a simple function to implement so not - * a big deal. - */ - - - public void testJobOpGetJobNames() throws Fault { - - String METHOD = "testJobOpGetJobNames"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - String jobName ="job_unique_get_job_names"; - - try { - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - List jobNames = jobOp.getJobNames(); - jobOp.startJobWithoutWaitingForResult("job_unique_get_job_names"); - if (jobNames.contains(jobName)) { - TestUtil.logMsg("JobOperator.getJobNames() already includes " + jobName + ", test is not so useful"); - } else { - TestUtil.logMsg("JobOperator.getJobNames() does not include " + jobName + " yet."); - } - - jobNames = jobOp.getJobNames(); - assertWithMessage("Now JobOperator.getJobNames() definitely includes " + jobName, jobNames.contains(jobName)); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testAbandoned - * - * @assertion: Job Operator - abandon() - * @test_Strategy: run a job that completes successfully. Abandon the job. Test to ensure the Batch Status for the said job is marked as 'ABANDONED' - * @throws Fault - * - */ - - - public void testAbandoned() throws Fault { - - String METHOD = "testAbandoned"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_batchlet_4steps.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_batchlet_4steps"); - assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus()); - - jobOp.abandonJobExecution(jobExec.getExecutionId()); - - JobExecution jobExec2 = jobOp.getJobExecution(jobExec.getExecutionId()); - assertObjEquals(BatchStatus.ABANDONED, jobExec2.getBatchStatus()); - - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testJobOpgetJobInstanceCount - * - * @assertion: Job Operator - getJobInstanceCount - * @test_Strategy: Retrieve the job instance count for a known job name. Run that job. - * Retrieve the job instance count for that job again. Test that the count has increased by 1. - * @throws Fault - * - */ - - - public void testJobOpgetJobInstanceCount() throws Fault { - String METHOD = "testJobOpgetJobInstanceCount"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - - int countTrackerBEFORE = 0; - - try { - countTrackerBEFORE = jobOp.getJobInstanceCount("chunksize5commitinterval5"); - } catch (NoSuchJobException e) { - // Can continue. - } - - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("readrecord.faile=12"); - TestUtil.logMsg("app.arraysize=30"); - TestUtil.logMsg("app.writepoints=0,5,10,15,20,25,30"); - TestUtil.logMsg("app.commitinterval=5"); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "12"); - jobParams.put("app.arraysize", "30"); - jobParams.put("app.writepoints", "0,5,10,15,20,25,30"); - jobParams.put("app.commitinterval", "5"); - - TestUtil.logMsg("Locate job XML file: chunksize5commitinterval5.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - TCKJobExecutionWrapper execution1 = jobOp.startJobAndWaitForResult("chunksize5commitinterval5", jobParams); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+execution1.getBatchStatus()); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()="+execution1.getExitStatus()); - assertWithMessage("Testing execution #1", BatchStatus.FAILED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", "FAILED", execution1.getExitStatus()); - - long jobInstanceId = execution1.getInstanceId(); - long lastExecutionId = execution1.getExecutionId(); - TestUtil.logMsg("Got Job instance id: " + jobInstanceId + ""); - TestUtil.logMsg("Got Job execution id: " + lastExecutionId + ""); - - int countTrackerAFTER = jobOp.getJobInstanceCount("chunksize5commitinterval5"); - - assertWithMessage("job count for job1 increased by 1", 1, countTrackerAFTER - countTrackerBEFORE); - - List jobNames = jobOp.getJobNames(); - - for (String jobname : jobNames) { - TestUtil.logMsg(jobname + " instance count : " + jobOp.getJobInstanceCount(jobname) + " - "); - } - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testJobOpgetJobInstanceCountException - * - * @assertion: Job Operator - getJobInstanceCountException - * @test_Strategy: Retrieve the job instance count for a known job name. Run that job. - * Retrieve the job instance count for a job name that does not exist. Test that the NoSuchJobException is returned. - * @throws Fault - * - */ - - - public void testJobOpgetJobInstanceCountException() throws Fault { - String METHOD = "testJobOpgetJobInstanceCountException"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - int countTrackerBEFORE = 0; - - try { - countTrackerBEFORE = jobOp.getJobInstanceCount("ChunkStopOnEndOn"); - } catch (NoSuchJobException e) { - // Can continue. - } - - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("readrecord.faile=12"); - TestUtil.logMsg("app.arraysize=30"); - TestUtil.logMsg("app.writepoints=0,5,10,15,20,25,30"); - TestUtil.logMsg("app.commitinterval=5"); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "12"); - jobParams.put("app.arraysize", "30"); - jobParams.put("app.writepoints", "0,5,10,15,20,25,30"); - jobParams.put("app.commitinterval", "5"); - - TestUtil.logMsg("Locate job XML file: chunksize5commitinterval5.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - TCKJobExecutionWrapper execution1 = jobOp.startJobAndWaitForResult("chunksize5commitinterval5", jobParams); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+execution1.getBatchStatus()); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()="+execution1.getExitStatus()); - assertWithMessage("Testing execution #1", BatchStatus.FAILED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", "FAILED", execution1.getExitStatus()); - - long jobInstanceId = execution1.getInstanceId(); - long lastExecutionId = execution1.getExecutionId(); - TestUtil.logMsg("Got Job instance id: " + jobInstanceId + ""); - TestUtil.logMsg("Got Job execution id: " + lastExecutionId + ""); - - boolean seenException = false; - try { - int countTrackerAFTER = jobOp.getJobInstanceCount("NoSuchJob"); - } catch (NoSuchJobException noJobEx) { - TestUtil.logMsg("Confirmed we caught NoSuchJobException"); - seenException = true; - } - assertWithMessage("Saw NoSuchJobException for job 'NoSuchJob'", seenException); - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testJobOpgetJobInstances - * - * @assertion: Job Operator - getJobInstances - * @test_Strategy: start a job 10 times which will ensure at least one job instance known to the runtime. - * Retrieve a list of job instance ids for the job name just started. Ask for the first 200 found. - * Test that size grows by 10. - * @throws Fault - * - */ - - - public void testJobOpgetJobInstances() throws Fault { - String METHOD = " testJobOpgetJobInstances"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - int submitTimes = 10; - - try { - int countTrackerBEFORE = 0; - int countTrackerAFTER = 0; - - try { - countTrackerBEFORE = jobOp.getJobInstanceCount("chunksize5commitinterval5"); - TestUtil.logMsg("Before test ran the JobInstance count for chunksize5commitinterval5 was " + countTrackerBEFORE ); - } catch (NoSuchJobException e) { - TestUtil.logMsg("Not an error, but just the first time executing this job "); - } - - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("readrecord.faile=12"); - TestUtil.logMsg("app.arraysize=30"); - TestUtil.logMsg("app.writepoints=0,5,10,15,20,25,30"); - TestUtil.logMsg("app.commitinterval=5"); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "12"); - jobParams.put("app.arraysize", "30"); - jobParams.put("app.writepoints", "0,5,10,15,20,25,30"); - jobParams.put("app.commitinterval", "5"); - - TestUtil.logMsg("Locate job XML file: chunksize5commitinterval5.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - for (int i=0; i < submitTimes; i++) { - jobOp.startJobWithoutWaitingForResult("chunksize5commitinterval5", jobParams); - } - - List jobInstances = null; - try { - jobInstances = jobOp.getJobInstances("chunksize5commitinterval5", 0, 10); - countTrackerAFTER = jobOp.getJobInstanceCount("chunksize5commitinterval5"); - assertWithMessage("Check that we see: " + submitTimes + " new submissions", - submitTimes, countTrackerAFTER - countTrackerBEFORE); - } catch (NoSuchJobException noJobEx) { - TestUtil.logMsg("Failing test, caught NoSuchJobException"); - throw noJobEx; - } - - TestUtil.logMsg("Size of Job Instances list = " + jobInstances.size() + ""); - assertWithMessage("Testing that a list of Job Instances were obtained", 10, jobInstances.size()); - - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testJobOpgetJobInstancesException - * - * @assertion: Job Operator - getJobInstancesException - * @test_Strategy: Retrieve a list of job instances for a job name that does not exist. - * Test that the NoSuchJobException is thrown. - * @throws Exception - * - */ - - - public void testJobOpgetJobInstancesException() throws Fault { - String METHOD = "testJobOpgetJobInstancesException"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("readrecord.faile=12"); - TestUtil.logMsg("app.arraysize=30"); - TestUtil.logMsg("app.writepoints=0,5,10,15,20,25,30"); - TestUtil.logMsg("app.commitinterval=5"); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "12"); - jobParams.put("app.arraysize", "30"); - jobParams.put("app.writepoints", "0,5,10,15,20,25,30"); - jobParams.put("app.commitinterval", "5"); - - - TestUtil.logMsg("Locate job XML file: /chunksize5commitinterval5.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - TCKJobExecutionWrapper execution1 = jobOp.startJobAndWaitForResult("chunksize5commitinterval5", jobParams); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+execution1.getBatchStatus()); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()="+execution1.getExitStatus()); - assertWithMessage("Testing execution #1", BatchStatus.FAILED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", "FAILED", execution1.getExitStatus()); - - List jobIds = null; - boolean seenException = false; - try { - jobIds = jobOp.getJobInstances("NoSuchJob", 0, 12); - } catch (NoSuchJobException noJobEx) { - seenException = true; - TestUtil.logMsg("Confirmed we caught NoSuchJobException"); - } - assertWithMessage("Saw NoSuchJobException for job 'NoSuchJob'", seenException); - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testJobOperatorGetParameters - * - * @assertion: Job Operator - getParameters - * @test_Strategy: Start a job with a set of parameters. Restart the job with a set of override parameters. Once completed, retrieve the - * parameters object associated with the job instance. Test that the object retrieved is a Properties object. - * Test that the NoSuchJobException is thrown. - * @throws Fault - * - */ - - - public void testJobOperatorGetParameters() throws Fault { - String METHOD = "testJobOperatorGetParameters"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties originalJobParams = new Properties(); - Properties restartJobParams = null; - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("readrecord.fail=12"); - TestUtil.logMsg("app.arraysize=30"); - TestUtil.logMsg("app.writepoints=0,5,10,15,20,25,30"); - TestUtil.logMsg("app.next.writepoints=10,15,20,25,30"); - TestUtil.logMsg("app.commitinterval=5"); - originalJobParams.put("execution.number", "1"); - originalJobParams.put("readrecord.fail", "12"); - originalJobParams.put("app.arraysize", "30"); - originalJobParams.put("app.writepoints", "0,5,10,15,20,25,30"); - originalJobParams.put("app.next.writepoints", "10,15,20,25,30"); - originalJobParams.put("app.commitinterval", "5"); - - // Expected parameters on restart only. - String N1="extra.parm.name1"; String V1="extra.parm.value1"; - String N2="extra.parm.name2"; String V2="extra.parm.value2"; - - TestUtil.logMsg("Locate job XML file: chunksize5commitinterval5.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - TCKJobExecutionWrapper execution1 = jobOp.startJobAndWaitForResult("chunksize5commitinterval5", originalJobParams); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+execution1.getBatchStatus()); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()="+execution1.getExitStatus()); - assertWithMessage("Testing execution #1", BatchStatus.FAILED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", "FAILED", execution1.getExitStatus()); - - long jobInstanceId = execution1.getInstanceId(); - long lastExecutionId = execution1.getExecutionId(); - TCKJobExecutionWrapper execution2 = null; - TestUtil.logMsg("Got Job instance id: " + jobInstanceId + ""); - TestUtil.logMsg("Got Job execution id: " + lastExecutionId + ""); - { - TestUtil.logMsg("Invoke clone original job execution parameters"); - // Shallow copy is OK for simple of java.util.Properties - restartJobParams = (Properties)originalJobParams.clone(); - TestUtil.logMsg("Put some extra parms in the restart execution"); - restartJobParams.put(N1, V1); - restartJobParams.put(N2, V2); - TestUtil.logMsg("Invoke restartJobAndWaitForResult for execution id: " + lastExecutionId + ""); - execution2 = jobOp.restartJobAndWaitForResult(lastExecutionId, restartJobParams); - TestUtil.logMsg("execution #2 JobExecution getBatchStatus()="+execution2.getBatchStatus()); - TestUtil.logMsg("execution #2 JobExecution getExitStatus()="+execution2.getExitStatus()); - TestUtil.logMsg("execution #2 Job instance id="+execution2.getInstanceId()); - assertWithMessage("Testing execution #2", BatchStatus.COMPLETED, execution2.getBatchStatus()); - assertWithMessage("Testing execution #2", "COMPLETED", execution2.getExitStatus()); - assertWithMessage("Testing execution #2", jobInstanceId, execution2.getInstanceId()); - } - - // Test original execution - Properties jobParamsFromJobOperator = jobOp.getParameters(execution1.getExecutionId()); - Properties jobParamsFromJobExecution = execution1.getJobParameters(); - assertWithMessage("Comparing original job params with jobOperator.getParameters", originalJobParams, jobParamsFromJobOperator); - TestUtil.logMsg("JobOperator.getParameters() matches for original execution "); - assertWithMessage("Comparing original job params with jobExecution.getParameters", originalJobParams, jobParamsFromJobExecution); - TestUtil.logMsg("JobExecution.getParameters() matches for original execution "); - - // Test restart execution - Properties restartJobParamsFromJobOperator = jobOp.getParameters(execution2.getExecutionId()); - Properties restartJobParamsFromJobExecution = execution2.getJobParameters(); - assertWithMessage("Comparing restart job params with jobOperator.getParameters", restartJobParams, restartJobParamsFromJobOperator); - TestUtil.logMsg("JobOperator.getParameters() matches for restart execution "); - assertWithMessage("Comparing restart job params with jobExecution.getParameters", restartJobParams, restartJobParamsFromJobExecution); - TestUtil.logMsg("JobExecution.getParameters() matches for restart execution "); - - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testJobOperatorGetJobInstances - * - * @assertion: Job Operator - getJobInstances - * @test_Strategy: Start a specific job four times, all of which will finish successfully. Retrieve two separate lists of JobExecutions for the job. - * List 1 will contain JobExecution Objects for job start 1 - 3. List 2 will contain JobExecution Objects for job start 2 - 4. - * Test that the second and third JobExecution objects of List 1 is equivalent to the first and second JobExecution objects in List 2. - * - * @throws Fault - * - */ - - - public void testJobOperatorGetJobInstances() throws Fault { - String METHOD = "testJobOperatorGetJobInstances"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("readrecord.fail=31"); - TestUtil.logMsg("app.arraysize=30"); - TestUtil.logMsg("app.writepoints=0,5,10,15,20,25,30"); - TestUtil.logMsg("app.commitinterval=5"); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "31"); - jobParams.put("app.arraysize", "30"); - jobParams.put("app.writepoints", "0,5,10,15,20,25,30"); - jobParams.put("app.commitinterval", "5"); - - TestUtil.logMsg("Locate job XML file: chunksize5commitinterval5.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("chunksize5commitinterval5", jobParams); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+execution1.getBatchStatus()); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()="+execution1.getExitStatus()); - assertWithMessage("Testing execution #1", BatchStatus.COMPLETED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", "COMPLETED", execution1.getExitStatus()); - - TestUtil.logMsg("Create job parameters for execution #2:"); - jobParams = new Properties(); - TestUtil.logMsg("execution.number=2"); - TestUtil.logMsg("readrecord.fail=31"); - TestUtil.logMsg("app.arraysize=30"); - TestUtil.logMsg("app.writepoints=10,15,20,25,30"); - TestUtil.logMsg("app.commitinterval=5"); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "31"); - jobParams.put("app.arraysize", "30"); - jobParams.put("app.writepoints", "0,5,10,15,20,25,30"); - jobParams.put("app.commitinterval", "5"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #2"); - JobExecution execution2 = jobOp.startJobAndWaitForResult("chunksize5commitinterval5", jobParams); - TestUtil.logMsg("execution #2 JobExecution getBatchStatus()="+execution1.getBatchStatus()); - TestUtil.logMsg("execution #2 JobExecution getExitStatus()="+execution1.getExitStatus()); - assertWithMessage("Testing execution #2", BatchStatus.COMPLETED, execution2.getBatchStatus()); - assertWithMessage("Testing execution #2", "COMPLETED", execution2.getExitStatus()); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #3"); - JobExecution execution3 = jobOp.startJobAndWaitForResult("chunksize5commitinterval5", jobParams); - TestUtil.logMsg("execution #3 JobExecution getBatchStatus()="+execution1.getBatchStatus()); - TestUtil.logMsg("execution #3 JobExecution getExitStatus()="+execution1.getExitStatus()); - assertWithMessage("Testing execution #3", BatchStatus.COMPLETED, execution3.getBatchStatus()); - assertWithMessage("Testing execution #3", "COMPLETED", execution3.getExitStatus()); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #4"); - JobExecution execution4 = jobOp.startJobAndWaitForResult("chunksize5commitinterval5", jobParams); - TestUtil.logMsg("execution #4 JobExecution getBatchStatus()="+execution1.getBatchStatus()); - TestUtil.logMsg("execution #4 JobExecution getExitStatus()="+execution1.getExitStatus()); - assertWithMessage("Testing execution #4", BatchStatus.COMPLETED, execution4.getBatchStatus()); - assertWithMessage("Testing execution #4", "COMPLETED", execution4.getExitStatus()); - - List jobInstances012 = jobOp.getJobInstances("chunksize5commitinterval5",0,3); - List jobInstances123 = jobOp.getJobInstances("chunksize5commitinterval5",1,3); - - for (int i=0; i<3; i++){ - logger.fine("AJM: instance id012["+i+"] = " + jobInstances012.get(i).getInstanceId()); - logger.fine("AJM: instance id123["+i+"] = " + jobInstances123.get(i).getInstanceId()); - } - - assertWithMessage("job instances should not be equal", jobInstances012.get(0).getInstanceId()!=jobInstances123.get(0).getInstanceId()); - assertWithMessage("job instances should be equal", jobInstances012.get(1).getInstanceId()==jobInstances123.get(0).getInstanceId()); - assertWithMessage("job instances should be equal", jobInstances012.get(2).getInstanceId()==jobInstances123.get(1).getInstanceId()); - assertWithMessage("job instances should not be equal", jobInstances012.get(2).getInstanceId()!=jobInstances123.get(2).getInstanceId()); - - TestUtil.logMsg("Size of jobInstancesList = " + jobInstances012.size() + ""); - TestUtil.logMsg("Testing retrieval of the JobInstances list, size = " + jobInstances012.size() + ""); - assertWithMessage("Testing retrieval of the JobInstances list", jobInstances012.size() > 0); - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testJobOperatorGetRunningJobExecutions - * - * @assertion: Job Operator - getRunningExecutions - * @test_Strategy: start a job which will ensure at least one job execution is known to the runtime. Job will be long running. Testcase does not wait for job to complete. - * Retrieve a list of JobExecution(s) for the job name just started that are in running state. Ensure that at least one JobExecution is returned - * Test that - * @throws Fault - * - */ - - - public void testJobOperatorGetRunningJobExecutions() throws Fault { - String METHOD = "testJobOperatorGetRunningJobExecutions"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - final String DEFAULT_SLEEP_TIME = "1000"; - final String DEFAULT_APP_TIME_INTERVAL = "10000"; - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - String timeinterval = System.getProperty("JobOperatorTests.testJobOperatorGetRunningJobExecutions.app.timeinterval",DEFAULT_APP_TIME_INTERVAL); - - jobParams.put("app.timeinterval", timeinterval); - - TestUtil.logMsg("Invoke startJobWithoutWaitingForResult for execution #1"); - JobExecution execution1 = jobOp.startJobWithoutWaitingForResult("job_batchlet_step_listener", jobParams); - - Properties newJobParameters = new Properties(); - newJobParameters.put("app.timeinterval", timeinterval); - TestUtil.logMsg("Invoke startJobWithoutWaitingForResult"); - - JobExecution exec = jobOp.startJobWithoutWaitingForResult("job_batchlet_step_listener", newJobParameters); - - // Sleep to give the runtime the chance to start the job. The job has a delay built into the stepListener afterStep() - // so we aren't worried about the job finishing early leaving zero running executions. - int sleepTime = Integer.parseInt(System.getProperty("ExecutionTests.testJobOperatorGetRunningJobExecutions.sleep",DEFAULT_SLEEP_TIME)); - TestUtil.logMsg("Thread.sleep(" + sleepTime + ")"); - Thread.sleep(sleepTime); - - List jobExecutions = jobOp.getRunningExecutions("job_batchlet_step_listener"); - assertWithMessage("Found job instances in the RUNNING state", jobExecutions.size() > 0); - - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testJobOperatorGetRunningJobInstancesException - * - * @assertion: Job Operator - getJobInstances - * @test_Strategy: start a job which will ensure at least one job instance known to the runtime. Job will be long running. Testcase does not wait for job to complete. - * Retrieve a list of job instance ids for a job name that does not exist in running state. Ensure that NoSuchJobException exception is thrown - * Test that - * @throws Fault - * - */ - - - public void testJobOperatorGetRunningJobInstancesException() throws Fault { - String METHOD = "testJobOperatorGetRunningJobInstancesException"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - final String DEFAULT_APP_TIME_INTERVAL = "10000"; - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - - String timeinterval = System.getProperty("JobOperatorTests.testJobOperatorGetRunningJobInstancesException.app.timeinterval",DEFAULT_APP_TIME_INTERVAL); - - jobParams.put("app.timeinterval", timeinterval); - - TestUtil.logMsg("Invoke startJobWithoutWaitingForResult for execution #1"); - JobExecution execution1 = jobOp.startJobWithoutWaitingForResult("job_batchlet_step_listener", jobParams); - - Properties restartJobParameters = new Properties(); - restartJobParameters.put("app.timeinterval", timeinterval); - - TestUtil.logMsg("Invoke startJobWithoutWaitingForResult"); - JobExecution exec = jobOp.startJobWithoutWaitingForResult("job_batchlet_step_listener", restartJobParameters); - - boolean seenException = false; - try { - TestUtil.logMsg("Check for an instance of a non-existent job"); - jobOp.getRunningExecutions("JOBNAMEDOESNOTEXIST"); - } - catch (NoSuchJobException e) { - TestUtil.logMsg("Confirmed that exception caught is an instanceof NoSuchJobException"); - seenException = true; - } - assertWithMessage("Saw NoSuchJobException for job 'JOBNAMEDOESNOTEXIST'", seenException); - } catch (Exception e) { - handleException(METHOD, e); - } - - } - /* - * @testName: testJobOperatorGetJobExecution - * - * @assertion: Job Operator - getJobExecution - * @test_Strategy: start a job which will run to successful completion. - * Retrieve a JobExecution object using the execution ID returned by the start command. - * Ensure the object returned is an instance of JobExecution - * - * @throws Fault - * - */ - - - public void testJobOperatorGetJobExecution() throws Fault { - String METHOD = "testJobOperatorGetJobExecution"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("readrecord.fail=12"); - TestUtil.logMsg("app.arraysize=30"); - TestUtil.logMsg("app.writepoints=0,5,10,15,20,25,30"); - TestUtil.logMsg("app.next.writepoints=10,15,20,25,30"); - TestUtil.logMsg("app.commitinterval=5"); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "12"); - jobParams.put("app.arraysize", "30"); - jobParams.put("app.writepoints", "0,5,10,15,20,25,30"); - jobParams.put("app.next.writepoints", "10,15,20,25,30"); - jobParams.put("app.commitinterval", "5"); - - TestUtil.logMsg("Locate job XML file: chunksize5commitinterval5.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - TCKJobExecutionWrapper execution1 = jobOp.startJobAndWaitForResult("chunksize5commitinterval5", jobParams); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+execution1.getBatchStatus()); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()="+execution1.getExitStatus()); - assertWithMessage("Testing execution #1", BatchStatus.FAILED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", "FAILED", execution1.getExitStatus()); - - long jobInstanceId = execution1.getInstanceId(); - long lastExecutionId = execution1.getExecutionId(); - TCKJobExecutionWrapper exec = null; - - { - - TestUtil.logMsg("Invoke restartJobAndWaitForResult for execution id: " + lastExecutionId + ""); - exec = jobOp.restartJobAndWaitForResult(lastExecutionId, jobParams); - lastExecutionId = exec.getExecutionId(); - TestUtil.logMsg("execution #2 JobExecution getBatchStatus()="+exec.getBatchStatus()); - TestUtil.logMsg("execution #2 JobExecution getExitStatus()="+exec.getExitStatus()); - TestUtil.logMsg("execution #2 Job instance id="+exec.getInstanceId()); - assertWithMessage("Testing execution #2", BatchStatus.COMPLETED, exec.getBatchStatus()); - assertWithMessage("Testing execution #2", "COMPLETED", exec.getExitStatus()); - assertWithMessage("Testing execution #2", jobInstanceId, exec.getInstanceId()); - } - - TestUtil.logMsg("Testing retrieval of a JobExecution obj"); - JobExecution jobEx = jobOp.getJobExecution(lastExecutionId); - TestUtil.logMsg("Status retreived from JobExecution obj: " + jobEx.getBatchStatus() + ""); - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testJobOperatorGetJobExecutions - * - * @assertion: Job Operator - getJobExecutions and JobExecution APIs - * @test_Strategy: start a job which will fail, then restart and run to successful completion. - * Validate the two JobExecution instances, e.g. ensure both map to the same - * JobInstance when getJobInstance() is passed the respective executionIds. - * Also ensure that getJobExecutions() on the instance returns these same two executionIds. - * @throws Fault - * - */ - - - public void testJobOperatorGetJobExecutions() throws Fault { - String METHOD = "testJobOperatorGetJobExecutions"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - String jobName = "chunksize5commitinterval5"; - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "12"); - jobParams.put("app.arraysize", "30"); - jobParams.put("app.writepoints", "0,5,10,15,20,25,30"); - jobParams.put("app.next.writepoints", "10,15,20,25,30"); - jobParams.put("app.commitinterval", "5"); - - TestUtil.logMsg("Locate job XML file: chunksize5commitinterval5.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - TCKJobExecutionWrapper execution1 = jobOp.startJobAndWaitForResult(jobName, jobParams); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+execution1.getBatchStatus()); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()="+execution1.getExitStatus()); - assertWithMessage("Testing execution #1", BatchStatus.FAILED, execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", "FAILED", execution1.getExitStatus()); - - long execution1ID= execution1.getExecutionId(); - TCKJobExecutionWrapper execution2 = null; - - { - TestUtil.logMsg("Invoke restartJobAndWaitForResult for execution id: " + execution1ID + ""); - execution2= jobOp.restartJobAndWaitForResult(execution1ID, jobParams); - TestUtil.logMsg("execution #2 JobExecution getBatchStatus()="+execution2.getBatchStatus()); - TestUtil.logMsg("execution #2 JobExecution getExitStatus()="+execution2.getExitStatus()); - TestUtil.logMsg("execution #2 Job instance id="+execution2.getInstanceId()); - assertWithMessage("Testing execution #2", BatchStatus.COMPLETED, execution2.getBatchStatus()); - assertWithMessage("Testing execution #2", "COMPLETED", execution2.getExitStatus()); - } - - // Execution 1 and 2 have the same instanceId - assertWithMessage("Testing execution #1 and execution #2 use the same instanceId", - execution1.getInstanceId(), execution2.getInstanceId()); - - long execution2ID= execution2.getExecutionId(); - JobInstance jobInstance = jobOp.getJobInstance(execution2ID); - - // Verify getJobExecutions() based on instance gives us the same two JobExecution(s); - List jobExecutions = jobOp.getJobExecutions(jobInstance); - assertWithMessage("Testing list size of JobExecutions", 2, jobExecutions.size()); - boolean seen1 = false; boolean seen2=false; - for (JobExecution je : jobExecutions){ - if (je.getExecutionId() == execution1ID) { - assertWithMessage("Dup of execution 1", !seen1); - TestUtil.logMsg("Seen execution #1 "); - seen1= true; - } else if (je.getExecutionId() == execution2ID) { - assertWithMessage("Dup of execution 2", !seen2); - TestUtil.logMsg("Seen execution #2 "); - seen2= true; - } - } - assertWithMessage("Seen both of the two JobExecutions", seen1 && seen2); - - assertWithMessage("Job name from JobInstance matches", jobName, jobInstance.getJobName()); - assertWithMessage("Job name from JobExecution 1 matches", jobName, execution1.getJobName()); - assertWithMessage("Job name from JobExecution 2 matches", jobName, execution2.getJobName()); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - - private void showStepState(StepExecution step) { - - - TestUtil.logMsg("---------------------------"); - TestUtil.logMsg("getStepName(): " + step.getStepName() + " - "); - TestUtil.logMsg("getJobExecutionId(): " + step.getStepExecutionId() + " - "); - //System.out.print("getStepExecutionId(): " + step.getStepExecutionId() + " - "); - Metric[] metrics = step.getMetrics(); - - for (int i = 0; i < metrics.length; i++) { - TestUtil.logMsg(metrics[i].getType() + ": " + metrics[i].getValue() + " - "); - } - - TestUtil.logMsg("getStartTime(): " + step.getStartTime() + " - "); - TestUtil.logMsg("getEndTime(): " + step.getEndTime() + " - "); - //System.out.print("getLastUpdateTime(): " + step.getLastUpdateTime() + " - "); - TestUtil.logMsg("getBatchStatus(): " + step.getBatchStatus() + " - "); - TestUtil.logMsg("getExitStatus(): " + step.getExitStatus()); - TestUtil.logMsg("---------------------------"); - } -} diff --git a/src/com/ibm/jbatch/tck/tests/jslxml/MetricsTests.java b/src/com/ibm/jbatch/tck/tests/jslxml/MetricsTests.java deleted file mode 100644 index 349e65ffd4..0000000000 --- a/src/com/ibm/jbatch/tck/tests/jslxml/MetricsTests.java +++ /dev/null @@ -1,761 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.tests.jslxml; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import static com.ibm.jbatch.tck.utils.AssertionUtils.assertWithMessage; - -import java.util.Date; -import java.util.List; -import java.util.Properties; - -import jakarta.batch.runtime.BatchStatus; -import jakarta.batch.runtime.JobExecution; -import jakarta.batch.runtime.Metric; -import jakarta.batch.runtime.StepExecution; - - - - - - -import com.ibm.jbatch.tck.artifacts.specialized.MetricsStepListener; -import com.ibm.jbatch.tck.utils.JobOperatorBridge; - -public class MetricsTests extends ServiceEETest { - - private static JobOperatorBridge jobOp = null; - - public static void setup(String[] args, Properties props) throws Fault { - String METHOD = "setup"; -TestUtil.logTrace(METHOD); - - try { - jobOp = new JobOperatorBridge(); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - - - public static void setUp() throws Fault { - jobOp = new JobOperatorBridge(); - } - - /* cleanup */ - public void cleanup() { - - } - - /* - * Obviously would be nicer to have more granular tests for some of this - * function, but here we're going a different route and saying, if it's - * going to require restart it will have some complexity, so let's test a - * few different functions in one longer restart scenario. - */ - - /* - * @testName: testMetricsInApp - * - * - * @assertion: Section 7.1 Job Metrics - Ensure Metrics are available to Batch Artifacts during job execution - * @test_Strategy: Batch Artifact reads a known number of items - test that those reads are reflected - * in the read count and accessible at job execution time to the Batch Artifact - * - */ - - - public void testMetricsInApp() throws Fault { - String METHOD = "testMetricsInApp"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("readrecord.fail=40"); - TestUtil.logMsg("app.arraysize=30"); - TestUtil.logMsg("app.chunksize=7"); - TestUtil.logMsg("app.commitinterval=10"); - TestUtil.logMsg("numberOfSkips=0"); - TestUtil.logMsg("ReadProcessWrite=READ"); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "40"); - jobParams.put("app.arraysize", "30"); - jobParams.put("app.chunksize", "7"); - jobParams.put("app.commitinterval", "10"); - jobParams.put("numberOfSkips", "0"); - jobParams.put("ReadProcessWrite", "READ"); - jobParams.put("app.writepoints", "0,7,14,21,28,30"); - jobParams.put("app.next.writepoints", "7,14,21,28,30"); - - TestUtil.logMsg("Locate job XML file: testChunkMetrics.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("testChunkMetrics", - jobParams); - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" - + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" - + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.COMPLETED, - execution1.getBatchStatus()); - assertWithMessage("Testing metrics", - MetricsStepListener.GOOD_EXIT_STATUS_READ, - execution1.getExitStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testMetricsSkipRead - * - * @assertion: Section 7.1 Job Metrics - Skip Read Count - * @test_Strategy: Force Batch Artifact to skip a known number of reads - test that those skips are reflected in the skip read count - * - */ - - - public void testMetricsSkipRead() throws Fault { - - String METHOD = "testMetricsSkipRead"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("readrecord.fail=1,3"); - TestUtil.logMsg("app.arraysize=30"); - TestUtil.logMsg("numberOfSkips=2"); - TestUtil.logMsg("ReadProcessWrite=READ_SKIP"); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "1,3,4,12"); - jobParams.put("app.arraysize", "30"); - jobParams.put("numberOfSkips", "4"); - jobParams.put("ReadProcessWrite", "READ_SKIP"); - - TestUtil.logMsg("Locate job XML file: testMetricsSkipCount.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("testMetricsSkipCount", - jobParams); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" - + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" - + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.COMPLETED, - execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", - MetricsStepListener.GOOD_EXIT_STATUS_READ, - execution1.getExitStatus()); - - List stepExecutions = jobOp - .getStepExecutions(execution1.getExecutionId()); - - StepExecution step = null; - String stepNameTest = "step1"; - - for (StepExecution stepEx : stepExecutions) { - if (stepNameTest.equals(stepEx.getStepName())) { - step = stepEx; - } - } - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" - + execution1.getBatchStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.COMPLETED, - execution1.getBatchStatus()); - - Metric[] metrics = step.getMetrics(); - - TestUtil.logMsg("Testing the read count for execution #1"); - for (int i = 0; i < metrics.length; i++) { - if (metrics[i].getType().equals(Metric.MetricType.READ_SKIP_COUNT)) { - TestUtil.logMsg("AJM: in test, found metric: " + metrics[i].getType() + ""); - assertWithMessage( - "Testing the read skip count for execution #1", 4L, - metrics[i].getValue()); - } - } - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testMetricsSkipWrite - * - * @assertion: Section 7.1 Job Metrics - Skip Write Count - * @test_Strategy: Force Batch Artifact to skip a known number of writes - test that those skips are reflected in the skip write count - * - */ - - - public void testMetricsSkipWrite() throws Fault { - - String METHOD = "testMetricsSkipWrite"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("readrecord.fail=1,3"); - TestUtil.logMsg("app.arraysize=30"); - TestUtil.logMsg("numberOfSkips=2"); - TestUtil.logMsg("ReadProcessWrite=WRITE_SKIP"); - jobParams.put("execution.number", "1"); - jobParams.put("writerecord.fail", "1,3,4"); - jobParams.put("app.arraysize", "30"); - jobParams.put("numberOfSkips", "3"); - jobParams.put("ReadProcessWrite", "WRITE_SKIP"); - - TestUtil.logMsg("Locate job XML file: testMetricsSkipWriteCount.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("testMetricsSkipWriteCount", - jobParams); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" - + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" - + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.COMPLETED, - execution1.getBatchStatus()); - - List stepExecutions = jobOp - .getStepExecutions(execution1.getExecutionId()); - - StepExecution step = null; - String stepNameTest = "step1"; - - for (StepExecution stepEx : stepExecutions) { - if (stepNameTest.equals(stepEx.getStepName())) { - step = stepEx; - } - } - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" - + execution1.getBatchStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.COMPLETED, - execution1.getBatchStatus()); - - Metric[] metrics = step.getMetrics(); - - TestUtil.logMsg("Testing the write skip count for execution #1"); - for (int i = 0; i < metrics.length; i++) { - if (metrics[i].getType().equals(Metric.MetricType.WRITE_SKIP_COUNT)) { - TestUtil.logMsg("AJM: in test, found metric: " + metrics[i].getType() + ""); - assertWithMessage( - "Testing the write skip count for execution #1", 3L, - metrics[i].getValue()); - } - } - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testMetricsSkipProcess - * - * @assertion: Section 7.1 Job Metrics - Skip Process Count - * @test_Strategy: Force Batch Artifact to skip a known number of processing - test that those skips are reflected in the skip process count - * - */ - - - public void testMetricsSkipProcess() throws Fault { - String METHOD = "testMetricsSkipProcess"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("readrecord.fail=7,13"); - TestUtil.logMsg("app.arraysize=30"); - TestUtil.logMsg("numberOfSkips=2"); - TestUtil.logMsg("ReadProcessWrite=PROCESS"); - jobParams.put("execution.number", "1"); - jobParams.put("processrecord.fail", "7,13"); - jobParams.put("app.arraysize", "30"); - jobParams.put("numberOfSkips", "2"); - jobParams.put("ReadProcessWrite", "PROCESS"); - - TestUtil.logMsg("Locate job XML file: testMetricsSkipCount.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("testMetricsSkipCount", - jobParams); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" - + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" - + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.COMPLETED, - execution1.getBatchStatus()); - assertWithMessage("Testing execution #1", - MetricsStepListener.GOOD_EXIT_STATUS_PROCESS, - execution1.getExitStatus()); - - List stepExecutions = jobOp - .getStepExecutions(execution1.getExecutionId()); - - StepExecution step = null; - String stepNameTest = "step1"; - - for (StepExecution stepEx : stepExecutions) { - if (stepNameTest.equals(stepEx.getStepName())) { - step = stepEx; - } - } - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" - + execution1.getBatchStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.COMPLETED, - execution1.getBatchStatus()); - - Metric[] metrics = step.getMetrics(); - - TestUtil.logMsg("Testing the read count for execution #1"); - for (int i = 0; i < metrics.length; i++) { - if (metrics[i].getType().equals(Metric.MetricType.PROCESS_SKIP_COUNT)) { - TestUtil.logMsg("AJM: in test, found metric: " + metrics[i].getType() + ""); - assertWithMessage( - "Testing the read count for execution #1", 2L, - metrics[i].getValue()); - } - } - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testReadMetric - * - * @assertion: Section 7.1 Job Metrics - Read Count - * @test_Strategy: Batch Artifact reads a known number of items - test that those reads are reflected in the read count - * - */ - - - public void testReadMetric() throws Fault { - String METHOD = "testReadMetric"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("readrecord.fail=40"); - TestUtil.logMsg("app.arraysize=30"); - TestUtil.logMsg("app.chunksize=7"); - TestUtil.logMsg("app.commitinterval=10"); - TestUtil.logMsg("numberOfSkips=0"); - TestUtil.logMsg("ReadProcessWrite=READ"); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "-1"); - jobParams.put("app.arraysize", "30"); - - TestUtil.logMsg("Locate job XML file: testChunkMetrics.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("testMetricCount", - jobParams); - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" - + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" - + execution1.getExitStatus() + ""); - - List stepExecutions = jobOp - .getStepExecutions(execution1.getExecutionId()); - - StepExecution step = null; - String stepNameTest = "step1Metric"; - - for (StepExecution stepEx : stepExecutions) { - if (stepNameTest.equals(stepEx.getStepName())) { - step = stepEx; - } - } - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" - + execution1.getBatchStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.COMPLETED, - execution1.getBatchStatus()); - - Metric[] metrics = step.getMetrics(); - - TestUtil.logMsg("Testing the read count for execution #1"); - for (int i = 0; i < metrics.length; i++) { - if (metrics[i].getType().equals(Metric.MetricType.READ_COUNT)) { - TestUtil.logMsg("AJM: in test, found metric: " + metrics[i].getType() + ""); - assertWithMessage( - "Testing the read count for execution #1", 9L, - metrics[i].getValue()); - } - } - - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testWriteMetric - * - * @assertion: Section 7.1 Job Metrics - Write Count - * @test_Strategy: Batch Artifact writes a known number of items - test that those writes are reflected in the write count - * - */ - - - public void testWriteMetric() throws Fault { - String METHOD = "testWriteMetric"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - - TestUtil.logMsg("Locate job XML file: testChunkMetrics.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("testMetricCount", - jobParams); - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" - + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" - + execution1.getExitStatus() + ""); - - List stepExecutions = jobOp - .getStepExecutions(execution1.getExecutionId()); - - StepExecution step = null; - String stepNameTest = "step1Metric"; - - for (StepExecution stepEx : stepExecutions) { - if (stepNameTest.equals(stepEx.getStepName())) { - step = stepEx; - } - } - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" - + execution1.getBatchStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.COMPLETED, - execution1.getBatchStatus()); - - Metric[] metrics = step.getMetrics(); - - TestUtil.logMsg("Testing the read count for execution #1"); - for (int i = 0; i < metrics.length; i++) { - if (metrics[i].getType().equals(Metric.MetricType.WRITE_COUNT)) { - TestUtil.logMsg("AJM: in test, found metric: " + metrics[i].getType() + ""); - assertWithMessage( - "Testing the write count for execution #1", 9L, - metrics[i].getValue()); - } - } - - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testMetricsFilterCount - * - * @assertion: Section 7.1 Job Metrics - Filter Count - * @test_Strategy: Batch Artifact filters a known number of items while processing - test that those filter actions are reflected in the filter count - * - */ - - - public void testMetricsFilterCount() throws Fault { - - String METHOD = "testMetricsFilterCount"; -TestUtil.logTrace(METHOD); - - try { - - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - jobParams.put("app.processFilterItem", "3"); - TestUtil.logMsg("app.processFilterItem=3"); - - TestUtil.logMsg("Locate job XML file: testMetricsFilterCount.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("testMetricsFilterCount", - jobParams); - - TestUtil.logMsg("Obtaining StepExecutions for execution id: " - + execution1.getExecutionId() + ""); - List stepExecutions = jobOp - .getStepExecutions(execution1.getExecutionId()); - - StepExecution tempstep = null; - StepExecution step = null; - String stepNameTest = "step1FM"; - - for (StepExecution stepEx : stepExecutions) { - if (stepNameTest.equals(stepEx.getStepName())) { - step = stepEx; - } - } - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" - + execution1.getBatchStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.COMPLETED, - execution1.getBatchStatus()); - Metric[] metrics = step.getMetrics(); - - TestUtil.logMsg("Testing the filter count for execution #1"); - for (int i = 0; i < metrics.length; i++) { - if (metrics[i].getType().equals(Metric.MetricType.FILTER_COUNT)) { - assertWithMessage( - "Testing the filter count for execution #1", 1L, - metrics[i].getValue()); - } - } - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testMetricsCommitCount - * - * @assertion: Section 7.1 Job Metrics - Commit Count - * @test_Strategy: Batch Artifact read/process/writes a known number of items and all are committed - test that those commits are reflected in the commit count - * - */ - - - public void testMetricsCommitCount() throws Fault { - - String METHOD = "testMetricsCommitCount"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - jobParams.put("app.processFilterItem", "3"); - TestUtil.logMsg("app.processFilterItem=3"); - - TestUtil.logMsg("Locate job XML file: testMetricsCommitCount.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("testMetricsCommitCount", - jobParams); - - TestUtil.logMsg("Obtaining StepExecutions for execution id: " - + execution1.getExecutionId() + ""); - List stepExecutions = jobOp - .getStepExecutions(execution1.getExecutionId()); - - StepExecution tempstep = null; - StepExecution step = null; - String stepNameTest = "step1CCM"; - - for (StepExecution stepEx : stepExecutions) { - if (stepNameTest.equals(stepEx.getStepName())) { - step = stepEx; - } - } - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" - + execution1.getBatchStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.COMPLETED, - execution1.getBatchStatus()); - Metric[] metrics = step.getMetrics(); - - TestUtil.logMsg("Testing the commit count for execution #1"); - for (int i = 0; i < metrics.length; i++) { - if (metrics[i].getType().equals(Metric.MetricType.COMMIT_COUNT)) { - assertWithMessage( - "Testing the commit count for execution #1", 4L, - metrics[i].getValue()); - } - } - } catch (Exception e) { - handleException(METHOD, e); - } - } - - - /* - * @testName: testMetricsStepTimestamps - * - * @assertion: Section 7.1 Job Metrics - Commit Count - * @test_Strategy: test case records a point in time and starts a job which contains a step. test that the step start time - * occurs after the test case point in time. test that the step end time occurs after the step start time. - * test that the step end time occurs after the test case point in time. - * - */ - - - public void testMetricsStepTimestamps() throws Fault { - - String METHOD = "testMetricsStepTimestamps"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - jobParams.put("app.processFilterItem", "3"); - TestUtil.logMsg("app.processFilterItem=3"); - - TestUtil.logMsg("Locate job XML file: testMetricsCommitCount.xml"); - long time = System.currentTimeMillis(); - Date ts = new Date(time); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("testMetricsCommitCount", - jobParams); - - TestUtil.logMsg("Obtaining StepExecutions for execution id: " - + execution1.getExecutionId() + ""); - List stepExecutions = jobOp - .getStepExecutions(execution1.getExecutionId()); - - StepExecution tempstep = null; - StepExecution step = null; - String stepNameTest = "step1CCM"; - - for (StepExecution stepEx : stepExecutions) { - if (stepNameTest.equals(stepEx.getStepName())) { - step = stepEx; - } - } - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" - + execution1.getBatchStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.COMPLETED, - execution1.getBatchStatus()); - - TestUtil.logMsg("AJM: testcase start time: " + ts + ""); - TestUtil.logMsg("AJM: step start time: " + step.getStartTime() + ""); - TestUtil.logMsg("AJM: step end time: " + step.getEndTime() + ""); - - assertWithMessage("Start time of test occurs approximately before start time of step", roughlyOrdered(ts, step.getStartTime())); - assertWithMessage("Start time of step occurs approximately before end time of step", roughlyOrdered(step.getStartTime(), step.getEndTime())); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testMetricsJobExecutionTimestamps - * - * @assertion: Section 7.1 Job Metrics - Commit Count - * @test_Strategy: test starts a job. Test that the start time of the testcase occurs before the start time of the job. - * test that the job create time occurs before the job start time. test that the job end time occurs - * after the job start time. test that the last status update time occurs after the job start time. - * test that the job end time occurs after the testcase start time. - * - */ - - - public void testMetricsJobExecutionTimestamps() throws Fault { - - String METHOD = "testMetricsJobExecutionTimestamps"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - jobParams.put("app.processFilterItem", "3"); - TestUtil.logMsg("app.processFilterItem=3"); - - TestUtil.logMsg("Locate job XML file: testMetricsCommitCount.xml"); - - long time = System.currentTimeMillis(); - Date ts = new Date(time); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution execution1 = jobOp.startJobAndWaitForResult("testMetricsCommitCount", - jobParams); - - - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" - + execution1.getBatchStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.COMPLETED, - execution1.getBatchStatus()); - - TestUtil.logMsg("AJM: testcase start time: " + ts + ""); - TestUtil.logMsg("AJM: job create time: " + execution1.getCreateTime() + ""); - TestUtil.logMsg("AJM: job start time: " + execution1.getStartTime() + ""); - TestUtil.logMsg("AJM: job last updated time: " + execution1.getLastUpdatedTime() + ""); - TestUtil.logMsg("AJM: job end time: " + execution1.getEndTime() + ""); - - assertWithMessage("Start time of test occurs approximately before create time of job", roughlyOrdered(ts, execution1.getCreateTime())); - assertWithMessage("Create time of job occurs approximately before start time of job", roughlyOrdered(execution1.getCreateTime(), execution1.getStartTime())); - assertWithMessage("Start time of job occurs approximately before end time of job", roughlyOrdered(execution1.getStartTime(), execution1.getEndTime())); - assertWithMessage("Start time of job occurs approximately before Last Updated time of job", roughlyOrdered(execution1.getStartTime(), execution1.getLastUpdatedTime())); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - private static void handleException(String methodName, Exception e) throws Fault { -TestUtil.logErr("Caught exception: " + e.getMessage()); -TestUtil.printStackTrace(e); -throw new Fault(methodName + " failed", e);} - - /* - * We want to confirm that 'd1' is roughly before 'd2', and also to - * allow for the fact that dates may be stored with a loss of precision. - * - * Let's assume then that we only have whole seconds precision (without - * necessarily accounting for any fractional seconds). - * - * So we can't simply perform d1 < d2, or even d1 <= d2 (the inclusion of 'equals' - * corrects for a different problem, the problem of running so fast that - * the times for d1 and d2 are the same even though d1 may still have - * been executed first). - * - * The "worst" case (in terms of highest rounding error), then, is that 'd1' gets - * rounded up while 'd2' gets rounded down, leaving the rounded 'd1' value a full - * second higher than the rounded 'd2' value. - * - * Therefore we check that d2 minus d1, which before rounding should be >= 0, is - * instead no less than -1000 (1 second). - */ - private static boolean roughlyOrdered(Date d1, Date d2) { - long time1 = d1.getTime(); - long time2 = d2.getTime(); - - long diff = time2 - time1; - - return diff >= -1000 ? true : false; - } - -} diff --git a/src/com/ibm/jbatch/tck/tests/jslxml/ParallelExecutionTests.java b/src/com/ibm/jbatch/tck/tests/jslxml/ParallelExecutionTests.java deleted file mode 100644 index 586470aa81..0000000000 --- a/src/com/ibm/jbatch/tck/tests/jslxml/ParallelExecutionTests.java +++ /dev/null @@ -1,608 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.tests.jslxml; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - - - -import static com.ibm.jbatch.tck.utils.AssertionUtils.assertObjEquals; -import static com.ibm.jbatch.tck.utils.AssertionUtils.assertWithMessage; - -import java.util.List; -import java.util.Properties; -import java.util.logging.Logger; - -import jakarta.batch.runtime.BatchStatus; -import jakarta.batch.runtime.JobExecution; -import jakarta.batch.runtime.StepExecution; - - - - - - - -import com.ibm.jbatch.tck.utils.JobOperatorBridge; -import com.ibm.jbatch.tck.utils.TCKJobExecutionWrapper; - - -public class ParallelExecutionTests extends ServiceEETest { - - private final static Logger logger = Logger.getLogger(ParallelExecutionTests.class.getName()); - - private static final String TIME_TO_SLEEP_BEFORE_ISSUING_STOP = "1900"; - - private static JobOperatorBridge jobOp = null; - - public static void setup(String[] args, Properties props) throws Fault { - String METHOD = "setup"; -TestUtil.logTrace(METHOD); - - try { - jobOp = new JobOperatorBridge(); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - - - public static void setUp() throws Fault { - jobOp = new JobOperatorBridge(); - } - - - public static void cleanup() throws Fault { - } - - - private void begin(String str) { - TestUtil.logMsg("Begin test method: " + str + ""); - } - - /* - * @testName: testInvokeJobWithOnePartitionedStep - * @assertion: FIXME - * @test_Strategy: FIXME - */ - - - public void testInvokeJobWithOnePartitionedStep() throws Fault { - String METHOD = "testInvokeJobWithOnePartitionedStep"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_partitioned_1step.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExecution = jobOp.startJobAndWaitForResult("job_partitioned_1step"); - - TestUtil.logMsg("JobExecution getBatchStatus()="+jobExecution.getBatchStatus()); - assertObjEquals(BatchStatus.COMPLETED, jobExecution.getBatchStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testInvokeJobWithOnePartitionedStepExitStatus - * @assertion: FIXME - * @test_Strategy: FIXME - */ - - - public void testInvokeJobWithOnePartitionedStepExitStatus() throws Fault { - String METHOD = "testInvokeJobWithOnePartitionedStepExitStatus"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - String DEFAULT_SLEEP_TIME = "2000"; - - try { - Properties jobParameters = new Properties(); - - String sleepTime = System.getProperty("ParallelExecutionTests.testInvokeJobWithOnePartitionedStepExitStatus.sleep",DEFAULT_SLEEP_TIME); - jobParameters.put("sleep.time", sleepTime); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExecution = jobOp.startJobAndWaitForResult("job_partitioned_1step_exitStatusTest",jobParameters); - - TestUtil.logMsg("JobExecution getBatchStatus()="+jobExecution.getBatchStatus()); - assertObjEquals(BatchStatus.COMPLETED, jobExecution.getBatchStatus()); - - List stepExecutions = jobOp.getStepExecutions(jobExecution.getExecutionId()); - assertObjEquals(1, stepExecutions.size()); - - for (StepExecution stepEx : stepExecutions) { - assertObjEquals("STEP EXIT STATUS: 10", stepEx.getExitStatus()); - assertObjEquals(BatchStatus.COMPLETED, stepEx.getBatchStatus()); - } - - assertObjEquals("JOB EXIT STATUS: 10", jobExecution.getExitStatus()); - assertObjEquals(BatchStatus.COMPLETED, jobExecution.getBatchStatus()); - - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testStopRunningPartitionedStep - * - * @assertion: Issuing a JobOperator.stop() will stop all partitioned - * threads - * - * @test_Strategy: A partitioned batchlet is run in an infinite loop with 4 - * instances. The Test verifies that the job returns with STOPPED status - * instead of running forever. - */ - - - public void testStopRunningPartitionedStep() throws Fault { - String METHOD = "testStopRunningPartitionedStep"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_batchlet_longrunning_partitioned.xml"); - - TestUtil.logMsg("Create job parameters"); - Properties overrideJobParams = new Properties(); - TestUtil.logMsg("run.indefinitely=true"); - overrideJobParams.setProperty("run.indefinitely" , "true"); - - TestUtil.logMsg("Invoke startJobWithoutWaitingForResult"); - JobExecution jobExecution = jobOp.startJobWithoutWaitingForResult("job_batchlet_longrunning_partitioned", overrideJobParams); - - //Sleep long enough for parallel steps to fan out - int sleepTime = Integer.parseInt(System.getProperty("ParallelExecutionTests.testStopRunningPartitionedStep.sleep",TIME_TO_SLEEP_BEFORE_ISSUING_STOP)); - TestUtil.logMsg("Sleep for " + TIME_TO_SLEEP_BEFORE_ISSUING_STOP); - Thread.sleep(sleepTime); - - - TestUtil.logMsg("Invoke stopJobAndWaitForResult"); - jobOp.stopJobAndWaitForResult(jobExecution); - - JobExecution jobExec2 = jobOp.getJobExecution(jobExecution.getExecutionId()); - TestUtil.logMsg("JobExecution getBatchStatus()=" + jobExec2.getBatchStatus() + ""); - assertObjEquals(BatchStatus.STOPPED, jobExec2.getBatchStatus()); - - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testStopRestartRunningPartitionedStep - * - * @assertion: A stopped partitioned step can be restarted to completion. - * - * @test_Strategy: A partitioned batchlet is run in an infinite loop with 4 - * instances. The Test verifies that the job returns with STOPPED status - * instead of running forever. The job is restarted and each partition must - * restart and run to completion. - */ - - - public void testStopRestartRunningPartitionedStep() throws Fault { - String METHOD = "testStopRestartRunningPartitionedStep"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_batchlet_longrunning_partitioned.xml"); - - TestUtil.logMsg("Create job parameters"); - Properties jobParams = new Properties(); - TestUtil.logMsg("run.indefinitely=true"); - jobParams.setProperty("run.indefinitely", "true"); - - TestUtil.logMsg("Invoke startJobWithoutWaitingForResult"); - JobExecution origJobExecution = jobOp.startJobWithoutWaitingForResult("job_batchlet_longrunning_partitioned", jobParams); - - // Sleep long enough for parallel steps to fan out - int sleepTime = Integer.parseInt(System.getProperty("ParallelExecutionTests.testStopRestartRunningPartitionedStep.sleep",TIME_TO_SLEEP_BEFORE_ISSUING_STOP)); - TestUtil.logMsg("Sleep for " + TIME_TO_SLEEP_BEFORE_ISSUING_STOP); - Thread.sleep(sleepTime); - - TestUtil.logMsg("Invoke stopJobAndWaitForResult"); - jobOp.stopJobAndWaitForResult(origJobExecution); - - JobExecution jobExec2 = jobOp.getJobExecution(origJobExecution.getExecutionId()); - TestUtil.logMsg("JobExecution getBatchStatus()=" + jobExec2.getBatchStatus() + ""); - assertObjEquals(BatchStatus.STOPPED, jobExec2.getBatchStatus()); - - TestUtil.logMsg("Create restart job parameters"); - Properties restartJobParams = new Properties(); - TestUtil.logMsg("run.indefinitely=true"); - restartJobParams.setProperty("run.indefinitely", "false"); - - TestUtil.logMsg("Invoke restartJobAndWaitForResult"); - JobExecution restartedJobExec = jobOp.restartJobAndWaitForResult(origJobExecution.getExecutionId(), restartJobParams); - - TestUtil.logMsg("JobExecution getBatchStatus()=" + restartedJobExec.getBatchStatus() + ""); - assertObjEquals(BatchStatus.COMPLETED, restartedJobExec.getBatchStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testInvokeJobSimpleSplit - * @assertion: FIXME - * @test_Strategy: FIXME - */ - - - public void testInvokeJobSimpleSplit() throws Fault { - String METHOD = "testInvokeJobSimpleSplit"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_split_batchlet_4steps.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution execution = jobOp.startJobAndWaitForResult("job_split_batchlet_4steps"); - - TestUtil.logMsg("JobExecution getBatchStatus()="+execution.getBatchStatus()); - assertObjEquals(BatchStatus.COMPLETED, execution.getBatchStatus()); - assertObjEquals("COMPLETED", execution.getExitStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testPartitionedPlanCollectorAnalyzerReducerComplete - * - * @assertion: Section 8.7. Partitioned artifact and Chunk processing order. - * Partition mapper can generate a plan that will determine partition - * instances and properties. - * - * @test_Strategy: A chunk is partitioned into exactly 3 partitions, using - * the mapper, each with their own checkpointing. The collector, analyzer, - * and reducer, each append to the exit status to verify that they are - * called in the correct order. The persistent data is used to remember how - * many times the step has been run. If the data is not persisted - */ - - - public void testPartitionedPlanCollectorAnalyzerReducerComplete() throws Fault { - String METHOD = "testPartitionedPlanCollectorAnalyzerReducerComplete"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_partitioned_artifacts.xml"); - - TestUtil.logMsg("Create Job parameters for Execution #1"); - Properties jobParams = new Properties(); - TestUtil.logMsg("numPartitionsProp=3"); - //append "CA" to expected exit status for each partition - jobParams.setProperty("numPartitionsProp" , "3"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution execution = jobOp.startJobAndWaitForResult("job_partitioned_artifacts", jobParams); - - TestUtil.logMsg("Execution exit status = " + execution.getExitStatus()); - assertObjEquals("nullBeginCACACABeforeAfter", execution.getExitStatus()); - - TestUtil.logMsg("Execution status = " + execution.getBatchStatus()); - assertObjEquals(BatchStatus.COMPLETED,execution.getBatchStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testZeroBasedPartitionedPlanCollectorAnalyzerReducerRollback - * - * @assertion: Section 8.7. Partitioned artifact and Chunk processing order - * verifies that Rollback() is called on the reducer in case of a failure in - * any partition. Also verifies that the collector and analyzer are always - * called at the end of a partition even in the case or a failure, and - * partition properties are passed to partitions. - * - * @test_Strategy: A mapper is used to generate exactly 3 partitions, with - * one partition marked to fail. Each partition appends to the exit status - * through the collector, analyzer, and finally the reducer. - */ - - - public void testZeroBasedPartitionedPlanCollectorAnalyzerReducerRollback() throws Fault { - String METHOD = "testZeroBasedPartitionedPlanCollectorAnalyzerReducerRollback"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_partitioned_artifacts.xml"); - - TestUtil.logMsg("Create Job parameters for Execution #1"); - Properties jobParams = new Properties(); - TestUtil.logMsg("numPartitionsProp=3"); - TestUtil.logMsg("failThisPartition=0"); - //append "CA" to expected exit status for each partition - jobParams.setProperty("numPartitionsProp" , "3"); - jobParams.setProperty("failThisPartition" , "0"); //Remember we are 0 based - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution execution = jobOp.startJobAndWaitForResult("job_partitioned_artifacts", jobParams); - - TestUtil.logMsg("Execution exit status = " + execution.getExitStatus()); - assertObjEquals("nullBeginCACACARollbackAfter", execution.getExitStatus()); - - TestUtil.logMsg("Execution status = " + execution.getBatchStatus()); - assertObjEquals(BatchStatus.FAILED,execution.getBatchStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testPartitionedCollectorAnalyzerReducerChunkRestartItemCount10 - * - * @assertion: Section 8.7. Partitioned artifact and Chunk processing order. - * and persistent data in partitioned step is actually persisted, and a - * completed partition is not restarted. - * - * @test_Strategy: A chunk is partitioned into 3 partitions each with their - * own checkpointing. The collector, analyzer, and reducer, each append to - * the exit status to verify that they are called in the correct order. (The - * 'C' in the exit status String represents a call to the (C)ollector and - * the 'A' a call to the (A)nalyzer). The persistent data is used to remember - * how many times the step has been run. If the data is not persisted correctly - * the partitioned steps will not be * able to complete because the persisted count will not get incremented One - * of the partitions completes on the first attempt. The other two fail and - * must be restarted. We verify that the completed partition is not rerun - * since it does not append any data to the exit status. - */ - - - public void testPartitionedCollectorAnalyzerReducerChunkRestartItemCount10() throws Fault { - - String METHOD = "testPartitionedCollectorAnalyzerReducerChunkRestartItemCount10"; -TestUtil.logTrace(METHOD); - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("readrecord.fail=23"); - TestUtil.logMsg("app.arraysize=30"); - TestUtil.logMsg("app.writepoints=0,5,10,15,20,25,30"); - TestUtil.logMsg("app.next.writepoints=0,5,10,15,20,25,30"); - jobParams.put("readrecord.fail", "23"); - jobParams.put("app.arraysize", "30"); - jobParams.put("app.writepoints", "0,10,20,30"); - jobParams.put("app.next.writepoints", "20,30"); - - TestUtil.logMsg("Locate job XML file: chunkrestartPartitionedCheckpt10.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - TCKJobExecutionWrapper execution1 = jobOp.startJobAndWaitForResult("chunkrestartPartitionedCheckpt10", jobParams); - - { // Use block to reduce copy/paste errors - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + execution1.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + execution1.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.FAILED, execution1.getBatchStatus()); - - // '2' each from partition that gets through the first two chunks and fails during the third - // '4' for the partition that gets through all three chunks, plus one call for end of partition - int CA_PAIRS = 2 + 2 + 4; - String CA = "CA"; // This is a (C)ollector(A)nalyzerPair - - String expectedExitStatus = "null"; // verifies clean exit status - expectedExitStatus += "Begin"; // From PartitionReducer beginPartitionedStep() - for (int i = 0; i < CA_PAIRS; i++, expectedExitStatus += CA); - expectedExitStatus += "Rollback"; // From PartitionReducer rollbackPartitionedStep() - expectedExitStatus += "After"; // From PartitionReducer afterPartitionedStepCompletion() - - // Should be: "nullBeginCACACACACACACACARollbackAfter" - assertWithMessage("Testing execution #1", expectedExitStatus, execution1.getExitStatus()); - } - - { - long execution1Id = execution1.getExecutionId(); - long execution1InstanceId = execution1.getInstanceId(); - TestUtil.logMsg("Invoke restartJobAndWaitForResult with execution id: " + execution1Id + ""); - TCKJobExecutionWrapper execution2 = jobOp.restartJobAndWaitForResult(execution1Id, jobParams); - - TestUtil.logMsg("execution #2 JobExecution getBatchStatus()=" + execution2.getBatchStatus() + ""); - TestUtil.logMsg("execution #2 JobExecution getExitStatus()=" + execution2.getExitStatus() + ""); - TestUtil.logMsg("execution #2 Job instance id=" + execution2.getInstanceId() + ""); - TestUtil.logMsg("execution #2 Job execution id=" + execution2.getExecutionId() + ""); - - // '2' for each of the two partitions that process chunks #2, #3, and each make one C+A call - // at the end of the partition and '0' for the partition already complete. - int CA_PAIRS = 2 + 2; - String CA = "CA"; // This is a (C)ollector(A)nalyzerPair - - String expectedExitStatus = "null"; // verifies clean exit status - expectedExitStatus += "Begin"; // From PartitionReducer beginPartitionedStep() - for (int i = 0; i < CA_PAIRS; i++, expectedExitStatus += CA); - expectedExitStatus += "Before"; // From PartitionReducer beforePartitionedStepCompletion() - expectedExitStatus += "After"; // From PartitionReducer afterPartitionedStepCompletion() - - // Should be: "nullBeginCACACACABeforeAfter" - assertWithMessage("Testing execution #2 exit status", expectedExitStatus, execution2.getExitStatus()); - assertWithMessage("Testing execution #2 batch status", BatchStatus.COMPLETED, execution2.getBatchStatus()); - assertWithMessage("Testing execution #2 instance ID", execution1InstanceId, execution2.getInstanceId()); - } - - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testPartitionedMapperOverrideFalseOnRestart - * - * @assertion: Section 8.7. Partitioned artifact and Chunk processing order. - * Partition mapper can generate a plan that will determine partition - * instances and properties. - * - * @test_Strategy: - */ - - - public void testPartitionedMapperOverrideFalseOnRestart() throws Fault { - String METHOD = "testPartitionedMapperOverrideFalse"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_partitioned_artifacts.xml"); - - TestUtil.logMsg("Create Job parameters for Execution #1"); - Properties jobParams = new Properties(); - TestUtil.logMsg("numPartitionsProp=3"); - TestUtil.logMsg("failThisPartition=0"); - //append "CA" to expected exit status for each partition - jobParams.setProperty("numPartitionsProp" , "3"); - jobParams.setProperty("failThisPartition" , "0"); //Remember we are 0 based - jobParams.setProperty("partitionsOverride", "false"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution execution = jobOp.startJobAndWaitForResult("job_partitioned_artifacts", jobParams); - - TestUtil.logMsg("Execution exit status = " + execution.getExitStatus()); - assertObjEquals("nullBeginCACACARollbackAfter", execution.getExitStatus()); - - TestUtil.logMsg("Execution status = " + execution.getBatchStatus()); - assertObjEquals(BatchStatus.FAILED,execution.getBatchStatus()); - - TestUtil.logMsg("Set restart job parameters"); - jobParams.setProperty("numPartitionsProp" , "7"); - jobParams.setProperty("failThisPartition" , "5"); //Remember we are 0 based - jobParams.setProperty("partitionsOverride", "false"); - - JobExecution execution2 = jobOp.restartJobAndWaitForResult(execution.getExecutionId(), jobParams); - TestUtil.logMsg("Execution exit status = " + execution2.getExitStatus()); - assertObjEquals("nullBeginCABeforeAfter", execution2.getExitStatus()); - - } catch (Exception e) { - handleException(METHOD, e); - } - } - - - /* - * @testName: testPartitionedMapperOverrideTrueDiffPartitionNumOnRestart - * - * @assertion: - * - * @test_Strategy: - */ - - - public void testPartitionedMapperOverrideTrueDiffPartitionNumOnRestart() throws Fault { - String METHOD = "testPartitionedMapperOverrideFalse"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_partitioned_artifacts.xml"); - - TestUtil.logMsg("Create Job parameters for Execution #1"); - Properties jobParams = new Properties(); - TestUtil.logMsg("numPartitionsProp=3"); - TestUtil.logMsg("failThisPartition=0"); - //append "CA" to expected exit status for each partition - jobParams.setProperty("numPartitionsProp" , "2"); - jobParams.setProperty("failThisPartition" , "0"); //Remember we are 0 based - jobParams.setProperty("partitionsOverride", "false"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution execution = jobOp.startJobAndWaitForResult("job_partitioned_artifacts", jobParams); - - TestUtil.logMsg("Execution exit status = " + execution.getExitStatus()); - assertObjEquals("nullBeginCACARollbackAfter", execution.getExitStatus()); - - TestUtil.logMsg("Execution status = " + execution.getBatchStatus()); - assertObjEquals(BatchStatus.FAILED,execution.getBatchStatus()); - - TestUtil.logMsg("Set restart job parameters"); - jobParams.setProperty("numPartitionsProp" , "4"); - jobParams.setProperty("failThisPartition" , "3"); //Remember we are 0 based - jobParams.setProperty("partitionsOverride", "true"); - - JobExecution execution2 = jobOp.restartJobAndWaitForResult(execution.getExecutionId(), jobParams); - TestUtil.logMsg("Execution exit status = " + execution2.getExitStatus()); - assertObjEquals("nullBeginCACACACARollbackAfter", execution2.getExitStatus()); - - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testPartitionedMapperOverrideTrueSamePartitionNumOnRestart - * - * @assertion: - * - * @test_Strategy: - */ - - - public void testPartitionedMapperOverrideTrueSamePartitionNumOnRestart() throws Fault { - String METHOD = "testPartitionedMapperOverrideFalse"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_partitioned_artifacts.xml"); - - TestUtil.logMsg("Create Job parameters for Execution #1"); - Properties jobParams = new Properties(); - TestUtil.logMsg("numPartitionsProp=3"); - TestUtil.logMsg("failThisPartition=0"); - //append "CA" to expected exit status for each partition - jobParams.setProperty("numPartitionsProp" , "3"); - jobParams.setProperty("failThisPartition" , "0"); //Remember we are 0 based - jobParams.setProperty("partitionsOverride", "false"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution execution = jobOp.startJobAndWaitForResult("job_partitioned_artifacts", jobParams); - - TestUtil.logMsg("Execution exit status = " + execution.getExitStatus()); - assertObjEquals("nullBeginCACACARollbackAfter", execution.getExitStatus()); - - TestUtil.logMsg("Execution status = " + execution.getBatchStatus()); - assertObjEquals(BatchStatus.FAILED,execution.getBatchStatus()); - - TestUtil.logMsg("Set restart job parameters"); - jobParams.setProperty("numPartitionsProp" , "3"); - jobParams.setProperty("failThisPartition" , "1"); //Remember we are 0 based - jobParams.setProperty("partitionsOverride", "true"); - - JobExecution execution2 = jobOp.restartJobAndWaitForResult(execution.getExecutionId(), jobParams); - TestUtil.logMsg("Execution exit status = " + execution2.getExitStatus()); - assertObjEquals("nullBeginCACACARollbackAfter", execution2.getExitStatus()); - - } catch (Exception e) { - handleException(METHOD, e); - } - } - - private static void handleException(String methodName, Exception e) throws Fault { -TestUtil.logErr("Caught exception: " + e.getMessage()); -TestUtil.printStackTrace(e); -throw new Fault(methodName + " failed", e);} -} diff --git a/src/com/ibm/jbatch/tck/tests/jslxml/PropertySubstitutionTests.java b/src/com/ibm/jbatch/tck/tests/jslxml/PropertySubstitutionTests.java deleted file mode 100644 index e55731e45c..0000000000 --- a/src/com/ibm/jbatch/tck/tests/jslxml/PropertySubstitutionTests.java +++ /dev/null @@ -1,455 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.tests.jslxml; - - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import static com.ibm.jbatch.tck.utils.AssertionUtils.assertObjEquals; - -import java.io.File; -import java.util.Properties; - -import jakarta.batch.runtime.JobExecution; - -import com.ibm.jbatch.tck.utils.JobOperatorBridge; - - - - - - - -public class PropertySubstitutionTests extends ServiceEETest { - - private static JobOperatorBridge jobOp; - - public static void setup(String[] args, Properties props) throws Fault { - String METHOD = "setup"; - -TestUtil.logTrace(METHOD); - - try { - jobOp = new JobOperatorBridge(); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - - - public static void setUp() throws Fault { - jobOp = new JobOperatorBridge(); - } - - - public static void tearDown() throws Fault { - } - - - public void cleanup() throws Fault { - // Clear this property for next test - System.clearProperty("property.junit.result"); - } - - /* - * @testName: testBatchArtifactPropertyInjection - * - * @assertion: Section 6.3.1, The @BatchProperty may be used on a class - * field for any class identified as a batch programming model artifact - * - * @test_Strategy: Include a property element on a Batchlet artifact and - * verify the java value of the String is set to the same value as in the - * job xml. - */ - - - public void testBatchArtifactPropertyInjection() throws Fault { - String METHOD = "testBatchArtifactPropertyInjection"; - -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_properties2.xml"); - - TestUtil.logMsg("Set system property: property.junit.propName=myProperty1"); - System.setProperty("property.junit.propName", "myProperty1"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_properties2"); - - String result = System.getProperty("property.junit.result"); - TestUtil.logMsg("Test result: " + result + ""); - assertObjEquals("value1", result); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - - /* - * @testName: testInitializedPropertyIsOverwritten - * - * @assertion: The java initialized value is overwritten with the required - * injected value. - * - * @test_Strategy: Include a property element on a Batchlet artifact and - * verify the java value of the String is set to the same value as in the - * job xml even if the Java field is initialized. - */ - - - public void testInitializedPropertyIsOverwritten() throws Fault { - - String METHOD = "testInitializedPropertyIsOverwritten"; - -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_properties2.xml"); - - TestUtil.logMsg("Set system property: property.junit.propName=myProperty2"); - System.setProperty("property.junit.propName", "myProperty2"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_properties2"); - - String result = System.getProperty("property.junit.result"); - TestUtil.logMsg("Test result: " + result + ""); - assertObjEquals("value2", result); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testPropertyWithJobParameter - * - * @assertion: Job Parameters submitted on start are substituted in the job - * XML using the following syntax, #{jobParameters['']} - * - * @test_Strategy: Submit job parameters through JobOperator.start(String, - * Properties) and verify that xml string is substituted correctly by - * injecting the property into a batch artifact - */ - - - public void testPropertyWithJobParameter() throws Fault { - - String METHOD = "testPropertyWithJobParameter"; - -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_properties2.xml"); - - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParameters = new Properties(); - String expectedResult = "mySubmittedValue"; - TestUtil.logMsg("mySubmittedPropr=" + expectedResult + ""); - jobParameters.setProperty("mySubmittedProp", expectedResult); - - TestUtil.logMsg("Set system property: property.junit.propName=mySubmittedProp"); - System.setProperty("property.junit.propName", "mySubmittedProp"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_properties2", jobParameters); - - String result = System.getProperty("property.junit.result"); - TestUtil.logMsg("Test result: " + result + ""); - assertObjEquals(expectedResult, result); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - - /* - * @testName: testDefaultPropertyName - * - * @assertion: If a name value is not supplied on the @BatchProperty - * qualifier the property name defaults to the java field name. - * - * @test_Strategy: Supply an xml property element with the name matching the - * Java field name and verify that the java field value injected matches the - * value provided through the job xml - */ - - - public void testDefaultPropertyName() throws Fault { - - String METHOD = "testDefaultPropertyName"; - -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_properties2.xml"); - - TestUtil.logMsg("Set system property:property.junit.propName=property4"); - System.setProperty("property.junit.propName", "property4"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_properties2"); - - String result = System.getProperty("property.junit.result"); - TestUtil.logMsg("Test result: " + result + ""); - assertObjEquals("value4", result); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testGivenPropertyName - * - * @assertion: The name provided on the @BatchProperty annotation maps to the job xml name of the property element - * - * @test_Strategy: Supply an xml property element with the name matching the - * @BatchProperty name and verify that the java field value injected matches the - * value provided through the job xml. - */ - - - public void testGivenPropertyName() throws Fault { - - String METHOD = "testGivenPropertyName"; - -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_properties2.xml"); - - TestUtil.logMsg("Set system property:property.junit.propName=myProperty4"); - System.setProperty("property.junit.propName", "myProperty4"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_properties2"); - - String result = System.getProperty("property.junit.result"); - TestUtil.logMsg("Test result: " + result + ""); - assertObjEquals("value4", result); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testPropertyInnerScopePrecedence - * - * @assertion: A batch artifacts properties overrides any parent properties defined in - * an outer XML scope. Child properties always override parent properties with the same name. - * - * @test_Strategy: Issue a job with a step level property and batchlet property with the same name. - * Verify that the injected property value is from the artifact level property. - */ - - - public void testPropertyInnerScopePrecedence() throws Fault { - - String METHOD = "testPropertyInnerScopePrecedence"; - -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_properties2.xml"); - - TestUtil.logMsg("Set system property:property.junit.propName=batchletProp"); - System.setProperty("property.junit.propName", "batchletProp"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_properties2"); - - String result = System.getProperty("property.junit.result"); - TestUtil.logMsg("Test result: " + result + ""); - assertObjEquals("batchletPropValue", result); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testPropertyQuestionMarkSimple - * - * @assertion: Section 5.7, The ?:...; syntax is honored for property - * defaulting, if a property cannot be resolved. - * - * @test_Strategy: A jobParameter property is used in the XML which is never passed - * in programmatically resulting in an unresolved property. The property then defaults - * to the default value expression which is verified through it's Java value in the - * batctlet artifact. - */ - - - public void testPropertyQuestionMarkSimple() throws Fault { - - String METHOD = "testPropertyQuestionMarkSimple"; - -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_properties2.xml"); - - TestUtil.logMsg("Set system property:property.junit.propName=defaultPropName1"); - System.setProperty("property.junit.propName", "defaultPropName1"); - - TestUtil.logMsg("Set system property:file.name.junit=myfile1.txt"); - System.setProperty("file.name.junit", "myfile1.txt"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_properties2"); - - // String result = jobExec.getStatus(); - String result = System.getProperty("property.junit.result"); - TestUtil.logMsg("Test result: " + result + ""); - assertObjEquals("myfile1.txt", result); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testPropertyQuestionMarkComplex - * - * @assertion: Section 5.7, Accord to the spec grammar multiple properties can each have their own default - * values and also be concatenated with string literals. - * - * @test_Strategy: Two jobParameter properties are used in the XML which are never passed - * in programmatically resulting in an unresolved property. The properties then default - * to the default value expression. This is verified through the injected Java value in the - * batctlet artifact. - */ - - - public void testPropertyQuestionMarkComplex() throws Fault { - - String METHOD = "testPropertyQuestionMarkComplex"; - -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_properties2.xml"); - - TestUtil.logMsg("Set system property:property.junit.propName=defaultPropName2"); - System.setProperty("property.junit.propName", "defaultPropName2"); - - TestUtil.logMsg("Set system property:file.name.junit=myfile2.txt"); - System.setProperty("file.name.junit", "myfile2"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_properties2"); - - // String result = jobExec.getStatus(); - String result = System.getProperty("property.junit.result"); - TestUtil.logMsg("Test result: " + result + ""); - - assertObjEquals(File.separator + "myfile2.txt", result); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testPropertyWithConcatenation - * - * @assertion: Section 5.7, Properties can be concatenated with string literals. - * - * @test_Strategy: Supply an xml property element with the name matching the - * @BatchProperty name and verify that the java field value injected matches the - * value provided through the job xml. - */ - - - public void testPropertyWithConcatenation() throws Fault { - - String METHOD = "testPropertyWithConcatenation"; - -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_properties2.xml"); - - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParameters = new Properties(); - TestUtil.logMsg("myFilename=testfile1"); - jobParameters.setProperty("myFilename", "testfile1"); - - TestUtil.logMsg("Set system property:file.name.junit=myConcatProp"); - System.setProperty("property.junit.propName", "myConcatProp"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_properties2", jobParameters); - - String result = System.getProperty("property.junit.result"); - TestUtil.logMsg("Test result: " + result + ""); - assertObjEquals("testfile1.txt", result); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testJavaSystemProperty - * - * @assertion: Section 5.7, Java system properties can be substituted in the XML using - * the following systax#{systemProperties['some.property']}, and properties can be - * concatenated. - * - * @test_Strategy: Supply an xml property element with the name matching the - * @BatchProperty name and verify that the java field value injected matches the - * value provided through the job xml. The "file.separator" system property is used - * in this test. - * - */ - - - public void testJavaSystemProperty() throws Fault { - - String METHOD = "testJavaSystemProperty"; - -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_properties2.xml"); - - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParameters = new Properties(); - TestUtil.logMsg("myFilename=testfile2"); - jobParameters.setProperty("myFilename", "testfile2"); - - TestUtil.logMsg("Set system property:file.name.junit=myJavaSystemProp"); - System.setProperty("property.junit.propName", "myJavaSystemProp"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_properties2", jobParameters); - String result = System.getProperty("property.junit.result"); - - String pathSep = System.getProperty("file.separator"); - - TestUtil.logMsg("Test result: " + pathSep + "test" + pathSep + "testfile2.txt"); - assertObjEquals(pathSep + "test" + pathSep + "testfile2.txt", result); - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - private static void handleException(String methodName, Exception e) throws Fault { -TestUtil.logErr("Caught exception: " + e.getMessage()); -TestUtil.printStackTrace(e); -throw new Fault(methodName + " failed", e);} -} diff --git a/src/com/ibm/jbatch/tck/tests/jslxml/RestartNotMostRecentTests.java b/src/com/ibm/jbatch/tck/tests/jslxml/RestartNotMostRecentTests.java deleted file mode 100644 index c4cbb7cebd..0000000000 --- a/src/com/ibm/jbatch/tck/tests/jslxml/RestartNotMostRecentTests.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.tests.jslxml; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import static com.ibm.jbatch.tck.utils.AssertionUtils.assertWithMessage; - -import java.util.Properties; - -import jakarta.batch.operations.JobExecutionNotMostRecentException; -import jakarta.batch.runtime.JobExecution; - - - - - - - -import com.ibm.jbatch.tck.utils.JobOperatorBridge; - -public class RestartNotMostRecentTests extends ServiceEETest { - - private JobOperatorBridge jobOp = null; - - /* - * @testName: testRestartNotMostRecentException - * - * @assertion: FIXME - * - * @test_Strategy: FIXME - */ - - - public void testRestartNotMostRecentException() throws Fault { - String METHOD = "testRestartNotMostRecentException"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("starting job"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - jobParams.put("execution.number", "1"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_attributes_restart_true_test", jobParams); - - Properties restartParams = new Properties(); - TestUtil.logMsg("execution.number=2"); - restartParams.put("execution.number", "2"); - jobOp.restartJobAndWaitForResult(jobExec.getExecutionId(), restartParams); - - try { - TestUtil.logMsg("Trying to execute the first job execution again."); - jobOp.restartJobAndWaitForResult(jobExec.getExecutionId(), restartParams); - assertWithMessage("It should have thrown JobExecutionNotMostRecentException", false); - } catch(JobExecutionNotMostRecentException e) { - assertWithMessage("JobExecutionNotMostRecentException thrown", true); - } - - TestUtil.logMsg("Job Status = " + jobExec.getBatchStatus()); - TestUtil.logMsg("job completed"); - - } catch (Exception e) { - handleException(METHOD, e); - } - } - - - private static void handleException(String methodName, Exception e) throws Fault { -TestUtil.logErr("Caught exception: " + e.getMessage()); -TestUtil.printStackTrace(e); -throw new Fault(methodName + " failed", e);} - - public void setup(String[] args, Properties props) throws Fault { - - String METHOD = "setup"; -TestUtil.logTrace(METHOD); - - try { - jobOp = new JobOperatorBridge(); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* cleanup */ - public void cleanup() - { - - } - - - public void beforeTest() throws ClassNotFoundException { - jobOp = new JobOperatorBridge(); - } - - - public void afterTest() { - jobOp = null; - } - -} diff --git a/src/com/ibm/jbatch/tck/tests/jslxml/RetryListenerTests.java b/src/com/ibm/jbatch/tck/tests/jslxml/RetryListenerTests.java deleted file mode 100644 index fc41873bb6..0000000000 --- a/src/com/ibm/jbatch/tck/tests/jslxml/RetryListenerTests.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.tests.jslxml; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import static com.ibm.jbatch.tck.utils.AssertionUtils.assertWithMessage; - -import java.util.Properties; - -import jakarta.batch.runtime.BatchStatus; -import jakarta.batch.runtime.JobExecution; - -import com.ibm.jbatch.tck.utils.JobOperatorBridge; - - - - - - -public class RetryListenerTests extends ServiceEETest { - - private static JobOperatorBridge jobOp = null; - - public static void setup(String[] args, Properties props) throws Fault { - - String METHOD = "setup"; -TestUtil.logTrace(METHOD); - - try { - jobOp = new JobOperatorBridge(); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - - - public static void setUp() throws Fault { - jobOp = new JobOperatorBridge(); - } - - /* cleanup */ - public void cleanup() - { - - } - - /* - * @testName: testRetryReadListener - * - * @assertion: Test will finish in FAILED status, with the onRetryReadException invoked. - * - * @test_Strategy: Test that the onRetryReadException listener is invoked when a retryable exception occurs on a read. - */ - - - public void testRetryReadListener() throws Fault { - String METHOD = "testRetryReadListener"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("readrecord.fail=8,13,22"); - TestUtil.logMsg("app.arraysize=30"); - jobParams.put("execution.number", "1"); - jobParams.put("readrecord.fail", "8,13,22"); - jobParams.put("app.arraysize", "30"); - - TestUtil.logMsg("Locate job XML file: job_retry_listener_test.xml"); - - - - TestUtil.logMsg("Invoking startJobAndWaitForResult for Execution #1"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_retry_listener_test",jobParams); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + jobExec.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + jobExec.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.FAILED, jobExec.getBatchStatus()); - assertWithMessage("Testing execution #1", "Retry listener invoked", jobExec.getExitStatus()); - } catch(Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testRetryProcessListener - * - * @assertion: Test will finish in FAILED status, with the onRetryProcessException invoked. - * - * @test_Strategy: Test that the onRetryProcessException listener is invoked when a retryable exception occurs on a process. - */ - - - public void testRetryProcessListener() throws Fault { - String METHOD = "testRetryProcessListener"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("processrecord.fail=8,13,22"); - TestUtil.logMsg("app.arraysize=30"); - jobParams.put("execution.number", "1"); - jobParams.put("processrecord.fail", "8,13,22"); - jobParams.put("app.arraysize", "30"); - - TestUtil.logMsg("Locate job XML file: job_retry_listener_test.xml"); - - - - TestUtil.logMsg("Invoking startJobAndWaitForResult for Execution #1"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_retry_listener_test",jobParams); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + jobExec.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + jobExec.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.FAILED, jobExec.getBatchStatus()); - assertWithMessage("Testing execution #1", "Retry listener invoked", jobExec.getExitStatus()); - } catch(Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testRetryWriteListener - * - * @assertion: Test will finish in FAILED status, with the onRetryWriteException invoked. - * - * @test_Strategy: Test that the onRetryWriteException listener is invoked when a retryable exception occurs on a write. - */ - - - public void testRetryWriteListener() throws Fault { - String METHOD = "testRetryWriteListener"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParams = new Properties(); - TestUtil.logMsg("execution.number=1"); - TestUtil.logMsg("writerecord.fail=8,13,22"); - TestUtil.logMsg("app.arraysize=30"); - jobParams.put("execution.number", "1"); - jobParams.put("writerecord.fail", "8,13,22"); - jobParams.put("app.arraysize", "30"); - - - TestUtil.logMsg("Locate job XML file: job_retry_listener_test.xml"); - - - - TestUtil.logMsg("Invoking startJobAndWaitForResult for Execution #1"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_retry_listener_test",jobParams); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()=" + jobExec.getBatchStatus() + ""); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()=" + jobExec.getExitStatus() + ""); - assertWithMessage("Testing execution #1", BatchStatus.FAILED, jobExec.getBatchStatus()); - assertWithMessage("Testing execution #1", "Retry listener invoked", jobExec.getExitStatus()); - } catch(Exception e) { - handleException(METHOD, e); - } - } - - private static void handleException(String methodName, Exception e) throws Fault { -TestUtil.logErr("Caught exception: " + e.getMessage()); -TestUtil.printStackTrace(e); -throw new Fault(methodName + " failed", e);} - -} \ No newline at end of file diff --git a/src/com/ibm/jbatch/tck/tests/jslxml/SplitFlowTransitionLoopTests.java b/src/com/ibm/jbatch/tck/tests/jslxml/SplitFlowTransitionLoopTests.java deleted file mode 100644 index 27bc41312b..0000000000 --- a/src/com/ibm/jbatch/tck/tests/jslxml/SplitFlowTransitionLoopTests.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.tests.jslxml; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import static com.ibm.jbatch.tck.utils.AssertionUtils.assertWithMessage; - -import java.util.Properties; - -import jakarta.batch.runtime.BatchStatus; -import jakarta.batch.runtime.JobExecution; - - - - - - - -import com.ibm.jbatch.tck.utils.JobOperatorBridge; - -public class SplitFlowTransitionLoopTests extends ServiceEETest { - - private JobOperatorBridge jobOp = null; - - /** - * @testName: testSplitFlowTransitionLoopSplitFlowSplit - * @assertion: Section 5.3 Flow - * @test_Strategy: 1. setup a job consisting of one split (w/ 2 flows) one of the inner flows has a split (w/ 2 more flows) - * 2. create a list of steps in job - * 3. start job - * 4. batchlet artifact saves step id in temp file - * 5. read file and make sure all visited steps are in the list of steps - * - * ** split spawns jobs to multiple threads, therefore steps might not run in order listed. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * @throws Fault - */ - - - public void testSplitFlowTransitionLoopSplitFlowSplit() throws Fault { - - String METHOD = "testSplitFlowTransitionLoopSplitFlowSplit"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("starting job"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("split_flow_transition_loop_splitflowsplit", null); - TestUtil.logMsg("Job Status = " + jobExec.getBatchStatus()); - - assertWithMessage("Job completed", BatchStatus.COMPLETED, jobExec.getBatchStatus()); - TestUtil.logMsg("job completed"); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - private static void handleException(String methodName, Exception e) throws Fault { -TestUtil.logErr("Caught exception: " + e.getMessage()); -TestUtil.printStackTrace(e); -throw new Fault(methodName + " failed", e);} - - /* cleanup */ - public void cleanup() - { - - } - - public void setup(String[] args, Properties props) throws Fault { - - String METHOD = "setup"; -TestUtil.logTrace(METHOD); - - try { - jobOp = new JobOperatorBridge(); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - - public void beforeTest() throws ClassNotFoundException { - jobOp = new JobOperatorBridge(); - } - - - public void afterTest() { - jobOp = null; - } -} diff --git a/src/com/ibm/jbatch/tck/tests/jslxml/SplitTransitioningTests.java b/src/com/ibm/jbatch/tck/tests/jslxml/SplitTransitioningTests.java deleted file mode 100644 index 835fbc08ec..0000000000 --- a/src/com/ibm/jbatch/tck/tests/jslxml/SplitTransitioningTests.java +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.tests.jslxml; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import static com.ibm.jbatch.tck.utils.AssertionUtils.assertWithMessage; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.Properties; - -import jakarta.batch.operations.JobStartException; -import jakarta.batch.runtime.BatchStatus; -import jakarta.batch.runtime.JobExecution; - - - - - - - -import com.ibm.jbatch.tck.utils.JobOperatorBridge; - -public class SplitTransitioningTests extends ServiceEETest { - - private JobOperatorBridge jobOp = null; - - /** - * @testName: testSplitTransitionToStep - * @assertion: Section 5.4 Split - * @test_Strategy: 1. setup a job consisting of one split (w/ 2 flows) and one step - * 2. start job - * 3. add step id from step context to job context exit status - * 4. verify that the split indeed transitioned to the step - * - * @throws JobStartException - * @throws FileNotFoundException - * @throws IOException - * @throws InterruptedException - */ - - public void testSplitTransitionToStep() throws Fault { - - String METHOD = "testSplitTransitionToStep"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("starting job"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("split_transition_to_step", null); - TestUtil.logMsg("Job Status = " + jobExec.getBatchStatus()); - - assertWithMessage("Split transitioned to step", "step1", jobExec.getExitStatus()); - - assertWithMessage("Job completed", BatchStatus.COMPLETED, jobExec.getBatchStatus()); - TestUtil.logMsg("job completed"); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /** - * @testName: testSplitTransitionToStepOutOfScope - * @assertion: Section 5.4 Split - * @test_Strategy: 1. setup a job consisting of one split (w/ 2 flows) and one step - * 2. start job - * 3. this job should fail because the split flow 'flow1' next to outside the split - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * @throws JobStartException - * @throws FileNotFoundException - * @throws IOException - * @throws InterruptedException - */ - - - public void testSplitTransitionToStepOutOfScope() throws Fault { - - String METHOD = "testSplitTransitionToStepOutOfScope"; -TestUtil.logTrace(METHOD); - - try { - TestUtil.logMsg("starting job"); - - boolean seenException = false; - JobExecution jobExec = null; - try { - jobExec = jobOp.startJobAndWaitForResult("split_transition_to_step_out_of_scope", null); - } catch (JobStartException e) { - TestUtil.logMsg("Caught JobStartException: " + e.getLocalizedMessage()); - seenException = true; - } - - // If we caught an exception we'd expect that a JobExecution would not have been created, - // though we won't validate that it wasn't created. - - // If we didn't catch an exception that we require that the implementation fail the job execution. - if (!seenException) { - TestUtil.logMsg("Didn't catch JobstartException, Job Batch Status = " + jobExec.getBatchStatus()); - assertWithMessage("Job should have failed because of out of scope execution elements.", BatchStatus.FAILED, jobExec.getBatchStatus()); - } - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /** - * @testName: testSplitTransitionToDecision - * @assertion: Section 5.4 Split - * @test_Strategy: 1. setup a job consisting of one split (w/ 2 flows) and one decision - * 2. start job - * 3. split will transition to decider which will change the exit status - * 4. compare that the exit status set by the decider matches that of the job - * - * @throws JobStartException - * @throws FileNotFoundException - * @throws IOException - * @throws InterruptedException - */ - - public void testSplitTransitionToDecision() throws Fault { - - String METHOD = "testSplitTransitionToDecision"; -TestUtil.logTrace(METHOD); - - try { - String exitStatus = "ThatsAllFolks"; - // based on our decider exit status - /* - - - - */ - TestUtil.logMsg("starting job"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("split_transition_to_decision", null); - TestUtil.logMsg("Job Status = " + jobExec.getBatchStatus()); - - assertWithMessage("Job Exit Status is from decider", exitStatus, jobExec.getExitStatus()); - assertWithMessage("Job completed", BatchStatus.COMPLETED, jobExec.getBatchStatus()); - TestUtil.logMsg("job completed"); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - private static void handleException(String methodName, Exception e) throws Fault { -TestUtil.logErr("Caught exception: " + e.getMessage()); -TestUtil.printStackTrace(e); -throw new Fault(methodName + " failed", e);} - - /* cleanup */ - public void cleanup() - { - - } - - public void setup(String[] args, Properties props) throws Fault { - - String METHOD = "setup"; -TestUtil.logTrace(METHOD); - - try { - jobOp = new JobOperatorBridge(); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - - public void beforeTest() throws ClassNotFoundException { - jobOp = new JobOperatorBridge(); - } - - - public void afterTest() { - jobOp = null; - } -} diff --git a/src/com/ibm/jbatch/tck/tests/jslxml/StartLimitTests.java b/src/com/ibm/jbatch/tck/tests/jslxml/StartLimitTests.java deleted file mode 100644 index 61f4a764bd..0000000000 --- a/src/com/ibm/jbatch/tck/tests/jslxml/StartLimitTests.java +++ /dev/null @@ -1,383 +0,0 @@ -/* - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.tests.jslxml; - - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import static com.ibm.jbatch.tck.utils.AssertionUtils.assertWithMessage; - -import java.util.List; -import java.util.Properties; - -import jakarta.batch.runtime.BatchStatus; -import jakarta.batch.runtime.StepExecution; - - - - - - - -import com.ibm.jbatch.tck.utils.JobOperatorBridge; -import com.ibm.jbatch.tck.utils.TCKJobExecutionWrapper; - -public class StartLimitTests extends ServiceEETest { - - private JobOperatorBridge jobOp = null; - - - /* - * @testName: testStartLimitVariation1 - * @assertion: This description applies to all methods in the class: - * - * 1. tests the "start-limit" attribute on steps, when explicitly set or defaulting, or set to '0' (= no limit) - * 2. Also tests the interaction between start-limit and allow-start-if-complete. By this we mean that we don't - * count against the start-limit simply because we transition to a step during restart, if allow-start-if-complete=false, - * but only if we execute it. - * 3. Tests that start-limit counts against the executions that ran to completion as well as the ones that did not. - * 4. Tests that allow-start-if-complete "trumps" start-limit in the sense - * 5. Show we can complete all steps in a job without completing the job. - * @test_Strategy: Reuse a batchlet in multiple steps with these characteristics. - * step1 - allow-start-if-complete=true, start-limit=0 - * step2 - allow-start-if-complete=true, (start-limit defaults) - * step3 - allow-start-if-complete=false, start-limit=3 - * step4 - allow-start-if-complete=true, start-limit=3 - * step5 - allow-start-if-complete=true, start-limit=3 - * - * // Variation1 - * Run 1 - c1, c2, x3 - * Run 2 - c1, c2, x3 - * Run 3 - c1, c2, x3 - * Run 4 - c1, c2, FAIL on t3 - * - * // Variation2 - * Run 1 - c1, c2, x3 - * Run 2 - c1, c2, x3 - * Run 3 - c1, c2, s3, - * Run 4 - c1, c2, s4,restart=3 - * Run 5 - f4 - * Run 6 - c1, c2, c4, f5 - * Run 7 - c1, c2, FAIL on t4 - * - * // Variation3 - * Run 1 - c1, c2, c3, c4, s5,restart=5 - * Run 2 - f5 - * Run 3 - c1, c2, c4 c5 - * - * key - * c - completed - * s - stopped (via JSL transition element) - * x - failed due to exception - * f - failed (via JSL transition element) - * - */ - - - public void testStartLimitVariation1() throws Fault { - - String METHOD = "testStartLimitVariation1"; - -TestUtil.logTrace(METHOD); - - try { - long lastExecutionId = 0L; - TCKJobExecutionWrapper exec = null; - - /* - * Run 1 - c1, c2, x3 - * Run 2 - c1, c2, x3 - * Run 3 - c1, c2, x3 - * Run 4 - c1, c2, FAIL on t3 - */ - String[] expectedExitStatuses = { "c1,c2,x3", "c1,c2,x3", "c1,c2,x3", "c1,c2" }; - // Note we start at '1' - for (int i = 1; i <= 4; i++) { - String execString = new Integer(i).toString(); - Properties jobParameters = new Properties(); - jobParameters.put("execution.number", execString); - jobParameters.put("batchlet.ref", "startLimitStateMachineVariation1Batchlet"); - if (i == 1) { - TestUtil.logMsg("Invoking startJobAndWaitForResult for Execution #1"); - exec = jobOp.startJobAndWaitForResult("startLimitTests", jobParameters); - } else { - TestUtil.logMsg("Invoke restartJobAndWaitForResult"); - exec = jobOp.restartJobAndWaitForResult(lastExecutionId, jobParameters); - } - lastExecutionId = exec.getExecutionId(); - - TestUtil.logMsg("Execution #" + i + " JobExecution getBatchStatus()="+exec.getBatchStatus()); - TestUtil.logMsg("Execution #" + i + " JobExecution getExitStatus()="+exec.getExitStatus()); - - // Typical TCK test execution # is 1-indexed but array is 0-indexed so use 'i-1' below. - assertWithMessage("Testing execution #" + i, expectedExitStatuses[i-1], exec.getExitStatus()); - - ///// - // All four are designed to FAIL, but with exit status checking and StepExecution checking we're sure - // we're executing as planned. - ///// - assertWithMessage("Testing execution #" + i, BatchStatus.FAILED, exec.getBatchStatus()); - - List steps = jobOp.getStepExecutions(lastExecutionId); - if (i >= 1 && i <= 3) { - assertWithMessage("Found 3 step executions", 3, steps.size()); - } else { - assertWithMessage("Found 2 step executions", 2, steps.size()); - } - for (StepExecution step : steps) { - if (step.getStepName().equals("step1")) { - assertWithMessage("Testing step execution #" + i + ", step1: ", BatchStatus.COMPLETED, step.getBatchStatus()); - } else if (step.getStepName().equals("step2")) { - assertWithMessage("Testing step execution #" + i + ", step2: ", BatchStatus.COMPLETED, step.getBatchStatus()); - } else if (step.getStepName().equals("step3")) { - assertWithMessage("Shouldn't have a StepExecution for step 3 on execution #4", i != 4); - assertWithMessage("Testing step execution #" + i + ", step3: ", BatchStatus.FAILED, step.getBatchStatus()); - } else { - throw new IllegalStateException("Shouldn't get here, unknown step"); - } - } - } - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testStartLimitVariation2 - * @assertion: - * @test_Strategy: - */ - - - public void testStartLimitVariation2() throws Fault { - - String METHOD = "testStartLimitVariation2"; - -TestUtil.logTrace(METHOD); - - try { - long lastExecutionId = 0L; - TCKJobExecutionWrapper exec = null; - - String[] expectedExitStatuses = { "c1,c2,x3", "c1,c2,x3", "c1,c2,s3", "c1,c2,s4", - "f4", "c1,c2,c4,f5", "c1,c2" }; - // Note we start at '1' - for (int i = 1; i <= 7; i++) { - String execString = new Integer(i).toString(); - Properties jobParameters = new Properties(); - jobParameters.put("execution.number", execString); - jobParameters.put("batchlet.ref", "startLimitStateMachineVariation2Batchlet"); - if (i >= 4) { - // We want it to stop on step 3 on execution 3, but on execution 4 and after - // we want to gain further coverage by continuing the restart, so we override - // the stop @on value so that we transition on to the step 4. - jobParameters.put("stop.after.step.3","DON'T_MATCH_ME"); - } - if (i >= 5) { - // We want it to stop on step 3 on execution 3, but on execution 4 and after - // we want to gain further coverage by continuing the restart, so we override - // the stop @on value so that we transition on to the step 4. - jobParameters.put("stop.after.step.4","DON'T_MATCH_ME"); - } - if (i == 1) { - TestUtil.logMsg("Invoking startJobAndWaitForResult for Execution #1"); - exec = jobOp.startJobAndWaitForResult("startLimitTests", jobParameters); - } else { - TestUtil.logMsg("Invoke restartJobAndWaitForResult"); - exec = jobOp.restartJobAndWaitForResult(lastExecutionId, jobParameters); - } - lastExecutionId = exec.getExecutionId(); - - TestUtil.logMsg("Execution #" + i + " JobExecution getBatchStatus()="+exec.getBatchStatus()); - TestUtil.logMsg("Execution #" + i + " JobExecution getExitStatus()="+exec.getExitStatus()); - - // Typical TCK test execution # is 1-indexed but array is 0-indexed so use 'i-1' below. - assertWithMessage("Testing execution #" + i, expectedExitStatuses[i-1], exec.getExitStatus()); - - // All are failed or stopped...refer to comment above. - if (i == 1 || i == 2 || i == 5 || i == 6 || i == 7) { - assertWithMessage("Testing execution #" + i, BatchStatus.FAILED, exec.getBatchStatus()); - } else if (i == 3 || i == 4) { - assertWithMessage("Testing execution #" + i, BatchStatus.STOPPED, exec.getBatchStatus()); - } - - List steps = jobOp.getStepExecutions(lastExecutionId); - if (i >= 1 && i <= 4 ) { - assertWithMessage("Found 3 step executions", 3, steps.size()); - } else if (i == 5 ) { - assertWithMessage("Found 1 step executions", 1, steps.size()); - } else if (i == 6 ) { - assertWithMessage("Found 4 step executions", 4, steps.size()); - } else if (i == 7 ) { - assertWithMessage("Found 2 step executions", 2, steps.size()); - } - - - /* - * Run 1 - c1, c2, x3 - * Run 2 - c1, c2, x3 - * Run 3 - c1, c2, s3, - * Run 4 - c1, c2, s4,restart=3 - * Run 5 - f4 - * Run 6 - c1, c2, c4, f5 - * Run 7 - c1, c2, FAIL on t4 - */ - - for (StepExecution step : steps) { - if (step.getStepName().equals("step1")) { - assertWithMessage("Shouldn't have a StepExecution for step 1 on execution #5, i= " + i, i != 5); - assertWithMessage("Testing step execution #" + i + ", step1: ", BatchStatus.COMPLETED, step.getBatchStatus()); - } else if (step.getStepName().equals("step2")) { - assertWithMessage("Shouldn't have a StepExecution for step 1 on execution #5, i = " + i, i != 5); - assertWithMessage("Testing step execution #" + i + ", step2: ", BatchStatus.COMPLETED, step.getBatchStatus()); - } else if (step.getStepName().equals("step3")) { - assertWithMessage("Should only have a StepExecution for step 3 on executions #1,2,3, i= " + i, i <= 3); - if (i <= 2) { - assertWithMessage("Testing step execution #" + i + ", step3: ", BatchStatus.FAILED, step.getBatchStatus()); - } else { - assertWithMessage("Testing step execution #" + i + ", step3: ", BatchStatus.COMPLETED, step.getBatchStatus()); - } - } else if (step.getStepName().equals("step4")) { - assertWithMessage("Should only have a StepExecution for step 4 on executions #4,5,6, i = " + i , i >= 4 && i <= 6); - assertWithMessage("Testing step execution #" + i + ", step4: ", BatchStatus.COMPLETED, step.getBatchStatus()); - } else if (step.getStepName().equals("step5")) { - assertWithMessage("Should only have a StepExecution for step 5 on execution #6, i = " + i , i == 6); - assertWithMessage("Testing step execution #" + i + ", step5: ", BatchStatus.COMPLETED, step.getBatchStatus()); - } else { - throw new IllegalStateException("Shouldn't get here, unknown step"); - } - } - } - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testStartLimitVariation3 - * @assertion: - * @test_Strategy: - */ - - - public void testStartLimitVariation3() throws Fault { - - String METHOD = "testStartLimitVariation3"; - -TestUtil.logTrace(METHOD); - - try { - long lastExecutionId = 0L; - TCKJobExecutionWrapper exec = null; - - /* - * Run 1 - c1, c2, c3, c4, s5,restart=5 - * Run 2 - f5 - * Run 3 - c1, c2, c4 c5 - */ - String[] expectedExitStatuses = { "c1,c2,c3,c4,s5", "f5", "c1,c2,c4,c5" }; - // Note we start at '1' - for (int i = 1; i <= 3; i++) { - String execString = new Integer(i).toString(); - Properties jobParameters = new Properties(); - jobParameters.put("execution.number", execString); - jobParameters.put("batchlet.ref", "startLimitStateMachineVariation3Batchlet"); - if (i == 1) { - TestUtil.logMsg("Invoking startJobAndWaitForResult for Execution #1"); - exec = jobOp.startJobAndWaitForResult("startLimitTests", jobParameters); - } else { - TestUtil.logMsg("Invoke restartJobAndWaitForResult"); - exec = jobOp.restartJobAndWaitForResult(lastExecutionId, jobParameters); - } - lastExecutionId = exec.getExecutionId(); - - TestUtil.logMsg("Execution #" + i + " JobExecution getBatchStatus()="+exec.getBatchStatus()); - TestUtil.logMsg("Execution #" + i + " JobExecution getExitStatus()="+exec.getExitStatus()); - - // Typical TCK test execution # is 1-indexed but array is 0-indexed so use 'i-1' below. - assertWithMessage("Testing execution #" + i, expectedExitStatuses[i-1], exec.getExitStatus()); - - if (i == 1) { - assertWithMessage("Testing execution #" + i, BatchStatus.STOPPED, exec.getBatchStatus()); - } else if (i == 2) { - assertWithMessage("Testing execution #" + i, BatchStatus.FAILED, exec.getBatchStatus()); - } else { - assertWithMessage("Testing execution #" + i, BatchStatus.COMPLETED, exec.getBatchStatus()); - } - - List steps = jobOp.getStepExecutions(lastExecutionId); - if (i == 1) { - assertWithMessage("Found 5 step executions", 5, steps.size()); - } else if (i == 2) { - assertWithMessage("Found 1 step execution", 1, steps.size()); - } else { - assertWithMessage("Found 4 step execution", 4, steps.size()); - } - - // All steps will be COMPLETED - for (StepExecution step : steps) { - assertWithMessage("Testing step execution #" + i + ", stepName = " + step.getStepName(), BatchStatus.COMPLETED, step.getBatchStatus()); - } - } - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - - - - - - private static void handleException(String methodName, Exception e) throws Fault { -TestUtil.logErr("Caught exception: " + e.getMessage()); -TestUtil.printStackTrace(e); -throw new Fault(methodName + " failed", e);} - - public void setup(String[] args, Properties props) throws Fault { - - String METHOD = "setup"; - -TestUtil.logTrace(METHOD); - - try { - jobOp = new JobOperatorBridge(); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* cleanup */ - public void cleanup() - { - - } - - - public void beforeTest() throws ClassNotFoundException { - jobOp = new JobOperatorBridge(); - } - - - public void afterTest() { - jobOp = null; - } -} diff --git a/src/com/ibm/jbatch/tck/tests/jslxml/StepExecutionTests.java b/src/com/ibm/jbatch/tck/tests/jslxml/StepExecutionTests.java deleted file mode 100644 index 6d4d40abbd..0000000000 --- a/src/com/ibm/jbatch/tck/tests/jslxml/StepExecutionTests.java +++ /dev/null @@ -1,417 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.tests.jslxml; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - - -import static com.ibm.jbatch.tck.utils.AssertionUtils.assertObjEquals; -import static com.ibm.jbatch.tck.utils.AssertionUtils.assertWithMessage; - -import java.util.HashSet; -import java.util.List; -import java.util.Properties; -import java.util.Set; -import java.util.logging.Logger; - -import jakarta.batch.runtime.BatchStatus; -import jakarta.batch.runtime.JobExecution; -import jakarta.batch.runtime.Metric; -import jakarta.batch.runtime.StepExecution; - -import com.ibm.jbatch.tck.artifacts.reusable.MyBatchletImpl; -import com.ibm.jbatch.tck.artifacts.reusable.MyPersistentUserData; -import com.ibm.jbatch.tck.utils.JobOperatorBridge; - - - - - - - -public class StepExecutionTests extends ServiceEETest { - - private final static Logger logger = Logger.getLogger(StepExecutionTests.class.getName()); - - private static JobOperatorBridge jobOp; - - public static void setup(String[] args, Properties props) throws Fault { - String METHOD = "setup"; -TestUtil.logTrace(METHOD); - - try { - jobOp = new JobOperatorBridge(); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - - - public static void setUp()throws Fault { - jobOp = new JobOperatorBridge(); - } - - - public static void cleanup() throws Fault { - } - - private void begin(String str) { - TestUtil.logMsg("Begin test method: " + str + ""); - } - - /* - * @testName: testOneStepExecutionStatus - * @assertion: FIXME - * @test_Strategy: FIXME - */ - - - public void testOneStepExecutionStatus() throws Fault { - - String METHOD = "testOneStepExecutionStatus"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_batchlet_1step.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_batchlet_1step"); - - TestUtil.logMsg("Obtaining StepExecutions for execution id: " + jobExec.getExecutionId() + ""); - List steps = jobOp.getStepExecutions(jobExec.getExecutionId()); - - assertObjEquals(1, steps.size()); - - for (StepExecution step : steps) { - // make sure all steps finish successfully - showStepState(step); - TestUtil.logMsg("Step status = " + step.getBatchStatus() + ""); - assertObjEquals(BatchStatus.COMPLETED, step.getBatchStatus()); - } - - TestUtil.logMsg("Job execution status = " + jobExec.getBatchStatus() + ""); - assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - /* - * @testName: testFourStepExecutionStatus - * @assertion: FIXME - * @test_Strategy: FIXME - */ - - - public void testFourStepExecutionStatus() throws Fault { - - String METHOD = "testFourStepExecutionStatus"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_batchlet_4steps.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_batchlet_4steps"); - - TestUtil.logMsg("Obtaining StepExecutions for execution id: " + jobExec.getExecutionId() + ""); - List steps = jobOp.getStepExecutions(jobExec.getExecutionId()); - assertObjEquals(4, steps.size()); - - Set stepExecutionsSeen = new HashSet(); - for (StepExecution step : steps) { - // check that each step completed successfully - showStepState(step); - TestUtil.logMsg("Step status = " + step.getBatchStatus() + ""); - assertObjEquals(BatchStatus.COMPLETED, step.getBatchStatus()); - - // Let's also make sure all four have unique IDs, to make sure the JobExecution id isn't being used say - assertWithMessage("New StepExecution id", !stepExecutionsSeen.contains(step.getStepExecutionId())); - stepExecutionsSeen.add(step.getStepExecutionId()); - } - TestUtil.logMsg("Job execution status = " + jobExec.getBatchStatus() + ""); - assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testFailedStepExecutionStatus - * @assertion: FIXME - * @test_Strategy: FIXME - */ - - - public void testFailedStepExecutionStatus() throws Fault { - String METHOD = "testFailedStepExecutionStatus"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_batchlet_failElement.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_batchlet_failElement"); - - TestUtil.logMsg("Obtaining StepExecutions for execution id: " + jobExec.getExecutionId() + ""); - List steps = jobOp.getStepExecutions(jobExec.getExecutionId()); - assertObjEquals(1, steps.size()); - for (StepExecution step : steps) { - // check that each step completed successfully - // TODO: shouldn't the step status be failed here ??? - showStepState(step); - } - - TestUtil.logMsg("Job execution getExitStatus()="+jobExec.getExitStatus()); - TestUtil.logMsg("Job execution getBatchStatus()="+jobExec.getBatchStatus()); - assertObjEquals("TEST_FAIL", jobExec.getExitStatus()); - assertObjEquals(BatchStatus.FAILED, jobExec.getBatchStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testStoppedStepExecutionStatus - * @assertion: FIXME - * @test_Strategy: FIXME - */ - - - public void testStoppedStepExecutionStatus() throws Fault { - String METHOD = "testStoppedStepExecutionStatus"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_batchlet_stopElement.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_batchlet_stopElement"); - - TestUtil.logMsg("Obtaining StepExecutions for execution id: " + jobExec.getExecutionId() + ""); - List steps = jobOp.getStepExecutions(jobExec.getExecutionId()); - assertObjEquals(1, steps.size()); - for (StepExecution step : steps) { - // check that each step completed successfully - // TODO: shouldn't the step status be stopped here ??? - showStepState(step); - } - - TestUtil.logMsg("Job execution getBatchStatus()="+jobExec.getBatchStatus()); - assertObjEquals(BatchStatus.STOPPED, jobExec.getBatchStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testPersistedStepData - * @assertion: FIXME - * @test_Strategy: FIXME - */ - - - public void testPersistedStepData() throws Fault { - String METHOD = "testPersistedStepData"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_batchlet_persistedData.xml"); - - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParameters = new Properties(); - TestUtil.logMsg("force.failure=true"); - jobParameters.setProperty("force.failure" , "true"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_batchlet_persistedData", jobParameters); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+jobExec.getBatchStatus()); - assertObjEquals(BatchStatus.FAILED, jobExec.getBatchStatus()); - - //This job should only have one step. - TestUtil.logMsg("Obtaining StepExecutions for execution id: " + jobExec.getExecutionId() + ""); - List steps = jobOp.getStepExecutions(jobExec.getExecutionId()); - StepExecution stepExec = steps.get(0); - assertObjEquals(1, steps.size()); - - TestUtil.logMsg("execution #1 StepExecution getBatchStatus()="+jobExec.getBatchStatus()); - assertObjEquals(BatchStatus.FAILED, stepExec.getBatchStatus()); - assertObjEquals(4, ((MyPersistentUserData)stepExec.getPersistentUserData()).getData()); - - //jobParameters.setProperty("force.failure" , "false"); - TestUtil.logMsg("Invoke restartJobAndWaitForResult with execution id: " + jobExec.getExecutionId() + ""); - JobExecution restartedJobExec = jobOp.restartJobAndWaitForResult(jobExec.getExecutionId(),jobParameters); - - //This job should only have one step. - - steps = jobOp.getStepExecutions(restartedJobExec.getExecutionId()); - stepExec = steps.get(0); - - TestUtil.logMsg("execution #1 StepExecution getBatchStatus()="+jobExec.getBatchStatus()); - assertObjEquals(BatchStatus.COMPLETED, stepExec.getBatchStatus()); - assertObjEquals(5, ((MyPersistentUserData)stepExec.getPersistentUserData()).getData()); - - } catch (Exception e) { - handleException(METHOD, e); - } - - } - - - /* - * @testName: testStepExecutionExitStatus - * @assertion: FIXME - * @test_Strategy: FIXME - */ - - - public void testStepExecutionExitStatus() throws Fault { - String METHOD = "testStepExecutionExitStatus"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_batchlet_failElement.xml"); - - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("job_batchlet_failElement"); - - TestUtil.logMsg("Obtaining StepExecutions for execution id: " + jobExec.getExecutionId() + ""); - List steps = jobOp.getStepExecutions(jobExec.getExecutionId()); - assertObjEquals(1, steps.size()); - - StepExecution step = steps.get(0); - showStepState(step); - assertWithMessage("Check step exit status", MyBatchletImpl.GOOD_EXIT_STATUS, step.getExitStatus()); - assertWithMessage("Check step batch status", BatchStatus.COMPLETED, step.getBatchStatus()); - TestUtil.logMsg("Job batch status =" + jobExec.getBatchStatus() + ""); - TestUtil.logMsg("Job exit status =" + jobExec.getExitStatus() + ""); - assertWithMessage("Check job batch status", BatchStatus.FAILED, jobExec.getBatchStatus()); - assertWithMessage("Check job exit status", "TEST_FAIL", jobExec.getExitStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testStepInFlowStepExecution - * @assertion: FIXME - * @test_Strategy: FIXME - */ - - - public void testStepInFlowStepExecution() throws Fault { - String METHOD = "testStepInFlowStepExecution"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_batchlet_failElement.xml"); - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("flow_transition_to_step"); - - TestUtil.logMsg("Obtaining StepExecutions for execution id: " + jobExec.getExecutionId() + ""); - List steps = jobOp.getStepExecutions(jobExec.getExecutionId()); - assertObjEquals(4, steps.size()); - for (StepExecution step : steps) { - showStepState(step); - // Conveniently all four steps have same exit and batch status. - assertWithMessage("Check step exit status", MyBatchletImpl.GOOD_EXIT_STATUS, step.getExitStatus()); - assertWithMessage("Check step batch status", BatchStatus.COMPLETED, step.getBatchStatus()); - } - - // Now check job level status - TestUtil.logMsg("Job batch status =" + jobExec.getBatchStatus() + ""); - TestUtil.logMsg("Job exit status =" + jobExec.getExitStatus() + ""); - assertWithMessage("Check job batch status", BatchStatus.COMPLETED, jobExec.getBatchStatus()); - assertWithMessage("Check job exit status", "flow1step1, flow1step2, flow1step3, step1", jobExec.getExitStatus()); - - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testStepInFlowInSplitStepExecution - * @assertion: FIXME - * @test_Strategy: FIXME - */ - - - public void testStepInFlowInSplitStepExecution() throws Fault { - String METHOD = "testStepInFlowInSplitStepExecution"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: split_batchlet_4steps.xml"); - TestUtil.logMsg("Invoke startJobAndWaitForResult for execution #1"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("split_batchlet_4steps"); - - // Saves debugging time to check these two first in case they fail - assertWithMessage("Check job batch status", BatchStatus.COMPLETED, jobExec.getBatchStatus()); - assertWithMessage("Check job exit status", "COMPLETED", jobExec.getExitStatus()); - - TestUtil.logMsg("Obtaining StepExecutions for execution id: " + jobExec.getExecutionId() + ""); - List steps = jobOp.getStepExecutions(jobExec.getExecutionId()); - assertObjEquals(4, steps.size()); - for (StepExecution step : steps) { - showStepState(step); - // Conveniently all four steps have same exit and batch status. - assertWithMessage("Check step exit status", MyBatchletImpl.GOOD_EXIT_STATUS, step.getExitStatus()); - assertWithMessage("Check step batch status", BatchStatus.COMPLETED, step.getBatchStatus()); - } - TestUtil.logMsg("Job batch status =" + jobExec.getBatchStatus() + ""); - TestUtil.logMsg("Job exit status =" + jobExec.getExitStatus() + ""); - - } catch (Exception e) { - handleException(METHOD, e); - } - } - - private void showStepState(StepExecution step) { - TestUtil.logMsg("---------------------------"); - TestUtil.logMsg("getStepName(): " + step.getStepName() + " - "); - TestUtil.logMsg("getStepExecutionId(): " + step.getStepExecutionId() + " - "); - Metric[] metrics = step.getMetrics(); - - for (int i = 0; i < metrics.length; i++) { - TestUtil.logMsg(metrics[i].getType() + ": " + metrics[i].getValue() + " - "); - } - - TestUtil.logMsg("getStartTime(): " + step.getStartTime() + " - "); - TestUtil.logMsg("getEndTime(): " + step.getEndTime() + " - "); - TestUtil.logMsg("getBatchStatus(): " + step.getBatchStatus() + " - "); - TestUtil.logMsg("getExitStatus(): " + step.getExitStatus()); - TestUtil.logMsg("---------------------------"); - } - - private static void handleException(String methodName, Exception e) throws Fault { -TestUtil.logErr("Caught exception: " + e.getMessage()); -TestUtil.printStackTrace(e); -throw new Fault(methodName + " failed", e);} - -} diff --git a/src/com/ibm/jbatch/tck/tests/jslxml/StepLevelPropertiesTests.java b/src/com/ibm/jbatch/tck/tests/jslxml/StepLevelPropertiesTests.java deleted file mode 100644 index bdfeab212d..0000000000 --- a/src/com/ibm/jbatch/tck/tests/jslxml/StepLevelPropertiesTests.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.tests.jslxml; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import static com.ibm.jbatch.tck.utils.AssertionUtils.assertWithMessage; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.Properties; - -import jakarta.batch.runtime.BatchStatus; -import jakarta.batch.runtime.JobExecution; - -import com.ibm.jbatch.tck.utils.JobOperatorBridge; - - - - - - - -public class StepLevelPropertiesTests extends ServiceEETest { - - private JobOperatorBridge jobOp = null; - - private int PROPERTIES_COUNT = 3; - - private String FOO_VALUE = "bar"; - - /** - * @testName: testStepLevelPropertiesCount - * @assertion: Section 5.2.3 Step Level Properties - * @test_Strategy: set a list of properties to the step should add them to the step context properties - * - * @throws FileNotFoundException - * @throws IOException - * @throws InterruptedException - */ - - public void testStepLevelPropertiesCount() throws Fault { - - String METHOD = "testStepLevelPropertiesCount"; -TestUtil.logTrace(METHOD); - String SHOULD_BE_UNAVAILABLE_PROP_PREFIX = "com.ibm.jbatch.tck.tests.jslxml.StepLevelPropertiesTests"; - - Properties jobParams = new Properties(); - jobParams.put(SHOULD_BE_UNAVAILABLE_PROP_PREFIX + ".parm1", "should.not.appear.in.step.context.properties"); - - try { - - TestUtil.logMsg("starting job"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("step_level_properties_count"); - - TestUtil.logMsg("Job Status = " + jobExec.getBatchStatus()); - assertWithMessage("Job completed", BatchStatus.COMPLETED, jobExec.getBatchStatus()); - assertWithMessage("Job completed", "VERY GOOD INVOCATION", jobExec.getExitStatus()); - TestUtil.logMsg("job completed"); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /** - * @testName: testStepLevelPropertiesPropertyValue - * @assertion: Section 5.2.3 Step Level Properties - * @test_Strategy: set a step property value should equal value set on step context property - * - * @throws FileNotFoundException - * @throws IOException - * @throws InterruptedException - */ - - public void testStepLevelPropertiesPropertyValue() throws Fault { - - String METHOD = "testStepLevelPropertiesPropertyValue"; -TestUtil.logTrace(METHOD); - - try { - - TestUtil.logMsg("starting job"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("step_level_properties_value"); - - TestUtil.logMsg("Job Status = " + jobExec.getBatchStatus()); - assertWithMessage("Job completed",BatchStatus.COMPLETED, jobExec.getBatchStatus()); - TestUtil.logMsg("job completed"); - - assertWithMessage("Property value", FOO_VALUE, jobExec.getExitStatus()); - - TestUtil.logMsg("Job batchlet return code is the step property foo value " + FOO_VALUE); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /** - * @testName: testStepLevelPropertiesShouldNotBeAvailableThroughJobContext - * @assertion: Section 5.2.3 Step Level Properties - * @test_Strategy: set a step property value should not be available to job context - * - * @throws InterruptedException - */ - - public void testStepLevelPropertiesShouldNotBeAvailableThroughJobContext() throws Fault { - - String METHOD = "testStepLevelPropertiesShouldNotBeAvailableThroughJobContext"; -TestUtil.logTrace(METHOD); - - try { - - TestUtil.logMsg("starting job"); - JobExecution jobExec = jobOp.startJobAndWaitForResult("step_level_properties_scope"); - - TestUtil.logMsg("Job Status = " + jobExec.getBatchStatus()); - assertWithMessage("Job completed", BatchStatus.COMPLETED, jobExec.getBatchStatus()); - TestUtil.logMsg("job completed"); - assertWithMessage("Step Level Property is not available through job context",BatchStatus.COMPLETED.name(), jobExec.getExitStatus()); - TestUtil.logMsg("Job batchlet return code is the step.property read through job context (expected value=COMPLETED) " + jobExec.getExitStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - private static void handleException(String methodName, Exception e) throws Fault { -TestUtil.logErr("Caught exception: " + e.getMessage()); -TestUtil.printStackTrace(e); -throw new Fault(methodName + " failed", e);} - - public void setup(String[] args, Properties props) throws Fault { - - String METHOD = "setup"; -TestUtil.logTrace(METHOD); - - try { - jobOp = new JobOperatorBridge(); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* cleanup */ - public void cleanup() - { - - } - - - public void beforeTest() throws ClassNotFoundException { - jobOp = new JobOperatorBridge(); - - } - - - public void afterTest() { - jobOp = null; - } - -} diff --git a/src/com/ibm/jbatch/tck/tests/jslxml/StopOrFailOnExitStatusWithRestartTests.java b/src/com/ibm/jbatch/tck/tests/jslxml/StopOrFailOnExitStatusWithRestartTests.java deleted file mode 100644 index 6e117a8fbe..0000000000 --- a/src/com/ibm/jbatch/tck/tests/jslxml/StopOrFailOnExitStatusWithRestartTests.java +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.tests.jslxml; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import static com.ibm.jbatch.tck.utils.AssertionUtils.assertObjEquals; -import static com.ibm.jbatch.tck.utils.AssertionUtils.assertWithMessage; - -import java.util.Properties; - -import jakarta.batch.runtime.BatchStatus; -import jakarta.batch.runtime.JobExecution; - - - - - - -import com.ibm.jbatch.tck.utils.JobOperatorBridge; -import com.ibm.jbatch.tck.utils.TCKJobExecutionWrapper; - -public class StopOrFailOnExitStatusWithRestartTests extends ServiceEETest { - - private static JobOperatorBridge jobOp; - - private void begin(String str) { - TestUtil.logMsg("Begin test method: " + str); - } - - public static void setup(String[] args, Properties props) throws Fault { - String METHOD = "setup"; -TestUtil.logTrace(METHOD); - try { - jobOp = new JobOperatorBridge(); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - - - public static void setUp() throws Fault { - jobOp = new JobOperatorBridge(); - } - - public static void cleanup() throws Fault { - } - - /* - * @testName: testInvokeJobWithUserStopAndRestart - * @assertion: FIXME - * @test_Strategy: FIXME - */ - - - public void testInvokeJobWithUserStopAndRestart() throws Fault { - - String METHOD = "testInvokeJobWithUserStopAndRestart"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - final String DEFAULT_SLEEP_TIME = "5000"; - - try { - TestUtil.logMsg("Locate job XML file: job_batchlet_longrunning.xml"); - - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties overrideJobParams = new Properties(); - TestUtil.logMsg("run.indefinitely=true"); - overrideJobParams.setProperty("run.indefinitely" , "true"); - - TestUtil.logMsg("Invoke startJobWithoutWaitingForResult for execution #1"); - TCKJobExecutionWrapper execution1 = jobOp.startJobWithoutWaitingForResult("job_batchlet_longrunning", overrideJobParams); - - long execID = execution1.getExecutionId(); - TestUtil.logMsg("StopRestart: Started job with execId=" + execID + ""); - - int sleepTime = Integer.parseInt(System.getProperty("StopOrFailOnExitStatusWithRestartTests.testInvokeJobWithUserStop.sleep",DEFAULT_SLEEP_TIME)); - TestUtil.logMsg("Sleep " + sleepTime + ""); - Thread.sleep(sleepTime); - - BatchStatus exec1BatchStatus = execution1.getBatchStatus(); - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+ exec1BatchStatus + ""); - - // Bug 5614 - Tolerate STARTING state in addition to STARTED - boolean startedOrStarting = exec1BatchStatus == BatchStatus.STARTED || exec1BatchStatus == BatchStatus.STARTING; - assertWithMessage("Found BatchStatus of " + exec1BatchStatus.toString() + "; Hopefully job isn't finished already, if it is fail the test and use a longer sleep time within the batch step-related artifact.", startedOrStarting); - - TestUtil.logMsg("Invoke stopJobAndWaitForResult"); - jobOp.stopJobAndWaitForResult(execution1); - - JobExecution postStopJobExecution = jobOp.getJobExecution(execution1.getExecutionId()); - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+postStopJobExecution.getBatchStatus()); - assertWithMessage("The stop should have taken effect by now, even though the batchlet artifact had control at the time of the stop, it should have returned control by now.", - BatchStatus.STOPPED, postStopJobExecution.getBatchStatus()); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+postStopJobExecution.getExitStatus()); - assertWithMessage("If this assert fails with an exit status of STOPPED, try increasing the sleep time. It's possible" + - "the JobOperator stop is being issued before the Batchlet has a chance to run.", "BATCHLET CANCELED BEFORE COMPLETION", postStopJobExecution.getExitStatus()); - - TestUtil.logMsg("Create job parameters for execution #2:"); - TestUtil.logMsg("run.indefinitely=false"); - overrideJobParams.setProperty("run.indefinitely" , "false"); - - - TestUtil.logMsg("Invoke restartJobAndWaitForResult with executionId: " + execution1.getInstanceId() + ""); - JobExecution execution2 = jobOp.restartJobAndWaitForResult(execution1.getExecutionId(),overrideJobParams); - - TestUtil.logMsg("execution #2 JobExecution getBatchStatus()="+execution2.getBatchStatus()); - assertWithMessage("If the restarted job hasn't completed yet then try increasing the sleep time.", - BatchStatus.COMPLETED, execution2.getBatchStatus()); - - TestUtil.logMsg("execution #2 JobExecution getExitStatus()="+execution2.getExitStatus()); - assertWithMessage("If this fails, the reason could be that step 1 didn't run the second time," + - "though it should since it won't have completed successfully the first time.", - "GOOD.STEP.GOOD.STEP", execution2.getExitStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - /* - * @testName: testInvokeJobWithUncaughtExceptionFailAndRestart - * @assertion: FIXME - * @test_Strategy: FIXME - */ - - - public void testInvokeJobWithUncaughtExceptionFailAndRestart() throws Fault { - String METHOD = "testInvokeJobWithUncaughtExceptionFailAndRestart"; -TestUtil.logTrace(METHOD); - begin(METHOD); - - try { - TestUtil.logMsg("Locate job XML file: job_batchlet_longrunning.xml"); - - TestUtil.logMsg("Create job parameters for execution #1:"); - Properties jobParameters = new Properties(); - TestUtil.logMsg("throw.exc.on.number.3=true"); - jobParameters.setProperty("throw.exc.on.number.3" , "true"); // JSL default is 'false' - - TestUtil.logMsg("Invoke startJobAndWaitForResult"); - TCKJobExecutionWrapper firstJobExecution = jobOp.startJobAndWaitForResult("job_batchlet_longrunning", jobParameters); - - TestUtil.logMsg("Started job with execId=" + firstJobExecution.getExecutionId()); - - TestUtil.logMsg("execution #1 JobExecution getBatchStatus()="+firstJobExecution.getBatchStatus()); - TestUtil.logMsg("execution #1 JobExecution getExitStatus()="+firstJobExecution.getExitStatus()); - assertWithMessage("If the job hasn't failed yet then try increasing the sleep time.", BatchStatus.FAILED, firstJobExecution.getBatchStatus()); - assertObjEquals("FAILED", firstJobExecution.getExitStatus()); - - TestUtil.logMsg("Create job parameters for execution #2:"); - Properties overrideJobParams = new Properties(); - TestUtil.logMsg("throw.exc.on.number.3=false"); - TestUtil.logMsg("run.indefinitely=false"); - overrideJobParams.setProperty("throw.exc.on.number.3" , "false"); - overrideJobParams.setProperty("run.indefinitely" , "false"); - - TestUtil.logMsg("Invoke restartJobAndWaitForResult with executionId: " + firstJobExecution.getInstanceId() + ""); - JobExecution secondJobExecution = jobOp.restartJobAndWaitForResult(firstJobExecution.getExecutionId(),overrideJobParams); - - TestUtil.logMsg("execution #2 JobExecution getBatchStatus()="+secondJobExecution.getBatchStatus()); - assertWithMessage("If the restarted job hasn't completed yet then try increasing the sleep time.", - BatchStatus.COMPLETED, secondJobExecution.getBatchStatus()); - - TestUtil.logMsg("execution #2 JobExecution getExitStatus()="+secondJobExecution.getExitStatus()); - assertWithMessage("If this fails with only \"GOOD.STEP\", the reason could be that step 1 didn't run the second time," + - "though it should since it won't have completed successfully the first time.", - "GOOD.STEP.GOOD.STEP", secondJobExecution.getExitStatus()); - } catch (Exception e) { - handleException(METHOD, e); - } - } - - - - private static void handleException(String methodName, Exception e) throws Fault { -TestUtil.logErr("Caught exception: " + e.getMessage()); -TestUtil.printStackTrace(e); -throw new Fault(methodName + " failed", e);} -} diff --git a/src/com/ibm/jbatch/tck/tests/jslxml/beans.xml b/src/com/ibm/jbatch/tck/tests/jslxml/beans.xml deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/com/ibm/jbatch/tck/tests/jslxml/build.xml b/src/com/ibm/jbatch/tck/tests/jslxml/build.xml deleted file mode 100644 index 1a38afeb4b..0000000000 --- a/src/com/ibm/jbatch/tck/tests/jslxml/build.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/com/ibm/jbatch/tck/tests/jslxml/ejb_vehicle_ejb.xml b/src/com/ibm/jbatch/tck/tests/jslxml/ejb_vehicle_ejb.xml deleted file mode 100644 index 322d92ee60..0000000000 --- a/src/com/ibm/jbatch/tck/tests/jslxml/ejb_vehicle_ejb.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - Ejb1 - - - com_sun_ts_tests_common_vehicle_ejb_EJBVehicle - com.sun.ts.tests.common.vehicle.ejb.EJBVehicleHome - com.sun.ts.tests.common.vehicle.ejb.EJBVehicleRemote - com.sun.ts.tests.common.vehicle.ejb.EJBVehicle - Stateful - Container - - description - java:module/env/jdbc/orderDB - javax.sql.DataSource - Container - Shareable - - - - - - - - - - com_sun_ts_tests_common_vehicle_ejb_EJBVehicle - Remote - runTest - - Supports - - - diff --git a/src/com/ibm/jbatch/tck/tests/jslxml/jslxml_ejb_vehicle_client.jar.sun-application-client.xml b/src/com/ibm/jbatch/tck/tests/jslxml/jslxml_ejb_vehicle_client.jar.sun-application-client.xml deleted file mode 100644 index d73d5ca3d5..0000000000 --- a/src/com/ibm/jbatch/tck/tests/jslxml/jslxml_ejb_vehicle_client.jar.sun-application-client.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - ejb/EJBVehicle - jslxml_ejb_vehicle - - diff --git a/src/com/ibm/jbatch/tck/tests/jslxml/jslxml_ejb_vehicle_ejb.jar.sun-ejb-jar.xml b/src/com/ibm/jbatch/tck/tests/jslxml/jslxml_ejb_vehicle_ejb.jar.sun-ejb-jar.xml deleted file mode 100644 index 1e1ca3461b..0000000000 --- a/src/com/ibm/jbatch/tck/tests/jslxml/jslxml_ejb_vehicle_ejb.jar.sun-ejb-jar.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - 0 - - com_sun_ts_tests_common_vehicle_ejb_EJBVehicle - jslxml_ejb_vehicle - - java:module/env/jdbc/orderDB - jdbc/orderDB - - user1 - password1 - - - false - - - supported - supported - supported - supported - - - username_password - default - false - - - supported - - - false - -1 - - - - diff --git a/src/com/ibm/jbatch/tck/tests/jslxml/jslxml_web_vehicle_web.war.sun-web.xml b/src/com/ibm/jbatch/tck/tests/jslxml/jslxml_web_vehicle_web.war.sun-web.xml deleted file mode 100644 index 7522110816..0000000000 --- a/src/com/ibm/jbatch/tck/tests/jslxml/jslxml_web_vehicle_web.war.sun-web.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - java:module/env/jdbc/orderDB - jdbc/orderDB - - user1 - password1 - - - diff --git a/src/com/ibm/jbatch/tck/tests/jslxml/web_vehicle_web.xml b/src/com/ibm/jbatch/tck/tests/jslxml/web_vehicle_web.xml deleted file mode 100644 index 2ef879c9e4..0000000000 --- a/src/com/ibm/jbatch/tck/tests/jslxml/web_vehicle_web.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - web_vehicle - - Servlet_VehicleLogicalName - com.sun.ts.tests.common.vehicle.servlet.ServletVehicle - - - jsp_vehicle - /jsp_vehicle.jsp - 0 - - - Servlet_VehicleLogicalName - /servlet_vehicle - - - 54 - - - java:module/env/jdbc/orderDB - javax.sql.DataSource - Container - Shareable - - diff --git a/src/com/ibm/jbatch/tck/utils/AssertionUtils.java b/src/com/ibm/jbatch/tck/utils/AssertionUtils.java deleted file mode 100644 index 6f5920c171..0000000000 --- a/src/com/ibm/jbatch/tck/utils/AssertionUtils.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2012,2013 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.utils; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -public class AssertionUtils { - - static public void assertObjEquals(Object expected, Object actual) { - assertWithMessage(null, expected, actual); - } - - static public void assertWithMessage(String message, Object expected, Object actual) - { - if (expected == null && actual == null) { - return; - } - if (expected == null && actual != null) { - if (message == null) - throw new AssertionError("Expected 'null' but found value: " + actual); - else - throw new AssertionError(message + "; Expected 'null' but found value: " + actual); - } - else if (!expected.equals(actual)) - { - if (message == null) - throw new AssertionError("Expected value: " + expected + ", but found value: " + actual); - else - throw new AssertionError(message + "; Expected value: " + expected + ", but found value: " + actual); - } - } - - static public void assertWithMessage(String message, boolean result) - { - if(!result) - { - if (message == null) - throw new AssertionError(); - else - throw new AssertionError(message); - } - } - - static public void assertWithMessage(String message, int expected, int actual) { - boolean result = (expected == actual); - - if(!result) - { - if (message == null) - throw new AssertionError("Expected value: " + expected + ", but found value: " + actual); - else - throw new AssertionError(message + "; Expected value: " + expected + ", but found value: " + actual); - } - } -} diff --git a/src/com/ibm/jbatch/tck/utils/BatchXMLGenerator.java b/src/com/ibm/jbatch/tck/utils/BatchXMLGenerator.java deleted file mode 100644 index c59a22f6b4..0000000000 --- a/src/com/ibm/jbatch/tck/utils/BatchXMLGenerator.java +++ /dev/null @@ -1,209 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.utils; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; - -import jakarta.inject.Named; - -/** - * This class is not needed at all by the executor of the TCK. It - * is used to generate the META-INF/batch.xml associated with the - * set of batch artifacts used in the TCK - * - * It was convenient to keep it in the same project with the TCK itself but it - * can be ignored by someone simply running/executing the TCK. - */ -public class BatchXMLGenerator { - - private final static Logger logger = Logger.getLogger(BatchXMLGenerator.class.getName()); - - private static final String SLASH = System.getProperty("file.separator"); - - List beanDefinitions = new ArrayList(); - - private final static String BATCHXML = "META-INF/batch.xml"; - - private void writeBatchXML(File dir) { - - - try { - - File batchXMLFile = new File (dir, "batch.xml"); - - logger.info("Writing batch.xml: " + batchXMLFile); - - BufferedWriter writer = new BufferedWriter(new FileWriter(batchXMLFile)); - - writer.write("\n"); - - for (BeanDefinition beanDef : this.beanDefinitions) { - writer.write(" " + beanDef.getXMLString() + "\n"); - } - writer.write("\n"); - - writer.close(); - } catch (IOException ex) { - ex.printStackTrace(); - } - } - - - - /* - * Implements default per: - * http://docs.jboss.org/cdi/spec/1.0/html/implementation.html Sec. 3.1.5 - * Default name for a managed bean - */ - private String generateId(String qualifiedClassName) { - String retVal = null; - - int index = qualifiedClassName.lastIndexOf("."); - - //We don't check for the default package - String simpleName = qualifiedClassName.substring(index+1); - - String simpleNameFirst = simpleName.substring(0, 1).toLowerCase(); - String simpleNameRest = simpleName.substring(1); - retVal = simpleNameFirst + simpleNameRest; // Works on 1-char - // boundary condition - // where "rest" is empty - // string - - return retVal; - } - - private void processClass(String qualifiedClassName) { - if (logger.isLoggable(Level.FINE)) { - logger.fine("Processing class: " + qualifiedClassName); - } - - String namedAnnotationValue = null; - Class artifactClass = null; - try { - artifactClass = Class.forName(qualifiedClassName); - Named namedAnnotation = artifactClass.getAnnotation(Named.class); - if (namedAnnotation != null) { - namedAnnotationValue = namedAnnotation.value(); - } - } catch (ClassNotFoundException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - // Continue and use classname-based defaulting - } - - String beanID = null; - // If we see a @Named with empty value (default), then use the classname-based calculation, - // which is purposely designed to mirror the CDI default. - if (namedAnnotationValue != null && !namedAnnotationValue.trim().isEmpty()) { - beanID = namedAnnotationValue; - } else { - beanID = generateId(qualifiedClassName); - } - - BeanDefinition beanXML = new BeanDefinition(beanID, qualifiedClassName); - - if (logger.isLoggable(Level.FINE)) { - logger.fine("Adding bean to batch.xml: beanId=" + beanID + " className=" + qualifiedClassName); - } - - this.beanDefinitions.add(beanXML); - } - - - - - private static List findClasses(String dir) { - File directory = new File(dir); - if (!directory.exists()) { - throw new IllegalArgumentException("This directory does not exist: " + directory.toString()); - } else if (!directory.isDirectory()) { - throw new IllegalArgumentException("This is not a directory: " + directory.toString()); - } - - - List classList = new ArrayList(); - - findClasses(directory, "" , classList); - - return classList; - - } - - private static void findClasses(File directory, String path, List classList) { - - File[] files = directory.listFiles(); - - for (File file : files) { - if (file.isDirectory()){ - findClasses(file, path + file.getName() + SLASH , classList); - - } - - String filename = file.getName(); - if (filename.endsWith(".class")) { - - String classname = filename.substring(0, filename.lastIndexOf(".")); - - classList.add(path.replace(SLASH, ".") + classname); - - } - - } - - } - - public static void main(String[] args){ - logger.info("Starting BatchXMLGenerator"); - - BatchXMLGenerator bxg = new BatchXMLGenerator(); - - //FIXME Need more input validation here - - List classList = bxg.findClasses(args[0]); - - for (String className : classList) { - bxg.processClass(className); - } - - File batchXMLDir = new File(args[1]); - - if (!batchXMLDir.exists()) { - throw new IllegalArgumentException("This directory does not exist: " + args[1]); - } - - if (!batchXMLDir.isDirectory()) { - throw new IllegalArgumentException("This is not a directory: " + args[1]); - - } - - bxg.writeBatchXML(batchXMLDir); - - logger.info("BatchXMLGenerator completed successfully."); - - } -} diff --git a/src/com/ibm/jbatch/tck/utils/BeanDefinition.java b/src/com/ibm/jbatch/tck/utils/BeanDefinition.java deleted file mode 100644 index 547b41f50b..0000000000 --- a/src/com/ibm/jbatch/tck/utils/BeanDefinition.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2012 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.utils; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -public class BeanDefinition { - - public final String beanID; - public final String qualifiedClassName; - - private StringBuffer buf = new StringBuffer(100); - - - public BeanDefinition(String beanID, String className) { - - this.beanID = beanID; - this.qualifiedClassName = className; - - buf.append(""); - } - - public String getXMLString() { - return buf.toString(); - } - - - public String toString() { - return "id="+beanID+" class="+qualifiedClassName; - } -} diff --git a/src/com/ibm/jbatch/tck/utils/JobOperatorBridge.java b/src/com/ibm/jbatch/tck/utils/JobOperatorBridge.java deleted file mode 100644 index e6e427a54c..0000000000 --- a/src/com/ibm/jbatch/tck/utils/JobOperatorBridge.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright 2012, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.jbatch.tck.utils; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; -import java.util.logging.Logger; - -import jakarta.batch.operations.JobExecutionAlreadyCompleteException; -import jakarta.batch.operations.JobExecutionIsRunningException; -import jakarta.batch.operations.JobExecutionNotMostRecentException; -import jakarta.batch.operations.JobExecutionNotRunningException; -import jakarta.batch.operations.JobOperator; -import jakarta.batch.operations.JobRestartException; -import jakarta.batch.operations.JobSecurityException; -import jakarta.batch.operations.JobStartException; -import jakarta.batch.operations.NoSuchJobException; -import jakarta.batch.operations.NoSuchJobExecutionException; -import jakarta.batch.operations.NoSuchJobInstanceException; -import jakarta.batch.runtime.BatchRuntime; -import jakarta.batch.runtime.JobExecution; -import jakarta.batch.runtime.JobInstance; -import jakarta.batch.runtime.StepExecution; - - - -import com.ibm.jbatch.tck.spi.JobExecutionWaiter; -import com.ibm.jbatch.tck.spi.JobExecutionWaiterFactory; -import com.ibm.jbatch.tck.spi.JobExecutionTimeoutException; - -public class JobOperatorBridge { - - public static final String DEFAULT_JOB_OPERATOR_SLEEP_TIME = "60000"; - - private final static Logger logger = Logger.getLogger(JobOperatorBridge.class.getName()); - - private JobOperator jobOp = BatchRuntime.getJobOperator(); - private JobExecutionWaiterFactory waiterFactory = ServiceGateway.getJobExecutionWaiterFactoryService(); - - private int sleepTime = Integer.parseInt(System.getProperty("tck.execution.waiter.timeout", DEFAULT_JOB_OPERATOR_SLEEP_TIME)); - private final String TIMEOUT_MSG = "Test failure due to timeout exception. Either the timeout should be increased and there is nothing else wrong, " - + "or perhaps the runtime implementation is handing and/or unresponsive

"; - public JobOperatorBridge() { - super(); - } - - public List getJobNames() throws JobSecurityException { - return new ArrayList(jobOp.getJobNames()); - } - - public int getJobInstanceCount(String jobName) throws NoSuchJobException, JobSecurityException { - return jobOp.getJobInstanceCount(jobName); - } - - public List getRunningExecutions(String jobName) throws NoSuchJobException, JobSecurityException { - return jobOp.getRunningExecutions(jobName); - } - - public List getJobExecutions(JobInstance instance) throws NoSuchJobInstanceException, JobSecurityException { - return jobOp.getJobExecutions(instance); - } - - public TCKJobExecutionWrapper restartJobAndWaitForResult(long oldExecutionId, Properties restartJobParameters) throws NoSuchJobExecutionException, NoSuchJobException, JobRestartException, JobExecutionAlreadyCompleteException, JobExecutionNotMostRecentException, JobSecurityException, JobExecutionTimeoutException { - - JobExecution terminatedJobExecution = null; - long newExecutionId = jobOp.restart(oldExecutionId, restartJobParameters); - - JobExecutionWaiter waiter = waiterFactory.createWaiter(newExecutionId, jobOp, sleepTime); - - try { - terminatedJobExecution = waiter.awaitTermination(); - } catch (JobExecutionTimeoutException e) { - logger.severe(TIMEOUT_MSG); - TestUtil.logMsg(TIMEOUT_MSG); - throw e; - } - - return new TCKJobExecutionWrapper(terminatedJobExecution, jobOp); - } - - public TCKJobExecutionWrapper restartJobWithoutWaitingForResult(long oldExecutionId, Properties jobParameters) throws NoSuchJobExecutionException, NoSuchJobException, JobRestartException, JobExecutionAlreadyCompleteException, JobExecutionNotMostRecentException, JobSecurityException, JobExecutionTimeoutException { - Long execID = (Long)jobOp.restart(oldExecutionId, jobParameters); - JobExecution jobExecution = jobOp.getJobExecution(execID); - return new TCKJobExecutionWrapper(jobExecution, jobOp); - } - - public void abandonJobExecution(long executionId) throws NoSuchJobInstanceException, JobExecutionIsRunningException, JobSecurityException, NoSuchJobExecutionException { - jobOp.abandon(executionId); - } - - public TCKJobExecutionWrapper startJobAndWaitForResult(String jobName) throws JobStartException, NoSuchJobExecutionException, JobSecurityException, JobExecutionTimeoutException { - return startJobAndWaitForResult(jobName, null); - } - - public TCKJobExecutionWrapper startJobWithoutWaitingForResult(String jobName, Properties jobParameters) throws JobStartException, NoSuchJobExecutionException, JobSecurityException { - Long execID = (Long)jobOp.start(jobName, jobParameters); - JobExecution jobExecution = jobOp.getJobExecution(execID); - return new TCKJobExecutionWrapper(jobExecution, jobOp); - } - - public void stopJobWithoutWaitingForResult(long jobInstanceId) throws NoSuchJobExecutionException, JobExecutionNotRunningException, JobSecurityException { - jobOp.stop(jobInstanceId); - } - - /* - * I haven't mentally proven it to myself but I'm assuming this can ONLY be used - * after startJobWithoutWaitingForResult(), not after startJobAndWaitForResult(). - */ - public JobExecution stopJobAndWaitForResult(JobExecution jobExecution) throws NoSuchJobExecutionException, JobExecutionNotRunningException, JobSecurityException, JobExecutionTimeoutException { - - JobExecution terminatedJobExecution = null; - jobOp.stop(jobExecution.getExecutionId()); - - JobExecutionWaiter waiter = waiterFactory.createWaiter(jobExecution.getExecutionId(), jobOp, sleepTime); - - try { - terminatedJobExecution = waiter.awaitTermination(); - } catch (JobExecutionTimeoutException e) { - logger.severe(TIMEOUT_MSG); - TestUtil.logMsg(TIMEOUT_MSG); - throw e; - } - - return new TCKJobExecutionWrapper(terminatedJobExecution, jobOp); - } - - - public TCKJobExecutionWrapper startJobAndWaitForResult(String jobName, Properties jobParameters) throws JobStartException, NoSuchJobExecutionException, JobSecurityException, JobExecutionTimeoutException{ - JobExecution terminatedJobExecution = null; - long executionId = jobOp.start(jobName, jobParameters); - - JobExecutionWaiter waiter = waiterFactory.createWaiter(executionId, jobOp, sleepTime); - - try { - terminatedJobExecution = waiter.awaitTermination(); - } catch (JobExecutionTimeoutException e) { - logger.severe(TIMEOUT_MSG); - TestUtil.logMsg(TIMEOUT_MSG); - throw e; - } - - return new TCKJobExecutionWrapper(terminatedJobExecution, jobOp); - } - - - - public Properties getParameters(long executionId) throws NoSuchJobInstanceException, JobSecurityException, NoSuchJobExecutionException{ - return jobOp.getParameters(executionId); - } - - public JobInstance getJobInstance(long executionId) throws NoSuchJobExecutionException, JobSecurityException{ - return jobOp.getJobInstance(executionId); - } - - public JobExecution getJobExecution(long executionId) throws NoSuchJobExecutionException, JobSecurityException{ - return jobOp.getJobExecution(executionId); - } - - public List getJobInstances(String jobName, int start, int end) throws NoSuchJobException, JobSecurityException { - return jobOp.getJobInstances(jobName, start, end); - } - - public List getStepExecutions(long executionId) throws NoSuchJobExecutionException, JobSecurityException { - return jobOp.getStepExecutions(executionId); - } - - public void startJobWithoutWaitingForResult(String jobName) throws JobStartException, NoSuchJobExecutionException, JobSecurityException { - startJobWithoutWaitingForResult(jobName, null); - } - -} diff --git a/src/com/ibm/jbatch/tck/utils/ServiceGateway.java b/src/com/ibm/jbatch/tck/utils/ServiceGateway.java deleted file mode 100644 index 9a73b26c2a..0000000000 --- a/src/com/ibm/jbatch/tck/utils/ServiceGateway.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2012 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.utils; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.ServiceLoader; -import java.util.logging.Level; -import java.util.logging.Logger; - - - -import com.ibm.jbatch.tck.spi.JobExecutionWaiterFactory; - -public class ServiceGateway { - private final static Logger logger = Logger.getLogger(ServiceGateway.class.getName()); - - public static JobExecutionWaiterFactory getJobExecutionWaiterFactoryService() { - JobExecutionWaiterFactory services = null; - ServiceLoader loader = - ServiceLoader.load(JobExecutionWaiterFactory.class); - - for (JobExecutionWaiterFactory provider : loader) { - if (provider != null) { - if (logger.isLoggable(Level.FINE)) { - logger.fine("Loaded JobExecutionWaiterFactory with className = " + provider.getClass().getCanonicalName()); - } - TestUtil.logMsg("Loaded JobExecutionWaiterFactory with className = " + provider.getClass().getCanonicalName() + "

"); - // Use first one - services = provider; - break; - } - } - - if (services == null) { - throw new IllegalStateException("Service loader didn't find resource found on classpath for service: META-INF/services/com.ibm.jbatch.tck.spi.JobExecutionWaiterFactory"); - } - return services; - } -} diff --git a/src/com/ibm/jbatch/tck/utils/TCKJobExecution.java b/src/com/ibm/jbatch/tck/utils/TCKJobExecution.java deleted file mode 100644 index bab62d3f26..0000000000 --- a/src/com/ibm/jbatch/tck/utils/TCKJobExecution.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.utils; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import jakarta.batch.operations.JobSecurityException; -import jakarta.batch.operations.NoSuchJobExecutionException; -import jakarta.batch.runtime.JobExecution; - -public interface TCKJobExecution extends JobExecution { - - public long getInstanceId() throws JobSecurityException, NoSuchJobExecutionException; - -} diff --git a/src/com/ibm/jbatch/tck/utils/TCKJobExecutionWrapper.java b/src/com/ibm/jbatch/tck/utils/TCKJobExecutionWrapper.java deleted file mode 100644 index 9c25c5dabf..0000000000 --- a/src/com/ibm/jbatch/tck/utils/TCKJobExecutionWrapper.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2013, 2020 International Business Machines Corp. - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -package com.ibm.jbatch.tck.utils; - -import com.sun.ts.lib.harness.*; -import com.sun.ts.lib.util.TestUtil; - -import java.util.Date; -import java.util.Properties; - -import jakarta.batch.operations.JobOperator; -import jakarta.batch.operations.JobSecurityException; -import jakarta.batch.operations.NoSuchJobExecutionException; -import jakarta.batch.runtime.BatchStatus; -import jakarta.batch.runtime.JobExecution; -import jakarta.batch.runtime.JobInstance; - -public class TCKJobExecutionWrapper implements TCKJobExecution { - - private JobExecution jobExecution = null; - private JobOperator jobOp = null; - - public TCKJobExecutionWrapper(JobExecution jobExecution, JobOperator jobOp) { - this.jobExecution = jobExecution; - this.jobOp = jobOp; - } - - @Override - public long getExecutionId() { - return jobExecution.getExecutionId(); - } - - @Override - public String getJobName() { - return jobExecution.getJobName(); - } - - @Override - public BatchStatus getBatchStatus() { - return jobExecution.getBatchStatus(); - } - - @Override - public Date getStartTime() { - return jobExecution.getStartTime(); - } - - @Override - public Date getEndTime() { - return jobExecution.getEndTime(); - } - - @Override - public String getExitStatus() { - return jobExecution.getExitStatus(); - } - - @Override - public Date getCreateTime() { - return jobExecution.getCreateTime(); - } - - @Override - public Date getLastUpdatedTime() { - return jobExecution.getLastUpdatedTime(); - } - - @Override - public Properties getJobParameters() { - return jobExecution.getJobParameters(); - } - - @Override - public long getInstanceId() throws NoSuchJobExecutionException, JobSecurityException { - long jobExecutionId = jobExecution.getExecutionId(); - JobInstance jobInstance = jobOp.getJobInstance(jobExecutionId); - return jobInstance.getInstanceId(); - } - -}