Remove unused resources and outdated/deprecated samples
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
# Placeholders batch.*
|
||||
# for Derby:
|
||||
batch.jdbc.driver=org.apache.derby.jdbc.EmbeddedDriver
|
||||
batch.jdbc.url=jdbc:derby:derby-home/test;create=true
|
||||
batch.jdbc.user=app
|
||||
batch.jdbc.password=
|
||||
batch.jdbc.testWhileIdle=false
|
||||
batch.jdbc.validationQuery=
|
||||
batch.drop.script=classpath:/org/springframework/batch/core/schema-drop-derby.sql
|
||||
batch.schema.script=classpath:/org/springframework/batch/core/schema-derby.sql
|
||||
batch.business.schema.script=business-schema-derby.sql
|
||||
batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.DerbyMaxValueIncrementer
|
||||
batch.database.incrementer.parent=columnIncrementerParent
|
||||
batch.lob.handler.class=org.springframework.jdbc.support.lob.DefaultLobHandler
|
||||
batch.grid.size=2
|
||||
batch.jdbc.pool.size=6
|
||||
batch.verify.cursor.position=false
|
||||
batch.isolationlevel=ISOLATION_SERIALIZABLE
|
||||
batch.table.prefix=BATCH_
|
||||
@@ -1,19 +0,0 @@
|
||||
# Placeholders batch.*
|
||||
# for H2:
|
||||
batch.jdbc.driver=org.h2.Driver
|
||||
batch.jdbc.url=jdbc:h2:file:target/data/h2
|
||||
batch.jdbc.user=sa
|
||||
batch.jdbc.password=
|
||||
batch.jdbc.testWhileIdle=false
|
||||
batch.jdbc.validationQuery=
|
||||
batch.drop.script=classpath:/org/springframework/batch/core/schema-drop-h2.sql
|
||||
batch.schema.script=classpath:/org/springframework/batch/core/schema-h2.sql
|
||||
batch.business.schema.script=classpath:/business-schema-h2.sql
|
||||
batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.H2SequenceMaxValueIncrementer
|
||||
batch.database.incrementer.parent=sequenceIncrementerParent
|
||||
batch.lob.handler.class=org.springframework.jdbc.support.lob.DefaultLobHandler
|
||||
batch.grid.size=2
|
||||
batch.jdbc.pool.size=6
|
||||
batch.verify.cursor.position=true
|
||||
batch.isolationlevel=ISOLATION_SERIALIZABLE
|
||||
batch.table.prefix=BATCH_
|
||||
@@ -1,20 +0,0 @@
|
||||
# Placeholders batch.*
|
||||
# for SAP HANA:
|
||||
batch.jdbc.driver=com.sap.db.jdbc.Driver
|
||||
batch.jdbc.url=jdbc:sap://localhost:39015/
|
||||
batch.jdbc.user=SPRING_TEST
|
||||
batch.jdbc.password=Spr1ng_test
|
||||
batch.jdbc.testWhileIdle=false
|
||||
batch.jdbc.validationQuery=
|
||||
batch.drop.script=classpath:/org/springframework/batch/core/schema-drop-hana.sql
|
||||
batch.schema.script=classpath:/org/springframework/batch/core/schema-hana.sql
|
||||
batch.business.schema.script=business-schema-hana.sql
|
||||
batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.HanaSequenceMaxValueIncrementer
|
||||
batch.database.incrementer.parent=sequenceIncrementerParent
|
||||
batch.lob.handler.class=org.springframework.jdbc.support.lob.DefaultLobHandler
|
||||
batch.grid.size=2
|
||||
batch.jdbc.pool.size=6
|
||||
batch.verify.cursor.position=true
|
||||
batch.isolationlevel=ISOLATION_SERIALIZABLE
|
||||
batch.table.prefix=BATCH_
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
# Placeholders batch.*
|
||||
# for MySQL:
|
||||
batch.jdbc.driver=com.mysql.jdbc.Driver
|
||||
batch.jdbc.url=jdbc:mysql://localhost/test
|
||||
batch.jdbc.user=test
|
||||
batch.jdbc.password=test
|
||||
batch.jdbc.testWhileIdle=true
|
||||
batch.jdbc.validationQuery=SELECT 1
|
||||
batch.drop.script=classpath:/org/springframework/batch/core/schema-drop-mysql.sql
|
||||
batch.schema.script=classpath:/org/springframework/batch/core/schema-mysql.sql
|
||||
batch.business.schema.script=classpath:business-schema-mysql.sql
|
||||
batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.MySQLMaxValueIncrementer
|
||||
batch.database.incrementer.parent=columnIncrementerParent
|
||||
batch.lob.handler.class=org.springframework.jdbc.support.lob.DefaultLobHandler
|
||||
batch.jdbc.pool.size=6
|
||||
batch.grid.size=50
|
||||
batch.verify.cursor.position=true
|
||||
batch.isolationlevel=ISOLATION_SERIALIZABLE
|
||||
batch.table.prefix=BATCH_
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
# Placeholders batch.*
|
||||
# for Oracle:
|
||||
batch.jdbc.driver=oracle.jdbc.OracleDriver
|
||||
batch.jdbc.url=jdbc:oracle:thin:@oracle:1521:xe
|
||||
batch.jdbc.user=spring
|
||||
batch.jdbc.password=spring
|
||||
batch.jdbc.testWhileIdle=false
|
||||
batch.jdbc.validationQuery=
|
||||
batch.drop.script=classpath:/org/springframework/batch/core/schema-drop-oracle.sql
|
||||
batch.schema.script=classpath:/org/springframework/batch/core/schema-oracle.sql
|
||||
batch.business.schema.script=business-schema-oracle.sql
|
||||
batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.OracleSequenceMaxValueIncrementer
|
||||
batch.database.incrementer.parent=sequenceIncrementerParent
|
||||
batch.lob.handler.class=org.springframework.jdbc.support.lob.OracleLobHandler
|
||||
batch.grid.size=2
|
||||
batch.jdbc.pool.size=6
|
||||
batch.verify.cursor.position=true
|
||||
batch.isolationlevel=ISOLATION_SERIALIZABLE
|
||||
batch.table.prefix=BATCH_
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
# Placeholders batch.*
|
||||
# for Postgres:
|
||||
batch.jdbc.driver=org.postgresql.Driver
|
||||
batch.jdbc.url=jdbc:postgresql://localhost/samples
|
||||
batch.jdbc.user=postgres
|
||||
batch.jdbc.password=dba
|
||||
batch.jdbc.testWhileIdle=false
|
||||
batch.jdbc.validationQuery=
|
||||
batch.jdbc.verifyCursorPosition=false
|
||||
batch.drop.script=classpath:/org/springframework/batch/core/schema-drop-postgresql.sql
|
||||
batch.schema.script=classpath:/org/springframework/batch/core/schema-postgresql.sql
|
||||
batch.business.schema.script=business-schema-postgresql.sql
|
||||
batch.data.source.init=true
|
||||
batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.PostgresSequenceMaxValueIncrementer
|
||||
batch.database.incrementer.parent=sequenceIncrementerParent
|
||||
batch.lob.handler.class=org.springframework.jdbc.support.lob.DefaultLobHandler
|
||||
batch.grid.size=2
|
||||
batch.jdbc.pool.size=6
|
||||
batch.verify.cursor.position=false
|
||||
batch.isolationlevel=ISOLATION_SERIALIZABLE
|
||||
batch.table.prefix=BATCH_
|
||||
@@ -1,20 +0,0 @@
|
||||
# Placeholders batch.*
|
||||
# for MS SQLServer:
|
||||
batch.jdbc.driver=net.sourceforge.jtds.jdbc.Driver
|
||||
batch.jdbc.url=jdbc:jtds:sqlserver://localhost:1433;instance=SQLEXPRESS
|
||||
batch.jdbc.user=sa
|
||||
batch.jdbc.password=sa
|
||||
batch.jdbc.testWhileIdle=false
|
||||
batch.jdbc.validationQuery=
|
||||
batch.drop.script=/org/springframework/batch/core/schema-drop-sqlserver.sql
|
||||
batch.schema.script=/org/springframework/batch/core/schema-sqlserver.sql
|
||||
batch.business.schema.script=business-schema-sqlserver.sql
|
||||
batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.SqlServerMaxValueIncrementer
|
||||
batch.lob.handler.class=org.springframework.jdbc.support.lob.DefaultLobHandler
|
||||
batch.database.incrementer.parent=columnIncrementerParent
|
||||
batch.grid.size=2
|
||||
batch.jdbc.pool.size=6
|
||||
batch.verify.cursor.position=true
|
||||
batch.isolationlevel=ISOLATION_SERIALIZABLE
|
||||
batch.table.prefix=BATCH_
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
# Placeholders batch.*
|
||||
# for MySQL:
|
||||
batch.jdbc.driver=net.sourceforge.jtds.jdbc.Driver
|
||||
batch.jdbc.url=jdbc:jtds:sybase://dbhost:5000;databaseName=test
|
||||
batch.jdbc.user=spring
|
||||
batch.jdbc.password=spring
|
||||
batch.jdbc.testWhileIdle=false
|
||||
batch.jdbc.validationQuery=
|
||||
batch.drop.script=/org/springframework/batch/core/schema-drop-sybase.sql
|
||||
batch.schema.script=/org/springframework/batch/core/schema-sybase.sql
|
||||
batch.business.schema.script=business-schema-sybase.sql
|
||||
batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.SybaseMaxValueIncrementer
|
||||
batch.lob.handler.class=org.springframework.jdbc.support.lob.DefaultLobHandler
|
||||
batch.database.incrementer.parent=columnIncrementerParent
|
||||
batch.jdbc.pool.size=6
|
||||
batch.grid.size=6
|
||||
batch.verify.cursor.position=true
|
||||
batch.isolationlevel=ISOLATION_SERIALIZABLE
|
||||
batch.table.prefix=BATCH_
|
||||
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
-- Autogenerated: do not edit this file
|
||||
DROP SEQUENCE BATCH_STAGING_SEQ ;
|
||||
DROP SEQUENCE TRADE_SEQ ;
|
||||
DROP SEQUENCE CUSTOMER_SEQ ;
|
||||
DROP TABLE BATCH_STAGING ;
|
||||
DROP TABLE TRADE ;
|
||||
DROP TABLE CUSTOMER ;
|
||||
DROP TABLE PLAYERS ;
|
||||
DROP TABLE GAMES ;
|
||||
DROP TABLE PLAYER_SUMMARY ;
|
||||
DROP TABLE ERROR_LOG ;
|
||||
|
||||
-- Autogenerated: do not edit this file
|
||||
|
||||
CREATE SEQUENCE CUSTOMER_SEQ;
|
||||
CREATE SEQUENCE BATCH_STAGING_SEQ;
|
||||
CREATE SEQUENCE TRADE_SEQ;
|
||||
|
||||
CREATE TABLE BATCH_STAGING (
|
||||
ID BIGINT NOT NULL PRIMARY KEY ,
|
||||
JOB_ID BIGINT NOT NULL,
|
||||
VALUE BLOB NOT NULL,
|
||||
PROCESSED CHAR(1) NOT NULL
|
||||
) ;
|
||||
|
||||
CREATE TABLE TRADE (
|
||||
ID BIGINT NOT NULL PRIMARY KEY ,
|
||||
VERSION BIGINT ,
|
||||
ISIN VARCHAR(45) NOT NULL,
|
||||
QUANTITY BIGINT ,
|
||||
PRICE DECIMAL(8,2) ,
|
||||
CUSTOMER VARCHAR(45)
|
||||
) ;
|
||||
|
||||
CREATE TABLE CUSTOMER (
|
||||
ID BIGINT NOT NULL PRIMARY KEY ,
|
||||
VERSION BIGINT ,
|
||||
NAME VARCHAR(45) ,
|
||||
CREDIT DECIMAL(10,2)
|
||||
) ;
|
||||
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (1, 0, 'customer1', 100000);
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (2, 0, 'customer2', 100000);
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (3, 0, 'customer3', 100000);
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (4, 0, 'customer4', 100000);
|
||||
|
||||
CREATE TABLE PLAYERS (
|
||||
PLAYER_ID CHAR(8) NOT NULL PRIMARY KEY,
|
||||
LAST_NAME VARCHAR(35) NOT NULL,
|
||||
FIRST_NAME VARCHAR(25) NOT NULL,
|
||||
POS VARCHAR(10) ,
|
||||
YEAR_OF_BIRTH BIGINT NOT NULL,
|
||||
YEAR_DRAFTED BIGINT NOT NULL
|
||||
) ;
|
||||
|
||||
CREATE TABLE GAMES (
|
||||
PLAYER_ID CHAR(8) NOT NULL,
|
||||
YEAR_NO BIGINT NOT NULL,
|
||||
TEAM CHAR(3) NOT NULL,
|
||||
WEEK BIGINT NOT NULL,
|
||||
OPPONENT CHAR(3) ,
|
||||
COMPLETES BIGINT ,
|
||||
ATTEMPTS BIGINT ,
|
||||
PASSING_YARDS BIGINT ,
|
||||
PASSING_TD BIGINT ,
|
||||
INTERCEPTIONS BIGINT ,
|
||||
RUSHES BIGINT ,
|
||||
RUSH_YARDS BIGINT ,
|
||||
RECEPTIONS BIGINT ,
|
||||
RECEPTIONS_YARDS BIGINT ,
|
||||
TOTAL_TD BIGINT
|
||||
) ;
|
||||
|
||||
CREATE TABLE PLAYER_SUMMARY (
|
||||
ID CHAR(8) NOT NULL,
|
||||
YEAR_NO BIGINT NOT NULL,
|
||||
COMPLETES BIGINT NOT NULL ,
|
||||
ATTEMPTS BIGINT NOT NULL ,
|
||||
PASSING_YARDS BIGINT NOT NULL ,
|
||||
PASSING_TD BIGINT NOT NULL ,
|
||||
INTERCEPTIONS BIGINT NOT NULL ,
|
||||
RUSHES BIGINT NOT NULL ,
|
||||
RUSH_YARDS BIGINT NOT NULL ,
|
||||
RECEPTIONS BIGINT NOT NULL ,
|
||||
RECEPTIONS_YARDS BIGINT NOT NULL ,
|
||||
TOTAL_TD BIGINT NOT NULL
|
||||
) ;
|
||||
|
||||
CREATE TABLE ERROR_LOG (
|
||||
JOB_NAME CHAR(20) ,
|
||||
STEP_NAME CHAR(20) ,
|
||||
MESSAGE VARCHAR(300) NOT NULL
|
||||
) ;
|
||||
@@ -1,94 +0,0 @@
|
||||
-- Autogenerated: do not edit this file
|
||||
-- You might need to remove this section the first time you run against a clean database
|
||||
DROP TABLE BATCH_STAGING_SEQ ;
|
||||
DROP TABLE TRADE_SEQ ;
|
||||
DROP TABLE CUSTOMER_SEQ ;
|
||||
DROP TABLE BATCH_STAGING ;
|
||||
DROP TABLE TRADE ;
|
||||
DROP TABLE CUSTOMER ;
|
||||
DROP TABLE PLAYERS ;
|
||||
DROP TABLE GAMES ;
|
||||
DROP TABLE PLAYER_SUMMARY ;
|
||||
DROP TABLE ERROR_LOG ;
|
||||
|
||||
-- Autogenerated: do not edit this file
|
||||
|
||||
CREATE TABLE CUSTOMER_SEQ (ID BIGINT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (start with 5), DUMMY VARCHAR(1));
|
||||
CREATE TABLE BATCH_STAGING_SEQ (ID BIGINT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (start with 0), DUMMY VARCHAR(1));
|
||||
CREATE TABLE TRADE_SEQ (ID BIGINT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (start with 0), DUMMY VARCHAR(1));
|
||||
|
||||
CREATE TABLE BATCH_STAGING (
|
||||
ID BIGINT NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
|
||||
JOB_ID BIGINT NOT NULL,
|
||||
VALUE BLOB NOT NULL,
|
||||
PROCESSED CHAR(1) NOT NULL
|
||||
) ;
|
||||
|
||||
CREATE TABLE TRADE (
|
||||
ID BIGINT NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
|
||||
VERSION BIGINT ,
|
||||
ISIN VARCHAR(45) NOT NULL,
|
||||
QUANTITY BIGINT ,
|
||||
PRICE DECIMAL(8,2) ,
|
||||
CUSTOMER VARCHAR(45)
|
||||
) ;
|
||||
|
||||
CREATE TABLE CUSTOMER (
|
||||
ID BIGINT NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
|
||||
VERSION BIGINT ,
|
||||
NAME VARCHAR(45) ,
|
||||
CREDIT DECIMAL(10,2)
|
||||
) ;
|
||||
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (1, 0, 'customer1', 100000);
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (2, 0, 'customer2', 100000);
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (3, 0, 'customer3', 100000);
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (4, 0, 'customer4', 100000);
|
||||
|
||||
CREATE TABLE PLAYERS (
|
||||
PLAYER_ID CHAR(8) NOT NULL PRIMARY KEY,
|
||||
LAST_NAME VARCHAR(35) NOT NULL,
|
||||
FIRST_NAME VARCHAR(25) NOT NULL,
|
||||
POS VARCHAR(10) ,
|
||||
YEAR_OF_BIRTH BIGINT NOT NULL,
|
||||
YEAR_DRAFTED BIGINT NOT NULL
|
||||
) ;
|
||||
|
||||
CREATE TABLE GAMES (
|
||||
PLAYER_ID CHAR(8) NOT NULL,
|
||||
YEAR_NO BIGINT NOT NULL,
|
||||
TEAM CHAR(3) NOT NULL,
|
||||
WEEK BIGINT NOT NULL,
|
||||
OPPONENT CHAR(3) ,
|
||||
COMPLETES BIGINT ,
|
||||
ATTEMPTS BIGINT ,
|
||||
PASSING_YARDS BIGINT ,
|
||||
PASSING_TD BIGINT ,
|
||||
INTERCEPTIONS BIGINT ,
|
||||
RUSHES BIGINT ,
|
||||
RUSH_YARDS BIGINT ,
|
||||
RECEPTIONS BIGINT ,
|
||||
RECEPTIONS_YARDS BIGINT ,
|
||||
TOTAL_TD BIGINT
|
||||
) ;
|
||||
|
||||
CREATE TABLE PLAYER_SUMMARY (
|
||||
ID CHAR(8) NOT NULL,
|
||||
YEAR_NO BIGINT NOT NULL,
|
||||
COMPLETES BIGINT NOT NULL ,
|
||||
ATTEMPTS BIGINT NOT NULL ,
|
||||
PASSING_YARDS BIGINT NOT NULL ,
|
||||
PASSING_TD BIGINT NOT NULL ,
|
||||
INTERCEPTIONS BIGINT NOT NULL ,
|
||||
RUSHES BIGINT NOT NULL ,
|
||||
RUSH_YARDS BIGINT NOT NULL ,
|
||||
RECEPTIONS BIGINT NOT NULL ,
|
||||
RECEPTIONS_YARDS BIGINT NOT NULL ,
|
||||
TOTAL_TD BIGINT NOT NULL
|
||||
) ;
|
||||
|
||||
CREATE TABLE ERROR_LOG (
|
||||
JOB_NAME CHAR(20) ,
|
||||
STEP_NAME CHAR(20) ,
|
||||
MESSAGE VARCHAR(300) NOT NULL
|
||||
) ;
|
||||
@@ -1,93 +0,0 @@
|
||||
-- Autogenerated: do not edit this file
|
||||
DROP SEQUENCE BATCH_STAGING_SEQ IF EXISTS;
|
||||
DROP SEQUENCE TRADE_SEQ IF EXISTS;
|
||||
DROP SEQUENCE CUSTOMER_SEQ IF EXISTS;
|
||||
DROP TABLE BATCH_STAGING IF EXISTS;
|
||||
DROP TABLE TRADE IF EXISTS;
|
||||
DROP TABLE CUSTOMER IF EXISTS;
|
||||
DROP TABLE PLAYERS IF EXISTS;
|
||||
DROP TABLE GAMES IF EXISTS;
|
||||
DROP TABLE PLAYER_SUMMARY IF EXISTS;
|
||||
DROP TABLE ERROR_LOG IF EXISTS;
|
||||
|
||||
-- Autogenerated: do not edit this file
|
||||
|
||||
CREATE SEQUENCE CUSTOMER_SEQ START WITH 5;
|
||||
CREATE SEQUENCE BATCH_STAGING_SEQ START WITH 0;
|
||||
CREATE SEQUENCE TRADE_SEQ START WITH 0;
|
||||
|
||||
CREATE TABLE BATCH_STAGING (
|
||||
ID BIGINT IDENTITY NOT NULL PRIMARY KEY ,
|
||||
JOB_ID BIGINT NOT NULL,
|
||||
VALUE LONGVARBINARY NOT NULL,
|
||||
PROCESSED CHAR(1) NOT NULL
|
||||
) ;
|
||||
|
||||
CREATE TABLE TRADE (
|
||||
ID BIGINT IDENTITY NOT NULL PRIMARY KEY ,
|
||||
VERSION BIGINT ,
|
||||
ISIN VARCHAR(45) NOT NULL,
|
||||
QUANTITY BIGINT ,
|
||||
PRICE DECIMAL(8,2) ,
|
||||
CUSTOMER VARCHAR(45)
|
||||
) ;
|
||||
|
||||
CREATE TABLE CUSTOMER (
|
||||
ID BIGINT IDENTITY NOT NULL PRIMARY KEY ,
|
||||
VERSION BIGINT ,
|
||||
NAME VARCHAR(45) ,
|
||||
CREDIT DECIMAL(10,2)
|
||||
) ;
|
||||
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (1, 0, 'customer1', 100000);
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (2, 0, 'customer2', 100000);
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (3, 0, 'customer3', 100000);
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (4, 0, 'customer4', 100000);
|
||||
|
||||
CREATE TABLE PLAYERS (
|
||||
PLAYER_ID CHAR(8) NOT NULL PRIMARY KEY,
|
||||
LAST_NAME VARCHAR(35) NOT NULL,
|
||||
FIRST_NAME VARCHAR(25) NOT NULL,
|
||||
POS VARCHAR(10) ,
|
||||
YEAR_OF_BIRTH BIGINT NOT NULL,
|
||||
YEAR_DRAFTED BIGINT NOT NULL
|
||||
) ;
|
||||
|
||||
CREATE TABLE GAMES (
|
||||
PLAYER_ID CHAR(8) NOT NULL,
|
||||
YEAR_NO BIGINT NOT NULL,
|
||||
TEAM CHAR(3) NOT NULL,
|
||||
WEEK BIGINT NOT NULL,
|
||||
OPPONENT CHAR(3) ,
|
||||
COMPLETES BIGINT ,
|
||||
ATTEMPTS BIGINT ,
|
||||
PASSING_YARDS BIGINT ,
|
||||
PASSING_TD BIGINT ,
|
||||
INTERCEPTIONS BIGINT ,
|
||||
RUSHES BIGINT ,
|
||||
RUSH_YARDS BIGINT ,
|
||||
RECEPTIONS BIGINT ,
|
||||
RECEPTIONS_YARDS BIGINT ,
|
||||
TOTAL_TD BIGINT
|
||||
) ;
|
||||
|
||||
CREATE TABLE PLAYER_SUMMARY (
|
||||
ID CHAR(8) NOT NULL,
|
||||
YEAR_NO BIGINT NOT NULL,
|
||||
COMPLETES BIGINT NOT NULL ,
|
||||
ATTEMPTS BIGINT NOT NULL ,
|
||||
PASSING_YARDS BIGINT NOT NULL ,
|
||||
PASSING_TD BIGINT NOT NULL ,
|
||||
INTERCEPTIONS BIGINT NOT NULL ,
|
||||
RUSHES BIGINT NOT NULL ,
|
||||
RUSH_YARDS BIGINT NOT NULL ,
|
||||
RECEPTIONS BIGINT NOT NULL ,
|
||||
RECEPTIONS_YARDS BIGINT NOT NULL ,
|
||||
TOTAL_TD BIGINT NOT NULL
|
||||
) ;
|
||||
|
||||
CREATE TABLE ERROR_LOG (
|
||||
JOB_NAME CHAR(20) ,
|
||||
STEP_NAME CHAR(20) ,
|
||||
MESSAGE VARCHAR(300) NOT NULL
|
||||
) ;
|
||||
@@ -1,94 +0,0 @@
|
||||
-- Autogenerated: do not edit this file
|
||||
-- You might need to remove this section the first time you run against a clean database
|
||||
DROP SEQUENCE BATCH_STAGING_SEQ ;
|
||||
DROP SEQUENCE TRADE_SEQ ;
|
||||
DROP SEQUENCE CUSTOMER_SEQ ;
|
||||
DROP TABLE BATCH_STAGING ;
|
||||
DROP TABLE TRADE ;
|
||||
DROP TABLE CUSTOMER ;
|
||||
DROP TABLE PLAYERS ;
|
||||
DROP TABLE GAMES ;
|
||||
DROP TABLE PLAYER_SUMMARY ;
|
||||
DROP TABLE ERROR_LOG ;
|
||||
|
||||
-- Autogenerated: do not edit this file
|
||||
|
||||
CREATE SEQUENCE CUSTOMER_SEQ START WITH 5 MINVALUE 0;
|
||||
CREATE SEQUENCE BATCH_STAGING_SEQ START WITH 0 MINVALUE 0;
|
||||
CREATE SEQUENCE TRADE_SEQ START WITH 0 MINVALUE 0;
|
||||
|
||||
CREATE TABLE BATCH_STAGING (
|
||||
ID BIGINT NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
|
||||
JOB_ID BIGINT NOT NULL,
|
||||
VALUE BLOB NOT NULL,
|
||||
PROCESSED CHAR(1) NOT NULL
|
||||
) ;
|
||||
|
||||
CREATE TABLE TRADE (
|
||||
ID BIGINT NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
|
||||
VERSION BIGINT ,
|
||||
ISIN VARCHAR(45) NOT NULL,
|
||||
QUANTITY BIGINT ,
|
||||
PRICE DECIMAL(8,2) ,
|
||||
CUSTOMER VARCHAR(45)
|
||||
) ;
|
||||
|
||||
CREATE TABLE CUSTOMER (
|
||||
ID BIGINT NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
|
||||
VERSION BIGINT ,
|
||||
NAME VARCHAR(45) ,
|
||||
CREDIT DECIMAL(10,2)
|
||||
) ;
|
||||
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (1, 0, 'customer1', 100000);
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (2, 0, 'customer2', 100000);
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (3, 0, 'customer3', 100000);
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (4, 0, 'customer4', 100000);
|
||||
|
||||
CREATE TABLE PLAYERS (
|
||||
PLAYER_ID CHAR(8) NOT NULL PRIMARY KEY,
|
||||
LAST_NAME VARCHAR(35) NOT NULL,
|
||||
FIRST_NAME VARCHAR(25) NOT NULL,
|
||||
POS VARCHAR(10) ,
|
||||
YEAR_OF_BIRTH BIGINT NOT NULL,
|
||||
YEAR_DRAFTED BIGINT NOT NULL
|
||||
) ;
|
||||
|
||||
CREATE TABLE GAMES (
|
||||
PLAYER_ID CHAR(8) NOT NULL,
|
||||
YEAR_NO BIGINT NOT NULL,
|
||||
TEAM CHAR(3) NOT NULL,
|
||||
WEEK BIGINT NOT NULL,
|
||||
OPPONENT CHAR(3) ,
|
||||
COMPLETES BIGINT ,
|
||||
ATTEMPTS BIGINT ,
|
||||
PASSING_YARDS BIGINT ,
|
||||
PASSING_TD BIGINT ,
|
||||
INTERCEPTIONS BIGINT ,
|
||||
RUSHES BIGINT ,
|
||||
RUSH_YARDS BIGINT ,
|
||||
RECEPTIONS BIGINT ,
|
||||
RECEPTIONS_YARDS BIGINT ,
|
||||
TOTAL_TD BIGINT
|
||||
) ;
|
||||
|
||||
CREATE TABLE PLAYER_SUMMARY (
|
||||
ID CHAR(8) NOT NULL,
|
||||
YEAR_NO BIGINT NOT NULL,
|
||||
COMPLETES BIGINT NOT NULL ,
|
||||
ATTEMPTS BIGINT NOT NULL ,
|
||||
PASSING_YARDS BIGINT NOT NULL ,
|
||||
PASSING_TD BIGINT NOT NULL ,
|
||||
INTERCEPTIONS BIGINT NOT NULL ,
|
||||
RUSHES BIGINT NOT NULL ,
|
||||
RUSH_YARDS BIGINT NOT NULL ,
|
||||
RECEPTIONS BIGINT NOT NULL ,
|
||||
RECEPTIONS_YARDS BIGINT NOT NULL ,
|
||||
TOTAL_TD BIGINT NOT NULL
|
||||
) ;
|
||||
|
||||
CREATE TABLE ERROR_LOG (
|
||||
JOB_NAME CHAR(20) ,
|
||||
STEP_NAME CHAR(20) ,
|
||||
MESSAGE VARCHAR(300) NOT NULL
|
||||
) ;
|
||||
@@ -1,97 +0,0 @@
|
||||
-- Autogenerated: do not edit this file
|
||||
-- You might need to remove this section the first time you run against a clean database
|
||||
DROP TABLE IF EXISTS BATCH_STAGING_SEQ ;
|
||||
DROP TABLE IF EXISTS TRADE_SEQ ;
|
||||
DROP TABLE IF EXISTS CUSTOMER_SEQ ;
|
||||
DROP TABLE IF EXISTS BATCH_STAGING ;
|
||||
DROP TABLE IF EXISTS TRADE ;
|
||||
DROP TABLE IF EXISTS CUSTOMER ;
|
||||
DROP TABLE IF EXISTS PLAYERS ;
|
||||
DROP TABLE IF EXISTS GAMES ;
|
||||
DROP TABLE IF EXISTS PLAYER_SUMMARY ;
|
||||
DROP TABLE IF EXISTS ERROR_LOG ;
|
||||
|
||||
-- Autogenerated: do not edit this file
|
||||
|
||||
CREATE TABLE CUSTOMER_SEQ (ID BIGINT NOT NULL) engine=InnoDB;
|
||||
INSERT INTO CUSTOMER_SEQ values(5);
|
||||
CREATE TABLE BATCH_STAGING_SEQ (ID BIGINT NOT NULL) engine=InnoDB;
|
||||
INSERT INTO BATCH_STAGING_SEQ values(0);
|
||||
CREATE TABLE TRADE_SEQ (ID BIGINT NOT NULL) engine=InnoDB;
|
||||
INSERT INTO TRADE_SEQ values(0);
|
||||
|
||||
CREATE TABLE BATCH_STAGING (
|
||||
ID BIGINT NOT NULL PRIMARY KEY ,
|
||||
JOB_ID BIGINT NOT NULL,
|
||||
VALUE BLOB NOT NULL,
|
||||
PROCESSED CHAR(1) NOT NULL
|
||||
) engine=InnoDB;
|
||||
|
||||
CREATE TABLE TRADE (
|
||||
ID BIGINT NOT NULL PRIMARY KEY ,
|
||||
VERSION BIGINT ,
|
||||
ISIN VARCHAR(45) NOT NULL,
|
||||
QUANTITY BIGINT ,
|
||||
PRICE DECIMAL(8,2) ,
|
||||
CUSTOMER VARCHAR(45)
|
||||
) engine=InnoDB;
|
||||
|
||||
CREATE TABLE CUSTOMER (
|
||||
ID BIGINT NOT NULL PRIMARY KEY ,
|
||||
VERSION BIGINT ,
|
||||
NAME VARCHAR(45) ,
|
||||
CREDIT DECIMAL(10,2)
|
||||
) engine=InnoDB;
|
||||
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (1, 0, 'customer1', 100000);
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (2, 0, 'customer2', 100000);
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (3, 0, 'customer3', 100000);
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (4, 0, 'customer4', 100000);
|
||||
|
||||
CREATE TABLE PLAYERS (
|
||||
PLAYER_ID CHAR(8) NOT NULL PRIMARY KEY,
|
||||
LAST_NAME VARCHAR(35) NOT NULL,
|
||||
FIRST_NAME VARCHAR(25) NOT NULL,
|
||||
POS VARCHAR(10) ,
|
||||
YEAR_OF_BIRTH BIGINT NOT NULL,
|
||||
YEAR_DRAFTED BIGINT NOT NULL
|
||||
) engine=InnoDB;
|
||||
|
||||
CREATE TABLE GAMES (
|
||||
PLAYER_ID CHAR(8) NOT NULL,
|
||||
YEAR_NO BIGINT NOT NULL,
|
||||
TEAM CHAR(3) NOT NULL,
|
||||
WEEK BIGINT NOT NULL,
|
||||
OPPONENT CHAR(3) ,
|
||||
COMPLETES BIGINT ,
|
||||
ATTEMPTS BIGINT ,
|
||||
PASSING_YARDS BIGINT ,
|
||||
PASSING_TD BIGINT ,
|
||||
INTERCEPTIONS BIGINT ,
|
||||
RUSHES BIGINT ,
|
||||
RUSH_YARDS BIGINT ,
|
||||
RECEPTIONS BIGINT ,
|
||||
RECEPTIONS_YARDS BIGINT ,
|
||||
TOTAL_TD BIGINT
|
||||
) engine=InnoDB;
|
||||
|
||||
CREATE TABLE PLAYER_SUMMARY (
|
||||
ID CHAR(8) NOT NULL,
|
||||
YEAR_NO BIGINT NOT NULL,
|
||||
COMPLETES BIGINT NOT NULL ,
|
||||
ATTEMPTS BIGINT NOT NULL ,
|
||||
PASSING_YARDS BIGINT NOT NULL ,
|
||||
PASSING_TD BIGINT NOT NULL ,
|
||||
INTERCEPTIONS BIGINT NOT NULL ,
|
||||
RUSHES BIGINT NOT NULL ,
|
||||
RUSH_YARDS BIGINT NOT NULL ,
|
||||
RECEPTIONS BIGINT NOT NULL ,
|
||||
RECEPTIONS_YARDS BIGINT NOT NULL ,
|
||||
TOTAL_TD BIGINT NOT NULL
|
||||
) engine=InnoDB;
|
||||
|
||||
CREATE TABLE ERROR_LOG (
|
||||
JOB_NAME CHAR(20) ,
|
||||
STEP_NAME CHAR(20) ,
|
||||
MESSAGE VARCHAR(300) NOT NULL
|
||||
) engine=InnoDB;
|
||||
@@ -1,93 +0,0 @@
|
||||
-- Autogenerated: do not edit this file
|
||||
DROP SEQUENCE BATCH_STAGING_SEQ ;
|
||||
DROP SEQUENCE TRADE_SEQ ;
|
||||
DROP SEQUENCE CUSTOMER_SEQ ;
|
||||
DROP TABLE BATCH_STAGING ;
|
||||
DROP TABLE TRADE ;
|
||||
DROP TABLE CUSTOMER ;
|
||||
DROP TABLE PLAYERS ;
|
||||
DROP TABLE GAMES ;
|
||||
DROP TABLE PLAYER_SUMMARY ;
|
||||
DROP TABLE ERROR_LOG ;
|
||||
|
||||
-- Autogenerated: do not edit this file
|
||||
|
||||
CREATE SEQUENCE CUSTOMER_SEQ START WITH 5;
|
||||
CREATE SEQUENCE BATCH_STAGING_SEQ START WITH 0 MINVALUE 0;
|
||||
CREATE SEQUENCE TRADE_SEQ START WITH 0 MINVALUE 0;
|
||||
|
||||
CREATE TABLE BATCH_STAGING (
|
||||
ID NUMBER(38) NOT NULL PRIMARY KEY ,
|
||||
JOB_ID NUMBER(38) NOT NULL,
|
||||
VALUE BLOB NOT NULL,
|
||||
PROCESSED CHAR(1) NOT NULL
|
||||
) ;
|
||||
|
||||
CREATE TABLE TRADE (
|
||||
ID NUMBER(38) NOT NULL PRIMARY KEY ,
|
||||
VERSION NUMBER(38) ,
|
||||
ISIN VARCHAR(45) NOT NULL,
|
||||
QUANTITY NUMBER(38) ,
|
||||
PRICE DECIMAL(8,2) ,
|
||||
CUSTOMER VARCHAR2(45)
|
||||
) ;
|
||||
|
||||
CREATE TABLE CUSTOMER (
|
||||
ID NUMBER(38) NOT NULL PRIMARY KEY ,
|
||||
VERSION NUMBER(38) ,
|
||||
NAME VARCHAR2(45) ,
|
||||
CREDIT DECIMAL(10,2)
|
||||
) ;
|
||||
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (1, 0, 'customer1', 100000);
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (2, 0, 'customer2', 100000);
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (3, 0, 'customer3', 100000);
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (4, 0, 'customer4', 100000);
|
||||
|
||||
CREATE TABLE PLAYERS (
|
||||
PLAYER_ID CHAR(8) NOT NULL PRIMARY KEY,
|
||||
LAST_NAME VARCHAR2(35) NOT NULL,
|
||||
FIRST_NAME VARCHAR2(25) NOT NULL,
|
||||
POS VARCHAR2(10) ,
|
||||
YEAR_OF_BIRTH NUMBER(38) NOT NULL,
|
||||
YEAR_DRAFTED NUMBER(38) NOT NULL
|
||||
) ;
|
||||
|
||||
CREATE TABLE GAMES (
|
||||
PLAYER_ID CHAR(8) NOT NULL,
|
||||
YEAR_NO NUMBER(38) NOT NULL,
|
||||
TEAM CHAR(3) NOT NULL,
|
||||
WEEK NUMBER(38) NOT NULL,
|
||||
OPPONENT CHAR(3) ,
|
||||
COMPLETES NUMBER(38) ,
|
||||
ATTEMPTS NUMBER(38) ,
|
||||
PASSING_YARDS NUMBER(38) ,
|
||||
PASSING_TD NUMBER(38) ,
|
||||
INTERCEPTIONS NUMBER(38) ,
|
||||
RUSHES NUMBER(38) ,
|
||||
RUSH_YARDS NUMBER(38) ,
|
||||
RECEPTIONS NUMBER(38) ,
|
||||
RECEPTIONS_YARDS NUMBER(38) ,
|
||||
TOTAL_TD NUMBER(38)
|
||||
) ;
|
||||
|
||||
CREATE TABLE PLAYER_SUMMARY (
|
||||
ID CHAR(8) NOT NULL,
|
||||
YEAR_NO NUMBER(38) NOT NULL,
|
||||
COMPLETES NUMBER(38) NOT NULL ,
|
||||
ATTEMPTS NUMBER(38) NOT NULL ,
|
||||
PASSING_YARDS NUMBER(38) NOT NULL ,
|
||||
PASSING_TD NUMBER(38) NOT NULL ,
|
||||
INTERCEPTIONS NUMBER(38) NOT NULL ,
|
||||
RUSHES NUMBER(38) NOT NULL ,
|
||||
RUSH_YARDS NUMBER(38) NOT NULL ,
|
||||
RECEPTIONS NUMBER(38) NOT NULL ,
|
||||
RECEPTIONS_YARDS NUMBER(38) NOT NULL ,
|
||||
TOTAL_TD NUMBER(38) NOT NULL
|
||||
) ;
|
||||
|
||||
CREATE TABLE ERROR_LOG (
|
||||
JOB_NAME CHAR(20) ,
|
||||
STEP_NAME CHAR(20) ,
|
||||
MESSAGE VARCHAR(300) NOT NULL
|
||||
) ;
|
||||
@@ -1,93 +0,0 @@
|
||||
-- Autogenerated: do not edit this file
|
||||
DROP SEQUENCE IF EXISTS BATCH_STAGING_SEQ ;
|
||||
DROP SEQUENCE IF EXISTS TRADE_SEQ ;
|
||||
DROP SEQUENCE IF EXISTS CUSTOMER_SEQ ;
|
||||
DROP TABLE IF EXISTS BATCH_STAGING ;
|
||||
DROP TABLE IF EXISTS TRADE ;
|
||||
DROP TABLE IF EXISTS CUSTOMER ;
|
||||
DROP TABLE IF EXISTS PLAYERS ;
|
||||
DROP TABLE IF EXISTS GAMES ;
|
||||
DROP TABLE IF EXISTS PLAYER_SUMMARY ;
|
||||
DROP TABLE IF EXISTS ERROR_LOG ;
|
||||
|
||||
-- Autogenerated: do not edit this file
|
||||
|
||||
CREATE SEQUENCE CUSTOMER_SEQ;
|
||||
CREATE SEQUENCE BATCH_STAGING_SEQ;
|
||||
CREATE SEQUENCE TRADE_SEQ;
|
||||
|
||||
CREATE TABLE BATCH_STAGING (
|
||||
ID BIGINT NOT NULL PRIMARY KEY ,
|
||||
JOB_ID BIGINT NOT NULL,
|
||||
VALUE BYTEA NOT NULL,
|
||||
PROCESSED CHAR(1) NOT NULL
|
||||
) ;
|
||||
|
||||
CREATE TABLE TRADE (
|
||||
ID BIGINT NOT NULL PRIMARY KEY ,
|
||||
VERSION BIGINT ,
|
||||
ISIN VARCHAR(45) NOT NULL,
|
||||
QUANTITY BIGINT ,
|
||||
PRICE DECIMAL(8,2) ,
|
||||
CUSTOMER VARCHAR(45)
|
||||
) ;
|
||||
|
||||
CREATE TABLE CUSTOMER (
|
||||
ID BIGINT NOT NULL PRIMARY KEY ,
|
||||
VERSION BIGINT ,
|
||||
NAME VARCHAR(45) ,
|
||||
CREDIT DECIMAL(10,2)
|
||||
) ;
|
||||
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (1, 0, 'customer1', 100000);
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (2, 0, 'customer2', 100000);
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (3, 0, 'customer3', 100000);
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (4, 0, 'customer4', 100000);
|
||||
|
||||
CREATE TABLE PLAYERS (
|
||||
PLAYER_ID CHAR(8) NOT NULL PRIMARY KEY,
|
||||
LAST_NAME VARCHAR(35) NOT NULL,
|
||||
FIRST_NAME VARCHAR(25) NOT NULL,
|
||||
POS VARCHAR(10) ,
|
||||
YEAR_OF_BIRTH BIGINT NOT NULL,
|
||||
YEAR_DRAFTED BIGINT NOT NULL
|
||||
) ;
|
||||
|
||||
CREATE TABLE GAMES (
|
||||
PLAYER_ID CHAR(8) NOT NULL,
|
||||
YEAR_NO BIGINT NOT NULL,
|
||||
TEAM CHAR(3) NOT NULL,
|
||||
WEEK BIGINT NOT NULL,
|
||||
OPPONENT CHAR(3) ,
|
||||
COMPLETES BIGINT ,
|
||||
ATTEMPTS BIGINT ,
|
||||
PASSING_YARDS BIGINT ,
|
||||
PASSING_TD BIGINT ,
|
||||
INTERCEPTIONS BIGINT ,
|
||||
RUSHES BIGINT ,
|
||||
RUSH_YARDS BIGINT ,
|
||||
RECEPTIONS BIGINT ,
|
||||
RECEPTIONS_YARDS BIGINT ,
|
||||
TOTAL_TD BIGINT
|
||||
) ;
|
||||
|
||||
CREATE TABLE PLAYER_SUMMARY (
|
||||
ID CHAR(8) NOT NULL,
|
||||
YEAR_NO BIGINT NOT NULL,
|
||||
COMPLETES BIGINT NOT NULL ,
|
||||
ATTEMPTS BIGINT NOT NULL ,
|
||||
PASSING_YARDS BIGINT NOT NULL ,
|
||||
PASSING_TD BIGINT NOT NULL ,
|
||||
INTERCEPTIONS BIGINT NOT NULL ,
|
||||
RUSHES BIGINT NOT NULL ,
|
||||
RUSH_YARDS BIGINT NOT NULL ,
|
||||
RECEPTIONS BIGINT NOT NULL ,
|
||||
RECEPTIONS_YARDS BIGINT NOT NULL ,
|
||||
TOTAL_TD BIGINT NOT NULL
|
||||
) ;
|
||||
|
||||
CREATE TABLE ERROR_LOG (
|
||||
JOB_NAME CHAR(20) ,
|
||||
STEP_NAME CHAR(20) ,
|
||||
MESSAGE VARCHAR(300) NOT NULL
|
||||
) ;
|
||||
@@ -1,95 +0,0 @@
|
||||
-- Autogenerated: do not edit this file
|
||||
DROP TABLE BATCH_STAGING_SEQ ;
|
||||
DROP TABLE TRADE_SEQ ;
|
||||
DROP TABLE CUSTOMER_SEQ ;
|
||||
DROP TABLE BATCH_STAGING ;
|
||||
DROP TABLE TRADE ;
|
||||
DROP TABLE CUSTOMER ;
|
||||
DROP TABLE PLAYERS ;
|
||||
DROP TABLE GAMES ;
|
||||
DROP TABLE PLAYER_SUMMARY ;
|
||||
DROP TABLE ERROR_LOG ;
|
||||
|
||||
-- Autogenerated: do not edit this file
|
||||
|
||||
CREATE TABLE CUSTOMER_SEQ (ID BIGINT IDENTITY);
|
||||
SET IDENTITY_INSERT CUSTOMER_SEQ ON;
|
||||
INSERT INTO CUSTOMER_SEQ (ID) values (5);
|
||||
CREATE TABLE BATCH_STAGING_SEQ (ID BIGINT IDENTITY);
|
||||
CREATE TABLE TRADE_SEQ (ID BIGINT IDENTITY);
|
||||
|
||||
CREATE TABLE BATCH_STAGING (
|
||||
ID BIGINT NOT NULL PRIMARY KEY ,
|
||||
JOB_ID BIGINT NOT NULL,
|
||||
VALUE IMAGE NOT NULL,
|
||||
PROCESSED CHAR(1) NOT NULL
|
||||
) ;
|
||||
|
||||
CREATE TABLE TRADE (
|
||||
ID BIGINT NOT NULL PRIMARY KEY ,
|
||||
VERSION BIGINT ,
|
||||
ISIN VARCHAR(45) NOT NULL,
|
||||
QUANTITY BIGINT ,
|
||||
PRICE DECIMAL(8,2) ,
|
||||
CUSTOMER VARCHAR(45)
|
||||
) ;
|
||||
|
||||
CREATE TABLE CUSTOMER (
|
||||
ID BIGINT NOT NULL PRIMARY KEY ,
|
||||
VERSION BIGINT ,
|
||||
NAME VARCHAR(45) ,
|
||||
CREDIT DECIMAL(10,2)
|
||||
) ;
|
||||
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (1, 0, 'customer1', 100000);
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (2, 0, 'customer2', 100000);
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (3, 0, 'customer3', 100000);
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (4, 0, 'customer4', 100000);
|
||||
|
||||
CREATE TABLE PLAYERS (
|
||||
PLAYER_ID CHAR(8) NOT NULL PRIMARY KEY,
|
||||
LAST_NAME VARCHAR(35) NOT NULL,
|
||||
FIRST_NAME VARCHAR(25) NOT NULL,
|
||||
POS VARCHAR(10) ,
|
||||
YEAR_OF_BIRTH BIGINT NOT NULL,
|
||||
YEAR_DRAFTED BIGINT NOT NULL
|
||||
) ;
|
||||
|
||||
CREATE TABLE GAMES (
|
||||
PLAYER_ID CHAR(8) NOT NULL,
|
||||
YEAR_NO BIGINT NOT NULL,
|
||||
TEAM CHAR(3) NOT NULL,
|
||||
WEEK BIGINT NOT NULL,
|
||||
OPPONENT CHAR(3) ,
|
||||
COMPLETES BIGINT ,
|
||||
ATTEMPTS BIGINT ,
|
||||
PASSING_YARDS BIGINT ,
|
||||
PASSING_TD BIGINT ,
|
||||
INTERCEPTIONS BIGINT ,
|
||||
RUSHES BIGINT ,
|
||||
RUSH_YARDS BIGINT ,
|
||||
RECEPTIONS BIGINT ,
|
||||
RECEPTIONS_YARDS BIGINT ,
|
||||
TOTAL_TD BIGINT
|
||||
) ;
|
||||
|
||||
CREATE TABLE PLAYER_SUMMARY (
|
||||
ID CHAR(8) NOT NULL,
|
||||
YEAR_NO BIGINT NOT NULL,
|
||||
COMPLETES BIGINT NOT NULL ,
|
||||
ATTEMPTS BIGINT NOT NULL ,
|
||||
PASSING_YARDS BIGINT NOT NULL ,
|
||||
PASSING_TD BIGINT NOT NULL ,
|
||||
INTERCEPTIONS BIGINT NOT NULL ,
|
||||
RUSHES BIGINT NOT NULL ,
|
||||
RUSH_YARDS BIGINT NOT NULL ,
|
||||
RECEPTIONS BIGINT NOT NULL ,
|
||||
RECEPTIONS_YARDS BIGINT NOT NULL ,
|
||||
TOTAL_TD BIGINT NOT NULL
|
||||
) ;
|
||||
|
||||
CREATE TABLE ERROR_LOG (
|
||||
JOB_NAME CHAR(20) ,
|
||||
STEP_NAME CHAR(20) ,
|
||||
MESSAGE VARCHAR(300) NOT NULL
|
||||
) ;
|
||||
@@ -1,96 +0,0 @@
|
||||
-- Autogenerated: do not edit this file
|
||||
DROP TABLE BATCH_STAGING_SEQ ;
|
||||
DROP TABLE TRADE_SEQ ;
|
||||
DROP TABLE CUSTOMER_SEQ ;
|
||||
DROP TABLE BATCH_STAGING ;
|
||||
DROP TABLE TRADE ;
|
||||
DROP TABLE CUSTOMER ;
|
||||
DROP TABLE PLAYERS ;
|
||||
DROP TABLE GAMES ;
|
||||
DROP TABLE PLAYER_SUMMARY ;
|
||||
DROP TABLE ERROR_LOG ;
|
||||
|
||||
-- Autogenerated: do not edit this file
|
||||
|
||||
CREATE TABLE CUSTOMER_SEQ (ID BIGINT IDENTITY);
|
||||
INSERT INTO CUSTOMER_SEQ (ID) values (5);
|
||||
CREATE TABLE BATCH_STAGING_SEQ (ID BIGINT IDENTITY);
|
||||
INSERT INTO BATCH_STAGING_SEQ (ID) values (0);
|
||||
CREATE TABLE TRADE_SEQ (ID BIGINT IDENTITY);
|
||||
INSERT INTO TRADE_SEQ (ID) values (0);
|
||||
|
||||
CREATE TABLE BATCH_STAGING (
|
||||
ID BIGINT NOT NULL PRIMARY KEY ,
|
||||
JOB_ID BIGINT NOT NULL,
|
||||
VALUE IMAGE NOT NULL,
|
||||
PROCESSED CHAR(1) NOT NULL
|
||||
) ;
|
||||
|
||||
CREATE TABLE TRADE (
|
||||
ID BIGINT NOT NULL PRIMARY KEY ,
|
||||
VERSION BIGINT NULL,
|
||||
ISIN VARCHAR(45) NOT NULL,
|
||||
QUANTITY BIGINT NULL,
|
||||
PRICE DECIMAL(8,2) NULL,
|
||||
CUSTOMER VARCHAR(45) NULL
|
||||
) ;
|
||||
|
||||
CREATE TABLE CUSTOMER (
|
||||
ID BIGINT NOT NULL PRIMARY KEY ,
|
||||
VERSION BIGINT NULL,
|
||||
NAME VARCHAR(45) NULL,
|
||||
CREDIT DECIMAL(10,2) NULL
|
||||
) ;
|
||||
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (1, 0, 'customer1', 100000);
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (2, 0, 'customer2', 100000);
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (3, 0, 'customer3', 100000);
|
||||
INSERT INTO CUSTOMER (ID, VERSION, NAME, CREDIT) VALUES (4, 0, 'customer4', 100000);
|
||||
|
||||
CREATE TABLE PLAYERS (
|
||||
PLAYER_ID CHAR(8) NOT NULL PRIMARY KEY,
|
||||
LAST_NAME VARCHAR(35) NOT NULL,
|
||||
FIRST_NAME VARCHAR(25) NOT NULL,
|
||||
POS VARCHAR(10) NULL,
|
||||
YEAR_OF_BIRTH BIGINT NOT NULL,
|
||||
YEAR_DRAFTED BIGINT NOT NULL
|
||||
) ;
|
||||
|
||||
CREATE TABLE GAMES (
|
||||
PLAYER_ID CHAR(8) NOT NULL,
|
||||
YEAR_NO BIGINT NOT NULL,
|
||||
TEAM CHAR(3) NOT NULL,
|
||||
WEEK BIGINT NOT NULL,
|
||||
OPPONENT CHAR(3) NULL,
|
||||
COMPLETES BIGINT NULL,
|
||||
ATTEMPTS BIGINT NULL,
|
||||
PASSING_YARDS BIGINT NULL,
|
||||
PASSING_TD BIGINT NULL,
|
||||
INTERCEPTIONS BIGINT NULL,
|
||||
RUSHES BIGINT NULL,
|
||||
RUSH_YARDS BIGINT NULL,
|
||||
RECEPTIONS BIGINT NULL,
|
||||
RECEPTIONS_YARDS BIGINT NULL,
|
||||
TOTAL_TD BIGINT NULL
|
||||
) ;
|
||||
|
||||
CREATE TABLE PLAYER_SUMMARY (
|
||||
ID CHAR(8) NOT NULL,
|
||||
YEAR_NO BIGINT NOT NULL,
|
||||
COMPLETES BIGINT NOT NULL ,
|
||||
ATTEMPTS BIGINT NOT NULL ,
|
||||
PASSING_YARDS BIGINT NOT NULL ,
|
||||
PASSING_TD BIGINT NOT NULL ,
|
||||
INTERCEPTIONS BIGINT NOT NULL ,
|
||||
RUSHES BIGINT NOT NULL ,
|
||||
RUSH_YARDS BIGINT NOT NULL ,
|
||||
RECEPTIONS BIGINT NOT NULL ,
|
||||
RECEPTIONS_YARDS BIGINT NOT NULL ,
|
||||
TOTAL_TD BIGINT NOT NULL
|
||||
) ;
|
||||
|
||||
CREATE TABLE ERROR_LOG (
|
||||
JOB_NAME CHAR(20) NULL,
|
||||
STEP_NAME CHAR(20) NULL,
|
||||
MESSAGE VARCHAR(300) NOT NULL
|
||||
) ;
|
||||
@@ -1,6 +0,0 @@
|
||||
customer1,10
|
||||
customer2,20
|
||||
customer3,30
|
||||
customer4,40
|
||||
customer5,50
|
||||
customer6,60
|
||||
|
@@ -1,2 +0,0 @@
|
||||
customer7,70
|
||||
customer8,80
|
||||
|
@@ -1,5 +0,0 @@
|
||||
UK21341EAH4121131.11customer1
|
||||
UK21341EAH4221232.11customer2
|
||||
UK21341EAH4321333.11customer3
|
||||
UK21341EAH4421434.11customer4
|
||||
UK21341EAH4521535.11customer5
|
||||
@@ -1,2 +0,0 @@
|
||||
UK21341EAH4121131.11customer1
|
||||
UK21341EAH4221232.11customer2
|
||||
@@ -1,3 +0,0 @@
|
||||
UK21341EAH4321333.11customer3
|
||||
UK21341EAH4421434.11customer4
|
||||
UK21341EAH4521535.11customer5
|
||||
@@ -1 +0,0 @@
|
||||
random input that would cause error if processed: g awegweagaer gw5t43 5643623456tr
|
||||
@@ -1,20 +0,0 @@
|
||||
RECORDTYPE1
|
||||
a,b,c
|
||||
d,e
|
||||
END
|
||||
|
||||
RECORDTYPE2
|
||||
1:2:3
|
||||
4
|
||||
5:6
|
||||
END
|
||||
|
||||
PERSON
|
||||
john, william, smith #name
|
||||
55 #age
|
||||
END
|
||||
|
||||
ANIMAL
|
||||
tiger #spieces
|
||||
1 #quantity
|
||||
END
|
||||
@@ -1,5 +0,0 @@
|
||||
UK21341EAH4597898.34customer1
|
||||
UK21341EAH4611218.12customer2
|
||||
UK21341EAH4724512.78customer2
|
||||
UK21341EAH48108109.25customer3
|
||||
UK21341EAH49854123.39customer4
|
||||
@@ -1,5 +0,0 @@
|
||||
UK21341EAH4121131.11customer1
|
||||
UK21341EAH4221232.11customer2
|
||||
UK21341EAH4321333.11customer3
|
||||
UK21341EAH4421434.11customer4
|
||||
UK21341EAH4521535.11customer5
|
||||
@@ -1,5 +0,0 @@
|
||||
UK21341EAH4597898.34customer1
|
||||
UK21341EAH4611218.12customer2
|
||||
UK21341EAH4724512.78customer2
|
||||
UK21341EAH48108109.25customer3
|
||||
UK21341EAH49854123.39customer4
|
||||
@@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<bean id="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
|
||||
<property name="dataSource" ref="dataSource" />
|
||||
<property name="mappingLocations" value="classpath*:/org/springframework/batch/sample/hibernate/*.hbm.xml" />
|
||||
</bean>
|
||||
|
||||
<bean id="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager" lazy-init="true">
|
||||
<property name="sessionFactory" ref="sessionFactory" />
|
||||
</bean>
|
||||
</beans>
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<import resource="classpath:data-source-context.xml"/>
|
||||
|
||||
<bean class="org.springframework.batch.sample.domain.trade.internal.JdbcCustomerDebitDao"/>
|
||||
</beans>
|
||||
@@ -1,45 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/batch https://www.springframework.org/schema/batch/spring-batch.xsd">
|
||||
|
||||
<description>Example for Hibernate integration.</description>
|
||||
|
||||
<job id="hibernateJob" restartable="false" xmlns="http://www.springframework.org/schema/batch">
|
||||
<step id="step1">
|
||||
<tasklet>
|
||||
<chunk reader="hibernateItemReader"
|
||||
processor="creditIncreaseProcessor"
|
||||
writer="hibernateCreditWriter"
|
||||
skip-limit="5"
|
||||
commit-interval="3">
|
||||
<skippable-exception-classes>
|
||||
<include class="java.lang.RuntimeException"/>
|
||||
</skippable-exception-classes>
|
||||
</chunk>
|
||||
</tasklet>
|
||||
</step>
|
||||
</job>
|
||||
|
||||
<bean id="creditIncreaseProcessor"
|
||||
class="org.springframework.batch.sample.domain.trade.internal.CustomerCreditIncreaseProcessor" />
|
||||
|
||||
<bean id="hibernateCreditWriter"
|
||||
class="org.springframework.batch.sample.domain.trade.internal.HibernateAwareCustomerCreditItemWriter">
|
||||
<property name="sessionFactory" ref="sessionFactory" />
|
||||
<property name="dao" ref="customerCreditDao" />
|
||||
</bean>
|
||||
|
||||
<bean id="customerCreditDao"
|
||||
class="org.springframework.batch.sample.domain.trade.internal.HibernateCreditDao">
|
||||
<property name="sessionFactory" ref="sessionFactory" />
|
||||
</bean>
|
||||
|
||||
<bean id="hibernateItemReader"
|
||||
class="org.springframework.batch.item.database.HibernateCursorItemReader">
|
||||
<property name="queryString" value="from CustomerCredit" />
|
||||
<property name="sessionFactory" ref="sessionFactory" />
|
||||
</bean>
|
||||
</beans>
|
||||
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/batch https://www.springframework.org/schema/batch/spring-batch.xsd
|
||||
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<job id="ioSampleJob" xmlns="http://www.springframework.org/schema/batch">
|
||||
<step id="step1">
|
||||
<tasklet>
|
||||
<chunk reader="itemReader" processor="itemProcessor" writer="itemWriter"
|
||||
commit-interval="2" />
|
||||
</tasklet>
|
||||
</step>
|
||||
</job>
|
||||
|
||||
<bean id="itemProcessor" class="org.springframework.batch.sample.domain.trade.internal.CustomerCreditIncreaseProcessor" />
|
||||
</beans>
|
||||
@@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<bean id="itemReader"
|
||||
class="org.springframework.batch.item.database.HibernateCursorItemReader">
|
||||
<property name="sessionFactory" ref="sessionFactory" />
|
||||
<property name="queryString" value="from CustomerCredit" />
|
||||
</bean>
|
||||
|
||||
<bean id="itemWriter"
|
||||
class="org.springframework.batch.item.database.HibernateItemWriter">
|
||||
<property name="sessionFactory" ref="sessionFactory" />
|
||||
</bean>
|
||||
</beans>
|
||||
@@ -1,33 +0,0 @@
|
||||
log4j.rootLogger=info, stdout
|
||||
# log4j.rootLogger=info, stdout, chainsaw
|
||||
|
||||
### direct log messages to stdout ###
|
||||
log4j.appender.stdout=org.apache.logging.log4j.core.appender.ConsoleAppender
|
||||
log4j.appender.stdout.Target=System.out
|
||||
log4j.appender.stdout.layout=org.apache.logging.log4j.core.layout.PatternLayout
|
||||
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %t %c{1}:%L - %m%n
|
||||
|
||||
log4j.appender.chainsaw=org.apache.log4j.RollingFileAppender
|
||||
log4j.appender.chainsaw.File=out.xml
|
||||
log4j.appender.chainsaw.Append=false
|
||||
log4j.appender.chainsaw.Threshold=debug
|
||||
log4j.appender.chainsaw.MaxFileSize=10MB
|
||||
log4j.appender.chainsaw.MaxBackupIndex=2
|
||||
log4j.appender.chainsaw.layout=org.apache.log4j.xml.XMLLayout
|
||||
|
||||
### set log levels - for more verbose logging change 'info' to 'debug' ###
|
||||
|
||||
### enable the following line if you want to track down connection ###
|
||||
### leakages when using DriverManagerConnectionProvider ###
|
||||
#log4j.logger.org.hibernate.connection.DriverManagerConnectionProvider=trace
|
||||
|
||||
### enable spring
|
||||
#log4j.logger.org.springframework=info
|
||||
#log4j.logger.org.springframework.transaction=debug
|
||||
#log4j.logger.org.springframework.jdbc.core=debug
|
||||
#log4j.logger.org.springframework.orm=debug
|
||||
|
||||
### debug your specific package or classes with the following example
|
||||
log4j.logger.org.springframework.jdbc=info
|
||||
#log4j.logger.org.springframework.batch=debug
|
||||
log4j.logger.org.springframework.batch.sample=debug
|
||||
@@ -1,20 +0,0 @@
|
||||
customer1,10
|
||||
customer2,20
|
||||
customer3,30
|
||||
customer4,40
|
||||
customer5,50
|
||||
customer6,60
|
||||
customer7,70
|
||||
customer8,80
|
||||
customer9,90
|
||||
customer10,100
|
||||
customer11,110
|
||||
customer12,120
|
||||
customer13,130
|
||||
customer14,140
|
||||
customer15,150
|
||||
customer16,160
|
||||
customer17,170
|
||||
customer18,180
|
||||
customer19,190
|
||||
customer20,200
|
||||
|
@@ -1,66 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/batch https://www.springframework.org/schema/batch/spring-batch.xsd
|
||||
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<job id="ioSampleJob" xmlns="http://www.springframework.org/schema/batch">
|
||||
<step id="step1">
|
||||
<tasklet>
|
||||
<chunk reader="itemReader" processor="itemProcessor" writer="itemWriter"
|
||||
commit-interval="5" />
|
||||
</tasklet>
|
||||
</step>
|
||||
</job>
|
||||
|
||||
<bean id="itemReaderParent" class="org.springframework.batch.item.file.FlatFileItemReader"
|
||||
abstract="true">
|
||||
<property name="lineMapper">
|
||||
<bean class="org.springframework.batch.item.file.mapping.DefaultLineMapper">
|
||||
<property name="lineTokenizer">
|
||||
<bean
|
||||
class="org.springframework.batch.item.file.transform.DelimitedLineTokenizer">
|
||||
<property name="delimiter" value="," />
|
||||
<property name="names" value="name,credit" />
|
||||
</bean>
|
||||
</property>
|
||||
<property name="fieldSetMapper">
|
||||
<bean
|
||||
class="org.springframework.batch.item.file.mapping.BeanWrapperFieldSetMapper">
|
||||
<property name="targetType"
|
||||
value="org.springframework.batch.sample.domain.trade.CustomerCredit" />
|
||||
</bean>
|
||||
</property>
|
||||
</bean>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="itemReader" parent="itemReaderParent" scope="step"
|
||||
autowire-candidate="false">
|
||||
<property name="resource" value="org/springframework/batch/sample/restart/fail/data/restartFile.csv" />
|
||||
</bean>
|
||||
|
||||
<bean id="itemProcessor"
|
||||
class="org.springframework.batch.sample.domain.trade.internal.CustomerCreditIncreaseProcessor" />
|
||||
|
||||
<bean id="itemWriter"
|
||||
class="org.springframework.batch.sample.restart.fail.RestartFileSampleFunctionalTests$CustomerCreditFlatFileItemWriter">
|
||||
<property name="resource" ref="outputResource" />
|
||||
<property name="lineAggregator">
|
||||
<bean
|
||||
class="org.springframework.batch.item.file.transform.DelimitedLineAggregator">
|
||||
<property name="delimiter" value="," />
|
||||
<property name="fieldExtractor">
|
||||
<bean
|
||||
class="org.springframework.batch.item.file.transform.BeanWrapperFieldExtractor">
|
||||
<property name="names" value="name,credit" />
|
||||
</bean>
|
||||
</property>
|
||||
</bean>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="outputResource" class="org.springframework.core.io.FileSystemResource">
|
||||
<constructor-arg value="target/test-outputs/restartFileOutput.csv" />
|
||||
</bean>
|
||||
</beans>
|
||||
@@ -1,11 +0,0 @@
|
||||
platform=db2
|
||||
# SQL language oddities
|
||||
BIGINT = BIGINT
|
||||
IDENTITY =
|
||||
DOUBLE = DOUBLE PRECISION
|
||||
DECIMAL = DECIMAL
|
||||
BLOB = BLOB
|
||||
TIMESTAMP = TIMESTAMP
|
||||
VARCHAR = VARCHAR
|
||||
# for generating drop statements...
|
||||
SEQUENCE = SEQUENCE
|
||||
@@ -1,12 +0,0 @@
|
||||
platform=db2
|
||||
# SQL language oddities
|
||||
BIGINT = BIGINT
|
||||
IDENTITY =
|
||||
GENERATED = GENERATED BY DEFAULT AS IDENTITY
|
||||
DOUBLE = DOUBLE PRECISION
|
||||
DECIMAL = DECIMAL
|
||||
BLOB = BLOB
|
||||
TIMESTAMP = TIMESTAMP
|
||||
VARCHAR = VARCHAR
|
||||
# for generating drop statements...
|
||||
SEQUENCE = TABLE
|
||||
@@ -1,12 +0,0 @@
|
||||
platform=h2
|
||||
# SQL language oddities
|
||||
BIGINT = BIGINT
|
||||
IDENTITY = IDENTITY
|
||||
IFEXISTS = IF EXISTS
|
||||
DOUBLE = DOUBLE PRECISION
|
||||
DECIMAL = DECIMAL
|
||||
BLOB = LONGVARBINARY
|
||||
TIMESTAMP = TIMESTAMP
|
||||
VARCHAR = VARCHAR
|
||||
# for generating drop statements...
|
||||
SEQUENCE = SEQUENCE
|
||||
@@ -1,12 +0,0 @@
|
||||
platform=hana
|
||||
# SQL language oddities
|
||||
BIGINT = BIGINT
|
||||
IDENTITY =
|
||||
GENERATED = GENERATED BY DEFAULT AS IDENTITY
|
||||
DOUBLE = DOUBLE
|
||||
DECIMAL = DECIMAL
|
||||
BLOB = BLOB
|
||||
TIMESTAMP = TIMESTAMP
|
||||
VARCHAR = VARCHAR
|
||||
# for generating drop statements...
|
||||
SEQUENCE = SEQUENCE
|
||||
@@ -1,12 +0,0 @@
|
||||
platform=hsqldb
|
||||
# SQL language oddities
|
||||
BIGINT = BIGINT
|
||||
IDENTITY = IDENTITY
|
||||
IFEXISTS = IF EXISTS
|
||||
DOUBLE = DOUBLE PRECISION
|
||||
DECIMAL = DECIMAL
|
||||
BLOB = LONGVARBINARY
|
||||
TIMESTAMP = TIMESTAMP
|
||||
VARCHAR = VARCHAR
|
||||
# for generating drop statements...
|
||||
SEQUENCE = TABLE
|
||||
@@ -1,14 +0,0 @@
|
||||
platform=mysql
|
||||
# SQL language oddities
|
||||
BIGINT = BIGINT
|
||||
IDENTITY =
|
||||
GENERATED =
|
||||
VOODOO = engine=InnoDB
|
||||
IFEXISTSBEFORE = IF EXISTS
|
||||
DOUBLE = DOUBLE PRECISION
|
||||
DECIMAL = DECIMAL
|
||||
BLOB = BLOB
|
||||
TIMESTAMP = DATETIME
|
||||
VARCHAR = VARCHAR
|
||||
# for generating drop statements...
|
||||
SEQUENCE = TABLE
|
||||
@@ -1,12 +0,0 @@
|
||||
platform=oracle
|
||||
# SQL language oddities
|
||||
BIGINT = NUMBER(38)
|
||||
IDENTITY =
|
||||
GENERATED =
|
||||
DOUBLE = NUMBER
|
||||
DECIMAL = DECIMAL
|
||||
BLOB = BLOB
|
||||
TIMESTAMP = TIMESTAMP
|
||||
VARCHAR = VARCHAR2
|
||||
# for generating drop statements...
|
||||
SEQUENCE = SEQUENCE
|
||||
@@ -1,12 +0,0 @@
|
||||
platform=postgresql
|
||||
# SQL language oddities
|
||||
BIGINT = BIGINT
|
||||
IDENTITY =
|
||||
GENERATED =
|
||||
DOUBLE = DOUBLE PRECISION
|
||||
DECIMAL = DECIMAL
|
||||
BLOB = BYTEA
|
||||
TIMESTAMP = TIMESTAMP
|
||||
VARCHAR = VARCHAR
|
||||
# for generating drop statements...
|
||||
SEQUENCE = SEQUENCE
|
||||
@@ -1,11 +0,0 @@
|
||||
# SQL language oddities
|
||||
BIGINT = BIGINT
|
||||
IDENTITY =
|
||||
GENERATED =
|
||||
DOUBLE = DOUBLE PRECISION
|
||||
DECIMAL = DECIMAL
|
||||
BLOB = IMAGE
|
||||
TIMESTAMP = DATETIME
|
||||
VARCHAR = VARCHAR
|
||||
# for generating drop statements...
|
||||
SEQUENCE = TABLE
|
||||
@@ -1,12 +0,0 @@
|
||||
# SQL language oddities
|
||||
BIGINT = BIGINT
|
||||
IDENTITY =
|
||||
GENERATED =
|
||||
DOUBLE = DOUBLE PRECISION
|
||||
DECIMAL = DECIMAL
|
||||
BLOB = IMAGE
|
||||
TIMESTAMP = DATETIME
|
||||
VARCHAR = VARCHAR
|
||||
NULL = NULL
|
||||
# for generating drop statements...
|
||||
SEQUENCE = TABLE
|
||||
@@ -1,170 +0,0 @@
|
||||
/*
|
||||
* Copyright 2007-2023 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.batch.sample;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.JobParametersBuilder;
|
||||
import org.springframework.batch.sample.domain.trade.internal.CustomerCreditIncreaseProcessor;
|
||||
import org.springframework.batch.sample.domain.trade.internal.HibernateCreditDao;
|
||||
import org.springframework.batch.test.JobLauncherTestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.UncategorizedSQLException;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.RowCallbackHandler;
|
||||
import org.springframework.orm.hibernate5.HibernateJdbcException;
|
||||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
import org.springframework.test.jdbc.JdbcTestUtils;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.support.TransactionCallback;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
|
||||
/**
|
||||
* Test for HibernateJob - checks that customer credit has been updated to expected value.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @author Glenn Renfro
|
||||
*/
|
||||
|
||||
@SpringJUnitConfig(locations = { "/simple-job-launcher-context.xml", "/hibernate-context.xml", "/jobs/hibernateJob.xml",
|
||||
"/job-runner-context.xml" })
|
||||
class HibernateFailureJobFunctionalTests {
|
||||
|
||||
private static final BigDecimal CREDIT_INCREASE = CustomerCreditIncreaseProcessor.FIXED_AMOUNT;
|
||||
|
||||
private static final String ALL_CUSTOMERS = "select * from CUSTOMER order by ID";
|
||||
|
||||
private static final String CREDIT_COLUMN = "CREDIT";
|
||||
|
||||
private static final String[] customers = {
|
||||
"INSERT INTO CUSTOMER (id, version, name, credit) VALUES (1, 0, 'customer1', 100000)",
|
||||
"INSERT INTO CUSTOMER (id, version, name, credit) VALUES (2, 0, 'customer2', 100000)",
|
||||
"INSERT INTO CUSTOMER (id, version, name, credit) VALUES (3, 0, 'customer3', 100000)",
|
||||
"INSERT INTO CUSTOMER (id, version, name, credit) VALUES (4, 0, 'customer4', 100000)" };
|
||||
|
||||
protected static final String ID_COLUMN = "ID";
|
||||
|
||||
@Autowired
|
||||
private HibernateCreditDao writer;
|
||||
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
@Autowired
|
||||
private PlatformTransactionManager transactionManager;
|
||||
|
||||
private List<BigDecimal> creditsBeforeUpdate;
|
||||
|
||||
@Autowired
|
||||
private JobLauncherTestUtils jobLauncherTestUtils;
|
||||
|
||||
@Autowired
|
||||
public void setDataSource(DataSource dataSource) {
|
||||
this.jdbcTemplate = new JdbcTemplate(dataSource);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testLaunchJob() throws Exception {
|
||||
validatePreConditions();
|
||||
|
||||
JobParameters params = new JobParametersBuilder().addString("key", "failureJob").toJobParameters();
|
||||
writer.setFailOnFlush(2);
|
||||
|
||||
try {
|
||||
jobLauncherTestUtils.launchJob(params);
|
||||
}
|
||||
catch (HibernateJdbcException e) {
|
||||
// This is what would happen if the flush happened outside the
|
||||
// RepeatContext:
|
||||
throw e;
|
||||
}
|
||||
catch (UncategorizedSQLException e) {
|
||||
// This is what would happen if the job wasn't configured to skip
|
||||
// exceptions at the step level.
|
||||
// assertEquals(1, writer.getErrors().size());
|
||||
throw e;
|
||||
}
|
||||
|
||||
int after = JdbcTestUtils.countRowsInTable(jdbcTemplate, "CUSTOMER");
|
||||
assertEquals(4, after);
|
||||
|
||||
validatePostConditions();
|
||||
}
|
||||
|
||||
/**
|
||||
* All customers have the same credit
|
||||
*/
|
||||
protected void validatePreConditions() {
|
||||
ensureState();
|
||||
creditsBeforeUpdate = new TransactionTemplate(transactionManager)
|
||||
.execute(status -> jdbcTemplate.query(ALL_CUSTOMERS, (rs, rowNum) -> rs.getBigDecimal(CREDIT_COLUMN)));
|
||||
}
|
||||
|
||||
/*
|
||||
* Ensure the state of the database is accurate by delete all the contents of the
|
||||
* customer table and reading the expected defaults.
|
||||
*/
|
||||
private void ensureState() {
|
||||
new TransactionTemplate(transactionManager).execute((TransactionCallback<Void>) status -> {
|
||||
JdbcTestUtils.deleteFromTables(jdbcTemplate, "CUSTOMER");
|
||||
for (String customer : customers) {
|
||||
jdbcTemplate.update(customer);
|
||||
}
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Credit was increased by CREDIT_INCREASE
|
||||
*/
|
||||
protected void validatePostConditions() {
|
||||
final List<BigDecimal> matches = new ArrayList<>();
|
||||
|
||||
new TransactionTemplate(transactionManager).execute((TransactionCallback<Void>) status -> {
|
||||
jdbcTemplate.query(ALL_CUSTOMERS, new RowCallbackHandler() {
|
||||
private int i = 0;
|
||||
|
||||
@Override
|
||||
public void processRow(ResultSet rs) throws SQLException {
|
||||
final BigDecimal creditBeforeUpdate = creditsBeforeUpdate.get(i++);
|
||||
final BigDecimal expectedCredit = creditBeforeUpdate.add(CREDIT_INCREASE);
|
||||
if (expectedCredit.equals(rs.getBigDecimal(CREDIT_COLUMN))) {
|
||||
matches.add(rs.getBigDecimal(ID_COLUMN));
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return null;
|
||||
});
|
||||
|
||||
assertEquals((creditsBeforeUpdate.size() - 1), matches.size());
|
||||
assertFalse(matches.contains(new BigDecimal(2)));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* Copyright 2006-2023 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.batch.sample.domain.trade.internal;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.batch.sample.domain.trade.CustomerDebit;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.JdbcOperations;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
@SpringJUnitConfig(locations = "classpath:jobs/JdbcCustomerDebitDaoTests-context.xml")
|
||||
class JdbcCustomerDebitDaoTests {
|
||||
|
||||
private JdbcOperations jdbcTemplate;
|
||||
|
||||
@Autowired
|
||||
private JdbcCustomerDebitDao writer;
|
||||
|
||||
@Autowired
|
||||
public void setDataSource(DataSource dataSource) {
|
||||
this.jdbcTemplate = new JdbcTemplate(dataSource);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
void testWrite() {
|
||||
jdbcTemplate.execute("INSERT INTO CUSTOMER VALUES (99, 0, 'testName', 100)");
|
||||
|
||||
CustomerDebit customerDebit = new CustomerDebit();
|
||||
customerDebit.setName("testName");
|
||||
customerDebit.setDebit(BigDecimal.valueOf(5));
|
||||
|
||||
writer.write(customerDebit);
|
||||
|
||||
jdbcTemplate.query("SELECT name, credit FROM CUSTOMER WHERE name = 'testName'", rs -> {
|
||||
assertEquals(95, rs.getLong("credit"));
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,146 +0,0 @@
|
||||
/*
|
||||
* Copyright 2008-2022 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.batch.sample.iosample;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.batch.core.BatchStatus;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.JobParametersBuilder;
|
||||
import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
import org.springframework.batch.item.ItemReader;
|
||||
import org.springframework.batch.item.ItemStream;
|
||||
import org.springframework.batch.sample.domain.trade.CustomerCredit;
|
||||
import org.springframework.batch.sample.domain.trade.internal.CustomerCreditIncreaseProcessor;
|
||||
import org.springframework.batch.test.JobLauncherTestUtils;
|
||||
import org.springframework.batch.test.MetaDataInstanceFactory;
|
||||
import org.springframework.batch.test.StepScopeTestExecutionListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.TestExecutionListeners;
|
||||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
import org.springframework.test.context.support.DependencyInjectionTestExecutionListener;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
/**
|
||||
* Base class for IoSample tests that increase input customer credit by fixed amount.
|
||||
* Assumes inputs and outputs are in the same format and uses the job's {@link ItemReader}
|
||||
* to parse the outputs.
|
||||
*
|
||||
* @author Robert Kasanicky
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
@SpringJUnitConfig(
|
||||
locations = { "/simple-job-launcher-context.xml", "/job-runner-context.xml", "/jobs/ioSampleJob.xml" })
|
||||
@TestExecutionListeners({ DependencyInjectionTestExecutionListener.class, StepScopeTestExecutionListener.class })
|
||||
abstract class AbstractIoSampleTests {
|
||||
|
||||
@Autowired
|
||||
private JobLauncherTestUtils jobLauncherTestUtils;
|
||||
|
||||
@Autowired
|
||||
private ItemReader<CustomerCredit> reader;
|
||||
|
||||
/**
|
||||
* Check the resulting credits correspond to inputs increased by fixed amount.
|
||||
*/
|
||||
@Test
|
||||
void testUpdateCredit() throws Exception {
|
||||
open(reader);
|
||||
List<CustomerCredit> inputs = getCredits(reader);
|
||||
close(reader);
|
||||
|
||||
JobExecution jobExecution = jobLauncherTestUtils.launchJob(getUniqueJobParameters());
|
||||
assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus());
|
||||
|
||||
pointReaderToOutput(reader);
|
||||
open(reader);
|
||||
List<CustomerCredit> outputs = getCredits(reader);
|
||||
close(reader);
|
||||
|
||||
assertEquals(inputs.size(), outputs.size());
|
||||
int itemCount = inputs.size();
|
||||
assertTrue(itemCount > 0);
|
||||
|
||||
for (int i = 0; i < itemCount; i++) {
|
||||
assertEquals(inputs.get(i).getCredit().add(CustomerCreditIncreaseProcessor.FIXED_AMOUNT).intValue(),
|
||||
outputs.get(i).getCredit().intValue());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected JobParameters getUniqueJobParameters() {
|
||||
return jobLauncherTestUtils.getUniqueJobParameters();
|
||||
}
|
||||
|
||||
protected JobParametersBuilder getUniqueJobParametersBuilder() {
|
||||
return jobLauncherTestUtils.getUniqueJobParametersBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the reader to read outputs (if necessary). Required for file-to-file jobs
|
||||
* jobs, usually no-op for database jobs where inputs are updated (rather than outputs
|
||||
* created).
|
||||
*/
|
||||
protected abstract void pointReaderToOutput(ItemReader<CustomerCredit> reader);
|
||||
|
||||
/**
|
||||
* Read all credits using the provided reader.
|
||||
*/
|
||||
private List<CustomerCredit> getCredits(ItemReader<CustomerCredit> reader) throws Exception {
|
||||
CustomerCredit credit;
|
||||
List<CustomerCredit> result = new ArrayList<>();
|
||||
while ((credit = reader.read()) != null) {
|
||||
result.add(credit);
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Open the reader if applicable.
|
||||
*/
|
||||
private void open(ItemReader<?> reader) {
|
||||
if (reader instanceof ItemStream) {
|
||||
((ItemStream) reader).open(new ExecutionContext());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the reader if applicable.
|
||||
*/
|
||||
private void close(ItemReader<?> reader) {
|
||||
if (reader instanceof ItemStream) {
|
||||
((ItemStream) reader).close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a {@link StepExecution} that can be used to satisfy step scoped dependencies
|
||||
* in the test itself (not in the job it launches).
|
||||
* @return a {@link StepExecution}
|
||||
*/
|
||||
protected StepExecution getStepExecution() {
|
||||
return MetaDataInstanceFactory.createStepExecution(getUniqueJobParameters());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright 2008-2022 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.batch.sample.iosample;
|
||||
|
||||
import org.springframework.batch.item.ItemReader;
|
||||
import org.springframework.batch.sample.domain.trade.CustomerCredit;
|
||||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
|
||||
@SpringJUnitConfig(locations = { "/hibernate-context.xml", "/jobs/iosample/hibernate.xml" })
|
||||
class HibernateFunctionalTests extends AbstractIoSampleTests {
|
||||
|
||||
@Override
|
||||
protected void pointReaderToOutput(ItemReader<CustomerCredit> reader) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright 2006-2022 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.batch.sample.iosample.internal;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.springframework.batch.item.Chunk;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.batch.sample.domain.trade.CustomerCredit;
|
||||
import org.springframework.batch.sample.domain.trade.Trade;
|
||||
import org.springframework.batch.sample.domain.trade.TradeDao;
|
||||
|
||||
/**
|
||||
* @author Dan Garrette
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @since 2.0
|
||||
*/
|
||||
public class TradeCustomerItemWriter implements ItemWriter<CustomerCredit> {
|
||||
|
||||
private TradeDao dao;
|
||||
|
||||
private int count;
|
||||
|
||||
@Override
|
||||
public void write(Chunk<? extends CustomerCredit> items) throws Exception {
|
||||
for (CustomerCredit c : items) {
|
||||
Trade t = new Trade("ISIN" + count++, 100, new BigDecimal("1.50"), c.getName());
|
||||
this.dao.writeTrade(t);
|
||||
}
|
||||
}
|
||||
|
||||
public void setDao(TradeDao dao) {
|
||||
this.dao = dao;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
/*
|
||||
* Copyright 2006-2023 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.batch.sample.jdbc;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.batch.core.BatchStatus;
|
||||
import org.springframework.batch.core.Job;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.JobParametersBuilder;
|
||||
import org.springframework.batch.core.launch.JobLauncher;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
import org.springframework.test.jdbc.JdbcTestUtils;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotSame;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @author Glenn Renfro
|
||||
* @since 2.0
|
||||
*/
|
||||
@SpringJUnitConfig(
|
||||
locations = { "/simple-job-launcher-context.xml", "/org/springframework/batch/sample/jdbc/job/jdbcPaging.xml" })
|
||||
class TwoJobInstancesPagingFunctionalTests {
|
||||
|
||||
@Autowired
|
||||
private JobLauncher launcher;
|
||||
|
||||
@Autowired
|
||||
private Job job;
|
||||
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
@Autowired
|
||||
public void setDataSource(DataSource dataSource) {
|
||||
jdbcTemplate = new JdbcTemplate(dataSource);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testLaunchJobTwice() throws Exception {
|
||||
int first = JdbcTestUtils.countRowsInTableWhere(jdbcTemplate, "CUSTOMER", "credit>1000");
|
||||
JobExecution jobExecution = launcher.run(this.job, getJobParameters(1000.));
|
||||
assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus());
|
||||
assertEquals(first, jobExecution.getStepExecutions().iterator().next().getWriteCount());
|
||||
int second = JdbcTestUtils.countRowsInTableWhere(jdbcTemplate, "CUSTOMER", "credit>1000000");
|
||||
assertNotSame(first, second, "The number of records above the threshold did not change");
|
||||
jobExecution = launcher.run(this.job, getJobParameters(1000000.));
|
||||
assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus());
|
||||
assertEquals(second, jobExecution.getStepExecutions().iterator().next().getWriteCount());
|
||||
}
|
||||
|
||||
protected JobParameters getJobParameters(double amount) {
|
||||
return new JobParametersBuilder().addLong("timestamp", new Date().getTime())
|
||||
.addDouble("credit", amount)
|
||||
.toJobParameters();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
/*
|
||||
* Copyright 2006-2022 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.batch.sample.restart.fail;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.batch.core.BatchStatus;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.item.Chunk;
|
||||
import org.springframework.batch.item.file.FlatFileItemWriter;
|
||||
import org.springframework.batch.sample.domain.trade.CustomerCredit;
|
||||
import org.springframework.batch.test.JobLauncherTestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
/**
|
||||
* @author Dan Garrette
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @author Glenn Renfro
|
||||
* @since 2.0
|
||||
*/
|
||||
@SpringJUnitConfig(locations = { "/simple-job-launcher-context.xml",
|
||||
"/org/springframework/batch/sample/restart/fail/job/restartFileSampleJob.xml", "/job-runner-context.xml" })
|
||||
class RestartFileSampleFunctionalTests {
|
||||
|
||||
@Autowired
|
||||
private Resource outputResource;
|
||||
|
||||
@Autowired
|
||||
private JobLauncherTestUtils jobLauncherTestUtils;
|
||||
|
||||
@Test
|
||||
void runTest() throws Exception {
|
||||
JobParameters jobParameters = jobLauncherTestUtils.getUniqueJobParameters();
|
||||
|
||||
JobExecution je1 = jobLauncherTestUtils.launchJob(jobParameters);
|
||||
assertEquals(BatchStatus.FAILED, je1.getStatus());
|
||||
Path outputResourceFile = outputResource.getFile().toPath();
|
||||
Assertions.assertEquals(10, Files.lines(outputResourceFile).count());
|
||||
|
||||
JobExecution je2 = jobLauncherTestUtils.launchJob(jobParameters);
|
||||
assertEquals(BatchStatus.COMPLETED, je2.getStatus());
|
||||
outputResourceFile = outputResource.getFile().toPath();
|
||||
Assertions.assertEquals(20, Files.lines(outputResourceFile).count());
|
||||
}
|
||||
|
||||
static class CustomerCreditFlatFileItemWriter extends FlatFileItemWriter<CustomerCredit> {
|
||||
|
||||
private boolean failed = false;
|
||||
|
||||
@Override
|
||||
public void write(Chunk<? extends CustomerCredit> arg0) throws Exception {
|
||||
for (CustomerCredit cc : arg0) {
|
||||
if (!failed && cc.getName().equals("customer13")) {
|
||||
failed = true;
|
||||
throw new RuntimeException();
|
||||
}
|
||||
}
|
||||
super.write(arg0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
/*
|
||||
* Copyright 2006-2022 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* https://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 org.springframework.batch.sample.restart.stop;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.batch.core.BatchStatus;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.launch.JobOperator;
|
||||
import org.springframework.batch.test.JobLauncherTestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
/**
|
||||
* Functional test for graceful shutdown. A batch container is started in a new thread,
|
||||
* then it's stopped using {@link JobOperator#stop(long)}}.
|
||||
*
|
||||
* @author Lucas Ward
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @author Glenn Renfro
|
||||
*
|
||||
*/
|
||||
|
||||
@SpringJUnitConfig(locations = { "/simple-job-launcher-context.xml",
|
||||
"/org/springframework/batch/sample/restart/stop/stopRestartSample.xml", "/job-runner-context.xml" })
|
||||
class DatabaseShutdownFunctionalTests {
|
||||
|
||||
/** Logger */
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
@Autowired
|
||||
private JobOperator jobOperator;
|
||||
|
||||
@Autowired
|
||||
private JobLauncherTestUtils jobLauncherTestUtils;
|
||||
|
||||
@Test
|
||||
void testLaunchJob() throws Exception {
|
||||
JobExecution jobExecution = jobLauncherTestUtils.launchJob();
|
||||
|
||||
Thread.sleep(1000);
|
||||
|
||||
assertEquals(BatchStatus.STARTED, jobExecution.getStatus());
|
||||
assertTrue(jobExecution.isRunning());
|
||||
assertNotNull(jobExecution.getVersion());
|
||||
|
||||
jobOperator.stop(jobExecution.getId());
|
||||
|
||||
int count = 0;
|
||||
while (jobExecution.isRunning() && count <= 10) {
|
||||
logger.info("Checking for end time in JobExecution: count=" + count);
|
||||
Thread.sleep(100);
|
||||
count++;
|
||||
}
|
||||
|
||||
assertFalse(jobExecution.isRunning(), "Timed out waiting for job to end.");
|
||||
assertEquals(BatchStatus.STOPPED, jobExecution.getStatus());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user