Add Velocity templates for business schema (BATCH-135).
This commit is contained in:
106
samples/pom.xml
106
samples/pom.xml
@@ -191,6 +191,112 @@
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>generate-sql</id>
|
||||
<phase>generate-sources</phase>
|
||||
<configuration>
|
||||
<tasks>
|
||||
<typedef resource="foundrylogic/vpp/typedef.properties" />
|
||||
<taskdef resource="foundrylogic/vpp/taskdef.properties" />
|
||||
<!-- Reference script for HSQLDB - N.B. not under source control, but packagaed in jar. -->
|
||||
<vppcopy todir="${basedir}/target/generated-resources" overwrite="true">
|
||||
<config>
|
||||
<context>
|
||||
<property key="includes" value="src/main/sql" />
|
||||
<property file="${basedir}/src/main/sql/hsqldb.properties" />
|
||||
</context>
|
||||
<engine>
|
||||
<property key="velocimacro.library" value="src/main/sql/hsqldb.vpp" />
|
||||
</engine>
|
||||
</config>
|
||||
<fileset dir="${basedir}/src/main/sql" includes="business-schema.sql.vpp" />
|
||||
<mapper type="glob" from="*.sql.vpp" to="*-hsqldb.sql" />
|
||||
</vppcopy>
|
||||
<!-- Reference script for DB2 - N.B. not under source control, but packagaed in jar. -->
|
||||
<vppcopy todir="${basedir}/target/generated-resources" overwrite="true">
|
||||
<config>
|
||||
<context>
|
||||
<property key="includes" value="src/main/sql" />
|
||||
<property file="${basedir}/src/main/sql/db2.properties" />
|
||||
</context>
|
||||
<engine>
|
||||
<property key="velocimacro.library" value="src/main/sql/db2.vpp" />
|
||||
</engine>
|
||||
</config>
|
||||
<fileset dir="${basedir}/src/main/sql" includes="business-schema.sql.vpp" />
|
||||
<mapper type="glob" from="*.sql.vpp" to="*-db2.sql" />
|
||||
</vppcopy>
|
||||
<!-- Reference script for Derby - N.B. not under source control, but packagaed in jar. -->
|
||||
<vppcopy todir="${basedir}/target/generated-resources" overwrite="true">
|
||||
<config>
|
||||
<context>
|
||||
<property key="includes" value="src/main/sql" />
|
||||
<property file="${basedir}/src/main/sql/derby.properties" />
|
||||
</context>
|
||||
<engine>
|
||||
<property key="velocimacro.library" value="src/main/sql/derby.vpp" />
|
||||
</engine>
|
||||
</config>
|
||||
<fileset dir="${basedir}/src/main/sql" includes="business-schema.sql.vpp" />
|
||||
<mapper type="glob" from="*.sql.vpp" to="*-derby.sql" />
|
||||
</vppcopy>
|
||||
<!-- Reference script for Oracle - N.B. not under source control, but packagaed in jar. -->
|
||||
<vppcopy todir="${basedir}/target/generated-resources" overwrite="true">
|
||||
<config>
|
||||
<context>
|
||||
<property key="includes" value="src/main/sql" />
|
||||
<property file="${basedir}/src/main/sql/oracle10g.properties" />
|
||||
</context>
|
||||
<engine>
|
||||
<property key="velocimacro.library" value="src/main/sql/oracle10g.vpp" />
|
||||
</engine>
|
||||
</config>
|
||||
<fileset dir="${basedir}/src/main/sql" includes="business-schema.sql.vpp" />
|
||||
<mapper type="glob" from="*.sql.vpp" to="*-oracle10g.sql" />
|
||||
</vppcopy>
|
||||
<!-- Reference script for PostgreSQL - N.B. not under source control, but packagaed in jar. -->
|
||||
<vppcopy todir="${basedir}/target/generated-resources" overwrite="true">
|
||||
<config>
|
||||
<context>
|
||||
<property key="includes" value="src/main/sql" />
|
||||
<property file="${basedir}/src/main/sql/postgresql.properties" />
|
||||
</context>
|
||||
<engine>
|
||||
<property key="velocimacro.library" value="src/main/sql/postgresql.vpp" />
|
||||
</engine>
|
||||
</config>
|
||||
<fileset dir="${basedir}/src/main/sql" includes="business-schema.sql.vpp" />
|
||||
<mapper type="glob" from="*.sql.vpp" to="*-postgresql.sql" />
|
||||
</vppcopy>
|
||||
</tasks>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-clover-plugin</artifactId>
|
||||
<configuration>
|
||||
<licenseLocation>
|
||||
${basedir}/src/test/resources/clover.license
|
||||
</licenseLocation>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>pre-site</phase>
|
||||
<goals>
|
||||
<goal>instrument</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
3
samples/src/main/sql/business-schema.sql.vpp
Normal file
3
samples/src/main/sql/business-schema.sql.vpp
Normal file
@@ -0,0 +1,3 @@
|
||||
#parse("${includes}/destroy.sql.vpp")
|
||||
|
||||
#parse("${includes}/init.sql.vpp")
|
||||
6
samples/src/main/sql/db2.properties
Normal file
6
samples/src/main/sql/db2.properties
Normal file
@@ -0,0 +1,6 @@
|
||||
platform=db2
|
||||
# SQL language oddities
|
||||
BIGINT = BIGINT
|
||||
IDENTITY =
|
||||
# for generating drop statements...
|
||||
SEQUENCE = SEQUENCE
|
||||
2
samples/src/main/sql/db2.vpp
Normal file
2
samples/src/main/sql/db2.vpp
Normal file
@@ -0,0 +1,2 @@
|
||||
#macro (sequence $name)CREATE SEQUENCE ${name};
|
||||
#end
|
||||
7
samples/src/main/sql/derby.properties
Normal file
7
samples/src/main/sql/derby.properties
Normal file
@@ -0,0 +1,7 @@
|
||||
platform=db2
|
||||
# SQL language oddities
|
||||
BIGINT = BIGINT
|
||||
IDENTITY =
|
||||
GENERATED = GENERATED BY DEFAULT AS IDENTITY
|
||||
# for generating drop statements...
|
||||
SEQUENCE = SEQUENCE
|
||||
2
samples/src/main/sql/derby.vpp
Normal file
2
samples/src/main/sql/derby.vpp
Normal file
@@ -0,0 +1,2 @@
|
||||
#macro (sequence $name)CREATE SEQUENCE ${name};
|
||||
#end
|
||||
8
samples/src/main/sql/destroy.sql.vpp
Normal file
8
samples/src/main/sql/destroy.sql.vpp
Normal file
@@ -0,0 +1,8 @@
|
||||
-- Autogenerated: do not edit this file
|
||||
DROP TABLE TRADE $!{IFEXISTS};
|
||||
DROP ${SEQUENCE} TRADE_SEQ $!{IFEXISTS};
|
||||
DROP TABLE CUSTOMER $!{IFEXISTS};
|
||||
DROP ${SEQUENCE} CUSTOMER_SEQ $!{IFEXISTS};
|
||||
DROP TABLE PLAYERS $!{IFEXISTS};
|
||||
DROP TABLE GAMES $!{IFEXISTS};
|
||||
DROP TABLE PLAYER_SUMMARY $!{IFEXISTS};
|
||||
7
samples/src/main/sql/hsqldb.properties
Normal file
7
samples/src/main/sql/hsqldb.properties
Normal file
@@ -0,0 +1,7 @@
|
||||
platform=hsqldb
|
||||
# SQL language oddities
|
||||
BIGINT = BIGINT
|
||||
IDENTITY = IDENTITY
|
||||
IFEXISTS = IF EXISTS
|
||||
# for generating drop statements...
|
||||
SEQUENCE = TABLE
|
||||
4
samples/src/main/sql/hsqldb.vpp
Normal file
4
samples/src/main/sql/hsqldb.vpp
Normal file
@@ -0,0 +1,4 @@
|
||||
#macro (sequence $name)CREATE TABLE ${name} (
|
||||
ID BIGINT IDENTITY
|
||||
);
|
||||
#end
|
||||
66
samples/src/main/sql/init.sql.vpp
Normal file
66
samples/src/main/sql/init.sql.vpp
Normal file
@@ -0,0 +1,66 @@
|
||||
-- Autogenerated: do not edit this file
|
||||
CREATE TABLE TRADE (
|
||||
ID ${BIGINT} $!{IDENTITY} PRIMARY KEY $!{GENERATED},
|
||||
VERSION ${BIGINT},
|
||||
ISIN VARCHAR(45) NOT NULL,
|
||||
QUANTITY ${BIGINT},
|
||||
PRICE FLOAT,
|
||||
CUSTOMER VARCHAR(45)
|
||||
);
|
||||
|
||||
#sequence( "TRADE_SEQ" )
|
||||
|
||||
CREATE TABLE CUSTOMER (
|
||||
ID ${BIGINT} $!{IDENTITY} PRIMARY KEY $!{GENERATED},
|
||||
VERSION ${BIGINT},
|
||||
NAME VARCHAR(45),
|
||||
CREDIT FLOAT
|
||||
);
|
||||
|
||||
#sequence( "CUSTOMER_SEQ" )
|
||||
|
||||
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,
|
||||
POSITION varchar(10),
|
||||
YEAR_OF_BIRTH ${BIGINT} not null,
|
||||
YEAR_DRAFTED ${BIGINT} not null);
|
||||
|
||||
CREATE TABLE GAMES (
|
||||
PLAYER_ID char(8) not null PRIMARY KEY,
|
||||
YEAR ${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 PRIMARY KEY,
|
||||
YEAR ${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 );
|
||||
7
samples/src/main/sql/oracle10g.properties
Normal file
7
samples/src/main/sql/oracle10g.properties
Normal file
@@ -0,0 +1,7 @@
|
||||
platform=oracle10g
|
||||
# SQL language oddities
|
||||
BIGINT = NUMBER(38)
|
||||
IDENTITY =
|
||||
GENERATED =
|
||||
# for generating drop statements...
|
||||
SEQUENCE = SEQUENCE
|
||||
2
samples/src/main/sql/oracle10g.vpp
Normal file
2
samples/src/main/sql/oracle10g.vpp
Normal file
@@ -0,0 +1,2 @@
|
||||
#macro (sequence $name)CREATE SEQUENCE ${name};
|
||||
#end
|
||||
7
samples/src/main/sql/postgresql.properties
Normal file
7
samples/src/main/sql/postgresql.properties
Normal file
@@ -0,0 +1,7 @@
|
||||
platform=postgresql
|
||||
# SQL language oddities
|
||||
BIGINT = BIGINT
|
||||
IDENTITY =
|
||||
GENERATED =
|
||||
# for generating drop statements...
|
||||
SEQUENCE = SEQUENCE
|
||||
2
samples/src/main/sql/postgresql.vpp
Normal file
2
samples/src/main/sql/postgresql.vpp
Normal file
@@ -0,0 +1,2 @@
|
||||
#macro (sequence $name)CREATE SEQUENCE ${name};
|
||||
#end
|
||||
@@ -3,7 +3,7 @@ package org.springframework.batch.sample;
|
||||
public class FootballJobFunctionalTests extends AbstractValidatingBatchLauncherTests {
|
||||
|
||||
protected String[] getConfigLocations() {
|
||||
return new String[] {"jobs/footballJob.xml"};
|
||||
return new String[] {"jobs/footballJob.xml###"};
|
||||
}
|
||||
|
||||
protected void validatePostConditions() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user