[jbpm-commits] JBoss JBPM SVN: r3883 - in jbpm4/trunk/modules/db: src and 3 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Mon Feb 16 08:38:36 EST 2009
Author: heiko.braun at jboss.com
Date: 2009-02-16 08:38:36 -0500 (Mon, 16 Feb 2009)
New Revision: 3883
Added:
jbpm4/trunk/modules/db/src/test/
jbpm4/trunk/modules/db/src/test/resources/
jbpm4/trunk/modules/db/src/test/resources/antrun-create_drop.xml
Modified:
jbpm4/trunk/modules/db/jbpm4-db.iml
jbpm4/trunk/modules/db/pom.xml
jbpm4/trunk/modules/db/src/main/ant/build.schema.xml
Log:
Create and drop tables by build profile trigger (-Pdrop-create)
Modified: jbpm4/trunk/modules/db/jbpm4-db.iml
===================================================================
--- jbpm4/trunk/modules/db/jbpm4-db.iml 2009-02-16 13:28:25 UTC (rev 3882)
+++ jbpm4/trunk/modules/db/jbpm4-db.iml 2009-02-16 13:38:36 UTC (rev 3883)
@@ -8,10 +8,11 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="module" module-name="jbpm4-toplevel" />
- <orderEntry type="module" module-name="jbpm4-api" />
<orderEntry type="module" module-name="jbpm4-jpdl" />
<orderEntry type="module" module-name="jbpm4-pvm" />
+ <orderEntry type="module" module-name="jbpm4-test-base" />
+ <orderEntry type="module" module-name="jbpm4-task" />
+ <orderEntry type="module" module-name="jbpm4-toplevel" />
<orderEntry type="module-library" exported="">
<library name="M2 Dep: javax.transaction:jta:jar:1.0.1B:compile">
<CLASSES>
Modified: jbpm4/trunk/modules/db/pom.xml
===================================================================
--- jbpm4/trunk/modules/db/pom.xml 2009-02-16 13:28:25 UTC (rev 3882)
+++ jbpm4/trunk/modules/db/pom.xml 2009-02-16 13:38:36 UTC (rev 3883)
@@ -37,6 +37,30 @@
<artifactId>jbpm-test-base</artifactId>
<version>${version}</version>
</dependency>
+
+ <!-- Database Driver Versions -->
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>postgresql</groupId>
+ <artifactId>postgresql</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>net.sourceforge.jtds</groupId>
+ <artifactId>jtds</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.oracle</groupId>
+ <artifactId>ojdbc14</artifactId>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
<!-- Plugins -->
@@ -47,6 +71,13 @@
<filtering>true</filtering>
</resource>
</resources>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ <filtering>true</filtering>
+ </testResource>
+ </testResources>
+
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
@@ -101,10 +132,44 @@
<ant antfile="src/main/ant/build.schema.xml" target="create-schema" />
</tasks>
</configuration>
- </execution>
+ </execution>
</executions>
</plugin>
</plugins>
</build>
+ <profiles>
+ <profile>
+ <id>drop-create</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>create-drop-tables</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <property name="compile_classpath" refid="maven.compile.classpath"/>
+ <property name="runtime_classpath" refid="maven.runtime.classpath"/>
+ <property name="test_classpath" refid="maven.test.classpath"/>
+ <property name="plugin_classpath" refid="maven.plugin.classpath"/>
+
+ <property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
+ <ant antfile="target/test-classes/antrun-create_drop.xml" target="drop-tables" />
+ <ant antfile="target/test-classes/antrun-create_drop.xml" target="create-tables" />
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
</project>
\ No newline at end of file
Modified: jbpm4/trunk/modules/db/src/main/ant/build.schema.xml
===================================================================
--- jbpm4/trunk/modules/db/src/main/ant/build.schema.xml 2009-02-16 13:28:25 UTC (rev 3882)
+++ jbpm4/trunk/modules/db/src/main/ant/build.schema.xml 2009-02-16 13:38:36 UTC (rev 3883)
@@ -26,46 +26,50 @@
<mkdir dir="target/classes/drop"/>
<!-- HsqlDB -->
- <schemaexport output="target/classes/create/jbpm.hsqldb.create.sql"
- create="yes" drop="no"
- config="target/jpdl-config/hibernate.cfg.hsqldb.xml" text="yes" />
- <schemaexport output="target/classes/drop/jbpm.hsqldb.drop.sql"
- create="no" drop="yes"
- config="target/jpdl-config/hibernate.cfg.hsqldb.xml" text="yes" />
+ <create-ddl db="hsqldb"/>
<!-- MySQL -->
- <schemaexport output="target/classes/create/jbpm.mysql.create.sql"
- create="yes" drop="no"
- config="target/jpdl-config/hibernate.cfg.mysql.xml" text="yes" />
- <schemaexport output="target/classes/drop/jbpm.mysql.drop.sql"
- create="no" drop="yes"
- config="target/jpdl-config/hibernate.cfg.mysql.xml" text="yes" />
+ <create-ddl db="mysql"/>
<!-- Oracle -->
- <schemaexport output="target/classes/create/jbpm.oracle.create.sql"
- create="yes" drop="no"
- config="target/jpdl-config/hibernate.cfg.oracle.xml" text="yes" />
- <schemaexport output="target/classes/drop/jbpm.oracle.drop.sql"
- create="no" drop="yes"
- config="target/jpdl-config/hibernate.cfg.oracle.xml" text="yes" />
+ <create-ddl db="oracle"/>
<!-- PostgreSQL -->
- <schemaexport output="target/classes/create/jbpm.postgresql.create.sql"
- create="yes" drop="no"
- config="target/jpdl-config/hibernate.cfg.postgresql.xml" text="yes" />
- <schemaexport output="target/classes/drop/jbpm.postgresql.drop.sql"
- create="no" drop="yes"
- config="target/jpdl-config/hibernate.cfg.postgresql.xml" text="yes" />
+ <create-ddl db="postgresql"/>
-
<!-- Sybase -->
- <schemaexport output="target/classes/create/jbpm.sybase.create.sql"
- create="yes" drop="no"
- config="target/jpdl-config/hibernate.cfg.sybase.xml" text="yes" />
- <schemaexport output="target/classes/drop/jbpm.sybase.drop.sql"
- create="no" drop="yes"
- config="target/jpdl-config/hibernate.cfg.sybase.xml" text="yes" />
-
+ <create-ddl db="sybase"/>
+
</target>
+ <!--
+ ============================================
+ Macro defs, no need to change anything below
+ ============================================
+ -->
+
+ <macrodef name="create-ddl">
+ <attribute name="db"/>
+
+ <sequential>
+ <echo></echo>
+ <echo>=====================</echo>
+ <echo>Create DDL @{db}</echo>
+
+ <schemaexport output="target/classes/create/jbpm.@{db}.create.sql"
+ create="yes" drop="no"
+ config="target/jpdl-config/hibernate.cfg.@{db}.xml"
+ text="yes" delimiter=";"
+ quiet="yes"/>
+ <schemaexport output="target/classes/drop/jbpm.@{db}.drop.sql"
+ create="no" drop="yes"
+ config="target/jpdl-config/hibernate.cfg.@{db}.xml"
+ text="yes" delimiter=";"
+ quiet="yes"/>
+
+ <echo>Done.</echo>
+ <echo>=====================</echo>
+ </sequential>
+ </macrodef>
+
</project>
Added: jbpm4/trunk/modules/db/src/test/resources/antrun-create_drop.xml
===================================================================
--- jbpm4/trunk/modules/db/src/test/resources/antrun-create_drop.xml (rev 0)
+++ jbpm4/trunk/modules/db/src/test/resources/antrun-create_drop.xml 2009-02-16 13:38:36 UTC (rev 3883)
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ============================================================ -->
+<!-- JBoss, the OpenSource J2EE webOS -->
+<!-- Distributable under LGPL license. -->
+<!-- See terms of license at http://www.gnu.org. -->
+<!-- ============================================================ -->
+
+<!-- $Id: antrun-jbpmschema.xml 2999 2008-11-19 16:16:01Z thomas.diesler at jboss.com $ -->
+
+<project>
+
+ <!--
+ ==================================================================
+ Create / Drop jBPM Database tables
+ NOTE: Depends on the connection settings ${project.home}/profiles.xml
+ ==================================================================
+ -->
+
+ <target name="create-tables">
+
+ <!-- MySQL -->
+ <execute-sql
+ db="mysql" action="create"
+ driver="com.mysql.jdbc.Driver"
+ url="${jdbc.mysql.url}"
+ user="${jdbc.mysql.username}"
+ pass="${jdbc.mysql.password}"/>
+
+ </target>
+
+
+ <target name="drop-tables">
+
+ <!-- MySQL -->
+ <execute-sql
+ db="mysql" action="drop"
+ driver="com.mysql.jdbc.Driver"
+ url="${jdbc.mysql.url}"
+ user="${jdbc.mysql.username}"
+ pass="${jdbc.mysql.password}"/>
+
+ </target>
+
+
+ <!--
+ ============================================
+ Macro defs, no need to change anything below
+ ============================================
+ -->
+
+ <macrodef name="execute-sql">
+ <attribute name="db"/>
+ <attribute name="action"/>
+ <attribute name="driver"/>
+ <attribute name="url"/>
+ <attribute name="user"/>
+ <attribute name="pass"/>
+
+ <sequential>
+ <echo>=====================</echo>
+ <echo>@{action} tables @{db}</echo>
+ <echo>URL: @{url}</echo>
+ <echo>=====================</echo>
+
+ <sql
+ driver="@{driver}"
+ url="@{url}"
+ userid="@{user}"
+ password="@{pass}"
+ onerror="abort">
+ <transaction
+ src="${project.build.directory}/classes/@{action}/jbpm.@{db}.@{action}.sql"/>
+ <classpath>
+ <pathelement path="${test_classpath}"/>
+ </classpath>
+ </sql>
+ </sequential>
+ </macrodef>
+
+</project>
\ No newline at end of file
More information about the jbpm-commits
mailing list