Author: vhalbert(a)redhat.com
Date: 2009-11-23 17:55:35 -0500 (Mon, 23 Nov 2009)
New Revision: 1585
Modified:
trunk/test-integration/db/pom.xml
trunk/test-integration/db/src/main/resources/ddl/manage_schemas.xml
Log:
Teiid 773 - added environment variable to enable specifying a different datasources
location to use
Modified: trunk/test-integration/db/pom.xml
===================================================================
--- trunk/test-integration/db/pom.xml 2009-11-23 21:56:34 UTC (rev 1584)
+++ trunk/test-integration/db/pom.xml 2009-11-23 22:55:35 UTC (rev 1585)
@@ -275,6 +275,8 @@
<property>
<name>usedatasources</name>
<value>${usedatasources}</value>
+ <name>datasourceloc</name>
+ <value>${datasourceloc}</value>
</property>
</systemProperties>
@@ -400,6 +402,7 @@
<tasks>
<property name="maven.runtime.classpath"
refid="maven.runtime.classpath" />
<property name="relative.resources.dir"
value="src/main/resources"></property>
+ <property name="datasourceloc"
value="${datasourceloc}"></property>
<ant antfile="src/main/resources/ddl/manage_schemas.xml" />
</tasks>
</configuration>
@@ -457,6 +460,7 @@
<property name="single"
value="${datasource}"></property>
<property name="maven.runtime.classpath"
refid="maven.runtime.classpath" />
+ <property name="datasourceloc"
value="${datasourceloc}"></property>
<property name="relative.resources.dir"
value="src/main/resources"></property>
<ant antfile="src/main/resources/ddl/manage_schemas.xml" />
Modified: trunk/test-integration/db/src/main/resources/ddl/manage_schemas.xml
===================================================================
--- trunk/test-integration/db/src/main/resources/ddl/manage_schemas.xml 2009-11-23
21:56:34 UTC (rev 1584)
+++ trunk/test-integration/db/src/main/resources/ddl/manage_schemas.xml 2009-11-23
22:55:35 UTC (rev 1585)
@@ -23,15 +23,36 @@
<isset property="single"/>
</not>
</condition>
+
+ <available file="${datasourceloc}"
property="external.datasource.dir"/>
</target>
+
- <target name="init">
+ <target name="init"
+ depends="check.external.ds.dir, set.local.ds.dir">
+
<mkdir dir="${target.dir}"/>
+
</target>
+
+
+ <target name="check.external.ds.dir"
+ if="external.datasource.dir">
+ <property name="ds.loc"
value="${datasourceloc}"></property>
+
+ </target>
+
+ <target name="set.local.ds.dir"
+ unless="external.datasource.dir">
+
+ <property name="ds.loc"
value="${resources.dir}/datasources/"></property>
+
+ </target>
+
<target name="manage.all.schemas" if="all">
- <echo>Creating all schemas from datasource dir ${resources.dir}</echo>
+ <echo>Creating all schemas from datasource dir ${ds.loc}</echo>
<!--
This will process each directory located under the refid location.
Its expects the following:
@@ -39,7 +60,7 @@
- connection.properties file must exist in the directory to be used
-->
<subant genericantfile="${resources.dir}/ddl/run_ddl.xml"
inheritall="true" >
- <dirset dir="${resources.dir}/datasources/" />
+ <dirset dir="${ds.loc}" />
<property name="sql.ddl.dir"
value="${resources.dir}/ddl"/>
<property name="lib.dir" value="${basedir}/lib"/>
@@ -50,14 +71,14 @@
<target name="manage.single.schemas" if="single">
- <echo>Creating single schema ${single}</echo>
+ <echo>Creating single schema ${ds.loc}/${single}</echo>
- <available file="${resources.dir}/datasources/${single}"
property="dir.exist"/>
- <fail unless="dir.exist" message="The datasource single was not found
at ${resources.dir}/datasources/${single}" />
+ <available file="${ds.loc}/${single}" property="dir.exist"/>
+ <fail unless="dir.exist" message="The datasource single was not found
at ${ds.loc}/${single}" />
<ant inheritAll="true"
antfile="${resources.dir}/ddl/run_ddl.xml">
- <property name="basedir"
value="${resources.dir}/datasources/${single}"/>
+ <property name="basedir" value="${ds.loc}/${single}"/>
<property name="sql.ddl.dir" value="${resources.dir}/ddl"/>
<property name="lib.dir" value="${basedir}/lib"/>