Author: rareddy
Date: 2009-12-01 16:17:40 -0500 (Tue, 01 Dec 2009)
New Revision: 1614
Added:
branches/JCA/test-integration/db/
branches/JCA/test-integration/db/howto
branches/JCA/test-integration/db/lib/
branches/JCA/test-integration/db/lib/readme.txt
branches/JCA/test-integration/db/pom.xml
branches/JCA/test-integration/db/src/
branches/JCA/test-integration/db/src/main/
branches/JCA/test-integration/db/src/main/java/
branches/JCA/test-integration/db/src/main/java/org/
branches/JCA/test-integration/db/src/main/java/org/teiid/
branches/JCA/test-integration/db/src/main/java/org/teiid/test/
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/ConfigPropertyLoader.java
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/ConfigPropertyNames.java
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/TransactionContainer.java
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/TransactionQueryTestCase.java
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/connection/
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategy.java
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategyFactory.java
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/connection/DataSourceConnection.java
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/connection/DriverConnection.java
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/connection/JEEConnection.java
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/datasource/
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSource.java
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSourceFactory.java
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSourceMgr.java
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataStore.java
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/exception/
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/exception/QueryTestFailedException.java
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/exception/TransactionRuntimeException.java
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/query/
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/query/AbstractQueryTransactionTest.java
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/query/QueryExecution.java
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/transaction/
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/transaction/JNDITransaction.java
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/transaction/LocalTransaction.java
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/transaction/OffWrapTransaction.java
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/transaction/OnWrapTransaction.java
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/transaction/OptimisticWrapTransaction.java
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/transaction/PessimisticWrapTransaction.java
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/transaction/StandaloneGlobalTransaction.java
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/transaction/XATransaction.java
branches/JCA/test-integration/db/src/main/java/org/teiid/test/util/
branches/JCA/test-integration/db/src/main/java/org/teiid/test/util/PropUtils.java
branches/JCA/test-integration/db/src/main/java/org/teiid/test/util/StringUtil.java
branches/JCA/test-integration/db/src/main/resources/
branches/JCA/test-integration/db/src/main/resources/configuration.xml
branches/JCA/test-integration/db/src/main/resources/datasources/
branches/JCA/test-integration/db/src/main/resources/datasources/derby/
branches/JCA/test-integration/db/src/main/resources/datasources/derby/connection.properties
branches/JCA/test-integration/db/src/main/resources/datasources/derby/example_connection.properties
branches/JCA/test-integration/db/src/main/resources/datasources/mysql/
branches/JCA/test-integration/db/src/main/resources/datasources/mysql/connection.properties
branches/JCA/test-integration/db/src/main/resources/datasources/mysql/example_connection.properties
branches/JCA/test-integration/db/src/main/resources/datasources/oracle/
branches/JCA/test-integration/db/src/main/resources/datasources/oracle/example_connection.properties
branches/JCA/test-integration/db/src/main/resources/datasources/postgres/
branches/JCA/test-integration/db/src/main/resources/datasources/postgres/example_connection.properties
branches/JCA/test-integration/db/src/main/resources/datasources/readme.txt
branches/JCA/test-integration/db/src/main/resources/datasources/sqlserver/
branches/JCA/test-integration/db/src/main/resources/datasources/sqlserver/example_connection.properties
branches/JCA/test-integration/db/src/main/resources/datasources/sybase/
branches/JCA/test-integration/db/src/main/resources/datasources/sybase/example_connection.properties
branches/JCA/test-integration/db/src/main/resources/ddl/
branches/JCA/test-integration/db/src/main/resources/ddl/db2/
branches/JCA/test-integration/db/src/main/resources/ddl/db2/create_tables.sql
branches/JCA/test-integration/db/src/main/resources/ddl/db2/drop_tables.sql
branches/JCA/test-integration/db/src/main/resources/ddl/db2/exec_parms.properties
branches/JCA/test-integration/db/src/main/resources/ddl/derby/
branches/JCA/test-integration/db/src/main/resources/ddl/derby/create_tables.sql
branches/JCA/test-integration/db/src/main/resources/ddl/derby/drop_tables.sql
branches/JCA/test-integration/db/src/main/resources/ddl/derby/exec_parms.properties
branches/JCA/test-integration/db/src/main/resources/ddl/exec_parms.properties_template
branches/JCA/test-integration/db/src/main/resources/ddl/manage_schemas.xml
branches/JCA/test-integration/db/src/main/resources/ddl/mysql/
branches/JCA/test-integration/db/src/main/resources/ddl/mysql/create_tables.sql
branches/JCA/test-integration/db/src/main/resources/ddl/mysql/drop_tables.sql
branches/JCA/test-integration/db/src/main/resources/ddl/mysql/exec_parms.properties
branches/JCA/test-integration/db/src/main/resources/ddl/oracle/
branches/JCA/test-integration/db/src/main/resources/ddl/oracle/create_tables.sql
branches/JCA/test-integration/db/src/main/resources/ddl/oracle/drop_tables.sql
branches/JCA/test-integration/db/src/main/resources/ddl/oracle/exec_parms.properties
branches/JCA/test-integration/db/src/main/resources/ddl/postgres/
branches/JCA/test-integration/db/src/main/resources/ddl/postgres/create_tables.sql
branches/JCA/test-integration/db/src/main/resources/ddl/postgres/drop_tables.sql
branches/JCA/test-integration/db/src/main/resources/ddl/postgres/exec_parms.properties
branches/JCA/test-integration/db/src/main/resources/ddl/run_ddl.xml
branches/JCA/test-integration/db/src/main/resources/ddl/sqlserver/
branches/JCA/test-integration/db/src/main/resources/ddl/sqlserver/create_tables.sql
branches/JCA/test-integration/db/src/main/resources/ddl/sqlserver/drop_tables.sql
branches/JCA/test-integration/db/src/main/resources/ddl/sqlserver/exec_parms.properties
branches/JCA/test-integration/db/src/main/resources/default-config.properties
branches/JCA/test-integration/db/src/main/resources/transactions/
branches/JCA/test-integration/db/src/main/resources/transactions/Transaction.vdb
branches/JCA/test-integration/db/src/main/resources/transactions/transaction.properties
branches/JCA/test-integration/db/src/main/resources/xa-config.properties
branches/JCA/test-integration/db/src/test/
branches/JCA/test-integration/db/src/test/java/
branches/JCA/test-integration/db/src/test/java/org/
branches/JCA/test-integration/db/src/test/java/org/teiid/
branches/JCA/test-integration/db/src/test/java/org/teiid/test/
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/BaseAbstractTransactionTestCase.java
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/CommonTransactionTests.java
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionDriverFalseOffTest.java
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionDriverTrueOffTest.java
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionTests.java
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/OffWrapTransactionTests.java
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/OnWrapTransactionTests.java
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/OptimisticWrapTransactionTests.java
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/PessimisticWrapTransactionTests.java
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/StandaloneGlobalTransactionTests.java
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/XATransactionDatasourceFalseOffTest.java
branches/JCA/test-integration/db/src/test/java/org/teiid/transaction/
Log:
adding the db project as it exists from trunk
Added: branches/JCA/test-integration/db/howto
===================================================================
--- branches/JCA/test-integration/db/howto (rev 0)
+++ branches/JCA/test-integration/db/howto 2009-12-01 21:17:40 UTC (rev 1614)
@@ -0,0 +1,88 @@
+This is a howto of the following:
+
+1. Creating unit tests that use 1 or more datasources
+2. Setting up a datasource to be used during testing
+3. Executing the db integration tests
+
+
+==========================================
+Creating Unit Tests
+==========================================
+
+- Unit test should be created under db/src/test/java
+- See LocalTransactionDriverFalseOffTest.java as an example
+
+- Test should extend org.teiid.transaction.test.BaseAbstractTransactionTestCase
+
+
+- NOTE: the following is used in a post test phase of validating the data in the
datasource
+- when calling: this.getSource("modelname") --- the "modelname"
represents the model for which
+ you want the connection for
+
+
+ By default, the datasource assigned to a model will be (somewhat) random. There is not
coding to
+ specifically control this assignment, as long as the -Dusedatasources option is not
used.
+
+ If the -Dusedatasources option is used, then there is an implied model-to-datasource
assignment.
+ To understand how this assignment will be made, find the config properties file being
+ loaded for this test (default is the default-config.properties) and look for
+ the model-to-order mapping(s)
+
+ The default Transaction.vdb has 2 models: pm1 and pm2
+
+ example: pm1:1
+ pm2:2
+
+ Therefore, the model-to-order mapping will map to the relative order specified in the
usedatasources property.
+
+ example: -Dusedatasources=oracle,postgres
+
+ This will result in model pm1 --> oracle
+ pm2 --> postgres
+
+ To EXCLUDE a test from using a specific database type, call
addProperty(ConfigPropertyNames.EXCLUDE_DATASBASE_TYPES_PROP, "postgres");
+ during setup()
+
+ NOTE: The EXCLUDE option excludes based on db.type, where "usedatasources"
specifies the actual datasource (not by type)
+
+
+==========================================
+Setting up a Datasource to be used during Testing
+==========================================
+
+1. DEFINE DATASOURCE:
+ To define a datasource, see the readme.txt in src/main/resources/datasources regarding
defining a datasource
+
+2. CREATE TABLES
+ To create the tables on the defined datasource, run the maven profile to execute the
process to create the required tables:
+ a. to setup all sources at one time, run:
+ mvn pre-integration-test -P setupdatasources -Dmaven.test.skip=true
+ b. to setup a specific source,
+ run: mvn pre-integration-test -Ddatasource=<datasourcedir> -Psingledatasource
-Dmaven.test.skip=true
+ where <datasourcedir> is the name of the directory for the datasource
+
+
+ Example:
+
+ mvn pre-integration-test -Ddatasource=oracle -Psingledatasource
-Dmaven.test.skip=true
+
+==========================================
+Executing the db integration tests
+==========================================
+
+The default profile in the pom.xml is set to compile and run the test. The following
are options for running tests:
+
+ a. Run with no regard to which specific datasource to use (only those with
connections.properties file are considered):
+ run: mvn install
+ b. To run the tests, but specify which datasource(s) to use:
+ run: mvn clean install -Dusedatasources=<comma seperated datasource names>
+ Example: mvn clean install -Dusedatasources=oracle,sqlserver
+
+
+ c. To run a single class of tests, run the "singleclass" profile
+ run: mvn clean install -Psingleclass -Dclassname=<classname> ====>
don't add .java to classname
+
+
+
+
+
\ No newline at end of file
Added: branches/JCA/test-integration/db/lib/readme.txt
===================================================================
--- branches/JCA/test-integration/db/lib/readme.txt (rev 0)
+++ branches/JCA/test-integration/db/lib/readme.txt 2009-12-01 21:17:40 UTC (rev 1614)
@@ -0,0 +1 @@
+# This directory is where 3rd party jdbc drivers should be placed.
\ No newline at end of file
Added: branches/JCA/test-integration/db/pom.xml
===================================================================
--- branches/JCA/test-integration/db/pom.xml (rev 0)
+++ branches/JCA/test-integration/db/pom.xml 2009-12-01 21:17:40 UTC (rev 1614)
@@ -0,0 +1,523 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+
+<!--
+ The database dependent tests are meant to be run on their own, not as part of the
continous or nightly
+ build for Teiid.
+-->
+
+
+<!--
+ <parent>
+ <artifactId>teiid-test-integration</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.0.0-SNAPSHOT</version>
+ </parent>
+
+ <packaging>pom</packaging>
+
+ -->
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>test-integration-db</artifactId>
+
+ <name>DB Dependent Integration Tests</name>
+ <groupId>org.jboss.teiid.teiid-test-integration</groupId>
+ <description>Integration tests that require external database dependencies
</description>
+
+ <version>7.0.0-SNAPSHOT</version>
+ <properties>
+ <
site.url>http://www.jboss.org/teiid</site.url>
+
+ <derby.version>10.2.1.6</derby.version>
+ <mysql.connector.version>5.1.5</mysql.connector.version>
+ <postgresql.version>8.3-603.jdbc3</postgresql.version>
+
+ <apache.ant.version>1.7.0</apache.ant.version>
+ </properties>
+ <scm>
+ <
developerConnection>scm:svn:https://svn.jboss.org/repos/teiid/trunk<...
+ </scm>
+ <licenses>
+ <license>
+ <name>GNU Lesser General Public License</name>
+ <
url>http://www.gnu.org/licenses/lgpl.html</url>
+ <distribution>repo</distribution>
+ <comments>A business-friendly OSS license</comments>
+ </license>
+ </licenses>
+
+ <repositories>
+ <repository>
+ <id>jboss</id>
+ <
url>http://repository.jboss.com/maven2/</url>
+ </repository>
+ <repository>
+ <id>jboss-snapshot</id>
+ <
url>http://snapshots.jboss.org/maven2</url>
+ </repository>
+ </repositories>
+
+
+ <dependencies>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-metadata</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-connector-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-txn-jbossts</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- internal dependencies that are only used by integration testing -->
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-runtime</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-runtime</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <artifactId>connector-loopback</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <artifactId>connector-text</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <artifactId>connector-jdbc</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-engine</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.code.guice</groupId>
+ <artifactId>guice</artifactId>
+ <version>1.0</version>
+ </dependency>
+
+<!--
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-internal</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <artifactId>connector-text</artifactId>
+ <type>test-jar</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <artifactId>connector-jdbc</artifactId>
+ <type>test-jar</type>
+ <version>${project.version}</version>
+ </dependency>
+
+
+
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-connector-sdk</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-metadata</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-connector-sdk</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+
+
+-->
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-client-jdbc</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-client</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ </dependency>
+
+<!--
+ </dependencies>
+
+ <dependencies>
+-->
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>${apache.ant.version}</version>
+ </dependency>
+
+ <!-- external dependencies -->
+ <dependency>
+ <groupId>postgresql</groupId>
+ <artifactId>postgresql</artifactId>
+ <version>${postgresql.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <version>${mysql.connector.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derbyclient</artifactId>
+ <version>${derby.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>${derby.version}</version>
+
+ </dependency>
+
+ <!-- DBUnit dependencies -->
+
+ <dependency>
+ <groupId>org.dbunit</groupId>
+ <artifactId>dbunit</artifactId>
+ <version>2.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>3.2.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.5.6</version>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.apache.poi</groupId>
+ <artifactId>poi</artifactId>
+ <version>3.2-FINAL</version>
+ </dependency>
+
+ <dependency>
+ <groupId>jdom</groupId>
+ <artifactId>jdom</artifactId>
+ <version>1.0</version>
+ </dependency>
+
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+
+ <build>
+ <plugins>
+ <!-- Specify the compiler options and settings -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ <showDeprecation>false</showDeprecation>
+ <showWarnings>false</showWarnings>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <additionalClasspathElements>
+
<additionalClasspathElement>${basedir}/lib/classes12_g.jar</additionalClasspathElement>
+
<additionalClasspathElement>${basedir}/lib/sqljdbc4.jar</additionalClasspathElement>
+
<additionalClasspathElement>${basedir}/lib/db2jcc4.jar</additionalClasspathElement>
+
<additionalClasspathElement>${basedir}/lib/jbedsp-datadirect.jar</additionalClasspathElement>
+
+ </additionalClasspathElements>
+ <systemProperties>
+ <property>
+ <name>usedatasources</name>
+ <value>${usedatasources}</value>
+ <name>datasourceloc</name>
+ <value>${datasourceloc}</value>
+ </property>
+ </systemProperties>
+
+
+ <forkMode>always</forkMode>
+<!--
+ <forkedProcessTimeoutInSeconds>600</forkedProcessTimeoutInSeconds>
+ -->
+ <includes>
+ <!-- <include>**/*TestCase.java</include> -->
+ <include>**/*Test.java</include>
+ <include>**/*Tests.java</include>
+ <include>**/Test*.java</include>
+ </includes>
+ <excludes>
+ <exclude>**/*Abstract*TestCase.java</exclude>
+ <exclude>**/*Abstract*Test.java</exclude>
+ <!-- hack to prevent anonymous inner classes in Tests from being run as tests
-->
+ <exclude>**/Test*$*.java</exclude>
+ </excludes>
+
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>singleclass</id>
+ <activation>
+ <property>
+ <name>classname</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <!-- Specify the compiler options and settings -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ <showDeprecation>false</showDeprecation>
+ <showWarnings>false</showWarnings>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <additionalClasspathElements>
+
<additionalClasspathElement>${basedir}/lib/classes12_g.jar</additionalClasspathElement>
+
<additionalClasspathElement>${basedir}/lib/sqljdbc4.jar</additionalClasspathElement>
+
<additionalClasspathElement>${basedir}/lib/db2jcc4.jar</additionalClasspathElement>
+
<additionalClasspathElement>${basedir}/lib/jbedsp-datadirect.jar</additionalClasspathElement>
+ </additionalClasspathElements>
+ <systemProperties>
+ <property>
+ <name>usedatasources</name>
+ <value>${usedatasources}</value>
+ <name>datasourceloc</name>
+ <value>${datasourceloc}</value>
+ </property>
+ </systemProperties>
+
+
+ <forkMode>always</forkMode>
+<!--
+ <forkedProcessTimeoutInSeconds>600</forkedProcessTimeoutInSeconds>
+ -->
+ <includes>
+ <include>**/${classname}.java</include>
+ </includes>
+ <excludes>
+ <exclude>**/*Abstract*TestCase.java</exclude>
+ <exclude>**/*Abstract*Test.java</exclude>
+ <!-- hack to prevent anonymous inner classes in Tests from being run as tests
-->
+ <exclude>**/Test*$*.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+ </profile>
+
+
+ <profile>
+ <id>setupdatasources</id>
+ <build>
+ <plugins>
+
+ <!-- Specify the compiler options and settings -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ <showDeprecation>false</showDeprecation>
+ <showWarnings>false</showWarnings>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>${apache.ant.version}</version>
+ </dependency>
+ </dependencies>
+ <configuration>
+ </configuration>
+ <executions>
+ <execution>
+ <id>setupalldatasources</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <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>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>singledatasource</id>
+ <activation>
+ <property>
+ <name>datasource</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <!-- Specify the compiler options and settings -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ <showDeprecation>false</showDeprecation>
+ <showWarnings>false</showWarnings>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>${apache.ant.version}</version>
+ </dependency>
+ </dependencies>
+ <configuration>
+
+ </configuration>
+ <executions>
+ <execution>
+ <id>setupsingledatasource</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+
+ <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" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+
+ </plugins>
+ </build>
+ </profile>
+
+ </profiles>
+
+
+</project>
\ No newline at end of file
Added:
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/ConfigPropertyLoader.java
===================================================================
---
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/ConfigPropertyLoader.java
(rev 0)
+++
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/ConfigPropertyLoader.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,173 @@
+package org.teiid.test.framework;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.teiid.test.framework.datasource.DataSourceFactory;
+import org.teiid.test.framework.exception.TransactionRuntimeException;
+import org.teiid.test.util.PropUtils;
+
+import com.metamatrix.common.util.PropertiesUtils;
+
+
+/**
+ * The ConfigProperteryLoader will load the configuration properties to be used by a
test.
+ * These properties only live for the duration of one test.
+ *
+ * NOTE: System properties set by the VM will be considered long living. This is so the
+ * -Dusedatasources ( {@link ConfigPropertyNames#USE_DATASOURCES_PROP} ) option can be
maintained for the duration of a set of tests.
+ *
+ *
+ * @author vanhalbert
+ *
+ */
+public class ConfigPropertyLoader {
+
+ /**
+ * The default config file to use when #CONFIG_FILE system property isn't
+ * set
+ */
+ public static final String DEFAULT_CONFIG_FILE_NAME =
"default-config.properties";
+
+ private static ConfigPropertyLoader _instance = null;
+ private static String LAST_CONFIG_FILE = null;
+
+ /**
+ * Contains any overrides specified for the test
+ */
+ private Properties overrides = new Properties();
+
+ /**
+ * Contains the properties loaded from the config file
+ */
+ private Properties props = null;
+
+ private Map<String, String>modelAssignedDatabaseType = new HashMap<String,
String>(5);
+
+ private DataSourceFactory dsfactory = null;
+
+ private ConfigPropertyLoader() {
+ }
+
+ public static synchronized ConfigPropertyLoader getInstance() {
+ boolean diff = differentConfigProp();
+
+
+ if (_instance != null && !diff) {
+ return _instance;
+ }
+
+ if (_instance != null) {
+ cleanup();
+ }
+
+ _instance = new ConfigPropertyLoader();
+ try {
+ _instance.initialize();
+ } catch (TransactionRuntimeException e) {
+ throw e;
+ }
+
+ return _instance;
+ }
+
+ /**
+ * because a config file could be different for the subsequent test, check
+ * to see if the file is different.
+ * @return
+ */
+ private static boolean differentConfigProp( ) {
+ String filename = System.getProperty(ConfigPropertyNames.CONFIG_FILE);
+ if (filename == null) {
+ filename = DEFAULT_CONFIG_FILE_NAME;
+ }
+
+ if (LAST_CONFIG_FILE == null || ! LAST_CONFIG_FILE.equalsIgnoreCase(filename)) {
+ LAST_CONFIG_FILE = filename;
+ return true;
+ }
+ return false;
+
+ }
+
+ public static synchronized void cleanup() {
+ _instance.overrides.clear();
+ _instance.modelAssignedDatabaseType.clear();
+ _instance.props.clear();
+ if (_instance.dsfactory != null) {
+ _instance.dsfactory.cleanup();
+ }
+ _instance = null;
+ LAST_CONFIG_FILE=null;
+ }
+
+
+ private void initialize() {
+ loadProperties(LAST_CONFIG_FILE);
+ dsfactory = new DataSourceFactory(this);
+ }
+
+ public DataSourceFactory getDataSourceFactory() {
+ return this.dsfactory;
+ }
+
+
+ public String getProperty(String key) {
+ String rtn = null;
+ rtn = overrides.getProperty(key);
+ if (rtn == null) {
+ rtn = props.getProperty(key);
+
+ if (rtn == null) {
+ rtn = System.getProperty(key);
+ }
+ }
+ return rtn;
+ }
+
+ public void setProperty(String key, String value) {
+ overrides.setProperty(key, value);
+ }
+
+ public Properties getProperties() {
+
+ Properties p = new Properties();
+ p.putAll(System.getProperties());
+ p.putAll(props);
+ p.putAll(overrides);
+
+ return p;
+ }
+
+ public Map<String, String> getModelAssignedDatabaseTypes() {
+ return this.modelAssignedDatabaseType;
+ }
+
+ public void setModelAssignedToDatabaseType(String modelname, String dbtype) {
+ this.modelAssignedDatabaseType.put(modelname, dbtype);
+ }
+
+ private void loadProperties(String filename) {
+
+ props = PropUtils.loadProperties("/" + filename, null);
+
+ }
+
+ public static void main(String[] args) {
+ System.setProperty("test", "value");
+
+ ConfigPropertyLoader _instance = ConfigPropertyLoader.getInstance();
+ Properties p = _instance.getProperties();
+ if (p == null || p.isEmpty()) {
+ throw new RuntimeException("Failed to load config properties file");
+
+ }
+ if (!p.getProperty("test").equalsIgnoreCase("value")) {
+ throw new RuntimeException("Failed to pickup system property");
+ }
+ System.out.println("Loaded Config Properties " + p.toString());
+
+ }
+
+}
Added:
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/ConfigPropertyNames.java
===================================================================
---
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/ConfigPropertyNames.java
(rev 0)
+++
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/ConfigPropertyNames.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,117 @@
+package org.teiid.test.framework;
+
+import org.teiid.test.framework.datasource.DataSource;
+import org.teiid.test.framework.datasource.DataSourceMgr;
+
+import com.metamatrix.jdbc.api.ExecutionProperties;
+
+/**
+ * The following properties can be set in 2 ways:
+ * <li>set as a System property(..)</li>
+ * <li>specify it in the config properties file</li>
+ *
+ * @author vanhalbert
+ *
+ */
+public interface ConfigPropertyNames {
+
+ /**
+ * Specify this as a system property to set a specific configuration to use
+ * otherwise the {@link ConfigPropertyLoader#DEFAULT_CONFIG_FILE_NAME} will be loaded.
+ */
+ public static final String CONFIG_FILE="config";
+
+
+ /**
+ * For Driver/Datasource connection related properties, {@link ConnectionStrategy}.
+ */
+
+
+
+ /**
+ * The USE_DATASOURCES_PROP is a comma delimited property that can be used to limit the
+ * datasources that are in use for the tests. Use the directory name defined in the
ddl directory.
+ * This enables a developers to test a certain datasource without having to remove
+ * connection.properties files.
+ */
+ public static final String USE_DATASOURCES_PROP = "usedatasources";
+
+
+ /**
+ * The USE_DATASOURCE_TYPES_PROP is a comma delimited property that can be used to limit
the
+ * types of datasources to be used for the tests. The database type {@link
DataSource#DB_TYPE} corresponds to the
+ * defined types in the resources/ddl directory. By specifying this property, the test
will use on data sources
+ * of the specified types..
+ */
+ public static final String USE_DATASOURCE_TYPES_PROP = "usedatasourcetypes";
+
+
+
+ /**
+ * The EXCLUDE_DATASOURCES_PROP is a comma delimited property that can be used to
exclude
+ * certain database types.
+ * This is done so that whole sets of tests can be excluded when a datasource has been
defined
+ * for a specific database type.
+ */
+
+ public static final String EXCLUDE_DATASBASE_TYPES_PROP =
"excludedatasourcetypes";
+
+ /**
+ * The {@link #OVERRIDE_DATASOURCES_LOC}, when specified, will override the default
+ * defined for {@link DataSourceMgr#DEFAULT_DATASOURCES_LOC};
+ *
+ */
+ public static final String OVERRIDE_DATASOURCES_LOC = "datasourceloc";
+
+ /**
+ * Connection Type indicates the type of connection (strategy) to use when
+ * connecting to Teiid.
+ * Options are {@link CONNECTION_TYPES}
+ */
+ public static final String CONNECTION_TYPE = "connection-type";
//$NON-NLS-1$
+
+
+ /**
+ * {@see #CONNECTION_TYPE} regarding setting the specific connection type to use
+ * when connecting to Teiid
+ * @author vanhalbert
+ *
+ */
+ public interface CONNECTION_TYPES {
+
+ // used to create the jdb driver
+ public static final String DRIVER_CONNECTION = "driver"; //$NON-NLS-1$
+ // used to create a datasource
+ public static final String DATASOURCE_CONNECTION = "datasource";
//$NON-NLS-1$
+ // used for when embedded is running in an appserver
+ public static final String JNDI_CONNECTION = "jndi"; //$NON-NLS-1$
+
+
+ }
+
+ /**
+ * Connection Props are the {@link CONNECTION_STRATEGY} execution options
+ * @author vanhalbert
+ *
+ */
+ public interface CONNECTION_STRATEGY_PROPS {
+
+ public static final String TXN_AUTO_WRAP = ExecutionProperties.PROP_TXN_AUTO_WRAP;
+ public static final String AUTOCOMMIT = "autocommit"; //$NON-NLS-1$
+ public static final String FETCH_SIZE = ExecutionProperties.PROP_FETCH_SIZE;
+ public static final String EXEC_IN_BATCH = "execute.in.batch"; //$NON-NLS-1$
+ public static final String CONNECTOR_BATCH = "connector-batch";
//$NON-NLS-1$
+ public static final String PROCESS_BATCH = "process-batch"; //$NON-NLS-1$
+ public static final String JNDINAME_USERTXN = "usertxn-jndiname";
//$NON-NLS-1$
+
+ }
+
+ public interface TXN_AUTO_WRAP_OPTIONS {
+ public static final String AUTO_WRAP_OFF = "OFF"; //$NON-NLS-1$
+ public static final String AUTO_WRAP_ON = "ON"; //$NON-NLS-1$
+ public static final String AUTO_WRAP_PESSIMISTIC = "PESSIMISTIC";
//$NON-NLS-1$
+ public static final String AUTO_WRAP_OPTIMISTIC = "OPTIMISTIC";
//$NON-NLS-1$
+
+ }
+
+}
Added:
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/TransactionContainer.java
===================================================================
---
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/TransactionContainer.java
(rev 0)
+++
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/TransactionContainer.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2000-2007 MetaMatrix, Inc.
+ * All rights reserved.
+ */
+package org.teiid.test.framework;
+
+import java.util.Properties;
+
+import org.teiid.test.framework.connection.ConnectionStrategy;
+import org.teiid.test.framework.connection.ConnectionStrategyFactory;
+import org.teiid.test.framework.exception.QueryTestFailedException;
+import org.teiid.test.framework.exception.TransactionRuntimeException;
+
+import com.metamatrix.core.util.StringUtil;
+
+public abstract class TransactionContainer {
+
+ private boolean debug = false;
+
+
+ private String testClassName = null;
+
+ protected ConnectionStrategy connStrategy;
+ protected Properties props;
+
+ protected TransactionContainer() {
+ ConfigPropertyLoader config = ConfigPropertyLoader.getInstance();
+
+ try {
+ this.connStrategy = ConnectionStrategyFactory
+ .createConnectionStrategy(config);
+ } catch (QueryTestFailedException e) {
+ // TODO Auto-generated catch block
+ throw new TransactionRuntimeException(e);
+ }
+ this.props = new Properties();
+ this.props.putAll(this.connStrategy.getEnvironment());
+
+ }
+
+
+ public ConnectionStrategy getConnectionStrategy() {
+ return this.connStrategy;
+ }
+
+
+ public void setEnvironmentProperty(String key, String value) {
+ this.getConnectionStrategy().getEnvironment().setProperty(key, value);
+ }
+
+ protected void before(TransactionQueryTestCase test) {
+ }
+
+ protected void after(TransactionQueryTestCase test) {
+ }
+
+ public void runTransaction(TransactionQueryTestCase test) {
+
+ this.testClassName = StringUtil.getLastToken(test.getClass().getName(),
+ ".");
+
+ try {
+ detail("Start transaction test: " + test.getTestName());
+
+ try {
+ test.setConnectionStrategy(connStrategy);
+
+ test.setup();
+
+ } catch (Throwable e) {
+ if (!test.exceptionExpected()) {
+ e.printStackTrace();
+ }
+ throw new TransactionRuntimeException(e.getMessage());
+ }
+
+ runTest(test);
+
+ detail("Completed transaction test: " + test.getTestName());
+
+ } finally {
+ debug(" test.cleanup");
+
+ try {
+ test.cleanup();
+ } finally {
+
+ // cleanup all connections created for this test.
+ if (connStrategy != null) {
+ connStrategy.shutdown();
+ }
+ }
+ }
+
+ }
+
+ protected void runTest(TransactionQueryTestCase test) {
+ debug("Start runTest: " + test.getTestName());
+
+ try {
+
+ debug(" before(test)");
+
+ before(test);
+ debug(" test.before");
+
+ test.before();
+
+ debug(" test.testcase");
+
+ // run the test
+ test.testCase();
+
+ debug(" test.after");
+
+ test.after();
+ debug(" after(test)");
+
+ after(test);
+
+ debug("End runTest: " + test.getTestName());
+
+ } catch (Throwable e) {
+
+ if (!test.exceptionExpected()) {
+ e.printStackTrace();
+ debug("Error: " + e.getMessage());
+ throw new TransactionRuntimeException(e.getMessage());
+
+ }
+ }
+
+ if (test.exceptionExpected() && !test.exceptionOccurred()) {
+ throw new TransactionRuntimeException(
+ "Expected exception, but one did not occur for test: "
+ + this.getClass().getName() + "."
+ + test.getTestName());
+ }
+
+ }
+
+
+ protected void debug(String message) {
+ if (debug) {
+ System.out.println("[" + this.testClassName + "] " + message);
+ }
+
+ }
+
+ protected void detail(String message) {
+ System.out.println("[" + this.testClassName + "] " + message);
+ }
+
+ protected boolean done() {
+ return true;
+ }
+
+}
Added:
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/TransactionQueryTestCase.java
===================================================================
---
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/TransactionQueryTestCase.java
(rev 0)
+++
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/TransactionQueryTestCase.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,207 @@
+package org.teiid.test.framework;
+
+import java.sql.Connection;
+import java.util.Properties;
+
+import javax.sql.XAConnection;
+
+import org.teiid.test.framework.connection.ConnectionStrategy;
+import org.teiid.test.framework.exception.QueryTestFailedException;
+
+import com.metamatrix.jdbc.api.AbstractQueryTest;
+
+/**
+ * The TransactionQueryTest interface represents the transaction test lifecycle of
execution
+ * from which the @link TransactionContainer operates.
+ * <br><br>
+ * QueryTest lifecycle:</br>
+ *
+ * <br>
+ * There are 4 phases or groupings of methods:
+ * <li>Setup </li>
+ * <li>Test </li>
+ * <li>Validation</li>
+ * <li>Cleanup</li>
+ *
+ * <br>
+ * <p>
+ * <b>1. Setup phase is about setting the global environment for the
testing</b>
+ * <br>
+ *
+ * <li>{@link #setConnectionStrategy(ConnectionStrategy)} - called first to
provide
+ * the environment (i.e, type of connection, parameters, etc) that the test will
+ * be run under.
+ * <li>{@link #hasRequiredDataSources()} - called after the connection
+ * strategy is set so the determination can be made if this test has the
+ * required datasources defined and available in order to run the test. If not,
+ * then the test is bypassed.
+ * <li>{@link #setup()} - called to enable the test to
+ * perform any pretest (i.e., global) setup. Example would be data source setup.
+ * <li>{@link #setConnection(Connection)} - called to set the client driver (i.e.,
+ * Teiid) connection that will be used to execute queries against
+ * <li>{@link #setExecutionProperties(Properties)} - called at this time so that
the
+ * overriding class can obtain / initialize settings that will be assigned when
+ * <li>{@link AbstractQueryTest#assignExecutionProperties(Statement)} is called
+ * prior to sql execution. (Example: set fetch size, batch time, or timeout)
+ * </li>
+ * <br>
+ * <p>
+ * <b>2. Test phase are the methods for executing a test, including any
+ * before/after test logic to support the test</b>
+ * <br><br>
+ *
+ * <li>{@link #before()} called before the execution of the test so that the
+ * transaction boundary can be set and any other pretest conditions
+ * <li>{@link #testCase()} called to execute the specific test
+ * <li>{@link #after()} called after the test is executed, which will
commit/rollback the transaction
+ * and perform any other post conditions
+ * </li>
+ * <br>
+ * <p>
+ * <b>3. Validation phase is meant to enable data validation post transaction
+ * completion. This is especially helpful when performing XA transactions
+ * because the results are not completed and available until after the {@link #after()}
step
+ * is performed.</b>
+ * <br><br>
+ *
+ * {@link #validateTestCase()}
+ *
+ * <p>
+ * <b>4. Cleanup</b>
+ * <br><br>
+ *
+ * {@link #cleanup()} Called to allow the testcase to perform any cleanup after
execution.
+ *
+ * <br>
+ * ================
+ * <p>
+ * <b>Other Notes:</b>
+ * <br><br>
+ *
+ * The following methods were exposed from {@link AbstractQueryTest}:
+ *
+ * <li>{@link #exceptionExpected()} - when an exception is expected to occur, the
+ * underlying logic will treat the execution as if it succeeded. </li>
+ * <li>{@link #exceptionOccurred()} - this method indicates when an exception
+ * actually occurred outside of the normal expected results. </li>
+ * <li>{@link #getConnection()} and {@link #getXAConnection()} - these connection
+ * methods are exposed for {@link #before()} and {@link #after()} methods</li>
+ * <li>{@link #rollbackAllways()} - this is exposed for the {@link #after()}
method
+ * as to what behavior is expected after the execution of the test</li>
+ *
+ *
+ * <br>
+ * @author vanhalbert
+ *
+ */
+
+public interface TransactionQueryTestCase {
+
+ /**
+ * Returns the name of the test so that better tracing of what tests are
+ * running/completing.
+ *
+ * @return String is test name
+ */
+ String getTestName();
+
+ /**
+ * Called to set the current connection strategy being used.
+ *
+ * @param connStrategy
+ *
+ * @since
+ */
+ void setConnectionStrategy(ConnectionStrategy connStrategy) throws
QueryTestFailedException;
+
+ /**
+ * Called by the {@link TransactionContainer} prior to testcase processing
+ * so that the responsibility for performing an setup duties (ie..,
+ * datasource setup) can be done
+ *
+ *
+ * @since
+ */
+ void setup() throws QueryTestFailedException;
+
+ /**
+ * Called by the @link TransactionContainer to set the Teiid connection to
+ * be used in the test.
+ *
+ * @param conn
+ *
+ * @since
+ */
+ void setConnection(Connection conn);
+
+ /**
+ * Called to set the properties used to initialize prior to execution.
+ *
+ * @param props
+ *
+ * @since
+ */
+// void setExecutionProperties(Properties props);
+
+ /**
+ * Override <code>before</code> if there is behavior that needs to be
+ * performed prior to {@link #testCase()} being called.
+ *
+ *
+ * @since
+ */
+ void before();
+
+ /**
+ * Implement testCase(), it is the entry point to the execution of the test.
+ *
+ * @throws Exception
+ *
+ * @since
+ */
+ void testCase() throws Exception;
+
+ /**
+ * Override <code>after</code> if there is behavior that needs to be
+ * performed after {@link #testCase()} being called.
+ *
+ *
+ * @since
+ */
+ void after();
+
+ /**
+ * Indicates what should be done when a failure occurs in
+ * {@link #testCase()}
+ *
+ * @return
+ *
+ * @since
+ */
+ boolean rollbackAllways();
+
+ /**
+ * Called at the end of the test so that the testcase can clean itself up by
+ * releasing any resources, closing any open connections, etc.
+ *
+ *
+ * @since
+ */
+ void cleanup();
+
+ /**
+ * Returns the connection being used in the test.
+ *
+ * @return
+ *
+ * @since
+ */
+ Connection getConnection();
+
+ XAConnection getXAConnection();
+
+ boolean exceptionExpected();
+
+ boolean exceptionOccurred();
+
+}
Added:
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategy.java
===================================================================
---
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategy.java
(rev 0)
+++
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategy.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,287 @@
+/*
+ * Copyright (c) 2000-2007 MetaMatrix, Inc.
+ * All rights reserved.
+ */
+package org.teiid.test.framework.connection;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.sql.Connection;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Properties;
+
+import javax.sql.XAConnection;
+
+import org.teiid.adminapi.Admin;
+import org.teiid.adminapi.AdminOptions;
+import org.teiid.adminapi.Model;
+import org.teiid.adminapi.VDB;
+import org.teiid.test.framework.ConfigPropertyNames.CONNECTION_STRATEGY_PROPS;
+import org.teiid.test.framework.datasource.DataSource;
+import org.teiid.test.framework.datasource.DataSourceFactory;
+import org.teiid.test.framework.datasource.DataSourceMgr;
+import org.teiid.test.framework.exception.QueryTestFailedException;
+import org.teiid.test.framework.exception.TransactionRuntimeException;
+
+import com.metamatrix.common.util.PropertiesUtils;
+import com.metamatrix.jdbc.util.MMJDBCURL;
+
+
+public abstract class ConnectionStrategy {
+
+
+ private Properties env = null;
+ private DataSourceFactory dsFactory;
+
+
+ public ConnectionStrategy(Properties props, DataSourceFactory dsf) {
+ this.env = PropertiesUtils.clone(props);
+
+ this.dsFactory = dsf;
+ }
+
+ /*
+ * Lifecycle methods for managing the connection
+ */
+
+ /**
+ * Returns a connection
+ * @return Connection
+ */
+ public abstract Connection getConnection() throws QueryTestFailedException;
+
+ /**
+ * @since
+ */
+ public void shutdown() {
+
+ }
+
+ public Connection getAdminConnection() throws QueryTestFailedException{
+ return null;
+ }
+
+ private boolean autoCommit;
+ public boolean getAutocommit() {
+ return autoCommit;
+ }
+
+
+ public XAConnection getXAConnection() throws QueryTestFailedException {
+ return null;
+ }
+
+
+
+
+ public Properties getEnvironment() {
+ return env;
+ }
+
+
+ class CloseInterceptor implements InvocationHandler {
+
+ Connection conn;
+
+ CloseInterceptor(Connection conn) {
+ this.conn = conn;
+ }
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
{
+ if (method.getName().equals("close")) { //$NON-NLS-1$
+ return null;
+ }
+ try {
+ return method.invoke(this.conn, args);
+ } catch (InvocationTargetException e) {
+ throw e.getTargetException();
+ }
+ }
+ }
+
+
+ void configure() throws QueryTestFailedException {
+
+ String ac = this.env.getProperty(CONNECTION_STRATEGY_PROPS.AUTOCOMMIT,
"true");
+ this.autoCommit = Boolean.getBoolean(ac);
+
+ com.metamatrix.jdbc.api.Connection c =null;
+ try {
+
+ // the the driver strategy is going to be used to connection directly to the
connector binding
+ // source, then no administration can be done
+ java.sql.Connection conn = getConnection();
+ if ( conn instanceof com.metamatrix.jdbc.api.Connection) {
+ c = (com.metamatrix.jdbc.api.Connection) conn;
+ } else {
+ return;
+ }
+
+ Admin admin = (Admin)c.getAdminAPI();
+
+ setupVDBConnectorBindings(admin);
+
+
+ // admin.restart();
+
+ int sleep = 5;
+
+ System.out.println("Bouncing the system..(wait " + sleep + "
seconds)"); //$NON-NLS-1$
+ Thread.sleep(1000*sleep);
+ System.out.println("done."); //$NON-NLS-1$
+
+ } catch (Throwable e) {
+ e.printStackTrace();
+
+ throw new TransactionRuntimeException(e.getMessage());
+ } finally {
+ // need to close and flush the connection after restarting
+ // this.shutdown();
+
+ }
+ }
+
+ protected void setupVDBConnectorBindings(Admin api) throws QueryTestFailedException
{
+
+ try {
+
+ VDB vdb = null;
+ Collection<VDB> vdbs = api.getVDBs("*");
+ if (vdbs == null || vdbs.isEmpty()) {
+ throw new QueryTestFailedException(
+ "AdminApi.GetVDBS returned no vdbs available");
+ }
+
+ String urlString = this.env.getProperty(DriverConnection.DS_URL);
+ MMJDBCURL url = new MMJDBCURL(urlString);
+ System.out.println("Trying to match VDB : " + url.getVDBName());
+
+ for (Iterator iterator = vdbs.iterator(); iterator.hasNext();) {
+ VDB v = (VDB) iterator.next();
+ if (v.getName().equalsIgnoreCase(url.getVDBName())) {
+ vdb = v;
+ }
+
+ }
+ if (vdbs == null) {
+ throw new QueryTestFailedException(
+ "GetVDBS did not return a vdb that matched "
+ + url.getVDBName());
+ }
+
+ Iterator<Model> modelIt = vdb.getModels().iterator();
+ while (modelIt.hasNext()) {
+ Model m = modelIt.next();
+
+ if (!m.isPhysical())
+ continue;
+
+ // get the mapping, if defined
+ String mappedName = this.env.getProperty(m.getName());
+
+ String useName = m.getName();
+ if (mappedName != null) {
+ useName = mappedName;
+ }
+
+ org.teiid.test.framework.datasource.DataSource ds = this.dsFactory
+ .getDatasource(useName, m.getName());
+
+ if (ds != null) {
+
+ System.out
+ .println("Set up Connector Binding (model:mapping:type): " + m.getName()
+ ":" + useName + ":" + ds.getConnectorType()); //$NON-NLS-1$
+
+ AdminOptions ao = new AdminOptions(
+ AdminOptions.OnConflict.OVERWRITE);
+ ao.addOption(AdminOptions.BINDINGS_IGNORE_DECRYPT_ERROR);
+
+ api.addConnectorBinding(ds.getName(),
+ ds.getConnectorType(), ds.getProperties(), ao);
+
+ api.assignBindingToModel(ds.getName(), vdb.getName(), vdb
+ .getVDBVersion(), m.getName());
+
+ api.startConnectorBinding(ds.getName());
+ } else {
+ throw new QueryTestFailedException(
+ "Error: Unable to create binding to map to model : "
+ + m.getName() + ", the mapped name "
+ + useName
+ + " had no datasource properties defined");
+ }
+
+ }
+
+ } catch (QueryTestFailedException qt) {
+ throw qt;
+ } catch (Exception t) {
+ t.printStackTrace();
+ throw new QueryTestFailedException(t);
+ }
+
+
+ }
+
+ public synchronized Connection createDriverConnection(String identifier) throws
QueryTestFailedException {
+
+ DataSource ds = null;
+ if (identifier != null) {
+ ds = DataSourceMgr.getInstance().getDataSource(identifier);
+ }
+ if (ds == null) {
+ throw new TransactionRuntimeException(
+ "Program Error: DataSource is not mapped to Identifier " + identifier);
+ }
+
+ Connection conn = ds.getConnection();
+
+ if (conn != null) return conn;
+
+ ConnectionStrategy cs = null;
+ if (identifier == null) {
+ cs = new DriverConnection(ds.getProperties(), this.dsFactory);
+
+ } else {
+ cs = new DriverConnection(ds.getProperties(), this.dsFactory);
+ }
+
+ ds.setConnection(cs);
+
+ return ds.getConnection();
+
+
+ }
+
+
+ public synchronized XAConnection createDataSourceConnection(String identifier) throws
QueryTestFailedException {
+
+ DataSource ds = null;
+ if (identifier != null) {
+ ds = DataSourceMgr.getInstance().getDataSource(identifier);
+ }
+ if (ds == null) {
+ throw new TransactionRuntimeException(
+ "Program Error: DataSource is not mapped to Identifier " + identifier);
+ }
+
+ XAConnection conn = ds.getXAConnection();
+
+ if (conn != null) return conn;
+
+ ConnectionStrategy cs = null;
+ if (identifier == null) {
+ cs = new DriverConnection(ds.getProperties(), this.dsFactory);
+ } else {
+ cs = new DriverConnection(ds.getProperties(), this.dsFactory);
+ }
+
+ ds.setXAConnection(cs);
+
+ return ds.getXAConnection();
+
+
+ }
+
+}
Added:
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategyFactory.java
===================================================================
---
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategyFactory.java
(rev 0)
+++
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategyFactory.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2000-2007 MetaMatrix, Inc.
+ * All rights reserved.
+ */
+package org.teiid.test.framework.connection;
+
+import java.util.Properties;
+
+import org.teiid.test.framework.ConfigPropertyLoader;
+import org.teiid.test.framework.ConfigPropertyNames;
+import org.teiid.test.framework.datasource.DataSourceFactory;
+import org.teiid.test.framework.exception.QueryTestFailedException;
+import org.teiid.test.framework.exception.TransactionRuntimeException;
+
+/**
+ * The ConnectionStrategyFactory is responsible for creating a connection strategy that
is to be used to provide the type of
+ * connection.
+ * @author vanhalbert
+ *
+ */
+public class ConnectionStrategyFactory {
+
+
+ public static ConnectionStrategy createConnectionStrategy(ConfigPropertyLoader
configprops) throws QueryTestFailedException {
+ ConnectionStrategy strategy = null;
+ Properties props = configprops.getProperties();
+
+ String type = props.getProperty(ConfigPropertyNames.CONNECTION_TYPE,
ConfigPropertyNames.CONNECTION_TYPES.DRIVER_CONNECTION);
+ if (type == null) {
+ throw new RuntimeException("Property " +
ConfigPropertyNames.CONNECTION_TYPE + " was specified");
+ }
+
+ if
(type.equalsIgnoreCase(ConfigPropertyNames.CONNECTION_TYPES.DRIVER_CONNECTION)) {
+ // pass in null to create new strategy
+ strategy = new DriverConnection(props,
configprops.getDataSourceFactory());
+ System.out.println("Created Driver Strategy");
+ }
+ else if
(type.equalsIgnoreCase(ConfigPropertyNames.CONNECTION_TYPES.DATASOURCE_CONNECTION)) {
+ strategy = new DataSourceConnection(props,
configprops.getDataSourceFactory());
+ System.out.println("Created DataSource Strategy");
+ }
+ else if
(type.equalsIgnoreCase(ConfigPropertyNames.CONNECTION_TYPES.JNDI_CONNECTION)) {
+ strategy = new JEEConnection(props, configprops.getDataSourceFactory());
+ System.out.println("Created JEE Strategy");
+ }
+
+ if (strategy == null) {
+ new TransactionRuntimeException("Invalid property value for " +
ConfigPropertyNames.CONNECTION_TYPE + " is " + type );
+ }
+ // call configure here because this is creating the connection to Teiid
+ // direct connections to the datasource use the static call directly to create
strategy and don't need to configure
+ strategy.configure();
+ return strategy;
+
+ }
+
+ public static void main(String[] args) {
+ //NOTE: to run this test to validate the DataSourceMgr, do the following:
+ // --- need 3 datasources, Oracle, SqlServer and 1 other
+
+ ConfigPropertyLoader config = ConfigPropertyLoader.getInstance();
+
+ new DataSourceFactory(config);
+
+ }
+}
Added:
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/connection/DataSourceConnection.java
===================================================================
---
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/connection/DataSourceConnection.java
(rev 0)
+++
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/connection/DataSourceConnection.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2000-2007 MetaMatrix, Inc.
+ * All rights reserved.
+ */
+package org.teiid.test.framework.connection;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.Properties;
+
+import javax.sql.XAConnection;
+import javax.sql.XADataSource;
+
+import org.teiid.connector.jdbc.JDBCPropertyNames;
+import org.teiid.jdbc.TeiidDataSource;
+import org.teiid.test.framework.datasource.DataSourceFactory;
+import org.teiid.test.framework.exception.QueryTestFailedException;
+import org.teiid.test.framework.exception.TransactionRuntimeException;
+
+import com.metamatrix.jdbc.BaseDataSource;
+import com.metamatrix.jdbc.EmbeddedDataSource;
+
+public class DataSourceConnection extends ConnectionStrategy {
+
+ public static final String DS_USER = "user"; //$NON-NLS-1$
+
+ // need both user variables because Teiid uses 'user' and connectors use
+ // 'username'
+ public static final String DS_USERNAME = JDBCPropertyNames.USERNAME; //$NON-NLS-1$
+ public static final String DS_PASSWORD = JDBCPropertyNames.PASSWORD; //$NON-NLS-1$
+
+ // the driver is only used for making direct connections to the source, the
+ // connector type will provide the JDBCPropertyNames.CONNECTION_SOURCE
+ // driver class
+ public static final String DS_DRIVER = "driver"; //$NON-NLS-1$
+
+ public static final String DS_SERVERNAME = "ServerName"; //$NON-NLS-1$
+ public static final String DS_SERVERPORT = "PortNumber"; //$NON-NLS-1$
+ public static final String DS_JNDINAME = "ds-jndiname"; //$NON-NLS-1$
+ public static final String DS_DATABASENAME = "DatabaseName"; //$NON-NLS-1$
+ public static final String DS_APPLICATION_NAME = "application-name";
//$NON-NLS-1$
+
+ private String driver = null;
+ private String username = null;
+ private String pwd = null;
+ private String applName = null;
+ private String databaseName = null;
+ private String serverName = null;
+ private String portNumber = null;
+
+ private XAConnection xaConnection;
+
+ public DataSourceConnection(Properties props,
+ DataSourceFactory dsf) throws QueryTestFailedException {
+ super(props, dsf);
+ }
+
+ public void validate() {
+ databaseName = this.getEnvironment().getProperty(DS_DATABASENAME);
+ if (databaseName == null || databaseName.length() == 0) {
+ throw new TransactionRuntimeException("Property " + DS_DATABASENAME
+ + " was not specified");
+ }
+
+ serverName = this.getEnvironment().getProperty(DS_SERVERNAME);
+ if (serverName == null || serverName.length() == 0) {
+ throw new TransactionRuntimeException("Property " + DS_SERVERNAME
+ + " was not specified");
+ }
+
+ this.portNumber = this.getEnvironment().getProperty(DS_SERVERPORT);
+
+ this.applName = this.getEnvironment().getProperty(DS_APPLICATION_NAME);
+
+ this.driver = this.getEnvironment().getProperty(DS_DRIVER);
+ if (this.driver == null || this.driver.length() == 0) {
+ throw new TransactionRuntimeException("Property " + DS_DRIVER
+ + " was not specified");
+ }
+
+ this.username = this.getEnvironment().getProperty(DS_USER);
+ if (username == null) {
+ this.username = this.getEnvironment().getProperty(DS_USERNAME);
+ }
+ this.pwd = this.getEnvironment().getProperty(DS_PASSWORD);
+
+ }
+
+ public Connection getConnection() throws QueryTestFailedException {
+ try {
+ return getXAConnection().getConnection();
+ } catch (QueryTestFailedException qtf) {
+ throw qtf;
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new QueryTestFailedException(e);
+ }
+ }
+
+ public synchronized XAConnection getXAConnection()
+ throws QueryTestFailedException {
+ if (xaConnection == null) {
+ validate();
+ try {
+ xaConnection = createConnection();
+ } catch (Exception e) {
+ throw new QueryTestFailedException(e);
+ }
+ }
+ return xaConnection;
+ }
+
+ private XAConnection createConnection() throws SQLException,
+ InstantiationException, IllegalAccessException,
+ ClassNotFoundException {
+ System.out
+ .println("Creating Datasource Connection: \"" + this.serverName + "
- " + this.databaseName + "\""); //$NON-NLS-1$ //$NON-NLS-2$
+
+ BaseDataSource dataSource = (BaseDataSource) Class.forName(this.driver)
+ .newInstance();
+
+ dataSource.setDatabaseName(this.databaseName);
+ if (this.applName != null) {
+ dataSource.setApplicationName(this.applName);
+ }
+
+ if (dataSource instanceof EmbeddedDataSource) {
+ ((EmbeddedDataSource) dataSource).setBootstrapFile(this.serverName);
+ } else {
+ ((TeiidDataSource) dataSource).setServerName(this.serverName);
+ ((TeiidDataSource) dataSource).setPortNumber(Integer
+ .parseInt(this.portNumber));
+ }
+
+ if (this.username != null) {
+ dataSource.setUser(this.username);
+ dataSource.setPassword(this.pwd);
+ }
+
+ return ((XADataSource) dataSource).getXAConnection(this.username,
+ this.pwd);
+ }
+
+ public void shutdown() {
+ super.shutdown();
+ try {
+
+ if (this.xaConnection != null) {
+ this.xaConnection.close();
+ }
+ } catch (SQLException e) {
+ // ignore..
+ }
+
+ this.xaConnection = null;
+ }
+}
Added:
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/connection/DriverConnection.java
===================================================================
---
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/connection/DriverConnection.java
(rev 0)
+++
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/connection/DriverConnection.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2000-2007 MetaMatrix, Inc.
+ * All rights reserved.
+ */
+package org.teiid.test.framework.connection;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.util.Properties;
+
+import org.teiid.connector.jdbc.JDBCPropertyNames;
+import org.teiid.test.framework.datasource.DataSourceFactory;
+import org.teiid.test.framework.exception.QueryTestFailedException;
+import org.teiid.test.framework.exception.TransactionRuntimeException;
+
+/**
+ * The DriverConnection strategy that can get connections in standalone mode or
+ * embedded mode.
+ */
+public class DriverConnection extends ConnectionStrategy {
+
+ public static final String DS_USER = "user"; //$NON-NLS-1$
+
+ // need both user variables because Teiid uses 'user' and connectors use
+ // 'username'
+ public static final String DS_USERNAME = JDBCPropertyNames.USERNAME; //$NON-NLS-1$
+ public static final String DS_PASSWORD = JDBCPropertyNames.PASSWORD; //$NON-NLS-1$
+
+ // the driver is only used for making direct connections to the source, the
+ // connector type will provide the JDBCPropertyNames.CONNECTION_SOURCE
+ // driver class
+ public static final String DS_DRIVER = "driver"; //$NON-NLS-1$
+
+ public static final String DS_URL = JDBCPropertyNames.URL; //$NON-NLS-1$
+ public static final String DS_APPLICATION_NAME = "application-name";
//$NON-NLS-1$
+
+ private String url = null;
+ private String driver = null;
+ private String username = null;
+ private String pwd = null;
+
+ private Connection connection;
+
+
+ public DriverConnection(Properties props,
+ DataSourceFactory dsf) throws QueryTestFailedException {
+ super(props, dsf);
+ validate();
+ }
+
+ public void validate() {
+
+ String urlProp = this.getEnvironment().getProperty(DS_URL);
+ if (urlProp == null || urlProp.length() == 0) {
+ throw new TransactionRuntimeException("Property " + DS_URL
+ + " was not specified");
+ }
+ StringBuffer urlSB = new StringBuffer(urlProp);
+
+ String appl = this.getEnvironment().getProperty(DS_APPLICATION_NAME);
+ if (appl != null) {
+ urlSB.append(";");
+ urlSB.append("ApplicationName").append("=").append(appl);
+ }
+
+ url = urlSB.toString();
+
+ driver = this.getEnvironment().getProperty(DS_DRIVER);
+ if (driver == null || driver.length() == 0) {
+ throw new TransactionRuntimeException("Property " + DS_DRIVER
+ + " was not specified");
+ }
+
+ // need both user variables because Teiid uses 'user' and connectors use
+ // 'username'
+
+ this.username = this.getEnvironment().getProperty(DS_USER);
+ if (username == null) {
+ this.username = this.getEnvironment().getProperty(DS_USERNAME);
+ }
+ this.pwd = this.getEnvironment().getProperty(DS_PASSWORD);
+
+ try {
+ // Load jdbc driver
+ Class.forName(driver);
+ } catch (ClassNotFoundException e) {
+ throw new TransactionRuntimeException(e);
+ }
+
+ }
+
+ public synchronized Connection getConnection()
+ throws QueryTestFailedException {
+ if (this.connection != null) {
+ try {
+ if (!this.connection.isClosed()) {
+ return this.connection;
+ }
+ } catch (SQLException e) {
+
+ }
+
+ }
+
+ this.connection = getJDBCConnection(this.driver, this.url,
+ this.username, this.pwd);
+ return this.connection;
+ }
+
+ private Connection getJDBCConnection(String driver, String url,
+ String user, String passwd) throws QueryTestFailedException {
+
+ System.out.println("Creating Driver Connection: \"" + url +
"\""); //$NON-NLS-1$ //$NON-NLS-2$
+
+ Connection conn;
+ try {
+ // Create a connection
+ if (user != null && user.length() > 0) {
+ conn = DriverManager.getConnection(url, user, passwd);
+ } else {
+ conn = DriverManager.getConnection(url);
+ }
+
+ } catch (SQLException e) {
+ throw new QueryTestFailedException(e);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ throw new QueryTestFailedException(t.getMessage());
+ }
+ return conn;
+
+ }
+
+ public void shutdown() {
+ super.shutdown();
+ if (this.connection != null) {
+ try {
+ this.connection.close();
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+
+ this.connection = null;
+
+ }
+}
Added:
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/connection/JEEConnection.java
===================================================================
---
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/connection/JEEConnection.java
(rev 0)
+++
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/connection/JEEConnection.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2000-2007 MetaMatrix, Inc.
+ * All rights reserved.
+ */
+package org.teiid.test.framework.connection;
+
+import java.sql.Connection;
+import java.util.Properties;
+
+import javax.naming.InitialContext;
+import javax.sql.DataSource;
+
+import org.teiid.test.framework.datasource.DataSourceFactory;
+import org.teiid.test.framework.exception.QueryTestFailedException;
+import org.teiid.test.framework.exception.TransactionRuntimeException;
+
+/**
+ * JEE (JNDI) Connection Strategy, when the test is run inside an application
+ * server. Make sure all the jndi names are set correctly in the properties
+ * file.
+ */
+public class JEEConnection extends ConnectionStrategy {
+
+ public static final String DS_JNDINAME = "ds-jndiname"; //$NON-NLS-1$
+
+ private String jndi_name = null;
+
+
+ public JEEConnection(Properties props,
+ DataSourceFactory dsf) throws QueryTestFailedException {
+ super(props, dsf);
+ }
+
+ public Connection getConnection() throws QueryTestFailedException {
+ validate();
+ try {
+ InitialContext ctx = new InitialContext();
+ DataSource source = (DataSource) ctx.lookup(jndi_name);
+
+ if (source == null) {
+ String msg = "Unable to find jndi source " + jndi_name;//$NON-NLS-1$
+
+ QueryTestFailedException mme = new QueryTestFailedException(msg);//$NON-NLS-1$
+ throw mme;
+ }
+ Connection conn = source.getConnection();
+ return conn;
+ } catch (QueryTestFailedException qtfe) {
+ throw qtfe;
+ } catch (Exception e) {
+ throw new QueryTestFailedException(e);
+ }
+ }
+
+ public void shutdown() {
+ super.shutdown();
+ // no connection management here; app server takes care of these..
+ }
+
+ public void validate() {
+ // TODO Auto-generated method stub
+
+ jndi_name = getEnvironment().getProperty(DS_JNDINAME);
+ if (jndi_name == null || jndi_name.length() == 0) {
+ throw new TransactionRuntimeException("Property " + DS_JNDINAME
+ + " was not specified");
+ }
+ }
+}
Added:
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSource.java
===================================================================
---
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSource.java
(rev 0)
+++
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSource.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,90 @@
+package org.teiid.test.framework.datasource;
+
+import java.sql.Connection;
+import java.util.Properties;
+
+import javax.sql.XAConnection;
+
+import org.teiid.test.framework.connection.ConnectionStrategy;
+import org.teiid.test.framework.exception.QueryTestFailedException;
+
+/**
+ * DataSource represents a single database that was configured by a connection.properties
file.
+ * @author vanhalbert
+ *
+ */
+public class DataSource {
+ public static final String CONNECTOR_TYPE="db.connectortype";
+ public static final String DB_TYPE="db.type";
+
+ private Properties props;
+
+ private String name;
+ private String group;
+ private String dbtype;
+
+ // The connections are stored in the datasource and are reused
+ // for the duration of all tests so thats there's not
+ // disconnect/connect being performed over and over
+ private ConnectionStrategy conn;
+ private ConnectionStrategy xaconn;
+
+ public DataSource() {
+ this.name = "notassigned";
+ }
+ public DataSource(String name, String group, Properties properties) {
+ this.name = name;
+ this.group = group;
+ this.props = properties;
+ this.dbtype = this.props.getProperty(DB_TYPE);
+ }
+
+
+ public String getName() {
+ return name;
+ }
+
+ public String getGroup() {
+ return group;
+ }
+
+ public String getConnectorType() {
+ return props.getProperty(CONNECTOR_TYPE);
+ }
+
+ public String getProperty(String propName) {
+ return props.getProperty(propName);
+ }
+
+ public Properties getProperties() {
+ return this.props;
+ }
+
+ public String getDBType() {
+ return this.dbtype;
+ }
+
+
+ public Connection getConnection() throws QueryTestFailedException {
+ if (this.conn == null) return null;
+
+ return this.conn.getConnection();
+ }
+
+ public void setConnection(ConnectionStrategy c) {
+ this.conn = c;
+ }
+
+ public XAConnection getXAConnection() throws QueryTestFailedException {
+ if (this.xaconn == null) return null;
+
+ return this.xaconn.getXAConnection();
+ }
+
+ public void setXAConnection(ConnectionStrategy xaconn) {
+ this.xaconn = xaconn;
+ }
+
+
+
+}
Added:
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSourceFactory.java
===================================================================
---
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSourceFactory.java
(rev 0)
+++
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSourceFactory.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,569 @@
+package org.teiid.test.framework.datasource;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import org.teiid.test.framework.ConfigPropertyLoader;
+import org.teiid.test.framework.ConfigPropertyNames;
+import org.teiid.test.framework.exception.QueryTestFailedException;
+
+import com.metamatrix.common.util.PropertiesUtils;
+import com.metamatrix.core.util.StringUtil;
+
+
+/**
+ * The DataSourceFactory is responsible for managing the datasources used during a single
test.
+ * It ensures the same data source is used in both the connector binding and during
validation to ensure validation is performed
+ * against the same datasource the test was performed on.
+ *
+ * The following are the available options for controlling which datasources are used
during a test:
+ * <li>Control which datasources are used and to which model they are
assigned</li>
+ *
+ * <p>
+ * Use the {@link ConfigPropertyNames#USE_DATASOURCES_PROP} property to specify a comma
delimited ordered list to control which data sources to use.
+ *
+ * <br><br>
+ * This will enable integration testing to be setup to use well known combinations, to
ensure coverage and makes it easier to replicate issues.
+ *
+ * This indicates to use only the specified datasources for this test. This option can
be used in test cases where only
+ * specific sources are to be used and tested against.
+ *
+ * This ordered list will map to the model:order mapping in the config.properties file.
+ * <br><br>
+ * Example: in the config.properties file, the models in the test and their order can be
specified:
+ * <li> pm1=1 </li>
+ * <li> pm2=2 </li>
+ * <br>
+ *
+ * Then set property: ConfigPropertyNames.USE_DATASOURCES_PROP=oracle,sqlserver
+ *
+ * This will use oracle and sqlserver datasources in the test, and when a datasource is
requested for model "pm1", the oracle datasource will be returned. And when a
data source
+ * for "pm2" is requested, the data source mapped to 2nd ordered datasource of
sqlserver will be returned.
+ *
+ * </p>
+ * <li>Control which datasources of a specific database type to exclude</li>
+ * <p>
+ *
+ * Use the {@link ConfigPropertyNames#EXCLUDE_DATASBASE_TYPES_PROP} property to specify a
comma delimited list of {@link DataBaseTypes} to exclude.
+ * <br><br>
+ * This will remove all datasources of a specific database type from the list of
available datasources. This option will be applied after
+ * {@link ConfigPropertyNames#USE_DATASOURCES_PROP} option. This is done because there
are some test that will not work with certain database
+ * types, and therefore, if the required datasources are not met, the test will be
bypassed for execution.
+ *</p>
+ * <li>Control for a specfic model, which database type of datasource to be
assigned</li>
+ * <p>
+ * This option gives the developer even more fine grain control of how datasources are
assigned. There are cases where a specific model must be assigned
+ * to a datasource of a specific database type.
+ *
+ * To use this option,
+ *
+ * </p>
+ * @author vanhalbert
+ *
+ */
+public class DataSourceFactory {
+
+ /**
+ * These types match the "ddl" directories for supported database types
+ * and it also found in the datasources connection.properties defined by the DB_TYPE
property
+ * These are also the values used to specify the required database types.
+ *
+ */
+ public static interface DataBaseTypes{
+ public static String MYSQL = "mysql";
+ public static String ORACLE = "oracle";
+ public static String POSTRES = "postgres";
+ public static String SQLSERVER = "sqlserver";
+ public static String DB2 = "db2";
+ public static String SYBASE = "sybase";
+ public static String DERBY = "derby";
+ public static String ANY = "any";
+
+ }
+
+ // the DO_NO_USE_DEFAULT will be passed in when the test are run from maven and no
property is passed in for UseDataSources
+ private static final String DO_NOT_USE_DEFAULT="${usedatasources}";
+
+ private DataSourceMgr dsmgr = DataSourceMgr.getInstance();
+
+// private ConfigPropertyLoader configprops;
+
+ private Properties configprops;
+
+ // contains the names of the datasources when the -Dusedatasources option is used
+ private Map<String, String> useDS = null;
+
+ // contains all the datasources available to be used
+ private Map<String, DataSource> availDS = null;
+
+
+ // contains any dbtype preconditions on a model, which requires a model to be assigned a
certain database type
+ private Map<String, String> requiredDataBaseTypes = null; // key=modelname
value=dbtype
+
+ // this set is use to track datasources that have already been assigned
+ private Set<String> assignedDataSources = new HashSet<String>();
+
+ private int lastassigned = 0;
+
+ // indicates if the datasource requirements have been, it will be false in the case
+ // a specific dbtype is required and that type was not one of the available types
defined
+ private boolean metDBRequiredTypes = true;
+
+ // indicates that there are required dbtypes to consider
+ private boolean hasRequiredDBTypes = false;
+
+
+ public DataSourceFactory(ConfigPropertyLoader config) {
+ this.configprops = PropertiesUtils.clone(config.getProperties(), null, true);
+ this.requiredDataBaseTypes = config.getModelAssignedDatabaseTypes();
+ config();
+ }
+
+ public Properties getConfigProperties() {
+ return this.configprops;
+ }
+
+ /**
+ * config is called at the start / setup of the {@link
+ * TransactionContainer#} test. This is to ensure any exclusions /
+ * inclusions are considered for the next executed set of test.
+ *
+ *
+ * 1st, check for the usedatasource property, if exist, then only add those specific
datasources
+ * to the useDataSources, otherwise add all available.
+ * 2nd, if the exclude option is used, then remove any excluded datasources from the
useDataSources.
+ *
+ * @since
+ */
+ private void config() {
+ System.out.println("Configure Datasource Factory ");
+
+ Map<String, DataSource> availDatasources = dsmgr.getDataSources();
+
+ availDS = new HashMap<String, DataSource>(availDatasources.size());
+
+ String usedstypeprop = configprops
+ .getProperty(ConfigPropertyNames.USE_DATASOURCE_TYPES_PROP);
+
+ Set<String> useDBTypes = null;
+
+ if (usedstypeprop != null && usedstypeprop.length() > 0) {
+ List<String> eprops = StringUtil.split(usedstypeprop, ",");
+ useDBTypes = new HashSet<String>(eprops.size());
+ useDBTypes.addAll(eprops);
+ System.out.println("EXCLUDE datasources: " + usedstypeprop);
+ } else {
+ useDBTypes = Collections.EMPTY_SET;
+ }
+
+ String excludeprop = configprops
+ .getProperty(ConfigPropertyNames.EXCLUDE_DATASBASE_TYPES_PROP);
+
+ Set<String> excludedDBTypes = null;
+
+ if (excludeprop != null && excludeprop.length() > 0) {
+ List<String> eprops = StringUtil.split(excludeprop, ",");
+ excludedDBTypes = new HashSet<String>(eprops.size());
+ excludedDBTypes.addAll(eprops);
+ System.out.println("EXCLUDE datasources: " + excludeprop);
+ } else {
+ excludedDBTypes = Collections.EMPTY_SET;
+ }
+
+
+ String limitdsprop = configprops
+ .getProperty(ConfigPropertyNames.USE_DATASOURCES_PROP);
+ if (limitdsprop != null && limitdsprop.length() > 0 && !
limitdsprop.equalsIgnoreCase(DO_NOT_USE_DEFAULT)) {
+ System.out.println("Use ONLY datasources: " + limitdsprop);
+
+ List<String> dss = StringUtil.split(limitdsprop, ",");
+
+ useDS = new HashMap<String, String>(dss.size());
+ DataSource ds = null;
+ int i = 1;
+ for (Iterator<String> it = dss.iterator(); it.hasNext(); i++) {
+ String dssName = it.next();
+ ds = availDatasources.get(dssName);
+
+ if (ds != null && !excludedDBTypes.contains(ds.getDBType())) {
+
+ useDS.put(String.valueOf(i), dssName);
+
+ availDS.put(dssName, ds);
+ System.out.println("Using ds: " + dssName);
+ }
+
+ }
+
+ } else {
+ for (Iterator<DataSource> it = availDatasources.values().iterator();
it.hasNext(); ) {
+ DataSource ds = it.next();
+ // if the datasource type is not excluded, then consider for usages
+ if (!excludedDBTypes.contains(ds.getDBType())) {
+
+ // if use a specific db type is specified, then it must match,
+ // otherwise add it to the available list
+ if (useDBTypes.size() > 0 && usedstypeprop.contains(ds.getDBType()))
{
+ availDS.put(ds.getName(), ds);
+ } else {
+ availDS.put(ds.getName(), ds);
+ }
+
+ }
+ }
+
+
+ }
+
+
+
+ if (requiredDataBaseTypes != null && requiredDataBaseTypes.size() > 0) {
+ this.hasRequiredDBTypes = true;
+
+ Iterator<String> rit = this.requiredDataBaseTypes.keySet().iterator();
+
+ // go thru all the datasources and remove those that are excluded
+ while (rit.hasNext()) {
+ String modelName = rit.next();
+ String rdbtype = this.requiredDataBaseTypes.get(modelName);
+
+ Iterator<DataSource> ait = availDS.values().iterator();
+
+ metDBRequiredTypes = false;
+
+ // go thru all the datasources and find the matching datasource of the correct
dbtype
+ while (ait.hasNext()) {
+ DataSource ds = ait.next();
+ if (ds.getDBType().equalsIgnoreCase(rdbtype)) {
+ assignedDataSources.add(ds.getName());
+
+ dsmgr.setDataSource(modelName, ds);
+ // modelToDatasourceMap.put(modelName, ds);
+ metDBRequiredTypes = true;
+
+ }
+
+ }
+
+ if (!metDBRequiredTypes) {
+ // did find a required dbtype, no need going any further
+ break;
+ }
+
+ }
+
+ }
+
+
+ }
+
+ public int getNumberAvailableDataSources() {
+ return (metDBRequiredTypes ? this.availDS.size() :0);
+ }
+
+ public synchronized DataSource getDatasource(String datasourceid,
+ String modelName) throws QueryTestFailedException {
+ DataSource ds = null;
+
+ // map the datasource to the model and datasourceid
+ // this is so the next time this combination is requested,
+ // the same datasource is returned to ensure when consecutive calls
+ // during the process
+ // corresponds to the same datasource
+ String key = null;
+
+ key = modelName;
+ //+ "_" + datasourceid;
+
+ // if the datasourceid represents a group name, then use the group name
+ // so that all future request using that group name for a specified
+ // model
+ // will use the same datasource
+
+ ds = dsmgr.getDataSource(key);
+ if (ds != null) {
+ return ds;
+ }
+
+ if (this.hasRequiredDBTypes) {
+ if (this.requiredDataBaseTypes.containsKey(modelName)) {
+ String dbtype = this.requiredDataBaseTypes.get(modelName);
+
+ Iterator<DataSource> it = availDS.values().iterator();
+
+ // need to go thru all the datasources to know if any has already been
+ // assigned
+ // because the datasourceid passed in was a group name
+ while (it.hasNext()) {
+ DataSource checkit = it.next();
+
+ if (dbtype.equalsIgnoreCase(checkit.getDBType())) {
+ ds = checkit;
+ break;
+ }
+
+ }
+
+
+ }
+
+ } else if (useDS != null) {
+ String dsname = useDS.get(datasourceid);
+ if (dsname != null) {
+ ds = availDS.get(dsname);
+ if (ds == null) {
+ throw new QueryTestFailedException("Datasource name "
+ + dsname
+ + " was not found in the allDatasources map");
+
+ }
+ }
+
+
+ } else {
+
+ Iterator<DataSource> it = availDS.values().iterator();
+
+ // need to go thru all the datasources to know if any has already been
+ // assigned
+ // because the datasourceid passed in was a group name
+ while (it.hasNext()) {
+ DataSource checkit = it.next();
+
+ if (!assignedDataSources.contains(checkit.getName())) {
+ ds = checkit;
+ break;
+ }
+
+ }
+ }
+
+ if (ds == null) {
+ int cnt = 0;
+ Iterator<String> itds = assignedDataSources.iterator();
+
+ // when all the datasources have been assigned, but a new model
+ // datasource id is
+ // passed in, need to reassign a previously assigned datasource
+ // This case will happen when more models are defined than there are
+ // defined datasources.
+ while (itds.hasNext()) {
+ String dsname = itds.next();
+
+ if (cnt == this.lastassigned) {
+
+ ds = availDS.get(dsname);
+
+ this.lastassigned++;
+ if (lastassigned >= assignedDataSources.size()) {
+ this.lastassigned = 0;
+ }
+
+ break;
+ }
+ }
+
+ }
+
+ if (ds == null) {
+ throw new QueryTestFailedException(
+ "Unable to assign a datasource for model:datasourceid "
+ + modelName + ":" + datasourceid);
+
+ }
+
+ assignedDataSources.add(ds.getName());
+
+ dsmgr.setDataSource(key, ds);
+ return ds;
+
+ }
+
+ public void cleanup() {
+
+ dsmgr.clear();
+ assignedDataSources.clear();
+ requiredDataBaseTypes.clear();
+
+ if (useDS != null) useDS.clear();
+ if (availDS != null) availDS.clear();
+
+ }
+
+ public static void main(String[] args) {
+ //NOTE: to run this test to validate the DataSourceMgr, do the following:
+ // --- need 3 datasources, Oracle, SqlServer and 1 other
+
+ ConfigPropertyLoader config = ConfigPropertyLoader.getInstance();
+
+ DataSourceFactory factory = new DataSourceFactory(config);
+
+ try {
+ if (factory.getDatasource("1", "model1") == null) {
+ throw new RuntimeException("No datasource was not found");
+ }
+
+
+ } catch (QueryTestFailedException e) {
+ e.printStackTrace();
+ }
+
+ factory.cleanup();
+
+ ConfigPropertyLoader.cleanup();
+
+
+ // the following verifies that order of "use" datasources is applied to
request for datasources.
+ config = ConfigPropertyLoader.getInstance();
+
+ config.setProperty(ConfigPropertyNames.USE_DATASOURCES_PROP,
"oracle,sqlserver");
+
+ factory = new DataSourceFactory(config);
+
+ try {
+
+ DataSource dsfind = factory.getDatasource("2", "model2");
+ if (dsfind == null) {
+ throw new RuntimeException("No datasource was not found as the 2nd
datasource");
+
+ }
+
+ if (dsfind.getConnectorType() == null) {
+ throw new RuntimeException("Connector types was not defined");
+ }
+
+ if (!dsfind.getName().equalsIgnoreCase("sqlserver")) {
+ throw new RuntimeException("Sqlserver was not found as the 2nd
datasource");
+
+ }
+
+ dsfind = factory.getDatasource("1", "model1");
+ if (dsfind == null) {
+ throw new RuntimeException("No datasource was not found as the 2nd
datasource");
+
+ }
+ if (!dsfind.getName().equalsIgnoreCase("oracle")) {
+ throw new RuntimeException("Oracle was not found as the 2nd datasource");
+
+ }
+ System.out.println("Datasource :" + dsfind.getName() + " was
found");
+
+
+ // the following test verifies that a sqlserver datasource is not
+ // returned (excluded)
+ factory.cleanup();
+
+ ConfigPropertyLoader.cleanup();
+
+
+ config = ConfigPropertyLoader.getInstance();
+ config.setProperty(ConfigPropertyNames.EXCLUDE_DATASBASE_TYPES_PROP,
"sqlserver");
+
+
+ factory = new DataSourceFactory(config);
+
+ int n = factory.getNumberAvailableDataSources();
+ System.out.println("Num avail datasources: " + n);
+
+ for (int i=0; i<n; i++) {
+
+ String k = String.valueOf(i);
+ DataSource ds1 = factory.getDatasource(k, "model" + k);
+ if (ds1 == null) {
+ throw new RuntimeException("No datasource was found for: model:" + k);
+
+ } if (ds1.getDBType().equalsIgnoreCase(DataSourceFactory.DataBaseTypes.SQLSERVER)) {
+ throw new RuntimeException("sqlserver dbtype should have been excluded");
+ }
+ }
+
+
+ DataSource reuse = factory.getDatasource(String.valueOf(n + 1), "model1");
+ if (reuse != null) {
+
+ } else {
+ throw new RuntimeException("The process was not able to reassign an already
used datasource");
+
+ }
+
+ factory.cleanup();
+
+ ConfigPropertyLoader.cleanup();
+
+
+ // test required database types
+ // test 1 source
+
+ config = ConfigPropertyLoader.getInstance();
+
+ config.setModelAssignedToDatabaseType("pm1",
DataSourceFactory.DataBaseTypes.ORACLE);
+
+ factory = new DataSourceFactory(config);
+
+ DataSource ds1 = factory.getDatasource("1","pm1");
+ if (!ds1.getDBType().equalsIgnoreCase(DataSourceFactory.DataBaseTypes.ORACLE)) {
+ throw new RuntimeException("Required DB Type of oracle for model pm1 is :"
+ ds1.getDBType());
+ }
+
+ System.out.println("Test1 Required DS1 " + ds1.getDBType());
+ factory.cleanup();
+
+ ConfigPropertyLoader.cleanup();
+
+ // test required database types
+ // test 2 sources, 1 required and other ANY
+ config = ConfigPropertyLoader.getInstance();
+
+
+ config.setModelAssignedToDatabaseType("pm2",
DataSourceFactory.DataBaseTypes.SQLSERVER);
+ config.setModelAssignedToDatabaseType("pm1",
DataSourceFactory.DataBaseTypes.ANY);
+
+ factory = new DataSourceFactory(config);
+
+ DataSource ds2 = factory.getDatasource("2","pm2");
+ if (!ds2.getDBType().equalsIgnoreCase(DataSourceFactory.DataBaseTypes.SQLSERVER)) {
+ throw new RuntimeException("Required DB Type of sqlserver for model pm2 is
:" + ds2.getDBType());
+ }
+ System.out.println("Test2 Required DS2 " + ds2.getDBType());
+
+ factory.cleanup();
+ ConfigPropertyLoader.cleanup();
+
+
+ // test required database types
+ // test 2 sources, 2 required
+ config = ConfigPropertyLoader.getInstance();
+
+
+ config.setModelAssignedToDatabaseType("pm2",
DataSourceFactory.DataBaseTypes.SQLSERVER);
+ config.setModelAssignedToDatabaseType("pm1",
DataSourceFactory.DataBaseTypes.ORACLE);
+
+ factory = new DataSourceFactory(config);
+
+ DataSource ds3a = factory.getDatasource("2","pm2");
+ if (!ds3a.getDBType().equalsIgnoreCase(DataSourceFactory.DataBaseTypes.SQLSERVER)) {
+ throw new RuntimeException("Required DB Type of sqlserver for model pm12 is
:" + ds3a.getDBType());
+ }
+
+ DataSource ds3b = factory.getDatasource("2","pm1");
+ if (!ds3b.getDBType().equalsIgnoreCase(DataSourceFactory.DataBaseTypes.ORACLE)) {
+ throw new RuntimeException("Required DB Type of oracle for model pm1 is
:" + ds3b.getDBType());
+ }
+ System.out.println("Test3 Required DS3a " + ds3a.getDBType());
+ System.out.println("Test3 Required DS3b " + ds3b.getDBType());
+
+ factory.cleanup();
+
+
+ } catch (QueryTestFailedException e) {
+ e.printStackTrace();
+ }
+ }
+
+}
Added:
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSourceMgr.java
===================================================================
---
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSourceMgr.java
(rev 0)
+++
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSourceMgr.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,227 @@
+/*
+ * Copyright (c) 2000-2007 MetaMatrix, Inc.
+ * All rights reserved.
+ */
+package org.teiid.test.framework.datasource;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.teiid.test.framework.ConfigPropertyLoader;
+import org.teiid.test.framework.ConfigPropertyNames;
+import org.teiid.test.framework.exception.QueryTestFailedException;
+import org.teiid.test.framework.exception.TransactionRuntimeException;
+
+import com.metamatrix.common.util.PropertiesUtils;
+
+/**
+ * The DataSourceMgr is responsible for loading and managing the datasources
+ * defined by the datasource connection properties file. There's only a need to
+ * load the set of available datasources once for the duration of the entire
+ * test suite. And it will maintain one {@link DataSource} for each
+ * connection.properties file that it finds.
+ *
+ * @author vanhalbert
+ *
+ */
+public class DataSourceMgr {
+
+ private static DataSourceMgr _instance = null;
+
+ /**
+ * Defines the default location where the datasource files will be found.
+ * An override can be specified by setting the property {@link
ConfigPropertyNames#OVERRIDE_DATASOURCES_LOC}.
+ */
+ public static final String
DEFAULT_DATASOURCES_LOC="./target/classes/datasources/";
+
+ /**
+ * When run from maven, the {@link ConfigPropertyNames#OVERRIDE_DATASOURCES_LOC} will
be assigned
+ * to this value because of its a place holder for when a user does set the vm
argument.
+ */
+ private static final String UNASSIGNEDDSLOC="${";
+
+ private Map<String, DataSource> allDatasourcesMap = new HashMap<String,
DataSource>(); // key
+ // =
+ // datasource
+ // name
+
+ // map of the datasources assigned to with model
+ // because only one VDB (Transactions) is used, then this mapping can live
+ // for the
+ // duration of all tests
+ private Map<String, DataSource> modelToDatasourceMap = new HashMap<String,
DataSource>(); // key
+ // =
+ // modelname
+
+ private DataSourceMgr() {
+ }
+
+ public static synchronized DataSourceMgr getInstance() {
+ if (_instance == null) {
+ _instance = new DataSourceMgr();
+ try {
+ _instance.loadDataSourceMappings();
+ } catch (QueryTestFailedException e) {
+ throw new TransactionRuntimeException(e);
+ } catch (TransactionRuntimeException e) {
+ throw e;
+ }
+
+ }
+ return _instance;
+ }
+
+ public Map<String, DataSource> getDataSources() {
+ Map<String, DataSource> ds = new HashMap<String, DataSource>(
+ allDatasourcesMap.size());
+ ds.putAll(allDatasourcesMap);
+ return ds;
+ }
+
+ public int numberOfAvailDataSources() {
+ return allDatasourcesMap.size();
+ }
+
+ public DataSource getDataSource(String modelname) {
+ if (modelToDatasourceMap.containsKey(modelname)) {
+ return modelToDatasourceMap.get(modelname);
+ }
+ return null;
+ }
+
+ void clear() {
+ modelToDatasourceMap.clear();
+ }
+
+ public void setDataSource(String modelName, DataSource ds) {
+ modelToDatasourceMap.put(modelName, ds);
+ }
+
+ private void loadDataSourceMappings() throws QueryTestFailedException {
+
+ String dsloc =
ConfigPropertyLoader.getInstance().getProperty(ConfigPropertyNames.OVERRIDE_DATASOURCES_LOC);
+
+ if (dsloc == null || dsloc.indexOf(UNASSIGNEDDSLOC) > -1) {
+ dsloc = DEFAULT_DATASOURCES_LOC;
+ System.out.println("Using default datasource loc: " +dsloc);
+ } else {
+ System.out.println("Using override for datasources loc: " + dsloc);
+ }
+
+ File[] dirs = findAllChildDirectories(dsloc);
+ if (dirs == null || dirs.length == 0) {
+ throw new TransactionRuntimeException(
+ "No datasource directories found at location "
+ + dsloc);
+ }
+ for (int i = 0; i < dirs.length; i++) {
+ File d = dirs[i];
+
+ addDataSource(d, allDatasourcesMap);
+
+ }
+
+ if (allDatasourcesMap == null || allDatasourcesMap.isEmpty()) {
+ throw new TransactionRuntimeException(
+ "Error: No Datasources were loaded.");
+ } else if (allDatasourcesMap.size() < 2) {
+ throw new TransactionRuntimeException(
+ "Error: Must load 2 Datasources, only 1 was found.");
+
+ }
+
+ System.out.println("Number of total datasource mappings loaded "
+ + allDatasourcesMap.size());
+
+ }
+
+ /**
+ * Returns a <code>File</code> array that will contain all the
directories
+ * that exist in the directory
+ *
+ * @return File[] of directories in the directory
+ */
+ private static File[] findAllChildDirectories(String dir) {
+
+ // Find all files in the specified directory
+ File mfile = new File(dir);
+
+ File modelsDirFile = null;
+ try {
+ modelsDirFile = new File(mfile.getCanonicalPath());
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ if (!modelsDirFile.exists()) {
+ return null;
+ }
+ FileFilter fileFilter = new FileFilter() {
+
+ public boolean accept(File file) {
+ if (file.isDirectory()) {
+ return true;
+ }
+
+ return false;
+ }
+ };
+
+ File[] modelFiles = modelsDirFile.listFiles(fileFilter);
+
+ return modelFiles;
+
+ }
+
+ private void addDataSource(File datasourcedir, //String dirname, String dirloc,
+ Map<String, DataSource> datasources) {
+
+// String dirname = datasourcefile.getName();
+
+ File dsfile = new File(datasourcedir, "connection.properties");
+
+ if (!dsfile.exists()) {
+ return;
+ }
+
+// String dsfile = "/datasources/" + dirname +
"/connection.properties";
+ Properties dsprops = loadProperties(dsfile);
+
+ if (dsprops != null) {
+
+ DataSource ds = new DataSource(datasourcedir.getName(), "dsgroup",
dsprops);
+ datasources.put(ds.getName(), ds);
+ System.out.println("Loaded datasource " + ds.getName());
+
+ }
+
+ }
+
+ private static Properties loadProperties(File dsfile) {
+ Properties props = null;
+
+ try {
+
+ props = PropertiesUtils.load(dsfile.getAbsolutePath());
+ return props;
+
+// InputStream in =
DataSourceMgr.class.getResourceAsStream(dsfile.getAbsolutePath());
+// if (in != null) {
+// props = new Properties();
+// props.load(in);
+// return props;
+// }
+// return null;
+ } catch (IOException e) {
+ throw new TransactionRuntimeException(
+ "Error loading properties from file '" + dsfile.getAbsolutePath() +
"'"
+ + e.getMessage());
+ }
+ }
+
+}
Added:
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataStore.java
===================================================================
---
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataStore.java
(rev 0)
+++
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataStore.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2000-2007 MetaMatrix, Inc.
+ * All rights reserved.
+ */
+package org.teiid.test.framework.datasource;
+
+import java.sql.Connection;
+import java.sql.Statement;
+
+import org.teiid.test.framework.ConfigPropertyLoader;
+import org.teiid.test.framework.connection.ConnectionStrategy;
+import org.teiid.test.framework.exception.QueryTestFailedException;
+
+/**
+ * This class loads the data in the databases specified, to a known state
+ */
+public class DataStore {
+
+ /**
+ * Called at the start of all the tests to initialize the database to ensure
+ * it's in the proper state.
+ *
+ * @param connStrategy
+ */
+ public static void initialize(ConnectionStrategy connStrategy) {
+// ConfigPropertyLoader.cleanup();
+// ConfigPropertyLoader.getInstance();
+ try {
+ load(getConnection("pm1", connStrategy));
+
+ load(getConnection("pm2", connStrategy));
+
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private static Connection getConnection(String identifier, ConnectionStrategy
connStrategy) throws QueryTestFailedException {
+ Connection conn = connStrategy.createDriverConnection(identifier);
+ // force autocommit back to true, just in case the last user didnt
+ try {
+ conn.setAutoCommit(true);
+ } catch (Exception sqle) {
+ throw new QueryTestFailedException(sqle);
+ }
+
+ return conn;
+ }
+
+ private static void load(Connection c) throws Exception {
+ // DDL
+ // drop table g1;
+ // drop table g2;
+
+ // oracle
+ // create Table g1 (e1 number(5) PRIMARY KEY, e2 varchar2(50));
+ // create Table g2 (e1 number(5) REFERENCES g1, e2 varchar2(50));
+
+ // SQL Server
+ // create Table g1 (e1 int PRIMARY KEY, e2 varchar(50));
+ // create Table g2 (e1 int references g1, e2 varchar(50));
+
+
+ Statement stmt = c.createStatement();
+ stmt.addBatch("delete from g2");
+ stmt.addBatch("delete from g1");
+
+ for (int i = 0; i < 100; i++) {
+ stmt.addBatch("insert into g1 (e1, e2)
values("+i+",'"+i+"')");
+ }
+
+
+ for (int i = 0; i < 50; i++) {
+ stmt.addBatch("insert into g2 (e1, e2)
values("+i+",'"+i+"')");
+ }
+
+ stmt.executeBatch();
+ stmt.close();
+
+ }
+
+ /**
+ * Called as part of the setup for each test.
+ * This will set the database state as if {@link #initialize(ConnectionStrategy)} was
called.
+ * However, for performance reasons, the process goes about removing what's not
needed instead of cleaning out everything
+ * and reinstalling.
+ * @param connStrategy
+ */
+ public static void setup(ConnectionStrategy connStrategy) {
+ try {
+ setUpTest(getConnection("pm1", connStrategy));
+
+ setUpTest(getConnection("pm2", connStrategy));
+
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+
+ }
+
+ private static void setUpTest(Connection c) throws Exception {
+
+ Statement stmt = c.createStatement();
+ stmt.addBatch("delete from g2 where e1 >= 50"); //$NON-NLS-1$
+ stmt.addBatch("delete from g1 where e1 >= 100");
+
+ stmt.executeBatch();
+ stmt.close();
+
+
+ }
+
+}
Added:
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/exception/QueryTestFailedException.java
===================================================================
---
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/exception/QueryTestFailedException.java
(rev 0)
+++
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/exception/QueryTestFailedException.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,358 @@
+/*
+ * Copyright (c) 2000-2005 MetaMatrix, Inc. All rights reserved.
+ */
+package org.teiid.test.framework.exception;
+
+import java.io.Serializable;
+import java.util.List;
+
+import com.metamatrix.core.MetaMatrixRuntimeException;
+import com.metamatrix.core.util.MetaMatrixExceptionUtil;
+
+/**
+ */
+
+ /**
+ * The QueryTestFailedException is thrown during a test.
+ *
+ * This exception which contains a reference to another exception. This
+ * class can be used to maintain a linked list of exceptions. <p>
+ *
+ * Subclasses of this exception typically only need to implement whatever
+ * constructors they need. <p>
+ */
+public class QueryTestFailedException extends Exception
+ implements Serializable{
+
//############################################################################################################################
+ //# Static Methods
#
+ //############################################################################################################################
+
+ /**
+ * @since
+ */
+ private static final long serialVersionUID = -4824998416118801290L;
+
+ /**
+ * Utility method to get the name of a class, without package information.
+ *
+ * @param cls The class to get the name of
+ * @return The name of the class, without package info
+ */
+ public static String getClassShortName( Class<?> cls ) {
+ if ( cls == null ) return ""; //$NON-NLS-1$
+ String className = cls.getName();
+ return className.substring( className.lastIndexOf('.')+1 );
+ }
+
+
//############################################################################################################################
+ //# Variables
#
+ //############################################################################################################################
+
+ /** An error code. */
+ private String code;
+
+ /** Exception chained to this one. */
+ private Throwable child;
+
+ private String msg;
+
+
//############################################################################################################################
+ //# Constructors
#
+ //############################################################################################################################
+
+ /**
+ * Construct a default instance of this class.
+ */
+ public QueryTestFailedException() {
+ }
+
+ /**
+ * Construct an instance with the specified error message. If the message is
actually a key, the actual message will be
+ * retrieved from a resource bundle using the key, the specified parameters will be
substituted for placeholders within the
+ * message, and the code will be set to the key.
+ * @param message The error message or a resource bundle key
+ */
+ public QueryTestFailedException(final String message) {
+ setMessage(message, null);
+ }
+
+ /**
+ * Construct an instance with the specified error code and message. If the message
is actually a key, the actual message will
+ * be retrieved from a resource bundle using the key, and the specified parameters
will be substituted for placeholders within
+ * the message.
+ * @param code The error code
+ * @param message The error message or a resource bundle key
+ */
+ public QueryTestFailedException(final String code, final String message) {
+ setMessage(message, null);
+ // The following setCode call should be executed after setting the message
+ setCode(code);
+ }
+
+ /**
+ * Construct an instance with a linked exception specified. If the exception is a
MetaMatrixException or a
+ * {@link MetaMatrixRuntimeException}, then the code will be set to the
exception's code.
+ * @param e An exception to chain to this exception
+ */
+ public QueryTestFailedException(final Throwable e) {
+ // This is nasty, but there's no setMessage() routine!
+ this.msg = ( e instanceof java.lang.reflect.InvocationTargetException )
+ ?
((java.lang.reflect.InvocationTargetException)e).getTargetException().getMessage()
+ : (e == null ? null : e.getMessage());
+ setChild( e );
+
+ }
+
+ /**
+ * Construct an instance with the linked exception and error message specified. If
the message is actually a key, the error
+ * message will be retrieved from a resource bundle the key, and code will be set to
that key. Otherwise, if the specified
+ * exception is a MetaMatrixException or a {@link MetaMatrixRuntimeException}, the
code will be set to the exception's code.
+ * @param e The exception to chain to this exception
+ * @param message The error message or a resource bundle key
+ */
+ public QueryTestFailedException(final Throwable e, final String message) {
+ setChild( e );
+ // The following setMessage call should be executed after attempting to set the
code from the passed-in exception
+ setMessage(message, null);
+
+ }
+
+
+ /**
+ * Construct an instance with the linked exception, error code, and error message
specified. If the message is actually a
+ * key, the error message will be retrieved from a resource bundle using the key.
+ * @param e The exception to chain to this exception
+ * @param code The error code
+ * @param message The error message or a resource bundle key
+ */
+ public QueryTestFailedException(final Throwable e, final String code, final String
message) {
+ setChild(e);
+ setMessage(message, null);
+ // The following setCode call should be executed after setting the message
+ setCode(code);
+ }
+
+
//############################################################################################################################
+ //# Methods
#
+ //############################################################################################################################
+
+ /**
+ * Get the exception which is linked to this exception.
+ *
+ * @return The linked exception
+ */
+ public Throwable getChild() {
+ return this.child;
+ }
+
+ /**
+ * Get the error code.
+ *
+ * @return The error code
+ */
+ public String getCode() {
+ return this.code;
+ }
+
+ /**
+ * Returns the error message, formatted for output. <P>
+ *
+ * The default formatting provided by this method is to prepend the
+ * error message with the level and the name of the class, and to
+ * append the error code on the end if a non-zero code is defined. <P>
+ *
+ * This method provides a hook for subclasses to override the default
+ * formatting of any one exception.
+ *
+ * @param except The exception to print
+ * @param level The depth of the exception in the chain of exceptions
+ * @return A formatted string for the exception
+ */
+ public String getFormattedMessage(final Throwable throwable, final int level) {
+
+ return ((level != 0) ? ("\n" + level + " ") : "" )
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ + "[" + getClassShortName(throwable.getClass()) + "]"
//$NON-NLS-1$ //$NON-NLS-2$
+ + ((code != null) ? (' ' + code + ": ") : "")
//$NON-NLS-1$//$NON-NLS-2$
+ + (throwable.getMessage() == null ? "" :
throwable.getMessage()); //$NON-NLS-1$
+ }
+
+ /**
+ * Get the full error message, including any message(s) from child
+ * exceptions. Messages of any exceptions chained to this exception are
+ * prepended with their "level" in the chain.
+ *
+ * @return The full error message
+ *
+ * @see #getFormattedMessage
+ */
+ public String getFullMessage() {
+ return MetaMatrixExceptionUtil.getLinkedMessages(this, 0 );
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Throwable#getMessage()
+ */
+ public String getMessage() {
+ return this.msg;
+ }
+
+ /**
+ * Set the exception which is linked to this exception. <P>
+ *
+ * For the special case of an InvocationTargetException, which is
+ * a wrapped exception provided in the <CODE>java.lang.reflect</CODE>
+ * package, the child is set to the wrapped exception, and the message,
+ * if not yet defined, is set to the message of the wrapped exception.
+ *
+ * @param child The linked exception
+ */
+ public void setChild( Throwable child ) {
+ // Special processing in case this is already a wrapped exception
+ if ( child instanceof java.lang.reflect.InvocationTargetException ) {
+ this.child =
((java.lang.reflect.InvocationTargetException)child).getTargetException();
+ } else {
+ this.child = child;
+ }
+ }
+
+ /**
+ * Set the error code.
+ *
+ * @param code The error code
+ */
+ public void setCode( String code ) {
+ this.code = code;
+ }
+
+ /**
+ * Sets the exception message to the specified text. If the message is actually a
resource bundle key, the actual message
+ * will be retrieved using that key, the specified parameters will be substituted
for placeholders within the message, and the
+ * code will be set to the key.
+ * @param message The message text or a resource bundle message key.
+ * @param parameters The list of parameters to substitute for placeholders in the
retrieved message.
+ * @since 3.1
+ */
+ private void setMessage(final String message, final List parameters) {
+ if (message == null) {
+ this.msg = message;
+ } else {
+ final String msg = message;
+// final String msg = TextManager.INSTANCE.getText(message, parameters);
+ final int len = msg.length();
+ if (msg.startsWith("<") && len >= 2) {
//$NON-NLS-1$
+ this.msg = msg.substring(1, len - 1);
+ } else {
+ this.msg = msg;
+ setCode(message);
+ }
+ }
+ }
+
+ /**
+ * Returns a string representation of this class.
+ *
+ * @return String representation of instance
+ */
+ public String toString() {
+ return getFullMessage();
+ }
+
+ // =========================================================================
+ // T E S T M E T H O D S
+ // =========================================================================
+
+ /**
+ * Test program for this class.
+ *
+ * @args The command line arguments
+ */
+
+ /*
+ public static void main( String[] args ) {
+ class TestAppException extends MetaMatrixException {
+ public TestAppException( Throwable e ) {
+ super( e );
+ }
+ public TestAppException( Throwable e, String message ) {
+ super( e, message );
+ }
+ } // END INNER CLASS
+
+ System.out.println( "\n2 MetaMatrixExceptions and 1 Exception..." );
+ try {
+ throw new MetaMatrixException(
+ new MetaMatrixException(
+ new Exception( "Non-chained exception" ),
+ "Nested Error" ),
+ "My App Error" );
+ } catch ( MetaMatrixException e ) {
+ System.out.println( "Message is \n" + e.getMessage() );
+ System.out.println( "Full message is \n" + e.getFullMessage() );
+ }
+
+ System.out.println( "\n2 MetaMatrixExceptions..." );
+ try {
+ throw new MetaMatrixException(
+ new MetaMatrixException( 1001, "Nested Error" ),
+ "My App Error" );
+ } catch ( MetaMatrixException e ) {
+ System.out.println( "Message is \n" + e.getMessage() );
+ System.out.println( "Full message is \n" + e.getFullMessage() );
+ }
+
+ System.out.println( "\n2 MetaMatrixExceptions (1 a subclass)..." );
+ try {
+ throw new TestAppException(
+ new MetaMatrixException( 1001, "Nested Error" ),
+ "My App Error" );
+ } catch ( MetaMatrixException e ) {
+ System.out.println( "Message is \n" + e.getMessage() );
+ System.out.println( "Full message is \n" + e.getFullMessage() );
+ }
+
+ System.out.println( "\n2 exceptions (1 MetaMatrixException, 1
null)..." );
+ try {
+ throw new TestAppException(
+ new MetaMatrixException( null, "Nested Error" ),
+ "My App Error" );
+ } catch ( MetaMatrixException e ) {
+ System.out.println( "Message is \n" + e.getMessage() );
+ System.out.println( "Full message is \n" + e.getFullMessage() );
+ }
+
+ System.out.println( "\n1 MetaMatrixException..." );
+ try {
+ throw new MetaMatrixException( 1002, "My App Error" );
+ } catch ( MetaMatrixException e ) {
+ System.out.println( "Message is \n" + e.getMessage() );
+ System.out.println( "Full message is \n" + e.getFullMessage() );
+ }
+
+ System.out.println( "\n5 MetaMatrixExceptions..." );
+ try {
+ MetaMatrixException root = new MetaMatrixException( 50, "Root" );
+ MetaMatrixException cur = root;
+ MetaMatrixException next;
+ for ( int i = 1; i <= 5; i++ ) {
+ next = new MetaMatrixException( 50+i, "Nested exception " + i
);
+ cur.setChild( next );
+ cur = next;
+ }
+ throw root;
+ } catch ( MetaMatrixException e ) {
+ System.out.println( "Message is \n" + e.getMessage() );
+ System.out.println( "Full message is \n" + e.getFullMessage() );
+ }
+
+ System.out.println( "\n1 MetaMatrixException
(InvocationTargetException)..." );
+ try {
+ throw new TestAppException(
+ new java.lang.reflect.InvocationTargetException(
+ new java.lang.IllegalArgumentException( "You can't do
that!" ) ) );
+ } catch ( MetaMatrixException e ) {
+ System.out.println( "Message is \n" + e.getMessage() );
+ System.out.println( "Full message is \n" + e.getFullMessage() );
+ }
+ }
+ */
+ } // END CLASS
Added:
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/exception/TransactionRuntimeException.java
===================================================================
---
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/exception/TransactionRuntimeException.java
(rev 0)
+++
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/exception/TransactionRuntimeException.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,23 @@
+package org.teiid.test.framework.exception;
+
+/**
+ * The TransactionRuntimeException is thrown outside of running a test.
+ * When this is thrown, the testing process should stop.
+ *
+ *
+ * @author vanhalbert
+ *
+ */
+public class TransactionRuntimeException extends RuntimeException{
+ /**
+ * @since
+ */
+ private static final long serialVersionUID = 1L;
+
+ public TransactionRuntimeException(Exception e){
+ super(e);
+ }
+ public TransactionRuntimeException(String msg){
+ super(msg);
+ }
+}
Added:
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/query/AbstractQueryTransactionTest.java
===================================================================
---
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/query/AbstractQueryTransactionTest.java
(rev 0)
+++
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/query/AbstractQueryTransactionTest.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,253 @@
+/*
+ * Copyright (c) 2000-2007 MetaMatrix, Inc.
+ * All rights reserved.
+ */
+package org.teiid.test.framework.query;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Properties;
+
+import javax.sql.XAConnection;
+
+import org.teiid.test.framework.TransactionContainer;
+import org.teiid.test.framework.TransactionQueryTestCase;
+import org.teiid.test.framework.ConfigPropertyNames.CONNECTION_STRATEGY_PROPS;
+import org.teiid.test.framework.connection.ConnectionStrategy;
+import org.teiid.test.framework.datasource.DataStore;
+import org.teiid.test.framework.exception.QueryTestFailedException;
+
+
+
+/**
+ * The AbstractQueryTransactionTest is the base implementation for the
+ * {@link TransactionQueryTestCase}. This provides the default logic for perform a
testcase.
+ * The only method to implement in order to perform a basic, single datasource, test
+ * is the {@link #testCase()} method.
+ *
+ * AbstractQueryTransactionTest is the class that should be extended when a
+ * testcase is being created to validate certain behavior
+ *
+ * <br>
+ * The following methods are useful when writing validation logic because they provide
+ * a direct connection to the datasource that was used by the VDB. This enables data
+ * validation of expected behavior of Teiid.
+ * <li>{@link #getSource(String)}. </li>
+ * <li>{@link #getXASource(String)} </li>
+ *
+ * <br>
+ *
+ * @see QueryExecution for use when direct queries to the source are used to
+ * validate the results of the testcase.
+ *
+ */
+public abstract class AbstractQueryTransactionTest extends
com.metamatrix.jdbc.api.AbstractQueryTest
+ implements TransactionQueryTestCase {
+
+ private static String initialized = null;
+
+ protected String testname = "NA";
+ protected int fetchSize = -1;
+ protected int queryTimeout = -1;
+
+ protected ConnectionStrategy connStrategy;
+
+ public AbstractQueryTransactionTest() {
+ super();
+ }
+
+ public AbstractQueryTransactionTest(String testname) {
+ super();
+ this.testname = testname;
+ }
+
+ public String getTestName() {
+ return this.testname;
+
+ }
+
+
+ @Override
+ public void setConnectionStrategy(ConnectionStrategy connStrategy) throws
QueryTestFailedException {
+ this.connStrategy = connStrategy;
+
+ this.setConnection(connStrategy.getConnection());
+
+ }
+
+// @Override
+// protected void compareResults(BufferedReader resultReader,
+// BufferedReader expectedReader) throws IOException {
+// assertEquals(read(expectedReader, compareResultsCaseSensitive()), read(
+// resultReader, compareResultsCaseSensitive()));
+// }
+
+ @Override
+ protected void assignExecutionProperties(Statement stmt) {
+ if (stmt instanceof com.metamatrix.jdbc.api.Statement) {
+ com.metamatrix.jdbc.api.Statement statement = (com.metamatrix.jdbc.api.Statement)
stmt;
+
+ Properties executionProperties = this.connStrategy.getEnvironment();
+ if (executionProperties != null) {
+ String txnautowrap = executionProperties
+ .getProperty(CONNECTION_STRATEGY_PROPS.TXN_AUTO_WRAP);
+ if (txnautowrap != null) {
+ statement.setExecutionProperty(
+ CONNECTION_STRATEGY_PROPS.TXN_AUTO_WRAP,
+ txnautowrap);
+
+
+// this.print("TransactionAutoWrap = " + txnautowrap);
+ }
+
+ String fetchSizeStr = executionProperties
+ .getProperty(CONNECTION_STRATEGY_PROPS.FETCH_SIZE);
+ if (fetchSizeStr != null) {
+ try {
+ fetchSize = Integer.parseInt(fetchSizeStr);
+
+ this.print("FetchSize = " + fetchSize);
+ } catch (NumberFormatException e) {
+ fetchSize = -1;
+ // this.print("Invalid fetch size value: " + fetchSizeStr
+ // + ", ignoring");
+ }
+ }
+
+ }
+
+
+
+ if (this.fetchSize > 0) {
+ try {
+ statement.setFetchSize(this.fetchSize);
+ } catch (SQLException e) {
+// this.print(e);
+ }
+ }
+
+ if (this.queryTimeout > 0) {
+ try {
+ statement.setQueryTimeout(this.queryTimeout);
+ } catch (SQLException e) {
+// this.print(e);
+ }
+ }
+ }
+
+ }
+
+
+
+ /**
+ * Override <code>setupDataSource</code> if there is different mechanism
for
+ * setting up the datasources for the testcase
+ *
+ * @throws QueryTestFailedException
+ * @throws QueryTestFailedException
+ *
+ * @since
+ */
+ @Override
+ public void setup() throws QueryTestFailedException {
+
+ if (initialized == null ||
!initialized.equalsIgnoreCase(this.getClass().getSimpleName()) ) {
+ initialized = this.getClass().getSimpleName();
+ DataStore.initialize(connStrategy);
+
+ }
+
+ DataStore.setup(connStrategy);
+
+ }
+
+ /**
+ * The source connection must be asked from the connection strategy because only
here
+ * is it known which model was mapped to which datasource.
+ * This is because each test could potentially use an include/exclude datasource
option
+ * that could change the mappings between tests.
+ * @param identifier
+ * @return
+ * @throws QueryTestFailedException
+ */
+ public Connection getSource(String identifier)
+ throws QueryTestFailedException {
+
+ Connection conn = this.connStrategy.createDriverConnection(identifier);
+ // force autocommit back to true, just in case the last user didnt
+ try {
+ conn.setAutoCommit(true);
+ } catch (Exception sqle) {
+ throw new QueryTestFailedException(sqle);
+ }
+
+ return conn;
+
+ }
+
+ public XAConnection getXASource(String identifier)
+ throws QueryTestFailedException {
+
+ return this.connStrategy.createDataSourceConnection(identifier);
+
+ }
+
+ /**
+ * Implement testCase(), it is the entry point to the execution of the test.
+ *
+ * @throws Exception
+ *
+ * @since
+ */
+ public abstract void testCase() throws Exception;
+
+ /**
+ * Indicates what should be done when a failure occurs in
+ * {@link #testCase()}
+ *
+ * @return
+ *
+ * @since
+ */
+ public boolean rollbackAllways() {
+ return false;
+ }
+
+ /**
+ * Override <code>before</code> if there is behavior that needs to be
+ * performed prior to {@link #testCase()} being called.
+ *
+ *
+ * @since
+ */
+ public void before() {
+ }
+
+ /**
+ * Override <code>after</code> if there is behavior that needs to be
+ * performed after {@link #testCase()} being called.
+ *
+ *
+ * @since
+ */
+ public void after() {
+ }
+
+ /**
+ * At end of each test, perform any cleanup that your test requires. Note:
+ * Do not cleanup any connections by calling {@link ConnectionStrategy#shutdown()}.
+ * That is performed by the
+ * {@link TransactionContainer#runTransaction(TransactionQueryTestCase)} at the
+ * end of the test.
+ */
+ public void cleanup() {
+
+ }
+
+ @Override
+ public XAConnection getXAConnection() {
+ return null;
+ }
+
+}
Added:
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/query/QueryExecution.java
===================================================================
---
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/query/QueryExecution.java
(rev 0)
+++
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/query/QueryExecution.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,22 @@
+package org.teiid.test.framework.query;
+
+import java.sql.Connection;
+
+import com.metamatrix.jdbc.api.AbstractQueryTest;
+
+/**
+ * The QueryExecution class can be used to query the source directly. The intended use
+ * of this class is for validating results after the execution of a test case.
+ *
+ * @see AbstractQueryTransactionTest regarding creating a testcase to validate behavior.
+ * @author vanhalbert
+ *
+ */
+public class QueryExecution extends AbstractQueryTest {
+
+ public QueryExecution(Connection conn) {
+ super(conn);
+ }
+
+
+}
Added:
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/transaction/JNDITransaction.java
===================================================================
---
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/transaction/JNDITransaction.java
(rev 0)
+++
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/transaction/JNDITransaction.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2000-2007 MetaMatrix, Inc.
+ * All rights reserved.
+ */
+package org.teiid.test.framework.transaction;
+
+import javax.naming.InitialContext;
+import javax.transaction.UserTransaction;
+
+import org.teiid.test.framework.TransactionContainer;
+import org.teiid.test.framework.TransactionQueryTestCase;
+import org.teiid.test.framework.ConfigPropertyNames.CONNECTION_STRATEGY_PROPS;
+import org.teiid.test.framework.exception.TransactionRuntimeException;
+
+
+
+
+public class JNDITransaction extends TransactionContainer {
+ UserTransaction userTxn = null;
+
+
+ public JNDITransaction() {
+ super();
+ }
+
+ protected void before(TransactionQueryTestCase test) {
+ if (this.props.getProperty(CONNECTION_STRATEGY_PROPS.JNDINAME_USERTXN) == null)
{
+ throw new TransactionRuntimeException("No JNDI name found for the User
Transaction to look up in application server");
+ }
+
+ try {
+
+ // begin the transaction
+ InitialContext ctx = new InitialContext();
+ this.userTxn =
(UserTransaction)ctx.lookup(this.props.getProperty(CONNECTION_STRATEGY_PROPS.JNDINAME_USERTXN));
+ this.userTxn.begin();
+ } catch (Exception e) {
+ throw new TransactionRuntimeException(e);
+ }
+ }
+
+ protected void after(TransactionQueryTestCase test) {
+ try {
+ if (this.userTxn != null) {
+ if (test.rollbackAllways()|| test.exceptionOccurred()) {
+ this.userTxn.rollback();
+ }
+ else {
+ this.userTxn.commit();
+ }
+ this.userTxn = null;
+ }
+ } catch (Exception e) {
+ throw new TransactionRuntimeException(e);
+ }
+ }
+}
Added:
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/transaction/LocalTransaction.java
===================================================================
---
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/transaction/LocalTransaction.java
(rev 0)
+++
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/transaction/LocalTransaction.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2000-2007 MetaMatrix, Inc.
+ * All rights reserved.
+ */
+package org.teiid.test.framework.transaction;
+
+
+import java.sql.SQLException;
+
+import org.teiid.test.framework.ConfigPropertyLoader;
+import org.teiid.test.framework.TransactionContainer;
+import org.teiid.test.framework.TransactionQueryTestCase;
+import org.teiid.test.framework.ConfigPropertyNames.CONNECTION_STRATEGY_PROPS;
+import org.teiid.test.framework.ConfigPropertyNames.TXN_AUTO_WRAP_OPTIONS;
+import org.teiid.test.framework.exception.TransactionRuntimeException;
+
+
+/**
+ * A transaction which is user controlled.
+ */
+public class LocalTransaction extends TransactionContainer {
+
+ public LocalTransaction() {
+ super();
+ }
+ protected void before(TransactionQueryTestCase test) {
+ this.setEnvironmentProperty(CONNECTION_STRATEGY_PROPS.TXN_AUTO_WRAP,
TXN_AUTO_WRAP_OPTIONS.AUTO_WRAP_OFF);
+
+ try {
+ debug("Autocommit: " + this.connStrategy.getAutocommit());
+ test.getConnection().setAutoCommit(this.connStrategy.getAutocommit());
+ } catch (SQLException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ protected void after(TransactionQueryTestCase test) {
+ boolean exception = false;
+ try {
+ if (test.rollbackAllways()|| test.exceptionOccurred()) {
+ test.getConnection().rollback();
+
+ }
+ else {
+ test.getConnection().commit();
+ }
+ } catch (SQLException se) {
+ exception = true;
+ // if exception, try to trigger the rollback
+ try {
+ test.getConnection().rollback();
+ } catch (Exception e) {
+ // do nothing
+ }
+ throw new TransactionRuntimeException(se);
+
+
+ } finally {
+ // if an exception occurs and the autocommit is set to true - while doing a
transaction
+ // will generate a new exception overriding the first exception
+ if (!exception) {
+ try {
+ test.getConnection().setAutoCommit(true);
+ } catch (SQLException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+ }
+
+
+
+}
Added:
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/transaction/OffWrapTransaction.java
===================================================================
---
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/transaction/OffWrapTransaction.java
(rev 0)
+++
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/transaction/OffWrapTransaction.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2000-2007 MetaMatrix, Inc.
+ * All rights reserved.
+ */
+package org.teiid.test.framework.transaction;
+
+import org.teiid.test.framework.TransactionContainer;
+import org.teiid.test.framework.TransactionQueryTestCase;
+import org.teiid.test.framework.ConfigPropertyNames.CONNECTION_STRATEGY_PROPS;
+import org.teiid.test.framework.ConfigPropertyNames.TXN_AUTO_WRAP_OPTIONS;
+
+
+
+/**
+ * This transction is only valid when
+ * AutoCommit = ON
+ * txnAutoWrap = OFF
+ */
+public class OffWrapTransaction extends TransactionContainer {
+
+ public OffWrapTransaction() {
+ super();
+ }
+
+ public void before(TransactionQueryTestCase test) {
+ this.setEnvironmentProperty(CONNECTION_STRATEGY_PROPS.TXN_AUTO_WRAP,
TXN_AUTO_WRAP_OPTIONS.AUTO_WRAP_OFF);
+
+
+ }
+
+ public void after(TransactionQueryTestCase test) {
+
+ }
+}
Added:
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/transaction/OnWrapTransaction.java
===================================================================
---
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/transaction/OnWrapTransaction.java
(rev 0)
+++
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/transaction/OnWrapTransaction.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2000-2007 MetaMatrix, Inc.
+ * All rights reserved.
+ */
+package org.teiid.test.framework.transaction;
+
+import org.teiid.test.framework.TransactionContainer;
+import org.teiid.test.framework.TransactionQueryTestCase;
+import org.teiid.test.framework.ConfigPropertyNames.CONNECTION_STRATEGY_PROPS;
+import org.teiid.test.framework.ConfigPropertyNames.TXN_AUTO_WRAP_OPTIONS;
+
+
+/**
+ * This transction is only valid when
+ * AutoCommit = ON
+ * txnAutoWrap = ON
+ */
+public class OnWrapTransaction extends TransactionContainer {
+ public OnWrapTransaction() {
+ super();
+ }
+
+ public void before(TransactionQueryTestCase test) {
+ this.setEnvironmentProperty(CONNECTION_STRATEGY_PROPS.TXN_AUTO_WRAP,
TXN_AUTO_WRAP_OPTIONS.AUTO_WRAP_ON);
+
+
+ }
+
+ public void after(TransactionQueryTestCase test) {
+
+ }
+}
Added:
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/transaction/OptimisticWrapTransaction.java
===================================================================
---
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/transaction/OptimisticWrapTransaction.java
(rev 0)
+++
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/transaction/OptimisticWrapTransaction.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2000-2007 MetaMatrix, Inc.
+ * All rights reserved.
+ */
+package org.teiid.test.framework.transaction;
+
+import org.teiid.test.framework.TransactionContainer;
+import org.teiid.test.framework.TransactionQueryTestCase;
+import org.teiid.test.framework.ConfigPropertyNames.CONNECTION_STRATEGY_PROPS;
+import org.teiid.test.framework.ConfigPropertyNames.TXN_AUTO_WRAP_OPTIONS;
+
+
+/**
+ * This transction is only valid when
+ * AutoCommit = ON
+ * txnAutoWrap = Optimistic.
+ */
+public class OptimisticWrapTransaction extends TransactionContainer {
+ public OptimisticWrapTransaction() {
+ super();
+ }
+
+ public void before(TransactionQueryTestCase test) {
+ this.setEnvironmentProperty(CONNECTION_STRATEGY_PROPS.TXN_AUTO_WRAP,
TXN_AUTO_WRAP_OPTIONS.AUTO_WRAP_OPTIMISTIC);
+
+ }
+
+ public void after(TransactionQueryTestCase test) {
+
+ }
+}
Added:
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/transaction/PessimisticWrapTransaction.java
===================================================================
---
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/transaction/PessimisticWrapTransaction.java
(rev 0)
+++
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/transaction/PessimisticWrapTransaction.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2000-2007 MetaMatrix, Inc.
+ * All rights reserved.
+ */
+package org.teiid.test.framework.transaction;
+
+import org.teiid.test.framework.TransactionContainer;
+import org.teiid.test.framework.TransactionQueryTestCase;
+import org.teiid.test.framework.ConfigPropertyNames.CONNECTION_STRATEGY_PROPS;
+import org.teiid.test.framework.ConfigPropertyNames.TXN_AUTO_WRAP_OPTIONS;
+
+
+/**
+ * This transaction type only is valid when
+ * AutoCommit = ON
+ * txnAutoWrap = PESSIMISTIC
+ */
+public class PessimisticWrapTransaction extends TransactionContainer {
+ public PessimisticWrapTransaction() {
+ super();
+ }
+
+ public void before(TransactionQueryTestCase test) {
+ this.setEnvironmentProperty(CONNECTION_STRATEGY_PROPS.TXN_AUTO_WRAP,
TXN_AUTO_WRAP_OPTIONS.AUTO_WRAP_PESSIMISTIC);
+
+ }
+
+ public void after(TransactionQueryTestCase test) {
+
+ }
+
+
+}
Added:
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/transaction/StandaloneGlobalTransaction.java
===================================================================
---
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/transaction/StandaloneGlobalTransaction.java
(rev 0)
+++
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/transaction/StandaloneGlobalTransaction.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2000-2007 MetaMatrix, Inc.
+ * All rights reserved.
+ */
+package org.teiid.test.framework.transaction;
+
+import java.util.Random;
+
+import javax.transaction.xa.XAResource;
+
+import org.teiid.test.framework.TransactionContainer;
+import org.teiid.test.framework.TransactionQueryTestCase;
+import org.teiid.test.framework.exception.TransactionRuntimeException;
+
+import com.metamatrix.common.xa.MMXid;
+
+public class StandaloneGlobalTransaction extends TransactionContainer {
+ private static Random RANDOM = new Random();
+ private MMXid xid;
+
+ public StandaloneGlobalTransaction() {
+ super();
+ }
+
+ protected void before(TransactionQueryTestCase test) {
+ try {
+ xid = createXid();
+ XAResource xaResource =
this.getConnectionStrategy().getXAConnection().getXAResource();
+ // getXAConnection().getXAResource();
+ xaResource.setTransactionTimeout(120);
+ xaResource.start(xid, XAResource.TMNOFLAGS);
+ } catch (Exception e) {
+ throw new TransactionRuntimeException(e);
+ }
+ }
+
+ public static MMXid createXid() {
+ byte[] gid = new byte[10];
+ byte[] bid = new byte[10];
+ RANDOM.nextBytes(gid);
+ RANDOM.nextBytes(bid);
+ return new MMXid(0, gid, bid);
+ }
+
+ protected void after(TransactionQueryTestCase test) {
+ boolean delistSuccessful = false;
+ boolean commit = false;
+ try {
+ XAResource xaResource =
this.getConnectionStrategy().getXAConnection().getXAResource();
+
+ xaResource.end(xid, XAResource.TMSUCCESS);
+
+ if (!test.exceptionExpected() && xaResource.prepare(xid) ==
XAResource.XA_OK) {
+ commit = true;
+ }
+ delistSuccessful = true;
+ } catch (Exception e) {
+ throw new TransactionRuntimeException(e);
+ } finally {
+ try {
+ if (!delistSuccessful || test.rollbackAllways()||
test.exceptionOccurred()) {
+
this.getConnectionStrategy().getXAConnection().getXAResource().rollback(xid);
+ //getXAConnection().getXAResource().rollback(xid);
+ }
+ else if (commit) {
+
this.getConnectionStrategy().getXAConnection().getXAResource().commit(xid, true);
+ }
+ } catch (Exception e) {
+ throw new TransactionRuntimeException(e);
+ }
+ }
+ }
+}
Added:
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/transaction/XATransaction.java
===================================================================
---
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/transaction/XATransaction.java
(rev 0)
+++
branches/JCA/test-integration/db/src/main/java/org/teiid/test/framework/transaction/XATransaction.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2000-2007 MetaMatrix, Inc.
+ * All rights reserved.
+ */
+package org.teiid.test.framework.transaction;
+
+import java.util.Random;
+
+import javax.sql.XAConnection;
+import javax.transaction.xa.XAResource;
+
+import org.teiid.test.framework.ConfigPropertyLoader;
+import org.teiid.test.framework.TransactionContainer;
+import org.teiid.test.framework.TransactionQueryTestCase;
+import org.teiid.test.framework.exception.QueryTestFailedException;
+import org.teiid.test.framework.exception.TransactionRuntimeException;
+
+import com.metamatrix.common.xa.MMXid;
+
+public class XATransaction extends TransactionContainer {
+ private static Random RANDOM = new Random();
+ private MMXid xid;
+
+ public XATransaction() {
+ super();
+ }
+
+ protected void before(TransactionQueryTestCase test) {
+ try {
+ xid = createXid();
+ XAResource xaResource = getXAConnection().getXAResource();
+ xaResource.setTransactionTimeout(120);
+ xaResource.start(xid, XAResource.TMNOFLAGS);
+ debug("Start transaction using XID: " + xid.toString());
+
+ } catch (Exception e) {
+ throw new TransactionRuntimeException(e);
+ }
+ }
+
+ public static MMXid createXid() {
+ byte[] gid = new byte[10];
+ byte[] bid = new byte[10];
+ RANDOM.nextBytes(gid);
+ RANDOM.nextBytes(bid);
+ return new MMXid(0, gid, bid);
+ }
+
+ protected void after(TransactionQueryTestCase test) {
+ boolean delistSuccessful = false;
+ boolean commit = false;
+
+ XAResource xaResource = null;
+ boolean exception = false;
+ try {
+ xaResource = getXAConnection().getXAResource();
+
+ xaResource.end(xid, XAResource.TMSUCCESS);
+
+ if (!test.exceptionExpected() && xaResource.prepare(xid) ==
XAResource.XA_OK) {
+ commit = true;
+ }
+ delistSuccessful = true;
+ } catch (Exception e) {
+ exception = true;
+ throw new TransactionRuntimeException(e);
+ } finally {
+ try {
+ if (!delistSuccessful || test.rollbackAllways()||
test.exceptionOccurred()) {
+ xaResource.rollback(xid);
+ }
+ else if (commit) {
+ xaResource.commit(xid, true);
+ }
+ } catch (Exception e) {
+ if (!exception) {
+ throw new TransactionRuntimeException(e);
+ }
+ }
+ }
+ }
+
+
+ protected XAConnection getXAConnection() throws QueryTestFailedException {
+ return this.connStrategy.getXAConnection();
+ }
+}
Added: branches/JCA/test-integration/db/src/main/java/org/teiid/test/util/PropUtils.java
===================================================================
--- branches/JCA/test-integration/db/src/main/java/org/teiid/test/util/PropUtils.java
(rev 0)
+++
branches/JCA/test-integration/db/src/main/java/org/teiid/test/util/PropUtils.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,42 @@
+package org.teiid.test.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.teiid.test.framework.ConfigPropertyLoader;
+
+public class PropUtils {
+
+
+
+ public static Properties loadProperties(String filename, Properties defaults) {
+ InputStream in = null;
+ Properties props = new Properties();
+ if (defaults != null) {
+ props.putAll(defaults);
+ }
+ try {
+ in = ConfigPropertyLoader.class.getResourceAsStream(filename);
+ if (in != null) {
+ Properties lprops = new Properties();
+ lprops.load(in);
+ props.putAll(lprops);
+
+ }
+ else {
+ throw new RuntimeException("Failed to load properties from file
'"+filename+ "' configuration file");
+ }
+ } catch (IOException e) {
+ throw new RuntimeException("Error loading properties from file
'"+filename+ "'" + e.getMessage());
+ } finally {
+ try {
+ in.close();
+ } catch(Exception e){
+
+ }
+ }
+
+ return props;
+ }
+}
Added: branches/JCA/test-integration/db/src/main/java/org/teiid/test/util/StringUtil.java
===================================================================
--- branches/JCA/test-integration/db/src/main/java/org/teiid/test/util/StringUtil.java
(rev 0)
+++
branches/JCA/test-integration/db/src/main/java/org/teiid/test/util/StringUtil.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * All rights reserved.
+ * This code is made available under the terms of the Eclipse Public
+ * License, version 1.0.
+ */
+
+package org.teiid.test.util;
+
+
+/**
+ * This is a common place to put String utility methods.
+ */
+public final class StringUtil {
+
+
+
+ public static String removeChars(final String value, final char[] chars) {
+ final StringBuffer result = new StringBuffer();
+ if (value != null && chars != null && chars.length > 0) {
+ final String removeChars = String.valueOf(chars);
+ for (int i = 0; i < value.length(); i++) {
+ final String character = value.substring(i, i + 1);
+ if (removeChars.indexOf(character) == -1) {
+ result.append(character);
+ }
+ }
+ } else {
+ result.append(value);
+ }
+ return result.toString();
+ }
+
+
+}
Added: branches/JCA/test-integration/db/src/main/resources/configuration.xml
===================================================================
--- branches/JCA/test-integration/db/src/main/resources/configuration.xml
(rev 0)
+++ branches/JCA/test-integration/db/src/main/resources/configuration.xml 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,458 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ConfigurationDocument>
+ <Header>
+ <ApplicationCreatedBy>Teiid</ApplicationCreatedBy>
+ <ApplicationVersionCreatedBy>6.0</ApplicationVersionCreatedBy>
+ <UserCreatedBy>Configuration</UserCreatedBy>
+ <ConfigurationVersion>6.0</ConfigurationVersion>
+ <MetaMatrixSystemVersion>6.0</MetaMatrixSystemVersion>
+ <Time>2009-03-20T12:23:53.919-06:00</Time>
+ </Header>
+ <Configuration Name="Next Startup"
ComponentType="Configuration" LastChangedBy="ConfigurationStartup"
CreatedBy="ConfigurationStartup">
+ <Properties />
+ </Configuration>
+ <Services>
+ <Service Name="QueryService" ComponentType="QueryService"
QueuedService="false" LastChangedBy="ConfigurationStartup"
CreatedBy="ConfigurationStartup">
+ <Properties>
+ <Property
Name="metamatrix.service.essentialservice">false</Property>
+ <Property
Name="ProcessPoolMaxThreads">64</Property>
+ <Property
Name="ProcessPoolThreadTTL">120000</Property>
+ <Property
Name="ServiceClassName">com.metamatrix.server.query.service.QueryService</Property>
+ <Property
Name="ProcessorTimeslice">2000</Property>
+ <Property Name="MaxCodeTables">50</Property>
+ <Property
Name="MaxCodeTableRecords">10000</Property>
+ <Property Name="MinFetchSize">100</Property>
+ <Property Name="MaxFetchSize">20000</Property>
+ <Property
Name="ResultSetCacheEnabled">0</Property>
+ <Property
Name="ResultSetCacheMaxSize">0</Property>
+ <Property Name="ResultSetCacheMaxAge">0</Property>
+ <Property
Name="ResultSetCacheScope">vdb</Property>
+ <Property Name="MaxPlanCacheSize">100</Property>
+ </Properties>
+ </Service>
+ </Services>
+ <ComponentTypes>
+ <ComponentType Name="Service" ComponentTypeCode="1"
Deployable="false" Deprecated="false" Monitorable="false"
ParentComponentType="VM" LastChangedBy="ConfigurationStartup"
CreatedBy="ConfigurationStartup">
+ <PropertyDefinition Name="ServiceClassName"
DisplayName="Service Class Name" ShortDescription=""
PropertyType="String" IsModifiable="false" IsMasked="false"
/>
+ <PropertyDefinition Name="metamatrix.service.essentialservice"
DisplayName="Essential Service" ShortDescription="Indicates if the service
is essential to operation of the Integration Server" DefaultValue="false"
PropertyType="Boolean" IsModifable="false" IsMasked="false"
/>
+ </ComponentType>
+ <ComponentType Name="QueryService" ComponentTypeCode="1"
Deployable="true" Deprecated="false" Monitorable="true"
SuperComponentType="Service" ParentComponentType="Integration Server"
LastChangedBy="ConfigurationStartup"
CreatedBy="ConfigurationStartup">
+ </ComponentType>
+ <ComponentType Name="Configuration" ComponentTypeCode="0"
Deployable="true" Deprecated="false" Monitorable="false"
LastChangedBy="ConfigurationStartup"
CreatedBy="ConfigurationStartup">
+ </ComponentType>
+ <!--
+
*************************************************************************************
+ Connector Type (This section gets filled by build process at kit
building time)
+
*************************************************************************************
+ -->
+ <ComponentType Name="Connector" ComponentTypeCode="2"
Deployable="false" Deprecated="false" Monitorable="true"
SuperComponentType="Service" ParentComponentType="Connectors"
LastChangedBy="ConfigurationStartup"
LastChangedDate="2008-10-31T10:26:19.916-06:00"
CreatedBy="ConfigurationStartup"
CreationDate="2008-10-31T10:26:19.916-06:00">
+ <PropertyDefinition Name="SourceConnectionTestInterval"
DisplayName="Data Source Test Connect Interval (seconds)"
ShortDescription="How often (in seconds) to create test connections to the underlying
datasource to see if it is available." DefaultValue="600"
IsRequired="true" PropertyType="Integer" IsExpert="true"
/>
+ <PropertyDefinition Name="ConnectorClassPath"
DisplayName="Class Path" ShortDescription="" />
+ <PropertyDefinition Name="ConnectorTypeClassPath"
DisplayName="Connector Type Class Path" ShortDescription="Connector Type
classpath (defined by system)" IsExpert="true"
IsModifiable="false" />
+ <PropertyDefinition Name="UsePostDelegation"
DisplayName="Use Separate Classloader" ShortDescription="Set to true to
indicate that the connector classpath and connector type classpath entries should be
loaded by a connector specific post-delegation class loader."
PropertyType="Boolean" IsRequired="true" IsExpert="true"
DefaultValue="false"/>
+ <PropertyDefinition Name="ExceptionOnMaxRows"
DisplayName="Exception on Exceeding Max Rows" ShortDescription="Indicates
if an Exception should be thrown if the specified value for Maximum Result Rows is
exceeded; else no exception and no more than the maximum will be returned"
DefaultValue="true" IsRequired="true" PropertyType="Boolean"
IsExpert="true" />
+ <PropertyDefinition Name="metamatrix.service.essentialservice"
DisplayName="Essential Service" ShortDescription="Indicates if the service
is essential to operation of the Integration Server" DefaultValue="false"
IsRequired="true" PropertyType="Boolean" IsExpert="true"
IsModifiable="false" />
+ <PropertyDefinition Name="ServiceMonitoringEnabled"
DisplayName="Data Source Monitoring Enabled" ShortDescription="Whether to
monitor the underlying data source to see if it is available."
DefaultValue="true" IsRequired="true" PropertyType="Boolean"
IsExpert="true" />
+ <PropertyDefinition Name="Immutable" DisplayName="Is
Immutable" ShortDescription="True if the source never changes."
DefaultValue="false" IsRequired="true"
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="ConnectorMaxConnections"
DisplayName="Maximum Concurrent Connections" ShortDescription=""
DefaultValue="20" IsRequired="true" PropertyType="Integer"
IsExpert="true" />
+ <PropertyDefinition Name="ConnectorClass"
DisplayName="Connector Class" ShortDescription=""
IsRequired="true" IsExpert="true" IsModifiable="false"
/>
+ <PropertyDefinition Name="ServiceClassName"
DisplayName="Service Class Name" ShortDescription=""
DefaultValue="com.metamatrix.server.connector.service.ConnectorService"
IsRequired="true" IsModifiable="false" />
+ <PropertyDefinition Name="MaxResultRows"
DisplayName="Maximum Result Rows" ShortDescription=""
DefaultValue="10000" IsRequired="true"
PropertyType="Integer" IsExpert="true" />
+ <PropertyDefinition Name="SynchWorkers"
DisplayName="Synchronous Workers" ShortDescription="Whether worker threads
will be bound to connections. Asynch connectors should set this value to false."
DefaultValue="true" IsRequired="true" PropertyType="Boolean"
IsExpert="true" />
+ <PropertyDefinition Name="ResultSetCacheEnabled"
DisplayName="ResultSet Cache Enabled" ShortDescription=""
DefaultValue="false" PropertyType="Boolean"
IsExpert="true" IsMasked="false" />
+ <PropertyDefinition Name="ResultSetCacheMaxSize"
DisplayName="ResultSet Cache Maximum Size (megabytes)"
ShortDescription="" DefaultValue="20" PropertyType="Integer"
IsExpert="true" />
+ <PropertyDefinition Name="ResultSetCacheMaxAge"
DisplayName="ResultSet Cache Maximum Age (milliseconds)"
ShortDescription="" DefaultValue="3600000"
PropertyType="Long" IsExpert="true" />
+ <PropertyDefinition Name="ResultSetCacheScope"
DisplayName="ResultSet Cache Scope" ShortDescription=""
DefaultValue="vdb" IsExpert="true">
+ <AllowedValue>vdb</AllowedValue>
+ <AllowedValue>session</AllowedValue>
+ </PropertyDefinition>
+ <PropertyDefinition Name="IsXA" DisplayName="Is XA"
ShortDescription="Set to true if this is an XA Connector"
DefaultValue="false" IsRequired="true"
PropertyType="Boolean" IsExpert="true" IsMasked="false"
/>
+ <PropertyDefinition Name="ConnectionPoolEnabled"
DisplayName="Connection Pool Enabled" ShortDescription="Enable the use of
connection pooling with this connector." DefaultValue="true"
IsRequired="true" PropertyType="Boolean" IsExpert="true"
IsMasked="false" />
+ <PropertyDefinition Name="UseCredentialMap"
DisplayName="Requires Credential Map" ShortDescription="Set to true if this
connector requires credentials to be passed via a credential map."
DefaultValue="false" IsRequired="true"
PropertyType="Boolean" IsExpert="true" IsMasked="false"
/>
+ <PropertyDefinition Name="AdminConnectionsAllowed"
DisplayName="Admin Connections Allowed" ShortDescription="Whether admin
connections without an execution context are allowed." DefaultValue="true"
IsRequired="true" PropertyType="Boolean" IsExpert="true"
IsMasked="false" />
+ <PropertyDefinition
Name="com.metamatrix.data.pool.max_connections_for_each_id"
DisplayName="Pool Maximum Connections for Each ID" ShortDescription="Set
the maximum number of connections for each connector ID for the connection pool"
DefaultValue="20" IsRequired="true" PropertyType="Integer"
IsExpert="true" IsMasked="false" />
+ <PropertyDefinition
Name="com.metamatrix.data.pool.live_and_unused_time" DisplayName="Pool
Connection Idle Time (seconds)" ShortDescription="Set the idle time of the
connection before it should be closed if pool shrinking is enabled"
DefaultValue="60" PropertyType="Integer" IsExpert="true"
IsMasked="false" />
+ <PropertyDefinition
Name="com.metamatrix.data.pool.wait_for_source_time" DisplayName="Pool
Connection Waiting Time (milliseconds)" ShortDescription="Set the time to wait
if the connection is not available" DefaultValue="120000"
PropertyType="Integer" IsExpert="true" IsMasked="false"
/>
+ <PropertyDefinition
Name="com.metamatrix.data.pool.cleaning_interval" DisplayName="Pool
cleaning Interval (seconds)" ShortDescription="Set the interval to cleaning the
pool" DefaultValue="60" PropertyType="Integer"
IsExpert="true" IsMasked="false" />
+ <PropertyDefinition
Name="com.metamatrix.data.pool.enable_shrinking" DisplayName="Enable Pool
Shrinking" ShortDescription="Set whether to enable the pool shrinking"
DefaultValue="false" PropertyType="Boolean"
IsExpert="true" IsMasked="false" />
+ <PropertyDefinition Name="supportsCompareCriteriaEquals"
DisplayName="supportsCompareCriteriaEquals" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsCompareCriteriaOrdered"
DisplayName="supportsCompareCriteriaOrdered" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsInCriteria"
DisplayName="supportsInCriteria" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="getMaxInCriteriaSize"
DisplayName="getMaxInCriteriaSize" ShortDescription=""
PropertyType="Integer" IsExpert="true" />
+ <PropertyDefinition Name="supportsIsNullCriteria"
DisplayName="supportsIsNullCriteria" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsLikeCriteria"
DisplayName="supportsLikeCriteria" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsLikeCriteriaEscapeCharacter"
DisplayName="supportsLikeCriteriaEscapeCharacter" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsNotCriteria"
DisplayName="supportsNotCriteria" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsOrCriteria"
DisplayName="supportsOrCriteria" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsBetweenCriteria"
DisplayName="supportsBetweenCriteria" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsSelectDistinct"
DisplayName="supportsSelectDistinct" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsSelectExpression"
DisplayName="supportsSelectExpression" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsInnerJoins"
DisplayName="supportsInnerJoins" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsAliasedGroup"
DisplayName="supportsAliasedGroup" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsSelfJoins"
DisplayName="supportsSelfJoins" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsOuterJoins"
DisplayName="supportsOuterJoins" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsFullOuterJoins"
DisplayName="supportsFullOuterJoins" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="getMaxFromGroups"
DisplayName="getMaxFromGroups" ShortDescription=""
PropertyType="Integer" IsExpert="true" />
+ <PropertyDefinition Name="getSupportedJoinCriteria"
DisplayName="getSupportedJoinCriteria" ShortDescription=""
PropertyType="String" IsExpert="true" >
+ <AllowedValue>ANY</AllowedValue>
+ <AllowedValue>THETA</AllowedValue>
+ <AllowedValue>EQUI</AllowedValue>
+ <AllowedValue>KEY</AllowedValue>
+ </PropertyDefinition>
+ <PropertyDefinition Name="supportsOrderBy"
DisplayName="supportsOrderBy" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsGroupBy"
DisplayName="supportsGroupBy" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsFunctionsInGroupBy"
DisplayName="supportsFunctionsInGroupBy" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsHaving"
DisplayName="supportsHaving" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsAggregatesSum"
DisplayName="supportsAggregatesSum" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsAggregatesAvg"
DisplayName="supportsAggregatesAvg" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsAggregatesMin"
DisplayName="supportsAggregatesMin" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsAggregatesMax"
DisplayName="supportsAggregatesMax" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsAggregatesCount"
DisplayName="supportsAggregatesCount" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsAggregatesCountStar"
DisplayName="supportsAggregatesCountStar" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsAggregatesDistinct"
DisplayName="supportsAggregatesDistinct" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsInCriteriaSubquery"
DisplayName="supportsInCriteriaSubquery" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsExistsCriteria"
DisplayName="supportsExistsCriteria" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsQuantifiedCompareCriteriaSome"
DisplayName="supportsQuantifiedCompareCriteriaSome"
ShortDescription="" PropertyType="Boolean" IsExpert="true"
/>
+ <PropertyDefinition Name="supportsQuantifiedCompareCriteriaAll"
DisplayName="supportsQuantifiedCompareCriteriaAll" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsScalarSubqueries"
DisplayName="supportsScalarSubqueries" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsCorrelatedSubqueries"
DisplayName="supportsCorrelatedSubqueries" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsCaseExpressions"
DisplayName="supportsCaseExpressions" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsSearchedCaseExpressions"
DisplayName="supportsSearchedCaseExpressions" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="getSupportedFunctions"
DisplayName="getSupportedFunctions" ShortDescription=""
PropertyType="string" IsExpert="true" />
+ <PropertyDefinition Name="supportsInlineViews"
DisplayName="supportsInlineViews" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsSetQueryOrderBy"
DisplayName="supportsSetQueryOrderBy" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsUnions"
DisplayName="supportsUnions" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsIntersect"
DisplayName="supportsIntersect" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsExcept"
DisplayName="supportsExcept" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="requiresCriteria"
DisplayName="requiresCriteria" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="useAnsiJoin"
DisplayName="useAnsiJoin" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsBatchedUpdates"
DisplayName="supportsBatchedUpdates" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsBulkUpdate"
DisplayName="supportsBulkUpdate" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsInsertWithQueryExpression"
DisplayName="supportsInsertWithQueryExpression" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsRowLimit"
DisplayName="supportsRowLimit" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="supportsRowOffset"
DisplayName="supportsRowOffset" ShortDescription=""
PropertyType="Boolean" IsExpert="true" />
+ </ComponentType>
+ <ComponentType Name="JDBC Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="Connector"
ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup"
LastChangedDate="2008-10-31T10:26:19.952-06:00"
CreatedBy="ConfigurationStartup"
CreationDate="2008-10-31T10:26:19.952-06:00">
+ <PropertyDefinition Name="URL" DisplayName="JDBC URL"
ShortDescription="" DefaultValue="jdbc:" IsRequired="true"
PropertyType="String"/>
+ <PropertyDefinition Name="User" DisplayName="User
Name" ShortDescription="" />
+ <PropertyDefinition Name="Password"
DisplayName="Password" ShortDescription="" IsMasked="true"
/>
+ <PropertyDefinition Name="ConnectorTypeClassPath"
DisplayName="Connector Type Class Path" ShortDescription="Connector Type
classpath (defined by system, do not modify)"
DefaultValue="extensionjar:connector_patch.jar;extensionjar:connector-jdbc-6.2.0-SNAPSHOT.jar;"
IsModifiable="false" />
+ <PropertyDefinition Name="UseBindVariables" DisplayName="Use
prepared statements and bind variables" ShortDescription=""
DefaultValue="false" PropertyType="Boolean" IsExpert="true"
/>
+ <PropertyDefinition Name="ExtensionCapabilityClass"
DisplayName="Extension Capability Class" ShortDescription=""
IsExpert="true" />
+ <PropertyDefinition Name="ConnectorClass"
DisplayName="Connector Class" ShortDescription=""
DefaultValue="org.teiid.connector.jdbc.JDBCConnector"
IsRequired="true" IsExpert="true" />
+ <PropertyDefinition Name="DatabaseTimeZone"
DisplayName="Database time zone" ShortDescription="Time zone of the
database, if different than Integration Server" IsExpert="true" />
+ <PropertyDefinition Name="TransactionIsolationLevel"
DisplayName="Transaction Isolation Level" ShortDescription="Set the data
source transaction isolation level" IsExpert="true" >
+ <AllowedValue>TRANSACTION_READ_UNCOMMITTED</AllowedValue>
+ <AllowedValue>TRANSACTION_READ_COMMITTED</AllowedValue>
+ <AllowedValue>TRANSACTION_SERIALIZABLE</AllowedValue>
+ <AllowedValue>TRANSACTION_NONE</AllowedValue>
+ </PropertyDefinition>
+ <PropertyDefinition Name="ExtensionTranslationClass"
DisplayName="Extension SQL Translation Class" ShortDescription=""
DefaultValue="org.teiid.connector.jdbc.translator.Translator"
IsExpert="true" />
+ <PropertyDefinition Name="ConnectionSource"
DisplayName="Connection Source Class" ShortDescription="Driver, DataSource,
or XADataSource class name" IsRequired="true" />
+ <PropertyDefinition Name="TrimStrings" DisplayName="Trim
string flag" ShortDescription="Right Trim fixed character types returned as
Strings" DefaultValue="false" PropertyType="Boolean"
IsExpert="true" />
+ <PropertyDefinition Name="UseCommentsInSourceQuery"
DisplayName="Use informational comments in Source Queries"
ShortDescription="This will embed /*comment*/ style comment with session/request id
in source SQL query for informational purposes" DefaultValue="false"
PropertyType="Boolean" IsExpert="true"/>
+ </ComponentType>
+ <ComponentType Name="Oracle Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="JDBC Connector"
ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup"
CreatedBy="ConfigurationStartup">
+ <PropertyDefinition Name="ConnectionSource"
DisplayName="Connection Source Class" ShortDescription="Driver, DataSource,
or XADataSource class name" DefaultValue="oracle.jdbc.driver.OracleDriver"
IsRequired="true" />
+ <PropertyDefinition Name="URL" DisplayName="JDBC URL"
ShortDescription=""
DefaultValue="jdbc:oracle:thin:@<host>:1521:<sid>"
IsRequired="true" PropertyType="String" IsMasked="false"
/>
+ <PropertyDefinition Name="ExtensionTranslationClass"
DisplayName="Extension SQL Translation Class" ShortDescription=""
DefaultValue="org.teiid.connector.jdbc.oracle.OracleSQLTranslator"
PropertyType="String" IsExpert="true" IsMasked="false"
/>
+ </ComponentType>
+ <ComponentType Name="Oracle XA Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="JDBC Connector"
ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup"
CreatedBy="ConfigurationStartup">
+ <PropertyDefinition Name="ConnectionSource"
DisplayName="Connection Source Class" ShortDescription="Driver, DataSource,
or XADataSource class name"
DefaultValue="oracle.jdbc.xa.client.OracleXADataSource"
IsRequired="true" />
+ <PropertyDefinition Name="URL" DisplayName="JDBC URL"
ShortDescription=""
DefaultValue="jdbc:oracle:thin:@<host>:1521:<sid>"
IsRequired="true" PropertyType="String" IsMasked="false"
/>
+ <PropertyDefinition Name="ExtensionTranslationClass"
DisplayName="Extension SQL Translation Class" ShortDescription=""
DefaultValue="org.teiid.connector.jdbc.oracle.OracleSQLTranslator"
PropertyType="String" IsExpert="true" IsMasked="false"
/>
+ <PropertyDefinition Name="IsXA" DisplayName="Is XA"
ShortDescription="Is XA" DefaultValue="true"
IsRequired="true" PropertyType="Boolean" />
+ </ComponentType>
+ <ComponentType Name="DB2 Connector" ComponentTypeCode="2"
Deployable="true" Deprecated="false" Monitorable="false"
SuperComponentType="JDBC Connector" ParentComponentType="Connectors"
LastChangedBy="ConfigurationStartup"
CreatedBy="ConfigurationStartup">
+ <PropertyDefinition Name="ConnectionSource"
DisplayName="Connection Source Class" ShortDescription="Driver, DataSource,
or XADataSource class name" DefaultValue="com.ibm.db2.jcc.DB2Driver"
IsRequired="true" />
+ <PropertyDefinition Name="URL" DisplayName="JDBC URL"
ShortDescription=""
DefaultValue="jdbc:db2://<server>:50000/<db-name>"
IsRequired="true" PropertyType="String" IsMasked="false"
/>
+ <PropertyDefinition Name="ExtensionTranslationClass"
DisplayName="Extension SQL Translation Class" ShortDescription=""
DefaultValue="org.teiid.connector.jdbc.db2.DB2SQLTranslator"
PropertyType="String" IsExpert="true" IsMasked="false"
/>
+ </ComponentType>
+ <ComponentType Name="DB2 XA Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="JDBC Connector"
ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup"
CreatedBy="ConfigurationStartup">
+ <PropertyDefinition Name="ConnectionSource"
DisplayName="Connection Source Class" ShortDescription="Driver, DataSource,
or XADataSource class name" DefaultValue="com.ibm.db2.jcc.DB2XADataSource"
IsRequired="true" />
+ <PropertyDefinition Name="PortNumber" DisplayName="Port
Number" DefaultValue="50000" ShortDescription=""
IsRequired="true" PropertyType="Integer" IsMasked="false"
/>
+ <PropertyDefinition Name="ServerName" DisplayName="Server Name"
ShortDescription="" IsRequired="true" PropertyType="String"
IsMasked="false" />
+ <PropertyDefinition Name="DatabaseName"
DisplayName="Database Name" ShortDescription=""
IsRequired="true" PropertyType="String" IsMasked="false"
/>
+ <PropertyDefinition Name="DriverType" DisplayName="Driver
Type" ShortDescription="" DefaultValue="4"
IsRequired="true" PropertyType="Integer" IsMasked="false"
/>
+ <PropertyDefinition Name="ExtensionTranslationClass"
DisplayName="Extension SQL Translation Class" ShortDescription=""
DefaultValue="org.teiid.connector.jdbc.db2.DB2SQLTranslator"
PropertyType="String" IsExpert="true" IsMasked="false"
/>
+ <PropertyDefinition Name="IsXA" DisplayName="Is XA"
ShortDescription="Is XA" DefaultValue="true"
IsRequired="true" PropertyType="Boolean" />
+ </ComponentType>
+ <ComponentType Name="SQL Server Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="JDBC Connector"
ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup"
CreatedBy="ConfigurationStartup">
+ <PropertyDefinition Name="ConnectionSource"
DisplayName="Connection Source Class" ShortDescription="Driver, DataSource,
or XADataSource class name"
DefaultValue="com.microsoft.sqlserver.jdbc.SQLServerDriver"
IsRequired="true" />
+ <PropertyDefinition Name="URL" DisplayName="JDBC URL"
ShortDescription=""
DefaultValue="jdbc:sqlserver://<host>:1433;databaseName=<db-name>"
IsRequired="true" PropertyType="String" IsMasked="false"
/>
+ <PropertyDefinition Name="ExtensionTranslationClass"
DisplayName="Extension SQL Translation Class" ShortDescription=""
DefaultValue="org.teiid.connector.jdbc.sqlserver.SqlServerSQLTranslator"
PropertyType="String" IsExpert="true" IsMasked="false"
/>
+ </ComponentType>
+ <ComponentType Name="SQL Server XA Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="JDBC Connector"
ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup"
CreatedBy="ConfigurationStartup">
+ <PropertyDefinition Name="ConnectionSource"
DisplayName="Connection Source Class" ShortDescription="Driver, DataSource,
or XADataSource class name"
DefaultValue="com.microsoft.sqlserver.jdbc.SQLServerXADataSource"
IsRequired="true" />
+ <PropertyDefinition Name="PortNumber" DisplayName="Port
Number" DefaultValue="1433" ShortDescription=""
IsRequired="true" PropertyType="Integer" IsMasked="false"
/>
+ <PropertyDefinition Name="ServerName" DisplayName="Server Name"
ShortDescription="" IsRequired="true" PropertyType="String"
IsMasked="false" />
+ <PropertyDefinition Name="DatabaseName"
DisplayName="Database Name" ShortDescription=""
IsRequired="true" PropertyType="String" IsMasked="false"
/>
+ <PropertyDefinition Name="ExtensionTranslationClass"
DisplayName="Extension SQL Translation Class" ShortDescription=""
DefaultValue="org.teiid.connector.jdbc.sqlserver.SqlServerSQLTranslator"
PropertyType="String" IsExpert="true" IsMasked="false"
/>
+ <PropertyDefinition Name="IsXA" DisplayName="Is XA"
ShortDescription="Is XA" DefaultValue="true"
IsRequired="true" PropertyType="Boolean" />
+ </ComponentType>
+ <ComponentType Name="MySQL JDBC Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="JDBC Connector"
ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup"
CreatedBy="ConfigurationStartup">
+ <PropertyDefinition Name="ConnectionSource"
DisplayName="Connection Source Class" ShortDescription="Driver, DataSource,
or XADataSource class name" DefaultValue="com.mysql.jdbc.Driver"
IsRequired="true" />
+ <PropertyDefinition Name="URL" DisplayName="JDBC URL"
ShortDescription=""
DefaultValue="jdbc:mysql://<host>:3306/<databaseName>"
IsRequired="true" PropertyType="String" IsMasked="false"
/>
+ <PropertyDefinition Name="ExtensionTranslationClass"
DisplayName="Extension SQL Translation Class" ShortDescription=""
DefaultValue="org.teiid.connector.jdbc.mysql.MySQLTranslator"
PropertyType="String" IsExpert="true" IsMasked="false"
/>
+ </ComponentType>
+ <ComponentType Name="MySQL 5 JDBC Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="JDBC Connector"
ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup"
CreatedBy="ConfigurationStartup">
+ <PropertyDefinition Name="ConnectionSource"
DisplayName="Connection Source Class" ShortDescription="Driver, DataSource,
or XADataSource class name" DefaultValue="com.mysql.jdbc.Driver"
IsRequired="true" />
+ <PropertyDefinition Name="URL" DisplayName="JDBC URL"
ShortDescription=""
DefaultValue="jdbc:mysql://<host>:3306/<databaseName>"
IsRequired="true" PropertyType="String" IsMasked="false"
/>
+ <PropertyDefinition Name="ExtensionTranslationClass"
DisplayName="Extension SQL Translation Class" ShortDescription=""
DefaultValue="org.teiid.connector.jdbc.mysql.MySQL5Translator"
PropertyType="String" IsExpert="true" IsMasked="false"
/>
+ </ComponentType>
+ <ComponentType Name="MySQL JDBC XA Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="JDBC Connector"
ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup"
CreatedBy="ConfigurationStartup">
+ <PropertyDefinition Name="ConnectionSource"
DisplayName="Connection Source Class" ShortDescription="Driver, DataSource,
or XADataSource class name"
DefaultValue="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource"
IsRequired="true" />
+ <PropertyDefinition Name="PortNumber" DisplayName="Port
Number" DefaultValue="3306" ShortDescription=""
IsRequired="true" PropertyType="Integer" IsMasked="false"
/>
+ <PropertyDefinition Name="ServerName" DisplayName="Server Name"
ShortDescription="" IsRequired="true" PropertyType="String"
IsMasked="false" />
+ <PropertyDefinition Name="DatabaseName"
DisplayName="Database Name" ShortDescription=""
IsRequired="true" PropertyType="String" IsMasked="false"
/>
+ <PropertyDefinition Name="ExtensionTranslationClass"
DisplayName="Extension SQL Translation Class" ShortDescription=""
DefaultValue="org.teiid.connector.jdbc.mysql.MySQLTranslator"
PropertyType="String" IsExpert="true" IsMasked="false"
/>
+ <PropertyDefinition Name="IsXA" DisplayName="Is XA"
ShortDescription="Is XA" DefaultValue="true"
IsRequired="true" PropertyType="Boolean" />
+ </ComponentType>
+ <ComponentType Name="MySQL 5 JDBC XA Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="JDBC Connector"
ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup"
CreatedBy="ConfigurationStartup">
+ <PropertyDefinition Name="ConnectionSource"
DisplayName="Connection Source Class" ShortDescription="Driver, DataSource,
or XADataSource class name"
DefaultValue="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource"
IsRequired="true" />
+ <PropertyDefinition Name="PortNumber" DisplayName="Port
Number" DefaultValue="3306" ShortDescription=""
IsRequired="true" PropertyType="Integer" IsMasked="false"
/>
+ <PropertyDefinition Name="ServerName" DisplayName="Server Name"
ShortDescription="" IsRequired="true" PropertyType="String"
IsMasked="false" />
+ <PropertyDefinition Name="DatabaseName"
DisplayName="Database Name" ShortDescription=""
IsRequired="true" PropertyType="String" IsMasked="false"
/>
+ <PropertyDefinition Name="ExtensionTranslationClass"
DisplayName="Extension SQL Translation Class" ShortDescription=""
DefaultValue="org.teiid.connector.jdbc.mysql.MySQL5Translator"
PropertyType="String" IsExpert="true" IsMasked="false"
/>
+ <PropertyDefinition Name="IsXA" DisplayName="Is XA"
ShortDescription="Is XA" DefaultValue="true"
IsRequired="true" PropertyType="Boolean" />
+ </ComponentType>
+ <ComponentType Name="PostgreSQL JDBC Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="JDBC Connector"
ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup"
CreatedBy="ConfigurationStartup">
+ <PropertyDefinition Name="ConnectionSource"
DisplayName="Connection Source Class" ShortDescription="Driver, DataSource,
or XADataSource class name" DefaultValue="org.postgresql.Driver"
IsRequired="true" />
+ <PropertyDefinition Name="URL" DisplayName="JDBC URL"
ShortDescription=""
DefaultValue="jdbc:postgresql://<host>:5432/<databaseName>"
IsRequired="true" PropertyType="String" IsMasked="false"
/>
+ <PropertyDefinition Name="ExtensionTranslationClass"
DisplayName="Extension SQL Translation Class" ShortDescription=""
DefaultValue="org.teiid.connector.jdbc.postgresql.PostgreSQLTranslator"
PropertyType="String" IsExpert="true" IsMasked="false"
/>
+ <PropertyDefinition Name="DatabaseVersion"
DisplayName="Database Version" ShortDescription="PostgreSQL Version i.e.
8.3" DefaultValue="8.0" PropertyType="String" />
+ </ComponentType>
+ <ComponentType Name="PostgreSQL XA JDBC Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="JDBC Connector"
ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup"
CreatedBy="ConfigurationStartup">
+ <PropertyDefinition Name="ConnectionSource"
DisplayName="Connection Source Class" ShortDescription="Driver, DataSource,
or XADataSource class name" DefaultValue="org.postgresql.xa.PGXADataSource"
IsRequired="true" />
+ <PropertyDefinition Name="PortNumber" DisplayName="Port
Number" DefaultValue="5432" ShortDescription=""
IsRequired="true" PropertyType="Integer" IsMasked="false"
/>
+ <PropertyDefinition Name="ServerName" DisplayName="Server Name"
ShortDescription="" IsRequired="true" PropertyType="String"
IsMasked="false" />
+ <PropertyDefinition Name="DatabaseName"
DisplayName="Database Name" ShortDescription=""
IsRequired="true" PropertyType="String" IsMasked="false"
/>
+ <PropertyDefinition Name="ExtensionTranslationClass"
DisplayName="Extension SQL Translation Class" ShortDescription=""
DefaultValue="org.teiid.connector.jdbc.postgresql.PostgreSQLTranslator"
PropertyType="String" IsExpert="true" IsMasked="false"
/>
+ <PropertyDefinition Name="IsXA" DisplayName="Is XA"
ShortDescription="Is XA" DefaultValue="true"
IsRequired="true" PropertyType="Boolean" />
+ <PropertyDefinition Name="DatabaseVersion"
DisplayName="Database Version" ShortDescription="PostgreSQL Version i.e.
8.3" DefaultValue="8.0" PropertyType="String" />
+ </ComponentType>
+ <ComponentType Name="Apache Derby Embedded Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="JDBC Connector"
ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup"
CreatedBy="ConfigurationStartup">
+ <PropertyDefinition Name="ConnectionSource"
DisplayName="Connection Source Class" ShortDescription="Driver, DataSource,
or XADataSource class name"
DefaultValue="org.apache.derby.jdbc.EmbeddedDriver" IsRequired="true"
/>
+ <PropertyDefinition Name="URL" DisplayName="JDBC URL"
ShortDescription=""
DefaultValue="jdbc:derby:<databaseName>"
IsRequired="true" PropertyType="String" IsMasked="false"
/>
+ <PropertyDefinition Name="ExtensionTranslationClass"
DisplayName="Extension SQL Translation Class" ShortDescription=""
DefaultValue="org.teiid.connector.jdbc.derby.DerbySQLTranslator"
PropertyType="String" IsExpert="true" IsMasked="false"
/>
+ <PropertyDefinition Name="DatabaseVersion" DisplayName="Database
Version" ShortDescription="Derby Version i.e. 10.3"
DefaultValue="10.1" PropertyType="String" />
+ </ComponentType>
+ <ComponentType Name="Apache Derby Network Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="JDBC Connector"
ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup"
CreatedBy="ConfigurationStartup">
+ <PropertyDefinition Name="ConnectionSource"
DisplayName="Connection Source Class" ShortDescription="Driver, DataSource,
or XADataSource class name"
DefaultValue="org.apache.derby.jdbc.ClientDriver" IsRequired="true"
/>
+ <PropertyDefinition Name="URL" DisplayName="JDBC URL"
ShortDescription=""
DefaultValue="jdbc:derby://localhost:1527/<path/to/db>"
IsRequired="true" PropertyType="String" IsMasked="false"
/>
+ <PropertyDefinition Name="ExtensionTranslationClass"
DisplayName="Extension SQL Translation Class" ShortDescription=""
DefaultValue="org.teiid.connector.jdbc.derby.DerbySQLTranslator"
PropertyType="String" IsExpert="true" IsMasked="false"
/>
+ <PropertyDefinition Name="DatabaseVersion"
DisplayName="Database Version" ShortDescription="Derby Version i.e.
10.3" DefaultValue="10.1" PropertyType="String" />
+ </ComponentType>
+ <ComponentType Name="Apache Derby XA Network Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="JDBC Connector"
ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup"
CreatedBy="ConfigurationStartup">
+ <PropertyDefinition Name="ConnectionSource"
DisplayName="Connection Source Class" ShortDescription="Driver, DataSource,
or XADataSource class name"
DefaultValue="org.apache.derby.jdbc.ClientXADataSource"
IsRequired="true" />
+ <PropertyDefinition Name="PortNumber" DisplayName="Port
Number" DefaultValue="1527" ShortDescription=""
IsRequired="true" PropertyType="Integer" IsMasked="false"
/>
+ <PropertyDefinition Name="ServerName" DisplayName="Server Name"
ShortDescription="" IsRequired="true" PropertyType="String"
IsMasked="false" />
+ <PropertyDefinition Name="DatabaseName"
DisplayName="Database Name" ShortDescription=""
IsRequired="true" PropertyType="String" IsMasked="false"
/>
+ <PropertyDefinition Name="ExtensionTranslationClass"
DisplayName="Extension SQL Translation Class" ShortDescription=""
DefaultValue="org.teiid.connector.jdbc.derby.DerbySQLTranslator"
PropertyType="String" IsExpert="true" IsMasked="false"
/>
+ <PropertyDefinition Name="IsXA" DisplayName="Is XA"
ShortDescription="Is XA" DefaultValue="true"
IsRequired="true" PropertyType="Boolean" />
+ </ComponentType>
+ <ComponentType Name="Teiid 6 JDBC Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="JDBC Connector"
ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup"
CreatedBy="ConfigurationStartup">
+ <PropertyDefinition Name="ConnectionSource"
DisplayName="Connection Source Class" ShortDescription="Driver, DataSource,
or XADataSource class name" DefaultValue="com.metamatrix.jdbc.MMDriver"
IsRequired="true" />
+ <PropertyDefinition Name="URL" DisplayName="JDBC URL"
ShortDescription=""
DefaultValue="jdbc:metamatrix:<vdbName>@mm://<host>:<port>"
IsRequired="true" />
+ </ComponentType>
+ <ComponentType Name="JDBC ODBC Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="JDBC Connector"
ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup"
CreatedBy="ConfigurationStartup">
+ <PropertyDefinition Name="ConnectionSource"
DisplayName="Connection Source Class" ShortDescription="Driver, DataSource,
or XADataSource class name" DefaultValue="sun.jdbc.odbc.JdbcOdbcDriver"
IsRequired="true" />
+ <PropertyDefinition Name="URL" DisplayName="JDBC URL"
ShortDescription=""
DefaultValue="jdbc:odbc:<data-source-name>[;UID=<xxx>
;PWD=<xxx>]" IsRequired="true" />
+ </ComponentType>
+ <ComponentType Name="MS Access Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="JDBC Connector"
ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup"
CreatedBy="ConfigurationStartup">
+ <PropertyDefinition Name="ConnectionSource"
DisplayName="Connection Source Class" ShortDescription="Driver, DataSource,
or XADataSource class name" DefaultValue="sun.jdbc.odbc.JdbcOdbcDriver"
IsRequired="true" />
+ <PropertyDefinition Name="URL" DisplayName="JDBC URL"
ShortDescription="" DefaultValue="jdbc:odbc:Driver={MicroSoft Access Driver
(*.mdb)};DBQ=<data-source-name>" IsRequired="true" />
+ <PropertyDefinition Name="ExtensionTranslationClass"
DisplayName="Extension SQL Translation Class" ShortDescription=""
DefaultValue="org.teiid.connector.jdbc.access.AccessSQLTranslator"
IsExpert="true" />
+ </ComponentType>
+ <ComponentType Name="MS Excel Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="JDBC Connector"
ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup"
LastChangedDate="2006-02-08T11:02:36.029-06:00"
CreatedBy="ConfigurationStartup"
CreationDate="2006-02-08T11:02:36.029-06:00">
+ <PropertyDefinition Name="ConnectionSource"
DisplayName="Connection Source Class" ShortDescription="Driver, DataSource,
or XADataSource class name" DefaultValue="sun.jdbc.odbc.JdbcOdbcDriver"
IsRequired="true" />
+ <PropertyDefinition Name="URL" DisplayName="JDBC URL"
ShortDescription="" DefaultValue="jdbc:odbc:Driver={MicroSoft Excel Driver
(*.xls)};DBQ=<filePathToExcelFile>" IsRequired="true"
/>
+ </ComponentType>
+
+ <ComponentType Name="Datadirect DB2 8 Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="JDBC Connector"
ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup"
LastChangedDate="2008-10-31T10:26:19.928-06:00"
CreatedBy="ConfigurationStartup"
CreationDate="2008-10-31T10:26:19.928-06:00">
+ <PropertyDefinition Name="ConnectionSource"
DisplayName="Connection Source Class" ShortDescription="Driver, DataSource,
or XADataSource class name"
DefaultValue="com.metamatrix.jdbcx.db2.DB2DataSource"
IsRequired="true" />
+ <PropertyDefinition Name="URL" DisplayName="JDBC URL"
ShortDescription=""
DefaultValue="jdbc:mmx:db2://<host>:50000;DatabaseName=<databasename>;CollectionID=<collectionid>;PackageName=<packagename>"
IsRequired="true" />
+ <PropertyDefinition Name="ExtensionTranslationClass"
DisplayName="Extension SQL Translation Class" ShortDescription=""
DefaultValue="org.teiid.connector.jdbc.db2.DB2SQLTranslator"
IsExpert="true" />
+ <PropertyDefinition Name="IsXA" DisplayName="Is XA"
ShortDescription="Is XA" DefaultValue="true"
IsRequired="true" PropertyType="Boolean" />
+ </ComponentType>
+ <ComponentType Name="Datadirect Oracle 9 Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="JDBC Connector"
ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup"
LastChangedDate="2008-10-31T10:26:19.923-06:00"
CreatedBy="ConfigurationStartup"
CreationDate="2008-10-31T10:26:19.923-06:00">
+ <PropertyDefinition Name="ConnectionSource"
DisplayName="Connection Source Class" ShortDescription="Driver, DataSource,
or XADataSource class name"
DefaultValue="com.metamatrix.jdbcx.oracle.OracleDataSource"
IsRequired="true" />
+ <PropertyDefinition Name="URL" DisplayName="JDBC URL"
ShortDescription=""
DefaultValue="jdbc:mmx:oracle://<host>:1521;SID=<sid>"
IsRequired="true" />
+ <PropertyDefinition Name="ExtensionTranslationClass"
DisplayName="Extension SQL Translation Class" ShortDescription=""
DefaultValue="org.teiid.connector.jdbc.oracle.OracleSQLTranslator"
IsExpert="true" />
+ <PropertyDefinition Name="IsXA" DisplayName="Is XA"
ShortDescription="Is XA" DefaultValue="true"
IsRequired="true" PropertyType="Boolean" />
+ </ComponentType>
+ <ComponentType Name="Datadirect SQL Server 2003 Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="JDBC Connector"
ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup"
LastChangedDate="2008-10-31T10:26:19.935-06:00"
CreatedBy="ConfigurationStartup"
CreationDate="2008-10-31T10:26:19.935-06:00">
+ <PropertyDefinition Name="ConnectionSource"
DisplayName="Connection Source Class" ShortDescription="Driver, DataSource,
or XADataSource class name"
DefaultValue="com.metamatrix.jdbcx.sqlserver.SQLServerDataSource"
IsRequired="true" />
+ <PropertyDefinition Name="URL" DisplayName="JDBC URL"
ShortDescription=""
DefaultValue="jdbc:mmx:sqlserver://<host>:1433;DatabaseName=<databasename>"
IsRequired="true" />
+ <PropertyDefinition Name="ExtensionTranslationClass"
DisplayName="Extension SQL Translation Class" ShortDescription=""
DefaultValue="org.teiid.connector.jdbc.sqlserver.SqlServerSQLTranslator"
IsExpert="true" />
+ <PropertyDefinition Name="IsXA" DisplayName="Is XA"
ShortDescription="Is XA" DefaultValue="true"
IsRequired="true" PropertyType="Boolean" />
+ </ComponentType>
+ <ComponentType Name="Datadirect Sybase 12 Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="JDBC Connector"
ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup"
LastChangedDate="2008-10-31T10:26:19.930-06:00"
CreatedBy="ConfigurationStartup"
CreationDate="2008-10-31T10:26:19.930-06:00">
+ <PropertyDefinition Name="ConnectionSource"
DisplayName="Connection Source Class" ShortDescription="Driver, DataSource,
or XADataSource class name"
DefaultValue="com.metamatrix.jdbcx.sybase.SybaseDataSource"
IsRequired="true" />
+ <PropertyDefinition Name="URL" DisplayName="JDBC URL"
ShortDescription=""
DefaultValue="jdbc:mmx:sybase://<host>:5000;DatabaseName=<databasename>"
IsRequired="true" />
+ <PropertyDefinition Name="ExtensionTranslationClass"
DisplayName="Extension SQL Translation Class" ShortDescription=""
DefaultValue="org.teiid.connector.jdbc.sybase.SybaseSQLTranslator"
IsExpert="true" />
+ <PropertyDefinition Name="IsXA" DisplayName="Is XA"
ShortDescription="Is XA" DefaultValue="true"
IsRequired="true" PropertyType="Boolean" />
+ <PropertyDefinition Name="SetCriteriaBatchSize"
DisplayName="Max Values in IN Predicate" ShortDescription="Max number of
values in an IN Predicate. Must be >= 0." DefaultValue="250"
PropertyType="Integer" IsExpert="true" />
+ </ComponentType>
+
<ComponentType Name="LDAP Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="Connector"
ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup"
LastChangedDate="2008-10-31T10:26:19.946-06:00"
CreatedBy="ConfigurationStartup"
CreationDate="2008-10-31T10:26:19.946-06:00">
+ <PropertyDefinition Name="ConnectorTypeClassPath"
DisplayName="Connector Type Class Path" ShortDescription="Connector Type
classpath (defined by system, do not modify)"
DefaultValue="extensionjar:connector_patch.jar;extensionjar:connector-ldap-6.2.0-SNAPSHOT.jar;"
IsModifiable="false" />
+ <PropertyDefinition Name="SearchDefaultBaseDN" DisplayName="Default
Search Base DN" ShortDescription="Default Base DN for LDAP Searches"
IsExpert="true" />
+ <PropertyDefinition Name="LdapAdminUserDN"
DisplayName="Ldap Admin User DN" ShortDescription="User DN for the LDAP
admin account."
DefaultValue="cn=<>,ou=<>,dc=<>"
IsRequired="true" />
+ <PropertyDefinition Name="Standard" DisplayName="Standard
Type" ShortDescription="Standard Built-in Connector Type"
DefaultValue="true" PropertyType="Boolean" IsExpert="true"
IsModifiable="false" />
+ <PropertyDefinition Name="ConnectorClass"
DisplayName="Connector Class" ShortDescription=""
DefaultValue="com.metamatrix.connector.ldap.LDAPConnector"
IsRequired="true" IsExpert="true" />
+ <PropertyDefinition Name="LdapAdminUserPassword"
DisplayName="Ldap Admin Password" ShortDescription="Password of the LDAP
admin user account." IsRequired="true" IsMasked="true" />
+ <PropertyDefinition Name="SearchDefaultScope"
DisplayName="Default Search Scope" ShortDescription="Default Scope for LDAP
Searches" DefaultValue="SUBTREE_SCOPE" IsRequired="true">
+ <AllowedValue>OBJECT_SCOPE</AllowedValue>
+ <AllowedValue>ONELEVEL_SCOPE</AllowedValue>
+ <AllowedValue>SUBTREE_SCOPE</AllowedValue>
+ </PropertyDefinition>
+ <PropertyDefinition Name="RestrictToObjectClass"
DisplayName="Restrict Searches To Named Object Class"
ShortDescription="Restrict Searches to objectClass named in the Name field for a
table" DefaultValue="false" PropertyType="Boolean"
IsExpert="true" />
+ <PropertyDefinition Name="LdapTxnTimeoutInMillis"
DisplayName="Ldap Transaction Timeout (ms)" ShortDescription="Timeout value
for LDAP searches. Defaults to TCP timeout value." />
+ <PropertyDefinition Name="LdapUrl" DisplayName="Ldap
URL" ShortDescription="Ldap URL of the server, including port number."
DefaultValue="ldap://<ldapServer>:<389>"
IsRequired="true" />
+ </ComponentType>
+ <ComponentType Name="Loopback Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="Connector"
ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup"
LastChangedDate="2008-10-31T10:26:19.945-06:00"
CreatedBy="ConfigurationStartup"
CreationDate="2008-10-31T10:26:19.945-06:00">
+ <PropertyDefinition Name="ConnectorTypeClassPath"
DisplayName="Connector Type Class Path" ShortDescription="Connector Type
classpath (defined by system, do not modify)"
DefaultValue="extensionjar:connector_patch.jar;extensionjar:connector-loopback-6.2.0-SNAPSHOT.jar;"
IsModifiable="false" />
+ <PropertyDefinition Name="CapabilitiesClass"
DisplayName="Capabilities Class" ShortDescription=""
DefaultValue="com.metamatrix.connector.loopback.LoopbackCapabilities"
IsRequired="true" IsExpert="true" />
+ <PropertyDefinition Name="WaitTime" DisplayName="Max Random
Wait Time" ShortDescription="" DefaultValue="0"
IsRequired="true" IsExpert="true" />
+ <PropertyDefinition Name="ConnectorClass"
DisplayName="Connector Class" ShortDescription=""
DefaultValue="com.metamatrix.connector.loopback.LoopbackConnector"
IsRequired="true" IsExpert="true" />
+ <PropertyDefinition Name="RowCount" DisplayName="Rows Per
Query" ShortDescription="" DefaultValue="1"
IsRequired="true" IsExpert="true" />
+ <PropertyDefinition Name="Standard" DisplayName="Standard
Type" ShortDescription="Standard Built-in Connector Type"
DefaultValue="true" PropertyType="Boolean" IsExpert="true"
IsModifiable="false" />
+ </ComponentType>
+ <ComponentType Name="Salesforce Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="Connector"
ParentComponentType="Connectors"
LastChangedDate="2008-10-31T10:26:19.916-06:00"
CreationDate="2008-10-31T10:26:19.916-06:00">
+ <PropertyDefinition Name="ConnectorTypeClassPath"
DisplayName="Connector Type Class Path" ShortDescription="Connector Type
classpath (defined by system, do not modify)"
DefaultValue="extensionjar:connector_patch.jar;extensionjar:connector-salesforce-6.2.0-SNAPSHOT.jar;extensionjar:commons-codec-1.2.jar;extensionjar:commons-discovery-0.2.jar;extensionjar:commons-httpclient-3.0.1.jar;extensionjar:xmlsec-1.3.0.jar;extensionjar:axis-1.3.jar;extensionjar:axis-jaxrpc-1.3.jar;extensionjar:axis-saaj-1.2.jar;extensionjar:axis-schema-1.3.jar;extensionjar:commons-discovery-0.2.jar;extensionjar:jms-1.1.jar;extensionjar:jaxen-1.1.1.jar;extensionjar:nux-1.6.jar;extensionjar:opensaml-1.1b.jar;extensionjar:salesforce-api-6.2.0-SNAPSHOT.jar;extensionjar:jetty-6.1.9.jar;extensionjar:jetty-util-6.1.9.jar;extensionjar:servlet-api-2.5-6.1.9.jar;extensionjar:wsdl4j-1.5.1.jar;extensionjar:wss4j-1.5.0.jar;extensionjar:xalan-2.7.0.jar;extensionjar:xom-1.2.jar"
IsModifiable="false" />
+ <PropertyDefinition Name="UsePostDelegation"
DisplayName="Use Separate Classloader" ShortDescription="Set to true to
indicate that the connector classpath and connector type classpath entries should be
loaded by a connector specific post-delegation class loader."
PropertyType="Boolean" IsRequired="true" IsExpert="true"
DefaultValue="true"/>
+ <PropertyDefinition Name="username" DisplayName="User
Name" ShortDescription="Name value for Salesforce authentication"
DefaultValue="" IsRequired="true" />
+ <PropertyDefinition Name="ConnectorStateClass"
DisplayName="Connector State Class" ShortDescription=""
DefaultValue="com.metamatrix.connector.salesforce.ConnectorState"
IsRequired="true" IsExpert="true" />
+ <PropertyDefinition Name="ConnectorClass"
DisplayName="Connector Class" ShortDescription=""
DefaultValue="com.metamatrix.connector.salesforce.Connector"
IsRequired="true" IsExpert="true" />
+ <PropertyDefinition Name="password"
DisplayName="Password" ShortDescription="Password value for Salesforce
authentication" DefaultValue="" IsRequired="true"
IsMasked="true" />
+ <PropertyDefinition Name="URL" DisplayName="Salesforce
URL" ShortDescription="URL for connecting to Salesforce"
DefaultValue="" IsExpert="true" />
+ <PropertyDefinition Name="ConnectorCapabilities"
DisplayName="Connector Capabilities Class" ShortDescription="The class to
use to provide the Connector Capabilities"
DefaultValue="com.metamatrix.connector.salesforce.SalesforceCapabilities"
IsExpert="true" />
+ </ComponentType>
+ <ComponentType Name="Text File Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="Connector"
ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup"
LastChangedDate="2008-10-31T10:26:19.945-06:00"
CreatedBy="ConfigurationStartup"
CreationDate="2008-10-31T10:26:19.945-06:00">
+ <PropertyDefinition Name="ConnectorTypeClassPath"
DisplayName="Connector Type Class Path" ShortDescription="Connector Type
classpath (defined by system, do not modify)"
DefaultValue="extensionjar:connector_patch.jar;extensionjar:connector-text-6.2.0-SNAPSHOT.jar;"
IsModifiable="false" />
+ <PropertyDefinition Name="PartialStartupAllowed"
DisplayName="Partial Startup Allowed" ShortDescription=""
DefaultValue="true" IsRequired="true" PropertyType="Boolean"
IsExpert="true" />
+ <PropertyDefinition Name="Standard" DisplayName="Standard
Type" ShortDescription="Standard Built-in Connector Type"
DefaultValue="true" PropertyType="Boolean" IsExpert="true"
IsModifiable="false" />
+ <PropertyDefinition Name="DescriptorFile" DisplayName="Text
File Descriptor" ShortDescription="" IsRequired="true" />
+ <PropertyDefinition Name="ConnectorClass"
DisplayName="Connector Class" ShortDescription=""
DefaultValue="com.metamatrix.connector.text.TextConnector"
IsRequired="true" IsExpert="true" />
+ <PropertyDefinition Name="EnforceColumnCount"
DisplayName="Enforce Column Count" ShortDescription="This forces the number
of columns in text file to match what was modeled" DefaultValue="false"
PropertyType="Boolean" />
+ <PropertyDefinition Name="DateResultFormatsDelimiter"
DisplayName="Date Result Formats Delimiter" ShortDescription=""
IsExpert="true" />
+ <PropertyDefinition Name="DateResultFormats"
DisplayName="Date Result Formats" ShortDescription=""
IsExpert="true" />
+ <PropertyDefinition Name="Immutable" DisplayName="Is
Immutable" ShortDescription="True if the source never changes."
DefaultValue="true" IsRequired="true" PropertyType="Boolean"
IsExpert="true" />
+ </ComponentType>
+ <ComponentType Name="XML Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="Connector"
ParentComponentType="Connectors"
LastChangedDate="2008-10-31T10:26:19.917-06:00"
CreationDate="2008-10-31T10:26:19.917-06:00">
+ <PropertyDefinition Name="ConnectorTypeClassPath"
DisplayName="Connector Type Class Path" ShortDescription="Connector Type
classpath (defined by system, do not modify)"
DefaultValue="extensionjar:connector_patch.jar;extensionjar:connector-xml-6.2.0-SNAPSHOT.jar;extensionjar:commons-codec-1.2.jar;extensionjar:commons-discovery-0.2.jar;extensionjar:commons-httpclient-3.0.1.jar;extensionjar:xmlsec-1.3.0.jar;extensionjar:axis-1.3.jar;extensionjar:axis-jaxrpc-1.3.jar;extensionjar:axis-saaj-1.2.jar;extensionjar:axis-schema-1.3.jar;extensionjar:commons-discovery-0.2.jar;extensionjar:jms-1.1.jar;extensionjar:jaxen-1.1.1.jar;extensionjar:nux-1.6.jar;extensionjar:opensaml-1.1b.jar;extensionjar:jetty-6.1.9.jar;extensionjar:jetty-util-6.1.9.jar;extensionjar:servlet-api-2.5-6.1.9.jar;extensionjar:wsdl4j-1.5.1.jar;extensionjar:wss4j-1.5.0.jar;extensionjar:xalan-2.7.0.jar;extensionjar:xom-1.2.jar"
IsModifiable="false"/>
+ <PropertyDefinition Name="UsePostDelegation"
DisplayName="Use Separate Classloader" ShortDescription="Set to true to
indicate that the connector classpath and connector type classpath entries should be
loaded by a connector specific post-delegation class loader."
PropertyType="Boolean" IsRequired="true" IsExpert="true"
DefaultValue="true"/>
+ </ComponentType>
+
+ <ComponentType Name="XML File Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="XML Connector"
ParentComponentType="Connectors"
LastChangedDate="2008-10-31T10:26:19.917-06:00"
CreationDate="2008-10-31T10:26:19.917-06:00">
+ <PropertyDefinition Name="CharacterEncodingScheme"
DisplayName="File Encoding Used" ShortDescription="A character-encoding
scheme is a mapping between a coded character set and a set of octet (eight-bit byte)
sequences. Some samples are UTF-8,ISO-8859-1,UTF-16)"
DefaultValue="ISO-8859-1" />
+ <PropertyDefinition Name="ConnectorClass"
DisplayName="Connector Class" ShortDescription=""
DefaultValue="com.metamatrix.connector.xmlsource.XMLSourceConnector"
IsRequired="true" IsExpert="true" />
+ <PropertyDefinition Name="ConnectionType" DisplayName="Type
Of XML Connection" ShortDescription="Connection type used to get the XML
data" DefaultValue="com.metamatrix.connector.xmlsource.file.FileConnection"
IsRequired="true" IsExpert="true" />
+ <PropertyDefinition Name="Standard" DisplayName="Standard
Type" ShortDescription="Standard Built-in Connector Type"
DefaultValue="true" PropertyType="Boolean" IsExpert="true"
IsModifiable="false" />
+ <PropertyDefinition Name="DirectoryLocation"
DisplayName="XML File(s) Directory Location" ShortDescription=""
DefaultValue="" IsRequired="true" />
+ </ComponentType>
+ <ComponentType Name="XML SOAP Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="XML Connector"
ParentComponentType="Connectors"
LastChangedDate="2008-10-31T10:26:19.917-06:00"
CreationDate="2008-10-31T10:26:19.917-06:00">
+ <PropertyDefinition Name="AuthPassword"
DisplayName="Authentication User Password" ShortDescription="Password value
for authentication" DefaultValue="" IsExpert="true"
IsMasked="true" />
+ <PropertyDefinition Name="SAMLPropertyFile"
DisplayName="SAML Property File (only required when SAML profile used)"
ShortDescription="SAML Security property file (saml.properties)"
DefaultValue="" IsExpert="true" />
+ <PropertyDefinition Name="Standard" DisplayName="Standard
Type" ShortDescription="Standard Built-in Connector Type"
DefaultValue="true" PropertyType="Boolean" IsExpert="true"
IsModifiable="false" />
+ <PropertyDefinition Name="wsdl" DisplayName="WSDL File
(URL)" ShortDescription="URL to Web Service Definition File"
DefaultValue="" IsRequired="true" />
+ <PropertyDefinition Name="AuthUserName"
DisplayName="Authentication User Name" ShortDescription="Name value for
authentication" DefaultValue="" IsExpert="true" />
+ <PropertyDefinition Name="WSSecurityType"
DisplayName="WS-Security Type(UsernameToken, SAML..)"
ShortDescription="Type of WS-Security to be used; Combinations of multiple security
types can be used with a space in-between. Allowed types are: (UsernameToken,
UsernameToken-Digest, SAMLTokenUnsigned, SAMLTokenSigned, Signature, Timestamp,
Encrypt)" DefaultValue="" />
+ <PropertyDefinition Name="ConnectorClass"
DisplayName="Connector Class" ShortDescription=""
DefaultValue="com.metamatrix.connector.xmlsource.XMLSourceConnector"
IsRequired="true" IsExpert="true" />
+ <PropertyDefinition Name="EncryptUserName"
DisplayName="Encrypt UserName (only if Encrypt profile used)"
ShortDescription="The username to be used in the encryption; if blank uses auth
username" DefaultValue="" IsExpert="true" />
+ <PropertyDefinition Name="EndPoint" DisplayName="Alternate
End Point" ShortDescription="An alternate service endpoint other than one
specified in WSDL, to execute the service" DefaultValue="" />
+ <PropertyDefinition Name="SecurityType"
DisplayName="WebService Security Used(None, HTTPBasic, WS-Security)"
ShortDescription="Type of Authentication to used with the web service; If WS-Secuirty
is being used, then WS-Secuirty type must be defined" DefaultValue="None"
IsRequired="true" />
+ <PropertyDefinition Name="CryptoPropertyFile"
DisplayName="User Crypto Property File (If SAML or Signature profile used)"
ShortDescription="The file defines properties of cryptography;defines the
certificates;(crypto.properties)" DefaultValue="" IsExpert="true"
/>
+ <PropertyDefinition Name="ConnectionType" DisplayName="Type
Of XML Connection" ShortDescription="Connection type used to get the XML
data" DefaultValue="com.metamatrix.connector.xmlsource.soap.SoapConnection"
IsRequired="true" IsExpert="true" />
+ <PropertyDefinition Name="EncryptPropertyFile"
DisplayName="Encrypt crypto property file (only if Encrypt profile used)"
ShortDescription="The file defines properties of cryptography for encryption of the
message;(crypto.properties)" DefaultValue="" IsExpert="true"
/>
+ <PropertyDefinition Name="TrustType" DisplayName="Trust
Type:(DirectReference or IssuerSerial)" ShortDescription="Only required for
Signature and Signed SAML; The issuer-serial method presumes that all trusted users of the
service are known to the service and have pre-registered their certificate chains before
using the service. The direct-reference method presumes that the service operator trusts
all users with certificates issued by a trusted CA."
DefaultValue="DirectReference" IsExpert="true" />
+ </ComponentType>
+ <ComponentType Name="XML-Relational File Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="XML Connector"
ParentComponentType="Connectors"
LastChangedDate="2008-10-31T10:26:19.918-06:00"
CreationDate="2008-10-31T10:26:19.918-06:00">
+ <PropertyDefinition Name="FilePath" DisplayName="File
Path" ShortDescription="" IsRequired="true" />
+ <PropertyDefinition Name="Standard" DisplayName="Standard
Type" ShortDescription="Standard Built-in Connector Type"
DefaultValue="true" PropertyType="Boolean" IsExpert="true"
IsModifiable="false" />
+ <PropertyDefinition Name="CacheEnabled" DisplayName="Enable
Document Caching" ShortDescription="" DefaultValue="false"
IsRequired="true" PropertyType="Boolean" />
+ <PropertyDefinition Name="SaxFilterProviderClass"
DisplayName="XML Filter Provider" ShortDescription="The class the provides
extended XML Filters"
DefaultValue="com.metamatrix.connector.xml.base.NoExtendedFilters"
IsExpert="true" />
+ <PropertyDefinition Name="ConnectorClass"
DisplayName="Connector Class" ShortDescription=""
DefaultValue="com.metamatrix.connector.xml.base.XMLConnector"
IsRequired="true" IsExpert="true" />
+ <PropertyDefinition Name="ConnectorStateClass"
DisplayName="Connector State Class" ShortDescription=""
DefaultValue="com.metamatrix.connector.xml.file.FileConnectorState"
IsRequired="true" IsExpert="true" />
+ <PropertyDefinition Name="LogRequestResponseDocs"
DisplayName="Log XML Request and Response Documents"
ShortDescription="Write the request and response documents to the log at Info
level" DefaultValue="false" PropertyType="Boolean"
IsExpert="true" />
+ <PropertyDefinition Name="InputStreamFilterClass"
DisplayName="Input Stream Filter Class" ShortDescription="The class to use
to preprocess raw XML input stream"
DefaultValue="com.metamatrix.connector.xml.base.PluggableInputStreamFilterImpl"
IsExpert="true" />
+ <PropertyDefinition Name="FileName" DisplayName="File
Name" ShortDescription="" DefaultValue="" />
+ <PropertyDefinition Name="QueryPreprocessorClass"
DisplayName="Query Preprocessor Class" ShortDescription="The class to use
to preprocess the IQuery"
DefaultValue="com.metamatrix.connector.xml.base.NoQueryPreprocessing"
IsExpert="true" />
+ <PropertyDefinition Name="ConnectorCapabilities"
DisplayName="Connector Capabilities Class" ShortDescription="The class to
use to provide the Connector Capabilities"
DefaultValue="com.metamatrix.connector.xml.base.XMLCapabilities"
IsExpert="true" />
+ </ComponentType>
+ <ComponentType Name="XML-Relational HTTP Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="XML Connector"
ParentComponentType="Connectors"
LastChangedDate="2008-10-31T10:26:19.920-06:00"
CreationDate="2008-10-31T10:26:19.921-06:00">
+ <PropertyDefinition Name="SaxFilterProviderClass"
DisplayName="XML Filter Provider" ShortDescription="The class the provides
extended XML Filters"
DefaultValue="com.metamatrix.connector.xml.base.NoExtendedFilters"
IsExpert="true" />
+ <PropertyDefinition Name="XMLParmName" DisplayName="XML
Parameter Name" ShortDescription="" />
+ <PropertyDefinition Name="RequestTimeout"
DisplayName="Request Timeout (in Milliseconds)" ShortDescription=""
DefaultValue="10000" IsRequired="true"
PropertyType="Integer" />
+ <PropertyDefinition Name="Authenticate"
DisplayName="Authentication Required" ShortDescription=""
DefaultValue="false" PropertyType="Boolean"
IsModifiable="true" />
+ <PropertyDefinition Name="ConnectorStateClass"
DisplayName="Connector State Class" ShortDescription=""
DefaultValue="com.metamatrix.connector.xml.http.HTTPConnectorState"
IsRequired="true" IsExpert="true" />
+ <PropertyDefinition Name="HttpBasicAuthPassword"
DisplayName="HTTP Basic Authentication Password" ShortDescription="Password
value for HTTP basic authentication" DefaultValue=""
IsExpert="true" IsMasked="true" />
+ <PropertyDefinition Name="AccessMethod" DisplayName="Access
Method" ShortDescription="" DefaultValue="get"
IsRequired="true">
+ <AllowedValue>get</AllowedValue>
+ <AllowedValue>post</AllowedValue>
+ </PropertyDefinition>
+ <PropertyDefinition Name="ProxyUri" DisplayName="Proxy
Server URI" ShortDescription="The URI of the proxy server"
DefaultValue="" />
+ <PropertyDefinition Name="ConnectorCapabilities"
DisplayName="Connector Capabilities Class" ShortDescription="The class to
use to provide the Connector Capabilities"
DefaultValue="com.metamatrix.connector.xml.base.XMLCapabilities"
IsExpert="true" />
+ <PropertyDefinition Name="Standard" DisplayName="Standard
Type" ShortDescription="Standard Built-in Connector Type"
DefaultValue="true" PropertyType="Boolean" IsExpert="true"
IsModifiable="false" />
+ <PropertyDefinition Name="HttpBasicAuthUserName"
DisplayName="HTTP Basic Authentication Name" ShortDescription="Name value
for HTTP basic authentication" DefaultValue="" IsExpert="true"
/>
+ <PropertyDefinition Name="ConnectorClass"
DisplayName="Connector Class" ShortDescription=""
DefaultValue="com.metamatrix.connector.xml.base.XMLConnector"
IsRequired="true" IsExpert="true" />
+ <PropertyDefinition Name="Uri" DisplayName="Server
URI" ShortDescription="The URI of the HTTP source"
IsRequired="true" />
+ <PropertyDefinition Name="UseHttpBasic" DisplayName="Use
HTTP Basic authentication" ShortDescription="Use basic HTTP Authentication"
DefaultValue="false" PropertyType="Boolean" IsExpert="true"
/>
+ <PropertyDefinition Name="LogRequestResponseDocs"
DisplayName="Log XML Request and Response Documents"
ShortDescription="Write the request and response documents to the log at Info
level" DefaultValue="false" PropertyType="Boolean"
IsExpert="true" />
+ <PropertyDefinition Name="TrustDeserializerClass"
DisplayName="Trust Deserializer Class" ShortDescription="The class to use
to process trusted payloads and execution payloads"
DefaultValue="com.metamatrix.connector.xml.http.DefaultTrustDeserializer"
IsExpert="true" />
+ <PropertyDefinition Name="ParameterMethod"
DisplayName="Parameter Method" ShortDescription=""
DefaultValue="None" IsRequired="true">
+ <AllowedValue>None</AllowedValue>
+ <AllowedValue>Name/Value</AllowedValue>
+ <AllowedValue>XMLRequest</AllowedValue>
+ <AllowedValue>XMLInQueryString</AllowedValue>
+ </PropertyDefinition>
+ <PropertyDefinition Name="InputStreamFilterClass"
DisplayName="Input Stream Filter Class" ShortDescription="The class to use
to preprocess raw XML input stream"
DefaultValue="com.metamatrix.connector.xml.base.PluggableInputStreamFilterImpl"
IsExpert="true" />
+ <PropertyDefinition Name="HostnameVerifier"
DisplayName="Hostname Verifier" ShortDescription="Class implementing
javax.net.ssl.HostnameVerifier. Used to implement a hostname mismatch workaround."
IsExpert="true" />
+ <PropertyDefinition Name="QueryPreprocessorClass"
DisplayName="Query Preprocessor Class" ShortDescription="The class to use
to preprocess the IQuery"
DefaultValue="com.metamatrix.connector.xml.base.NoQueryPreprocessing"
IsExpert="true" />
+ </ComponentType>
+ <ComponentType Name="XML-Relational SOAP Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="XML Connector"
ParentComponentType="Connectors"
LastChangedDate="2008-10-31T10:26:19.919-06:00"
CreationDate="2008-10-31T10:26:19.919-06:00">
+ <PropertyDefinition Name="AuthPassword"
DisplayName="Authentication User Password" ShortDescription="Password value
for authentication" DefaultValue="" IsExpert="true"
IsMasked="true" />
+ <PropertyDefinition Name="SaxFilterProviderClass"
DisplayName="XML Filter Provider" ShortDescription="The class the provides
extended XML Filters"
DefaultValue="com.metamatrix.connector.xml.base.NoExtendedFilters"
IsExpert="true" />
+ <PropertyDefinition Name="AuthUserName"
DisplayName="Authentication User Name" ShortDescription="Name value for
authentication" DefaultValue="" IsExpert="true" />
+ <PropertyDefinition Name="WSSecurityType"
DisplayName="WS-Security Type(UsernameToken, SAML..)"
ShortDescription="Type of WS-Security to be used; Combinations of multiple security
types can be used with a space in-between. Allowed types are: (UsernameToken,
UsernameToken-Digest, SAMLTokenUnsigned, SAMLTokenSigned, Signature, Timestamp,
Encrypt)" DefaultValue="" />
+ <PropertyDefinition Name="XMLParmName" DisplayName="XML
Parameter Name" ShortDescription="" DefaultValue=""
IsModifiable="false" />
+ <PropertyDefinition Name="EncryptUserName"
DisplayName="Encrypt UserName (only if Encrypt profile used)"
ShortDescription="The username to be used in the encryption; if blank uses auth
username" DefaultValue="" IsExpert="true" />
+ <PropertyDefinition Name="ExceptionOnSOAPFault"
DisplayName="Exception on SOAP Fault" ShortDescription="Throw connector
exception when SOAP fault is returned from source." DefaultValue="true"
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="RequestTimeout"
DisplayName="Request Timeout (in Milliseconds)" ShortDescription=""
DefaultValue="10000" IsRequired="true"
PropertyType="Integer" />
+ <PropertyDefinition Name="CryptoPropertyFile"
DisplayName="User Crypto Property File (If SAML or Signature profile used)"
ShortDescription="The file defines properties of cryptography;defines the
certificates;(crypto.properties)" DefaultValue="" IsExpert="true"
/>
+ <PropertyDefinition Name="ConnectorStateClass"
DisplayName="Connector State Class" ShortDescription=""
DefaultValue="com.metamatrix.connector.xml.soap.SOAPConnectorState"
IsRequired="true" IsExpert="true" />
+ <PropertyDefinition Name="SOAPAction"
DisplayName="SOAP-Action" ShortDescription="Value for SOAP-Action
header" DefaultValue="" IsExpert="true" />
+ <PropertyDefinition Name="AccessMethod" DisplayName="Access
Method (Get, Post)" ShortDescription="" DefaultValue="post"
IsModifiable="false">
+ <AllowedValue>get</AllowedValue>
+ <AllowedValue>post</AllowedValue>
+ </PropertyDefinition>
+ <PropertyDefinition Name="ProxyUri" DisplayName="Proxy
Server URI" ShortDescription="The URI of the proxy server"
DefaultValue="" />
+ <PropertyDefinition Name="EncryptPropertyFile"
DisplayName="Encrypt crypto property file (only if Encrypt profile used)"
ShortDescription="The file defines properties of cryptography for encryption of the
message;(crypto.properties)" DefaultValue="" IsExpert="true"
/>
+ <PropertyDefinition Name="ConnectorCapabilities"
DisplayName="Connector Capabilities Class" ShortDescription="The class to
use to provide the Connector Capabilities"
DefaultValue="com.metamatrix.connector.xml.base.XMLCapabilities"
IsExpert="true" />
+ <PropertyDefinition Name="SAMLPropertyFile"
DisplayName="SAML Property File (only required when SAML profile used)"
ShortDescription="SAML Security property file (saml.properties)"
DefaultValue="" IsExpert="true" />
+ <PropertyDefinition Name="Standard" DisplayName="Standard
Type" ShortDescription="Standard Built-in Connector Type"
DefaultValue="true" PropertyType="Boolean" IsExpert="true"
IsModifiable="false" />
+ <PropertyDefinition Name="EncodingStyle"
DisplayName="Encoding Style (RPC - Encoded, RPC - Literal, Document - Literal,
Document - Encoded)" ShortDescription="Encoding Style"
DefaultValue="Document - Literal" IsRequired="true">
+ <AllowedValue>RPC - Encoded</AllowedValue>
+ <AllowedValue>RPC - Literal</AllowedValue>
+ <AllowedValue>Document - Literal</AllowedValue>
+ <AllowedValue>Document - Encoded</AllowedValue>
+ </PropertyDefinition>
+ <PropertyDefinition Name="ConnectorClass"
DisplayName="Connector Class" ShortDescription=""
DefaultValue="com.metamatrix.connector.xml.base.XMLConnector"
IsRequired="true" IsExpert="true" />
+ <PropertyDefinition Name="Uri" DisplayName="Server
URI" ShortDescription="The URI of the HTTP source"
IsRequired="true" />
+ <PropertyDefinition Name="SecurityType"
DisplayName="WebService Security Used(None, HTTPBasic, WS-Security)"
ShortDescription="Type of Authentication to used with the web service; If WS-Secuirty
is being used, then WS-Secuirty type must be defined" DefaultValue="None"
IsRequired="true" />
+ <PropertyDefinition Name="LogRequestResponseDocs"
DisplayName="Log XML Request and Response Documents"
ShortDescription="Write the request and response documents to the log at Info
level" DefaultValue="false" PropertyType="Boolean"
IsExpert="true" />
+ <PropertyDefinition Name="TrustDeserializerClass"
DisplayName="Trust Deserializer Class" ShortDescription="The class to use
to process trusted payloads and execution payloads"
DefaultValue="com.metamatrix.connector.xml.soap.DefaultSoapTrustDeserializer"
IsExpert="true" />
+ <PropertyDefinition Name="ParameterMethod"
DisplayName="Parameter Method (None, Name/Value, XMLRequest, XMLInQueryString)"
ShortDescription="" DefaultValue="XMLRequest"
IsModifiable="false">
+ <AllowedValue>None</AllowedValue>
+ <AllowedValue>Name/Value</AllowedValue>
+ <AllowedValue>XMLRequest</AllowedValue>
+ <AllowedValue>XMLInQueryString</AllowedValue>
+ </PropertyDefinition>
+ <PropertyDefinition Name="InputStreamFilterClass"
DisplayName="Input Stream Filter Class" ShortDescription="The class to use
to preprocess raw XML input stream"
DefaultValue="com.metamatrix.connector.xml.base.PluggableInputStreamFilterImpl"
IsExpert="true" />
+ <PropertyDefinition Name="HostnameVerifier"
DisplayName="Hostname Verifier" ShortDescription="a class implmenting
javax.net.ssl.HostnameVerifier. Used to implement a hostname mismatch workaround."
IsExpert="true" />
+ <PropertyDefinition Name="TrustType" DisplayName="Trust
Type:(DirectReference or IssuerSerial)" ShortDescription="Only required for
Signature and Signed SAML; The issuer-serial method presumes that all trusted users of the
service are known to the service and have pre-registered their certificate chains before
using the service. The direct-reference method presumes that the service operator trusts
all users with certificates issued by a trusted CA."
DefaultValue="DirectReference" IsExpert="true" />
+ <PropertyDefinition Name="QueryPreprocessorClass"
DisplayName="Query Preprocessor Class" ShortDescription="The class to use
to preprocess the IQuery"
DefaultValue="com.metamatrix.connector.xml.base.NoQueryPreprocessing"
IsExpert="true" />
+ </ComponentType>
+
+ </ComponentTypes>
+</ConfigurationDocument>
\ No newline at end of file
Added:
branches/JCA/test-integration/db/src/main/resources/datasources/derby/connection.properties
===================================================================
---
branches/JCA/test-integration/db/src/main/resources/datasources/derby/connection.properties
(rev 0)
+++
branches/JCA/test-integration/db/src/main/resources/datasources/derby/connection.properties 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,18 @@
+# db.type must match a ddl folder
+db.type=derby
+# db.connectortype must match a connector type defined in the configuration.xml
+db.connectortype=Apache Derby Network XA Connector
+
+
+driver=org.apache.derby.jdbc.ClientDriver
+URL=jdbc:derby://localhost:1527/txntest
+User=rareddy
+Password=mm
+
+ServerName=localhost
+DatabaseNMame=txntest
+PortNumber=1527
+ds-jndiname=localhost_1527
+
+Immutable=true
+
Added:
branches/JCA/test-integration/db/src/main/resources/datasources/derby/example_connection.properties
===================================================================
---
branches/JCA/test-integration/db/src/main/resources/datasources/derby/example_connection.properties
(rev 0)
+++
branches/JCA/test-integration/db/src/main/resources/datasources/derby/example_connection.properties 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,18 @@
+# db.type must match a ddl folder
+db.type=derby
+# db.connectortype must match a connector type defined in the configuration.xml
+db.connectortype=Apache Derby Network XA Connector
+
+
+driver=org.apache.derby.jdbc.ClientDriver
+URL=jdbc:derby://localhost:1527//(derbyinstallloc)
+User=
+Password=
+
+ServerName=localhost
+SatabaseNMame=(databasename)
+PortNumber=1527
+ds-jndiname=localhost_1527
+
+Immutable=true
+
Added:
branches/JCA/test-integration/db/src/main/resources/datasources/mysql/connection.properties
===================================================================
---
branches/JCA/test-integration/db/src/main/resources/datasources/mysql/connection.properties
(rev 0)
+++
branches/JCA/test-integration/db/src/main/resources/datasources/mysql/connection.properties 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,20 @@
+# db.type must match a ddl folder
+db.type=mysql
+# db.connectortype must match a connector type defined in the configuration.xml
+db.connectortype=MySQL JDBC XA Connector
+
+
+driver=com.mysql.jdbc.Driver
+URL=jdbc:mysql://localhost:3306/txntest
+User=rareddy
+Password=mm
+
+ServerName=txntest
+DatabaseName=localhost
+PortNumber=3306
+ds-jndiname=mysql_3306
+
+
+
+
+
Added:
branches/JCA/test-integration/db/src/main/resources/datasources/mysql/example_connection.properties
===================================================================
---
branches/JCA/test-integration/db/src/main/resources/datasources/mysql/example_connection.properties
(rev 0)
+++
branches/JCA/test-integration/db/src/main/resources/datasources/mysql/example_connection.properties 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,22 @@
+# db.type must match a ddl folder
+db.type=mysql
+# db.connectortype must match a connector type defined in the configuration.xml
+db.connectortype=MySQL JDBC XA Connector
+
+
+driver=com.mysql.jdbc.Driver
+URL=jdbc:mysql://(servername):3306/(databasename)
+User=
+Password=
+
+ServerName=(servername)
+DatabaseName=(databasename)
+PortNumber=3306
+ds-jndiname=mysql_3306
+
+Immutable=true
+
+
+
+
+
Added:
branches/JCA/test-integration/db/src/main/resources/datasources/oracle/example_connection.properties
===================================================================
---
branches/JCA/test-integration/db/src/main/resources/datasources/oracle/example_connection.properties
(rev 0)
+++
branches/JCA/test-integration/db/src/main/resources/datasources/oracle/example_connection.properties 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,22 @@
+# db.type must match a ddl folder
+db.type=oracle
+# db.connectortype must match a connector type defined in the configuration.xml
+db.connectortype=Oracle XA Connector
+
+
+driver=oracle.jdbc.OracleDriver
+URL=jdbc:oracle:thin:@(servername):1521:(sid)
+User=
+Password=
+
+ServerName=(servername)
+DatabaseName=(databasename)
+PortNumber=1527
+ds-jndiname=(servername)_1527
+
+Immutable=true
+
+
+
+
+
Added:
branches/JCA/test-integration/db/src/main/resources/datasources/postgres/example_connection.properties
===================================================================
---
branches/JCA/test-integration/db/src/main/resources/datasources/postgres/example_connection.properties
(rev 0)
+++
branches/JCA/test-integration/db/src/main/resources/datasources/postgres/example_connection.properties 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,20 @@
+# db.type must match a ddl folder
+db.type=postgres
+# db.connectortype must match a connector type defined in the configuration.xml
+db.connectortype=PostgreSQL XA JDBC Connector
+
+
+driver=org.postgresql.Driver
+URL=jdbc:postgresql://(servername):5432/(databasename)
+User=
+Password=
+
+ServerName=(servername)
+DatabaseName=(databasename)
+PortNumber=5432
+ds-jndiname=(servername)_5432
+
+Immutable=true
+
+
+
Added: branches/JCA/test-integration/db/src/main/resources/datasources/readme.txt
===================================================================
--- branches/JCA/test-integration/db/src/main/resources/datasources/readme.txt
(rev 0)
+++ branches/JCA/test-integration/db/src/main/resources/datasources/readme.txt 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1 @@
+These datasources are used for product testing
\ No newline at end of file
Added:
branches/JCA/test-integration/db/src/main/resources/datasources/sqlserver/example_connection.properties
===================================================================
---
branches/JCA/test-integration/db/src/main/resources/datasources/sqlserver/example_connection.properties
(rev 0)
+++
branches/JCA/test-integration/db/src/main/resources/datasources/sqlserver/example_connection.properties 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,22 @@
+# db.type must match a ddl folder
+db.type=sqlserver
+# db.connectortype must match a connector type defined in the configuration.xml
+db.connectortype=SQL Server XA Connector
+
+
+driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
+URL=jdbc:sqlserver://(servername):1433;databaseName=(databasename)
+User=
+Password=
+
+ServerName=(servername)
+DatabaseName=(databasename)
+PortNumber=1433
+ds-jndiname=microsoft_1433
+
+Immutable=true
+
+
+
+
+
Added:
branches/JCA/test-integration/db/src/main/resources/datasources/sybase/example_connection.properties
===================================================================
---
branches/JCA/test-integration/db/src/main/resources/datasources/sybase/example_connection.properties
(rev 0)
+++
branches/JCA/test-integration/db/src/main/resources/datasources/sybase/example_connection.properties 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,22 @@
+# db.type must match a ddl folder
+db.type=sybase
+# db.connectortype must match a connector type defined in the configuration.xml
+db.connectorytype=
+
+
+driver=com.mysql.jdbc.Driver
+URL=jdbc:mysql://(servername):3306/(databasename)
+User=
+Password=
+
+ServerName=(servername)
+DatabaseName=(databasename)
+PortNumber=3306
+ds-jndiname=microsoft_3306
+
+Immutable=true
+
+
+
+
+
Added: branches/JCA/test-integration/db/src/main/resources/ddl/db2/create_tables.sql
===================================================================
--- branches/JCA/test-integration/db/src/main/resources/ddl/db2/create_tables.sql
(rev 0)
+++
branches/JCA/test-integration/db/src/main/resources/ddl/db2/create_tables.sql 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,13 @@
+
+-- these tables are used by custom junit test for testing transactions
+
+create Table g1 (
+ e1 NUMERIC(5),
+ e2 varchar(50),
+ PRIMARY KEY (e1)
+);
+create Table g2 (
+ e1 NUMERIC(5) REFERENCES g1 (e1),
+ e2 varchar(50)
+);
+
\ No newline at end of file
Added: branches/JCA/test-integration/db/src/main/resources/ddl/db2/drop_tables.sql
===================================================================
--- branches/JCA/test-integration/db/src/main/resources/ddl/db2/drop_tables.sql
(rev 0)
+++ branches/JCA/test-integration/db/src/main/resources/ddl/db2/drop_tables.sql 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,7 @@
+
+-- drop the tables
+
+drop Table g2;
+drop Table g1;
+
+
\ No newline at end of file
Added: branches/JCA/test-integration/db/src/main/resources/ddl/db2/exec_parms.properties
===================================================================
--- branches/JCA/test-integration/db/src/main/resources/ddl/db2/exec_parms.properties
(rev 0)
+++
branches/JCA/test-integration/db/src/main/resources/ddl/db2/exec_parms.properties 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,3 @@
+delim=%
+delimtype=normal
+rdbms.type=db2
Added: branches/JCA/test-integration/db/src/main/resources/ddl/derby/create_tables.sql
===================================================================
--- branches/JCA/test-integration/db/src/main/resources/ddl/derby/create_tables.sql
(rev 0)
+++
branches/JCA/test-integration/db/src/main/resources/ddl/derby/create_tables.sql 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,13 @@
+
+-- these tables are used by custom junit test for testing transactions
+
+create Table g1 (
+ e1 NUMERIC(5),
+ e2 varchar(50),
+ PRIMARY KEY (e1)
+);
+create Table g2 (
+ e1 NUMERIC(5) REFERENCES g1 (e1),
+ e2 varchar(50)
+);
+
\ No newline at end of file
Added: branches/JCA/test-integration/db/src/main/resources/ddl/derby/drop_tables.sql
===================================================================
--- branches/JCA/test-integration/db/src/main/resources/ddl/derby/drop_tables.sql
(rev 0)
+++
branches/JCA/test-integration/db/src/main/resources/ddl/derby/drop_tables.sql 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,7 @@
+
+-- drop the tables
+
+drop Table g2;
+drop Table g1;
+
+
\ No newline at end of file
Added:
branches/JCA/test-integration/db/src/main/resources/ddl/derby/exec_parms.properties
===================================================================
--- branches/JCA/test-integration/db/src/main/resources/ddl/derby/exec_parms.properties
(rev 0)
+++
branches/JCA/test-integration/db/src/main/resources/ddl/derby/exec_parms.properties 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,3 @@
+delim=;
+delimtype=normal
+rdbms.type=derby
Added:
branches/JCA/test-integration/db/src/main/resources/ddl/exec_parms.properties_template
===================================================================
---
branches/JCA/test-integration/db/src/main/resources/ddl/exec_parms.properties_template
(rev 0)
+++
branches/JCA/test-integration/db/src/main/resources/ddl/exec_parms.properties_template 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,10 @@
+# These properties are used in the execution of the sql statements
+# using the SQL Ant tasks.
+
+# Each database type in the "ddl" directory must have an
exec_parms.properties file.
+
+# For property setting options, see the SQL ant task page at @
http://ant.apache.org/manual/index.html
+
+delim=;
+delimtype=normal
+rdbms.type=oracle
Added: branches/JCA/test-integration/db/src/main/resources/ddl/manage_schemas.xml
===================================================================
--- branches/JCA/test-integration/db/src/main/resources/ddl/manage_schemas.xml
(rev 0)
+++ branches/JCA/test-integration/db/src/main/resources/ddl/manage_schemas.xml 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="create_schemas" default="manage.schemas"
basedir="../../">
+ <property name="resources.dir"
value="${basedir}/${relative.resources.dir}"></property>
+
+ <property name="target.dir"
value="${basedir}/target"></property>
+
+ <!--
+ This script triggers the running of the process for creating schemas
+ -->
+
+
+ <target name="manage.schemas" depends="check, init,
manage.all.schemas, manage.single.schemas">
+ <echo>Ran create schemas</echo>
+
+ </target>
+
+
+ <target name="check">
+
+ <echo>Perform check</echo>
+ <condition property="all">
+ <not>
+ <isset property="single"/>
+ </not>
+ </condition>
+
+ <available file="${datasourceloc}"
property="external.datasource.dir"/>
+
+ </target>
+
+
+ <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 ${ds.loc}</echo>
+ <!--
+ This will process each directory located under the refid location.
+ Its expects the following:
+ - each directory represents one datasource.
+ - connection.properties file must exist in the directory to be used
+ -->
+ <subant genericantfile="${resources.dir}/ddl/run_ddl.xml"
inheritall="true" >
+ <dirset dir="${ds.loc}" />
+ <property name="sql.ddl.dir"
value="${resources.dir}/ddl"/>
+ <property name="lib.dir" value="${basedir}/lib"/>
+
+ </subant>
+
+ <echo>Completed creating all schemas</echo>
+ </target>
+
+
+ <target name="manage.single.schemas" if="single">
+ <echo>Creating single schema ${ds.loc}/${single}</echo>
+
+ <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="${ds.loc}/${single}"/>
+ <property name="sql.ddl.dir" value="${resources.dir}/ddl"/>
+ <property name="lib.dir" value="${basedir}/lib"/>
+
+
+ </ant>
+
+ <echo>Completed creating single schema ${single}</echo>
+
+ </target>
+
+</project>
\ No newline at end of file
Added: branches/JCA/test-integration/db/src/main/resources/ddl/mysql/create_tables.sql
===================================================================
--- branches/JCA/test-integration/db/src/main/resources/ddl/mysql/create_tables.sql
(rev 0)
+++
branches/JCA/test-integration/db/src/main/resources/ddl/mysql/create_tables.sql 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,12 @@
+
+-- these tables are used by custom junit test for testing transactions
+create Table g1 (e1 NUMERIC(5) PRIMARY KEY, e2 varchar(50))ENGINE=INNODB;
+create Table g2 (e1 NUMERIC(5), e2 varchar(50), FOREIGN KEY (e1) REFERENCES
g1(e1))ENGINE=INNODB;
+
+
+--create Table g1 (e1 NUMERIC(5) PRIMARY KEY, e2 varchar(50));
+--create Table g2 (e1 NUMERIC(5) REFERENCES g1 (e1), e2 varchar(50));
+
+
+
+
\ No newline at end of file
Added: branches/JCA/test-integration/db/src/main/resources/ddl/mysql/drop_tables.sql
===================================================================
--- branches/JCA/test-integration/db/src/main/resources/ddl/mysql/drop_tables.sql
(rev 0)
+++
branches/JCA/test-integration/db/src/main/resources/ddl/mysql/drop_tables.sql 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,7 @@
+
+-- drop the tables
+
+drop Table g2;
+drop Table g1;
+
+
\ No newline at end of file
Added:
branches/JCA/test-integration/db/src/main/resources/ddl/mysql/exec_parms.properties
===================================================================
--- branches/JCA/test-integration/db/src/main/resources/ddl/mysql/exec_parms.properties
(rev 0)
+++
branches/JCA/test-integration/db/src/main/resources/ddl/mysql/exec_parms.properties 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,3 @@
+delim=;
+delimtype=normal
+rdbms.type=mysql
Added: branches/JCA/test-integration/db/src/main/resources/ddl/oracle/create_tables.sql
===================================================================
--- branches/JCA/test-integration/db/src/main/resources/ddl/oracle/create_tables.sql
(rev 0)
+++
branches/JCA/test-integration/db/src/main/resources/ddl/oracle/create_tables.sql 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,6 @@
+
+-- these tables are used by custom junit test for testing transactions
+
+create Table g1 (e1 number(5) PRIMARY KEY, e2 varchar2(50));
+create Table g2 (e1 number(5) REFERENCES g1, e2 varchar2(50));
+
\ No newline at end of file
Added: branches/JCA/test-integration/db/src/main/resources/ddl/oracle/drop_tables.sql
===================================================================
--- branches/JCA/test-integration/db/src/main/resources/ddl/oracle/drop_tables.sql
(rev 0)
+++
branches/JCA/test-integration/db/src/main/resources/ddl/oracle/drop_tables.sql 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,7 @@
+
+-- drop the tables
+
+drop Table g2;
+drop Table g1;
+
+
\ No newline at end of file
Added:
branches/JCA/test-integration/db/src/main/resources/ddl/oracle/exec_parms.properties
===================================================================
--- branches/JCA/test-integration/db/src/main/resources/ddl/oracle/exec_parms.properties
(rev 0)
+++
branches/JCA/test-integration/db/src/main/resources/ddl/oracle/exec_parms.properties 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,3 @@
+delim=;
+delimtype=normal
+rdbms.type=oracle
Added: branches/JCA/test-integration/db/src/main/resources/ddl/postgres/create_tables.sql
===================================================================
--- branches/JCA/test-integration/db/src/main/resources/ddl/postgres/create_tables.sql
(rev 0)
+++
branches/JCA/test-integration/db/src/main/resources/ddl/postgres/create_tables.sql 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,13 @@
+
+-- these tables are used by custom junit test for testing transactions
+
+create Table g1 (
+ e1 NUMERIC(5),
+ e2 VARCHAR(50),
+ PRIMARY KEY (e1)
+);
+create Table g2 (
+ e1 NUMERIC(5) REFERENCES g1 (e1),
+ e2 VARCHAR(50)
+);
+
\ No newline at end of file
Added: branches/JCA/test-integration/db/src/main/resources/ddl/postgres/drop_tables.sql
===================================================================
--- branches/JCA/test-integration/db/src/main/resources/ddl/postgres/drop_tables.sql
(rev 0)
+++
branches/JCA/test-integration/db/src/main/resources/ddl/postgres/drop_tables.sql 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,6 @@
+
+-- drop the tables
+
+drop Table g2;
+drop Table g1;
+
\ No newline at end of file
Added:
branches/JCA/test-integration/db/src/main/resources/ddl/postgres/exec_parms.properties
===================================================================
---
branches/JCA/test-integration/db/src/main/resources/ddl/postgres/exec_parms.properties
(rev 0)
+++
branches/JCA/test-integration/db/src/main/resources/ddl/postgres/exec_parms.properties 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,3 @@
+delim=;
+delimtype=normal
+rdbms.type=postgres
Added: branches/JCA/test-integration/db/src/main/resources/ddl/run_ddl.xml
===================================================================
--- branches/JCA/test-integration/db/src/main/resources/ddl/run_ddl.xml
(rev 0)
+++ branches/JCA/test-integration/db/src/main/resources/ddl/run_ddl.xml 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,307 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="run_ddl" default="run.ddl"
basedir=".">
+
+
+ <!--
+
+ NOTES:
+ 1. sql.scripts.dir variable must be set to the root directory where the sql script
directories are found
+ 2. rdbms.type value must match the folder name (ddl script directory) for its repective
scripts in the sql.ddl.dir
+
+ -->
+
+ <target name="run.ddl" if="conn.props.exist"
depends="init" >
+ <echo>Loading connection properties
${basedir}/connection.properties</echo>
+ <!--
+ Load the datasource specific connection properties
+ -->
+ <loadproperties srcFile="${basedir}/connection.properties"/>
+
+ <!--
+ Load the ddl specific parms in order to execute the ddl appropriately against the
database type
+ -->
+ <loadproperties
srcFile="${sql.ddl.dir}/${db.type}/exec_parms.properties"/>
+
+ <antcall target="execute.create.schema" inheritall="true" />
+ <antcall target="execute.create.tables" inheritall="true" />
+
+
+ </target>
+
+ <target name="init">
+ <echo>Initializing at base dir ${basedir}</echo>
+
+ <available file="${sql.ddl.dir}" property="dir.exist"/>
+
+ <fail unless="dir.exist" message="${sql.ddl.dir} does not exist or
was not set" />
+
+ <!--
+ ${basedir}/
+ -->
+ <available file="connection.properties"
property="conn.props.exist"/>
+
+ <!--
+ due to the ddl supported syntax for certain databases ('if'), there is a need
to
+ seperate the drop logic so that it can be executed with the option to not fail
+ if the user/schema doesn't exist. Because we want a failure to occur if the
+ schema cannot be create (don't care if an error occurs when it doesn't exist)
+ -->
+ <!--
+ <property name="drop.script"
value="${sql.ddl.dir}/${db.type}/drop_schema.sql" />
+ <available file="${drop.script}" property="drop.exist"/>
+-->
+ <!--
+ <condition property="dont.create.schema">
+ <isfalse value="${create.schema}" />
+ </condition>
+ -->
+
+ <condition property="create.database">
+ <isset property="${adminuser}"/>
+ </condition>
+ <echo>Will only create/drop table be done ${create.database}</echo>
+
+ <!--
+ <condition property="dont.create.schema">
+ <and>
+ <isset property="${create.schema}"/>
+
+ <isfalse value="${create.schema}"/>
+
+ </and>
+ </condition>
+-->
+
+ </target>
+
+
+
+ <target name="execute.create.schema"
+ if="create.database">
+
+ <antcall target="execute.drop.schema" inheritall="true" />
+
+
+ <echo>Executing sql for rdbms ${db.type} using delim ${delim}</echo>
+ <echo>Connecting using url ${adminurl}</echo>
+ <echo>using admin account ${adminuser} and pwd ${adminpassword}</echo>
+
+ <property name="onerror" value="abort" />
+ <property name="autocommit" value="true" />
+
+ <property name="create.script"
value="${sql.ddl.dir}/${db.type}/create_schema.sql" />
+
+ <property name="target.create.script"
value="${target.dir}/${db.type}_create_schema.sql" />
+
+ <available file="${create.script}"
property="create.schema.script.exist"/>
+
+ <fail unless="create.schema.script.exist" message="${create.script}
does not exist" />
+
+
+ <antcall target="make.sql.file" inheritall="true" >
+ <param name="script.file" value="${create.script}"/>
+ <param name="target.script.file"
value="${target.create.script}"/>
+ </antcall>
+
+ <antcall target="execute.schema.sql" inheritall="true" >
+ <param name="script.file"
value="${target.create.script}"/>
+ </antcall>
+
+ </target>
+
+ <target name="execute.drop.schema" >
+
+ <echo>Executing drop sql for rdbms ${db.type} </echo>
+ <property name="onerror" value="continue" />
+ <property name="autocommit" value="true" />
+
+ <property name="drop.schema.script"
value="${sql.ddl.dir}/${db.type}/drop_schema.sql" />
+ <available file="${drop.schema.script}"
property="create.schema.script.exist"/>
+
+ <fail unless="create.schema.script.exist"
message="${drop.schema.script} does not exist" />
+
+
+ <property name="target.drop.schema.script"
value="${target.dir}/${db.type}_drop_schema.sql" />
+
+ <antcall target="make.sql.file" inheritall="true" >
+ <param name="script.file" value="${drop.schema.script}"/>
+ <param name="target.script.file"
value="${target.drop.schema.script}"/>
+ </antcall>
+
+ <antcall target="execute.schema.sql" inheritall="true" >
+ <param name="script.file"
value="${target.drop.schema.script}"/>
+ </antcall>
+
+ </target>
+
+ <target name="execute.create.tables"
depends="execute.drop.tables" >
+
+ <echo>Executing sql to load tables for ${db.type} </echo>
+ <echo>Connecting using url ${URL}</echo>
+ <echo>using username ${User} and password ${Password}</echo>
+
+ <property name="create.table.script"
value="${sql.ddl.dir}/${db.type}/create_tables.sql" />
+
+ <available file="${create.table.script}"
property="create.table.script.exist"/>
+
+ <fail unless="create.table.script.exist"
message="${create.table.script} does not exist" />
+
+
+ <property name="onerror" value="abort" />
+ <property name="autocommit" value="true" />
+
+ <antcall target="execute.tables.sql" inheritall="true" >
+ <param name="script.file"
value="${create.table.script}"/>
+ </antcall>
+
+ </target>
+
+ <target name="execute.drop.tables" >
+
+ <echo>Executing sql to drop tables for ${db.type} </echo>
+ <echo>Connecting using url ${URL}</echo>
+ <echo>using username ${User} and password ${Password}</echo>
+
+ <property name="drop.table.script"
value="${sql.ddl.dir}/${db.type}/drop_tables.sql" />
+
+ <available file="${drop.table.script}"
property="drop.table.script.exist"/>
+
+ <fail unless="drop.table.script.exist" message="${drop.table.script}
does not exist" />
+
+
+ <property name="onerror" value="continue" />
+ <property name="autocommit" value="true" />
+
+ <antcall target="execute.tables.sql" inheritall="true" >
+ <param name="script.file" value="${drop.table.script}"/>
+ </antcall>
+ </target>
+
+
+ <target name="make.sql.file" >
+
+ <available file="${script.file}"
property="script.file.exist"/>
+
+ <fail unless="script.file.exist" message="${script.file} does not
exist" />
+
+ <echo>Updating script file ${target.script.file}</echo>
+
+ <delete file="${target.script.file}"/>
+ <copy file="${script.file}" tofile="${target.script.file}"/>
+
+ <replace
+ file="${target.script.file}">
+ <replacefilter
+ token="(username)"
+ value="${username}"/>
+ <replacefilter
+ token="(password)"
+ value="${password}"/>
+ <replacefilter
+ token="(databasename)"
+ value="${databasename}"/>
+ </replace>
+ </target>
+
+ <!--
+ This executes using the admin username and password because
+ it requires specific rights to create schema
+ -->
+ <target name="execute.schema.sql" >
+ <echo>Executing schema script file ${script.file}</echo>
+ <echo>Admin account: ${adminuser} url: ${adminurl}</echo>
+
+ <available file="${script.file}"
property="script.file.exist"/>
+
+ <fail unless="script.file.exist" message="${script.file} does not
exist" />
+
+ <sql driver="${driver}"
+ url="${adminurl}"
+ userid="${adminuser}"
+ password="${adminpassword}"
+ src="${script.file}"
+ rdbms="${rdbms.type}"
+ delimiter="${delim}"
+ delimitertype="${delimtype}"
+ autocommit="${autocommit}"
+ onerror="${onerror}" >
+ <classpath>
+ <fileset dir="${lib.dir}">
+ <include name="*.jar" />
+ </fileset>
+ <pathelement path="${maven.runtime.classpath}"/>
+ </classpath>
+
+ </sql>
+ </target>
+
+ <!--
+ This executes using the username and password for the so that tables
+ are created under this user and not the admin
+ -->
+ <target name="execute.tables.sql" >
+ <echo>Executing table script file ${script.file}</echo>
+ <echo>User account: ${User} url: ${URL}</echo>
+
+ <available file="${script.file}"
property="script.file.exist"/>
+
+ <fail unless="script.file.exist" message="DDL ${script.file} does not
exist" />
+
+ <sql driver="${driver}"
+ url="${URL}"
+ userid="${User}"
+ password="${Password}"
+ src="${script.file}"
+ rdbms="${rdbms.type}"
+ delimiter="${delim}"
+ delimitertype="${delimtype}"
+ autocommit="${autocommit}"
+ onerror="${onerror}" >
+ <classpath>
+ <fileset dir="${lib.dir}">
+ <include name="*.jar" />
+ </fileset>
+ <pathelement path="${maven.runtime.classpath}"/>
+ </classpath>
+
+
+ </sql>
+
+ <echo>Executed sql for ${rdbms.type}</echo>
+
+
+ </target>
+
+ <target name="does.user.schema.exist" >
+ <echo>Executing table script file ${script.file}</echo>
+ <echo>User account: ${adminuser} url: ${url}</echo>
+
+ <available file="${script.file}"
property="script.file.exist"/>
+
+ <fail unless="script.file.exist" message="DDL ${script.file} does
not exist" />
+
+
+ <sql driver="${driver}"
+ url="${URL}"
+ userid="${adminuser}"
+ password="${adminpassword}"
+ src="${script.file}"
+ rdbms="${rdbms.type}"
+ delimiter="${delim}"
+ delimitertype="${delimtype}"
+ autocommit="${autocommit}"
+ onerror="${onerror}" >
+ <classpath>
+ <fileset dir="${lib.dir}">
+ <include name="*.jar" />
+ </fileset>
+ <pathelement path="${maven.runtime.classpath}"/>
+ </classpath>
+
+
+ </sql>
+
+
+ </target>
+
+</project>
\ No newline at end of file
Added:
branches/JCA/test-integration/db/src/main/resources/ddl/sqlserver/create_tables.sql
===================================================================
--- branches/JCA/test-integration/db/src/main/resources/ddl/sqlserver/create_tables.sql
(rev 0)
+++
branches/JCA/test-integration/db/src/main/resources/ddl/sqlserver/create_tables.sql 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,13 @@
+
+-- these tables are used by custom junit test for testing transactions
+
+create Table g1 (
+ e1 NUMERIC(5),
+ e2 VARCHAR(50),
+ PRIMARY KEY (e1)
+);
+create Table g2 (
+ e1 NUMERIC(5) REFERENCES g1 (e1),
+ e2 VARCHAR(50)
+);
+
\ No newline at end of file
Added: branches/JCA/test-integration/db/src/main/resources/ddl/sqlserver/drop_tables.sql
===================================================================
--- branches/JCA/test-integration/db/src/main/resources/ddl/sqlserver/drop_tables.sql
(rev 0)
+++
branches/JCA/test-integration/db/src/main/resources/ddl/sqlserver/drop_tables.sql 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,6 @@
+
+-- drop the tables
+
+drop Table g2;
+drop Table g1;
+
\ No newline at end of file
Added:
branches/JCA/test-integration/db/src/main/resources/ddl/sqlserver/exec_parms.properties
===================================================================
---
branches/JCA/test-integration/db/src/main/resources/ddl/sqlserver/exec_parms.properties
(rev 0)
+++
branches/JCA/test-integration/db/src/main/resources/ddl/sqlserver/exec_parms.properties 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,3 @@
+delim=;
+delimtype=normal
+rdbms.type=microsoft
Added: branches/JCA/test-integration/db/src/main/resources/default-config.properties
===================================================================
--- branches/JCA/test-integration/db/src/main/resources/default-config.properties
(rev 0)
+++
branches/JCA/test-integration/db/src/main/resources/default-config.properties 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,53 @@
+##########################################
+# Common Properties for everybody
+##########################################
+
+connection-type=datasource
+
+process-batch = 20
+connector-batch = 20
+
+# this is how to submit queries to Teiid
+# default is true
+execute.in.batch=false
+
+##########################################
+# properties for Teiid connection
+##########################################
+#driver=org.teiid.jdbc.TeiidDriver
+driver=com.metamatrix.jdbc.EmbeddedDataSource
+
+#URL=jdbc:teiid:Transaction@mm://localhost:31000
+URL=jdbc:metamatrix:Transaction@target/classes/transactions/transaction.properties;user=admin;password=teiid
+User=admin
+Password=teiid
+DatabaseName=Transaction
+#ServerName=localhost
+ServerName=target/classes/transactions/transaction.properties
+PortNumber=31000
+application-name=txn-test
+
+# jboss
+# mm.ds-jndiname=java:mmXA
+# usertxn-jndiname=UserTransaction
+
+# weblogic
+mm.ds-jndiname=mmXA
+usertxn-jndiname=java:comp/UserTransaction
+
+
+# These mappings control what datasource is mapped to which model when the
-Dusedatasources=<comma seperated datasource names> option is used
+# or the system environment is set.
+#
+# By providing the numerical order, it indicates which datasource to assign based on the
order in the usedatasources property.
+#
+# If -Dusedatasources is not set, then the datasource will be assigned randomly when
obtaining a datasource.
+#
+#
+
+pm1=1
+pm2=2
+
+
+
+
Added: branches/JCA/test-integration/db/src/main/resources/transactions/Transaction.vdb
===================================================================
(Binary files differ)
Property changes on:
branches/JCA/test-integration/db/src/main/resources/transactions/Transaction.vdb
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
branches/JCA/test-integration/db/src/main/resources/transactions/transaction.properties
===================================================================
---
branches/JCA/test-integration/db/src/main/resources/transactions/transaction.properties
(rev 0)
+++
branches/JCA/test-integration/db/src/main/resources/transactions/transaction.properties 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,104 @@
+#
+# This is properties file used for bootstrap Teiid embedded for loading
+#
+#Path to the Teiid Configuration file
+dqp.configFile=../configuration.xml
+
+# Path to the directory where the VDBs are located, or list of VDBS separated by
";"
+vdb.definition=./Transaction.vdb
+dqp.buffer.usedisk=false
+dqp.buffer.processorBatchSize=5
+dqp.buffer.connectorBatchSize=5
+
+xa.enable_recovery=false
+
+teiid.home=target/scratch
+
+processName=integrationTest
+
+#xa.txnstore_dir=./txndir
+
+#dqp.workdir=./tmp/
+
+#only for testing, as this takes more time to start and shutdown
+#metamatrix.xatxnmgr.enable_recovery=false
+
+
+#Log file (optional) - will be modified to include the instance name, i.e. teiid_1.log
+dqp.logFile=./teiid.log
+
+#Logging level (CRITICAL=1,ERROR=2,WARNING=3,INFO=4,DETAIL=5) (optional: default 3)
+dqp.logLevel=3
+
+#Extensions directory - where the Connector Binding's classpath jar files are
loaded.
+#Use of this property is an implicit declaration that each Connector Binding has its own
Class Loader.
+#dqp.extensions=./extensions/
+
+#Path to instance specific temporary information for caching, buffering, and
transactions
+dqp.workdir=./work
+
+#Jars to load, which will be available to all services: UDFs, command logging, etc.
+#dqp.extension.CommonClasspath=extensionjar:x.jar,extensionjar:y.jar
+
+#Location of the UDF model
+#dqp.userDefinedFunctionsFile=extensionjar:FunctionDefinition.xmi
+
+#
+# Processor settings
+#
+
+#Process pool maximum thread count. (default 64)
+#ProcessPoolMaxThreads=64
+
+#Query processor time slice, in milliseconds. (default 2000)
+#ProcessorTimeslice=2000
+
+#Maximum allowed fetch size, set via JDBC. User requested value ignored above this value.
(default 20000)
+#MaxFetchSize=20000
+
+#The maximum number of query plans that are cached. Note: this is a memory based cache.
(default 250)
+#MaxPlanCacheSize=250
+
+#
+# BufferManager Settings
+#
+
+#The max size of a batch sent between connector and query service. Should be even
multiple of processorBatchSize. (default 2000)
+#dqp.buffer.connectorBatchSize=2000
+
+#The max size of a batch sent internally within the query processor. Should be <= the
connectorBatchSize. (default 2000)
+#dqp.buffer.processorBatchSize=2000
+
+#Defines whether to use disk buffering or not. (default 64)
+#dqp.buffer.useDisk=true
+
+#The numeric memory size in MB, to be used before disk buffering kicks in (default 64)
+#dqp.buffer.memory=64
+
+#
+# Cache Settings
+#
+
+#Maximum number of cached lookup tables. Note: this is a memory based cache. (default
20)
+#MaxCodeTables=50
+
+#Maximum number of records in a single lookup table (default 10000)
+#MaxCodeTableRecords=10000
+
+#Denotes whether or not result set caching is enabled. (default false)
+#ResultSetCacheEnabled=false
+
+#The maximum size in MB the result set cache will be allowed to grow to before objects
are removed. 0 indicates no limit. (default 50)
+#ResultSetCacheSize=50
+
+#The maximum time a result set will be kept in cache before being automatically cleared.
0 indicates no limit. (default 3600000)
+#ResultSetCacheMaxAge=3600000
+
+#Defines whether caching is restricted to a specific session ('session') or a
specific VDB version ('vdb'). (default vdb)
+#ResultSetCacheScope=vdb
+
+
+
+
+
+
Added: branches/JCA/test-integration/db/src/main/resources/xa-config.properties
===================================================================
--- branches/JCA/test-integration/db/src/main/resources/xa-config.properties
(rev 0)
+++ branches/JCA/test-integration/db/src/main/resources/xa-config.properties 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,71 @@
+##########################################
+# Common Properties for everybody
+##########################################
+
+process-batch = 20
+connector-batch = 20
+
+# this is how to submit queries to Teiid
+# default is true
+execute.in.batch=false
+
+##########################################
+# properties for Teiid connection
+##########################################
+driver=org.teiid.jdbc.TeiidDataSource
+URL=jdbc:metamatrix:Transaction@target/classes/transactions/transaction.properties;user=admin;password=teiid
+User=admin
+Password=teiid
+DatabaseName=Transaction
+ServerName=target/classes/transactions/transaction.properties
+PortNumber=0
+application-name=txn-test
+
+# jboss
+# mm.ds-jndiname=java:mmXA
+# usertxn-jndiname=UserTransaction
+
+# weblogic
+mm.ds-jndiname=mmXA
+usertxn-jndiname=java:comp/UserTransaction
+
+# These mappings control what datasource is mapped to which model when the
-Dusedatasources=<comma seperated datasource names> option is used
+# or the system environment is set.
+#
+# By providing the numerical order, it indicates which datasource to assign based on the
order in the usedatasources property.
+#
+# If -Dusedatasources is not set, then the datasource will be assigned in the order they
are calling to obtain a datasource.
+#
+#
+
+pm1=1
+pm2=2
+
+
+##########################################
+# For default design of testcases, these properties are in the setup method of the
testcase.
+# However, you can create your own version of the config properties file
+# and specify these properties in the config file
+# NOTE: will need to set the Sytem "config" property in order to override the
default-config.properties file
+##########################################
+
+
+#available types (datasource, driver, jndi)
+#connection-type=datasource
+#connection-type=driver
+
+
+# autocommit applies to local transaction-type only
+# default is true
+#autocommit=false
+
+# AUTO_WRAP_OFF = "OFF"
+# AUTO_WRAP_ON = "ON"
+# AUTO_WRAP_PESSIMISTIC = "PESSIMISTIC"
+# AUTO_WRAP_OPTIMISTIC = "OPTIMISTIC"
+
+#txnAutoWrap=off
+
+#-----------------------------
+
+
Added:
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/BaseAbstractTransactionTestCase.java
===================================================================
---
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/BaseAbstractTransactionTestCase.java
(rev 0)
+++
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/BaseAbstractTransactionTestCase.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,44 @@
+package org.teiid.test.testcases;
+
+import junit.framework.TestCase;
+
+import org.teiid.test.framework.ConfigPropertyLoader;
+import org.teiid.test.framework.TransactionContainer;
+
+public abstract class BaseAbstractTransactionTestCase extends TestCase {
+
+ protected TransactionContainer container = null;
+
+ public BaseAbstractTransactionTestCase(String name) {
+ super(name);
+
+
+ }
+
+ protected abstract TransactionContainer getTransactionContainter();
+
+
+
+ @Override
+ protected void setUp() throws Exception {
+ // TODO Auto-generated method stub
+ super.setUp();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ // TODO Auto-generated method stub
+ super.tearDown();
+
+ }
+
+
+ protected void addProperty(String key, String value) {
+
+ ConfigPropertyLoader.getInstance().setProperty(key, value);
+
+ }
+
+
+
+}
Added:
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/CommonTransactionTests.java
===================================================================
---
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/CommonTransactionTests.java
(rev 0)
+++
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/CommonTransactionTests.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,604 @@
+/*
+ * Copyright (c) 2000-2007 MetaMatrix, Inc.
+ * All rights reserved.
+ */
+package org.teiid.test.testcases;
+
+import java.sql.SQLException;
+import java.util.ArrayList;
+
+import org.teiid.test.framework.TransactionContainer;
+import org.teiid.test.framework.query.AbstractQueryTransactionTest;
+import org.teiid.test.framework.query.QueryExecution;
+import org.teiid.test.framework.transaction.OnWrapTransaction;
+
+import com.metamatrix.jdbc.api.AbstractQueryTest;
+
+
+/**
+ * A common test case among many different transaction stuff.
+ */
+public abstract class CommonTransactionTests extends BaseAbstractTransactionTestCase {
+
+ public CommonTransactionTests(String name) {
+ super(name);
+ }
+
+ protected abstract TransactionContainer getTransactionContainter();
+
+// void runConcurrentTestCases(int howMany, final String[] sqls) {
+//
+// SeparateClient[] clients = new SeparateClient[howMany];
+//
+// for(int i = 0; i < howMany; i++) {
+// AbstractQueryTransactionTest testCase = new AbstractQueryTransactionTest()
{
+// public void testCase() throws Exception {
+// execute(sqls);
+// }
+// };
+// clients[i] = new SeparateClient(getTransactionContainter(), testCase);
+// }
+//
+// for(int i = 0; i < howMany; i++) {
+// clients[i].start();
+// }
+//
+// try {
+// for(int i = 0; i < howMany; i++) {
+// clients[i].join();
+// }
+// } catch (InterruptedException e) {
+// // boo
+// }
+// }
+
+// static class SeparateClient extends Thread{
+// TransactionContainer container = null;
+// AbstractTransactionTestCase testCase = null;
+//
+// public SeparateClient(TransactionContainer container,
AbstractTransactionTestCase testCase) {
+// this.container = container;
+// this.testCase = testCase;
+// }
+//
+// public void run() {
+// this.container.runTransaction(this.testCase);
+// }
+// }
+
+
///////////////////////////////////////////////////////////////////////////////////////////////
+ // Single Source - Rows below 500 (for insert/update/delete)
+
///////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Sources = 1
+ * Commands = 1, Select
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testSingleSourceSelect() throws Exception {
+ AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testSingleSourceSelect") {
+ public void testCase() throws Exception {
+ execute("select * from pm1.g1 where pm1.g1.e1 < 100");
+ assertRowCount(100);
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // there is nothing to verify here..
+ }
+
+
+ /**
+ * Sources = 1
+ * Commands = 1, Update
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testSingleSourceUpdate() throws Exception {
+ AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testSingleSourceUpdate") {
+ public void testCase() throws Exception {
+ execute("insert into pm1.g1 (e1, e2) values(100,
'100')");
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g1 where e1 = 100");
+ test.assertRowCount(1);
+ test.closeConnection();
+ }
+
+
+ /**
+ * Sources = 1
+ * Commands = 1, Update(prepared statement)
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testSingleSourcePreparedUpdate() throws Exception {
+ AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testSingleSourcePreparedUpdate") {
+
+ public void testCase() throws Exception {
+ execute("insert into pm1.g1 (e1, e2) values(?, ?)", new
Object[] {new Integer(102), "102"});
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g1 where e1 = 102");
+ test.assertRowCount(1);
+ test.closeConnection();
+ }
+
+ /**
+ * Sources = 1
+ * Commands = multiple - Success
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testSingleSourceMultipleCommands() throws Exception {
+ AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testSingleSourceMultipleCommands") {
+ public void testCase() throws Exception {
+
+ execute("delete from pm1.g1 where pm1.g1.e1 >= ?", new
Object[] {new Integer(100)});
+
+ execute("select * from pm1.g1");
+ assertRowCount(100);
+
+ for (int i = 100; i < 110; i++) {
+ Integer val = new Integer(i);
+ execute("insert into pm1.g1 (e1, e2) values(?,?)", new
Object[] {val, val.toString()});
+ execute("insert into pm1.g2 (e1, e2) values(?,?)", new
Object[] {val, val.toString()});
+ }
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g1 where e1 >= 100");
+ test.assertRowCount(10);
+ test.execute("select * from g2 where e1 >= 100");
+ test.assertRowCount(10);
+ test.closeConnection();
+ }
+
+ /**
+ * Sources = 1
+ * Commands = 1, Select
+ * Batching = Partial Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testSingleSourcePartialProcessing() throws Exception {
+ AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testSingleSourcePartialProcessing") {
+ public void testCase() throws Exception {
+ execute("select * from pm1.g1 where pm1.g1.e1 < 100 limit
10");
+ assertRowCount(10);
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+ }
+
+
///////////////////////////////////////////////////////////////////////////////////////////////
+ // Multiple Sources - Rows from 500
+
///////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Sources = 2
+ * Commands = 1, Select
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testMultipleSourceSelect() throws Exception {
+ AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testMultipleSourceSelect") {
+ public void testCase() throws Exception {
+ execute("select * from pm1.g1 join pm2.g1 on pm1.g1.e1 = pm2.g1.e1
where pm1.g1.e1 < 100");
+ assertRowCount(100);
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+ }
+
+ /**
+ * Sources = 2
+ * Commands = 1, Select
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testMultipleSourceVirtualSelect() throws Exception {
+ AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testMultipleSourceVirtualSelect") {
+ public void testCase() throws Exception {
+ execute("select * from vm.g1 where vm.g1.pm1e1 < 100");
+ assertRowCount(100);
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+ }
+
+ /**
+ * Sources = 2
+ * Commands = 1, Update
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testMultipleSourceUpdate() throws Exception {
+ AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testMultipleSourceUpdate") {
+ public void testCase() throws Exception {
+ execute("insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2) values(500,
'500', 500, '500')");
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g1 where e2 = '500'");
+ test.assertRowCount(1);
+ test.closeConnection();
+
+ test = new QueryExecution(userTxn.getSource("pm2"));
+ test.execute("select * from g1 where e2 = '500'");
+ test.assertRowCount(1);
+ test.closeConnection();
+ }
+
+ /**
+ * Sources = 2
+ * Commands = 1, Update
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testMultipleSourceSelectInto() throws Exception {
+ AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testMultipleSourceSelectInto") {
+ public void testCase() throws Exception {
+ execute("insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2) values(501,
'501', 501, '501')");
+ execute("select pm1.g1.e1, pm1.g1.e2 into pm2.g2 from pm1.g1 where
pm1.g1.e1 = 501");
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g1 where e2 = '501'");
+ test.assertRowCount(1);
+ test.closeConnection();
+
+ test = new QueryExecution(userTxn.getSource("pm2"));
+ test.execute("select * from g1 where e2 = '501'");
+ test.assertRowCount(1);
+ test.closeConnection();
+ }
+
+ /**
+ * Sources = 2
+ * Commands = 1, Update
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testMultipleSourceBulkRowInsert() throws Exception {
+ AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testMultipleSourceBulkRowInsert") {
+ public void testCase() throws Exception {
+ for (int i = 100; i < 112; i++) {
+ Integer val = new Integer(i);
+ execute("insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2)
values(?,?,?,?)", new Object[] {val, val.toString(), val, val.toString()});
+ }
+ execute("select pm1.g1.e1, pm1.g1.e2 into pm2.g2 from pm1.g1 where
pm1.g1.e1 >= 100");
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g1 where e1 >= 100 and e1 < 112");
+ test.assertRowCount(12);
+ test.closeConnection();
+
+ test = new QueryExecution(userTxn.getSource("pm2"));
+ test.execute("select * from g1 where e1 >= 100 and e1 < 112");
+ test.assertRowCount(12);
+ test.execute("select * from g2 where e1 >= 100 and e1 < 112");
+ test.assertRowCount(12);
+ test.closeConnection();
+ }
+
+ /**
+ * Sources = 2
+ * Commands = 1, Update(prepared statement)
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testMultipleSourcePreparedUpdate() throws Exception {
+ AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testMultipleSourcePreparedUpdate") {
+ public void testCase() throws Exception {
+ Integer value = new Integer(500);
+ execute("insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2)
values(?,?,?,?)", new Object[] {value, value.toString(), value, value.toString()});
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g1 where e1 = 500");
+ test.assertRowCount(1);
+ test.closeConnection();
+
+ test = new QueryExecution(userTxn.getSource("pm2"));
+ test.execute("select * from g1 where e1 = 500");
+ test.assertRowCount(1);
+ test.closeConnection();
+ }
+
+
+ /**
+ * Sources = 2
+ * Commands = multiple - Success
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testMultipleSourceMultipleCommands() throws Exception {
+ AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testMultipleSourceMultipleCommands") {
+ public void testCase() throws Exception {
+ execute("delete from pm1.g2 where e1 >= ?", new Object[]
{new Integer(100)});
+ execute("delete from pm1.g1 where e1 >= ?", new Object[]
{new Integer(100)});
+ execute("delete from pm2.g2 where e1 >= ?", new Object[]
{new Integer(100)});
+ execute("delete from pm2.g1 where e1 >= ?", new Object[]
{new Integer(100)});
+
+ execute("select * from pm1.g1");
+ assertRowCount(100);
+
+ for (int i = 100; i < 115; i++) {
+ Integer val = new Integer(i);
+ execute("insert into pm1.g1 (e1, e2) values(?,?)", new
Object[] {val, val.toString()});
+ execute("insert into pm1.g2 (e1, e2) values(?,?)", new
Object[] {val, val.toString()});
+
+ execute("insert into pm2.g1 (e1, e2) values(?,?)", new
Object[] {val, val.toString()});
+ execute("insert into pm2.g2 (e1, e2) values(?,?)", new
Object[] {val, val.toString()});
+ }
+
+ execute("update pm1.g1 set e2='blah' where e1 >
100");
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"))
{
+ protected boolean compareCaseSensitive() {
+ return false;
+ }
+ };
+ test.execute("select * from g1 where e1 >= 100 and e1 < 115");
+ test.assertRowCount(15);
+ test.execute("select * from g2 where e1 >= 100 and e1 < 115");
+ test.assertRowCount(15);
+ test.execute("select distinct e2 from g1 where e1 > 100");
+
+ // NOTE: if this is an oracle source, it failes because it return varchar2
+ if
(userTxn.getSource("pm1").getMetaData().getDatabaseProductName().toLowerCase().indexOf("oracle")
> -1) {
+ test.assertResultsSetEquals(new String[] {"e2[varchar2]",
"blah"});
+ } else {
+ test.assertResultsSetEquals(new String[] {"e2[varchar]",
"blah"});
+ }
+ test.closeConnection();
+ }
+
+ /**
+ * Sources = 2
+ * Commands = multiple - Success
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testMultipleSourceMultipleVirtualCommands() throws Exception {
+ AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testMultipleSourceMultipleVirtualCommands") {
+ public void testCase() throws Exception {
+
+ for (int i = 200; i < 207; i++) {
+ Integer val = new Integer(i);
+ execute("insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2)
values(?,?,?,?)", new Object[] {val, val.toString(), val, val.toString()});
+ execute("insert into vm.g2 (pm1e1, pm1e2, pm2e1, pm2e2)
values(?,?,?,?)", new Object[] {val, val.toString(), val, val.toString()});
+ }
+
+ execute("update vm.g1 set pm1e2='blah' where pm1e1 >=
200");
+
+ execute("delete from vm.g2 where vm.g2.pm1e1 >= 205");
+ execute("delete from vm.g1 where vm.g1.pm1e1 >= 205");
+
+ execute("select * from vm.g1 where pm1e1 >= 200 and pm1e1 <
207");
+ assertRowCount(5);
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1")){
+ protected boolean compareCaseSensitive() {
+ return false;
+ }
+ };
+ test.execute("select * from g1 where e1 >= 200 and e1 < 207");
+ test.assertRowCount(5);
+ test.execute("select * from g2 where e1 >= 200 and e1 < 207");
+ test.assertRowCount(5);
+ test.execute("select distinct e2 from g1 where e1 >= 200 and e1 <
207");
+ test.assertResultsSetEquals(new String[] {"e2[varchar2]",
"blah"});
+ test.closeConnection();
+ }
+
+ /**
+ * Sources = 2
+ * Commands = multiple - Success
+ * Batching = Full Processing, Single Connector Batch
+ * result = rollback
+ */
+ public void testMultipleSourceMultipleCommandsCancel() throws Exception {
+ AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testMultipleSourceMultipleCommandsCancel") {
+
+ public void testCase() throws Exception {
+ Thread t = new Thread("Cancel Thread") {
+ public void run() {
+ try {
+ try {
+ Thread.sleep(500);
+ cancelQuery();
+ } catch (SQLException e) {
+ // debug(e.getMessage());
+ }
+ } catch (InterruptedException e) {}
+ }
+ };
+ t.start();
+ executeBatch(getMultipleSourceBatch());
+ }
+
+ /**
+ * @see
com.metamatrix.transaction.test.framework.AbstractQueryTest#exceptionExpected()
+ */
+ public boolean exceptionExpected() {
+ return true;
+ }
+ };
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results (this may finish under one second, then this test is
not valid)
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g1 where e1 >= 600 and e1 < 650");
+ test.assertRowCount(0);
+ test.execute("select * from g2 where e1 >= 600 and e1 < 650");
+ test.assertRowCount(0);
+ test.execute("select distinct e2 from g1 where e1 >= 600 and e1 <
650");
+ test.assertRowCount(0);
+ test.closeConnection();
+ }
+
+ /**
+ * Sources = 2
+ * Commands = multiple - Success
+ * Batching = Full Processing, Single Connector Batch
+ * result = rollback
+ */
+ public void testMultipleSourceTimeout() throws Exception{
+ AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testMultipleSourceTimeout") {
+ public void testCase() throws Exception {
+ executeBatch(getMultipleSourceBatch(), 1); // time out after 1 sec
+ }
+
+ public boolean exceptionExpected() {
+ return true;
+ }
+
+ public void after() {
+ if (!exceptionOccurred()) {
+ fail("should have failed with time out exception");
+ }
+ else {
+ assertTrue(getLastException().getMessage().indexOf("Operation
timed out before completion") != -1);
+ }
+ }
+ };
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results (this may finish under one second, then this test is
not valid)
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g1 where e1 >= 600 and e1 < 750");
+ test.assertRowCount(0);
+ test.execute("select * from g2 where e1 >= 600 and e1 < 750");
+ test.assertRowCount(0);
+ test.execute("select distinct e2 from g1 where e1 >= 600 and e1 <
750");
+ test.assertRowCount(0);
+ test.closeConnection();
+ }
+
+
+ static String[] getMultipleSourceBatch() {
+ ArrayList list = new ArrayList();
+
+ for (int i = 600; i < 750; i++) {
+ list.add("insert into pm1.g1 (e1, e2)
values("+i+",'"+i+"')");
+ list.add("insert into pm1.g2 (e1, e2) values
("+i+",'"+i+"')");
+ list.add("insert into pm2.g1 (e1, e2)
values("+i+",'"+i+"')");
+ list.add("insert into pm2.g2 (e1, e2) values
("+i+",'"+i+"')");
+ }
+
+ list.add("update pm1.g1 set e2='blah' where pm1.g1.e1 >=
600");
+ list.add("update pm2.g1 set e2='blah' where pm2.g1.e1 >=
600");
+
+ list.add("delete from pm1.g2 where pm1.g2.e1 >= 610");
+ list.add("delete from pm1.g1 where pm1.g1.e1 >= 610");
+ list.add("delete from pm2.g2 where pm2.g2.e1 >= 610");
+ list.add("delete from pm2.g1 where pm2.g1.e1 >= 610");
+
+ return(String[])list.toArray(new String[list.size()]);
+ }
+
+
+ /**
+ * Sources = 2
+ * Commands = 1, Select
+ * Batching = Partial Processing, Single Connector Batch
+ * result = commit
+ * Note: This is producing the below error some times; however this is SQL Server
issue.
+ *
http://support.microsoft.com/?kbid=834849
+ */
+ public void xtestMultipleSourcePartialProcessingUsingLimit() throws Exception {
+ AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testMultipleSourcePartialProcessingUsingLimit") {
+ public void testCase() throws Exception {
+ execute("select * from vm.g1 where pm1e1 < 100 limit 10");
+ assertRowCount(10);
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+ }
+
+ /**
+ * Sources = 2
+ * Commands = 1, Select
+ * Batching = Partial Processing, Single Connector Batch
+ * result = commit
+ * Note: This is producing the below error some times; however this is SQL Server
issue.
+ *
http://support.microsoft.com/?kbid=834849
+ */
+ public void xtestMultipleSourcePartialProcessingUsingMakedep() throws Exception {
+ AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testMultipleSourcePartialProcessingUsingMakedep")
{
+ public void testCase() throws Exception {
+ execute("select pm1.g1.e1, pm1.g1.e2 from pm1.g1 LEFT OUTER JOIN
pm2.g1 MAKENOTDEP ON pm1.g1.e2 = pm2.g1.e2 where pm2.g1.e1 >= 50 and pm2.g1.e1 <
100");
+ assertRowCount(50);
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+ }
+
+
+
+
+}
Added:
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionDriverFalseOffTest.java
===================================================================
---
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionDriverFalseOffTest.java
(rev 0)
+++
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionDriverFalseOffTest.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2000-2007 MetaMatrix, Inc.
+ * All rights reserved.
+ */
+package org.teiid.test.testcases;
+
+import org.teiid.test.framework.ConfigPropertyLoader;
+import org.teiid.test.framework.ConfigPropertyNames;
+import org.teiid.test.framework.ConfigPropertyNames.CONNECTION_STRATEGY_PROPS;
+
+
+/**
+ * Local Transaction Test
+ *
+ * Settings:
+ *
+ * - Using Driver
+ * - Autocommit = False
+ * - TxnAutoWrap = Off
+ */
+public class LocalTransactionDriverFalseOffTest extends TwoSourceTransactionScenarios {
+
+ public LocalTransactionDriverFalseOffTest(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ this.addProperty(ConfigPropertyNames.CONNECTION_TYPE,
ConfigPropertyNames.CONNECTION_TYPES.DRIVER_CONNECTION);
+
+ this.addProperty(CONNECTION_STRATEGY_PROPS.AUTOCOMMIT, "false");
+ this.addProperty(CONNECTION_STRATEGY_PROPS.TXN_AUTO_WRAP, "off");
+ this.addProperty(ConfigPropertyNames.CONFIG_FILE,
ConfigPropertyLoader.DEFAULT_CONFIG_FILE_NAME);
+ this.addProperty(ConfigPropertyNames.USE_DATASOURCES_PROP, "derby,mysql");
+
+
+ }
+
+
+
+
+
+
+
+
+}
Added:
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionDriverTrueOffTest.java
===================================================================
---
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionDriverTrueOffTest.java
(rev 0)
+++
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionDriverTrueOffTest.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2000-2007 MetaMatrix, Inc.
+ * All rights reserved.
+ */
+package org.teiid.test.testcases;
+
+import org.teiid.test.framework.ConfigPropertyLoader;
+import org.teiid.test.framework.ConfigPropertyNames;
+import org.teiid.test.framework.ConfigPropertyNames.CONNECTION_STRATEGY_PROPS;
+
+
+/**
+ * Local Transaction Test
+ *
+ * Settings:
+ *
+ * - Using Driver
+ * - Autocommit = True
+ * - TxnAutoWrap = Off
+ */
+public class LocalTransactionDriverTrueOffTest extends TwoSourceTransactionScenarios {
+
+ public LocalTransactionDriverTrueOffTest(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ this.addProperty(ConfigPropertyNames.CONNECTION_TYPE,
ConfigPropertyNames.CONNECTION_TYPES.DRIVER_CONNECTION);
+ this.addProperty(CONNECTION_STRATEGY_PROPS.AUTOCOMMIT, "true");
+ this.addProperty(CONNECTION_STRATEGY_PROPS.TXN_AUTO_WRAP, "off");
+ this.addProperty(ConfigPropertyNames.CONFIG_FILE,
ConfigPropertyLoader.DEFAULT_CONFIG_FILE_NAME);
+ this.addProperty(ConfigPropertyNames.USE_DATASOURCES_PROP, "derby,mysql");
+
+
+ }
+
+}
Added:
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionTests.java
===================================================================
---
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionTests.java
(rev 0)
+++
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionTests.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,273 @@
+/*
+ * Copyright (c) 2000-2007 MetaMatrix, Inc.
+ * All rights reserved.
+ */
+package org.teiid.test.testcases;
+
+import org.teiid.test.framework.TransactionContainer;
+import org.teiid.test.framework.query.AbstractQueryTransactionTest;
+import org.teiid.test.framework.query.QueryExecution;
+import org.teiid.test.framework.transaction.LocalTransaction;
+
+import com.metamatrix.jdbc.api.AbstractQueryTest;
+
+
+
+
+/**
+ * User Transaction Test is where user handles all the transaction boundaries
+ * so, autocmmit = OFF, and No transaction auto wrapping.
+ */
+public class LocalTransactionTests extends CommonTransactionTests {
+
+
+ public LocalTransactionTests(String testName) {
+ super(testName);
+ }
+
+
+ @Override
+ protected TransactionContainer getTransactionContainter() {
+ // TODO Auto-generated method stub
+ return new LocalTransaction();
+ }
+
+ /**
+ * Sources = 1
+ * Commands = multiple - Success
+ * Batching = Full Processing, Single Connector Batch
+ * result = rollback
+ */
+ public void testSingleSourceMultipleCommandsExplicitRollback() throws Exception {
+ AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testSingleSourceMultipleCommandsExplicitRollback")
{
+ public void testCase() throws Exception {
+ for (int i = 200; i < 220; i++) {
+ execute("insert into pm1.g1 (e1, e2)
values("+i+",'"+i+"')");
+ execute("insert into pm1.g2 (e1, e2)
values("+i+",'"+i+"')");
+ }
+ }
+
+ public boolean rollbackAllways() {
+ return true;
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g1 where e1 >= 200 and e1 < 220");
+ test.assertRowCount(0);
+ test.execute("select * from g2 where e1 >= 200 and e1 < 220");
+ test.assertRowCount(0);
+ test.closeConnection();
+ }
+
+ /**
+ * Sources = 1
+ * Commands = multiple - Success
+ * Batching = Full Processing, Single Connector Batch
+ * result = rollback
+ */
+ public void testSingleSourceMultipleCommandsReferentialIntegrityRollback() throws
Exception {
+ AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testSingleSourceMultipleCommandsReferentialIntegrityRollback")
{
+ public void testCase() throws Exception {
+ for (int i = 200; i < 220; i++) {
+ Integer val = new Integer(i);
+ execute("insert into pm1.g1 (e1, e2) values(?,?)", new
Object[] {val, val.toString()});
+ execute("insert into pm1.g2 (e1, e2) values(?,?)", new
Object[] {val, val.toString()});
+ }
+
+ // force the rollback by trying to insert an invalid row.
+ execute("insert into pm1.g2 (e1, e2) values(?,?)", new Object[]
{new Integer(9999), "9999"});
+ }
+
+ public boolean exceptionExpected() {
+ return true;
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g1 where e1 >= 200 and e1 < 220");
+ test.assertRowCount(0);
+ test.closeConnection();
+ }
+
+ /**
+ * Sources = 2
+ * Commands = multiple - Success
+ * Batching = Full Processing, Single Connector Batch
+ * result = rollback
+ */
+ public void testMultipleSourceMultipleCommandsExplicitRollback() throws Exception {
+ AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testMultipleSourceMultipleCommandsExplicitRollback")
{
+ public void testCase() throws Exception {
+
+ for (int i = 700; i < 720; i++) {
+ Integer val = new Integer(i);
+ execute("insert into pm1.g1 (e1, e2) values(?,?)", new
Object[] {val, val.toString()});
+ execute("insert into pm1.g2 (e1, e2) values(?,?)", new
Object[] {val, val.toString()});
+
+ execute("insert into pm2.g1 (e1, e2) values(?,?)", new
Object[] {val, val.toString()});
+ execute("insert into pm2.g2 (e1, e2) values(?,?)", new
Object[] {val, val.toString()});
+ }
+ }
+
+ // force the rollback
+ public boolean rollbackAllways() {
+ return true;
+ }
+
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g1 where e1 >= 700 and e1 < 720");
+ test.assertRowCount(0);
+ test.closeConnection();
+
+ test = new QueryExecution(userTxn.getSource("pm2"));
+ test.execute("select * from g1 where e1 >= 700 and e1 < 720");
+ test.assertRowCount(0);
+ test.closeConnection();
+ }
+
+ /**
+ * Sources = 2
+ * Commands = multiple - Success
+ * Batching = Full Processing, Single Connector Batch
+ * result = rollback
+ */
+ public void testMultipleSourceMultipleCommandsReferentialIntegrityRollback() throws
Exception {
+ AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testMultipleSourceMultipleCommandsReferentialIntegrityRollback")
{
+ public void testCase() throws Exception {
+
+ for (int i = 700; i < 720; i++) {
+ Integer val = new Integer(i);
+ execute("insert into pm1.g1 (e1, e2) values(?,?)", new
Object[] {val, val.toString()});
+ execute("insert into pm1.g2 (e1, e2) values(?,?)", new
Object[] {val, val.toString()});
+
+ execute("insert into pm2.g1 (e1, e2) values(?,?)", new
Object[] {val, val.toString()});
+ execute("insert into pm2.g2 (e1, e2) values(?,?)", new
Object[] {val, val.toString()});
+ }
+
+ // force the rollback by trying to insert an invalid row.
+ execute("insert into pm1.g2 (e1, e2) values(?,?)", new Object[]
{new Integer(9999), "9999"});
+ }
+
+ public boolean exceptionExpected() {
+ return true;
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g1 where e1 >= 700 and e1 < 720");
+ test.assertRowCount(0);
+ test.closeConnection();
+
+ test = new QueryExecution(userTxn.getSource("pm2"));
+ test.execute("select * from g1 where e1 >= 700 and e1 < 720");
+ test.assertRowCount(0);
+ test.closeConnection();
+ }
+
+ /**
+ * Sources = 2
+ * Commands = 1, Update
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testMultipleSourceBulkRowInsertRollback() throws Exception {
+ AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testMultipleSourceBulkRowInsertRollback") {
+ public void testCase() throws Exception {
+ for (int i = 100; i < 120; i++) {
+ Integer val = new Integer(i);
+ execute("insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2)
values(?,?,?,?)", new Object[] {val, val.toString(), val, val.toString()});
+ }
+ execute("select pm1.g1.e1, pm1.g1.e2 into pm2.g2 from pm1.g1 where
pm1.g1.e1 >= 100");
+
+ // force the rollback by trying to insert an invalid row.
+ execute("insert into pm1.g2 (e1, e2) values(?,?)", new Object[]
{new Integer(9999), "9999"});
+ }
+
+ public boolean exceptionExpected() {
+ return true;
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g1 where e1 >= 100 and e1 < 120");
+ test.assertRowCount(0);
+ test.closeConnection();
+
+ test = new QueryExecution(userTxn.getSource("pm2"));
+ test.execute("select * from g1 where e1 >= 100 and e1 < 120");
+ test.assertRowCount(0);
+ test.execute("select * from g2 where e1 >= 100 and e1 < 120");
+ test.assertRowCount(0);
+ test.closeConnection();
+ }
+
+ /**
+ * Sources = 2
+ * Commands = multiple - Success
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testMultipleSourceMultipleVirtualCommandsRollback() throws Exception {
+ AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testMultipleSourceMultipleVirtualCommandsRollback")
{
+ public void testCase() throws Exception {
+
+ for (int i = 600; i < 615; i++) {
+ Integer val = new Integer(i);
+ execute("insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2)
values(?,?,?,?)", new Object[] {val, val.toString(), val, val.toString()});
+ execute("insert into vm.g2 (pm1e1, pm1e2, pm2e1, pm2e2)
values(?,?,?,?)", new Object[] {val, val.toString(), val, val.toString()});
+ }
+
+ execute("update vm.g1 set pm1e2='blah' where pm1e1 >=
605");
+
+ execute("delete from vm.g2 where vm.g2.pm1e1 >= 610");
+ execute("delete from vm.g1 where vm.g1.pm1e1 >= 610");
+
+ execute("select * from vm.g1 where pm1e1 >= 600 and pm1e1 <
615");
+ assertRowCount(10);
+
+ // force the rollback by trying to insert an invalid row.
+ execute("insert into pm1.g2 (e1, e2) values(?,?)", new Object[]
{new Integer(9999), "9999"});
+ }
+
+ public boolean exceptionExpected() {
+ return true;
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g1 where e1 >= 600 and e1 < 615");
+ test.assertRowCount(0);
+ test.execute("select * from g2 where e1 >= 600 and e1 < 615");
+ test.assertRowCount(0);
+ test.execute("select distinct e2 from g1 where e1 >= 600 and e1 <
615");
+ test.assertRowCount(0);
+ test.closeConnection();
+ }
+}
Added:
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/OffWrapTransactionTests.java
===================================================================
---
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/OffWrapTransactionTests.java
(rev 0)
+++
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/OffWrapTransactionTests.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,283 @@
+/*
+ * Copyright (c) 2000-2007 MetaMatrix, Inc.
+ * All rights reserved.
+ */
+package org.teiid.test.testcases;
+
+import java.util.ArrayList;
+
+import org.teiid.test.framework.TransactionContainer;
+import org.teiid.test.framework.query.AbstractQueryTransactionTest;
+import org.teiid.test.framework.query.QueryExecution;
+import org.teiid.test.framework.transaction.OffWrapTransaction;
+
+import com.metamatrix.jdbc.api.AbstractQueryTest;
+
+
+public class OffWrapTransactionTests extends BaseAbstractTransactionTestCase {
+
+
+
+ public OffWrapTransactionTests(String testName) {
+ super(testName);
+ }
+
+ @Override
+ protected TransactionContainer getTransactionContainter() {
+ // TODO Auto-generated method stub
+ return new OffWrapTransaction();
+ }
+
+
+
+ /**
+ * Sources = 1
+ * Commands = 1, Select
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testSingleSourceSelect() throws Exception {
+
+ AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testSingleSourceSelect") {
+ public void testCase() throws Exception {
+ execute("select * from pm1.g1 where pm1.g1.e1 < 100");
+ assertRowCount(100);
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+ }
+
+
+
+ /**
+ * Sources = 1
+ * Commands = 1, Update
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testSingleSourceUpdate() throws Exception {
+ AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testSingleSourceUpdate") {
+ public void testCase() throws Exception {
+ execute("insert into pm1.g1 (e1, e2) values(100,
'100')");
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g1 where e1 = 100");
+ test.assertRowCount(1);
+ test.closeConnection();
+ }
+
+ /**
+ * Sources = 1
+ * Commands = multiple - Success
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testSingleSourceMultipleCommands() throws Exception {
+ AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testSingleSourceMultipleCommands") {
+ public void testCase() throws Exception {
+ execute("delete from pm1.g1 where pm1.g1.e1 >= ?", new
Object[] {new Integer(100)});
+ execute("select * from pm1.g1");
+ assertRowCount(100);
+ for (int i = 100; i < 110; i++) {
+ Integer val = new Integer(i);
+ execute("insert into pm1.g1 (e1, e2) values(?,?)", new
Object[] {val, val.toString()});
+ execute("insert into pm1.g2 (e1, e2) values(?,?)", new
Object[] {val, val.toString()});
+ }
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g1 where e1 >= 100");
+ test.assertRowCount(10);
+ test.execute("select * from g2 where e1 >= 100");
+ test.assertRowCount(10);
+ test.closeConnection();
+ }
+
+ /**
+ * Sources = 1
+ * Commands = multiple - Success
+ * Batching = Full Processing, Single Connector Batch
+ * result = rollback
+ */
+ public void testSingleSourceMultipleCommandsReferentialIntegrityRollback() throws
Exception {
+ AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest() {
+ public void testCase() throws Exception {
+
+ for (int i = 200; i < 210; i++) {
+ Integer val = new Integer(i);
+ execute("insert into pm1.g1 (e1, e2) values(?,?)", new
Object[] {val, val.toString()});
+ execute("insert into pm1.g2 (e1, e2) values(?,?)", new
Object[] {val, val.toString()});
+ }
+
+ // force the rollback by trying to insert an invalid row.
+ execute("insert into pm1.g2 (e1, e2) values(?,?)", new Object[]
{new Integer(9999), "9999"});
+ }
+ public boolean exceptionExpected() {
+ return true;
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g1 where e1 >= 200");
+ test.assertRowCount(10);
+ test.closeConnection();
+ }
+
+
///////////////////////////////////////////////////////////////////////////////////////////////
+ // Multiple Sources - Rows from 500
+
///////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Sources = 2
+ * Commands = 1, Select
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testMultipleSourceSelect() throws Exception {
+ AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest() {
+ public void testCase() throws Exception {
+ execute("select * from pm1.g1 join pm2.g1 on pm1.g1.e1 = pm2.g1.e1
where pm1.g1.e1 < 100");
+ assertRowCount(100);
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+ }
+
+ /**
+ * Sources = 2
+ * Commands = 1, Update
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testMultipleSourceUpdate() throws Exception {
+ AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest() {
+ public void testCase() throws Exception {
+ execute("insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2) values(500,
'500', 500, '500')");
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g1 where e1 = 500");
+ test.assertRowCount(1);
+ test.closeConnection();
+
+ test = new QueryExecution(userTxn.getSource("pm2"));
+ test.execute("select * from g1 where e1 = 500");
+ test.assertRowCount(1);
+ test.closeConnection();
+ }
+
+ /**
+ * Sources = 2
+ * Commands = multiple - Success
+ * Batching = Full Processing, Single Connector Batch
+ * result = rollback
+ */
+ public void testMultipleSourceMultipleCommandsReferentialIntegrityRollback() throws
Exception {
+
+ AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest() {
+ public void testCase() throws Exception {
+
+ for (int i = 700; i < 710; i++) {
+ Integer val = new Integer(i);
+ execute("insert into pm1.g1 (e1, e2) values(?,?)", new
Object[] {val, val.toString()});
+ execute("insert into pm1.g2 (e1, e2) values(?,?)", new
Object[] {val, val.toString()});
+
+ execute("insert into pm2.g1 (e1, e2) values(?,?)", new
Object[] {val, val.toString()});
+ execute("insert into pm2.g2 (e1, e2) values(?,?)", new
Object[] {val, val.toString()});
+ }
+
+ // force the rollback by trying to insert an invalid row.
+ execute("insert into pm1.g2 (e1, e2) values(?,?)", new Object[]
{new Integer(9999), "9999"});
+ }
+
+ public boolean exceptionExpected() {
+ return true;
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g1 where e1 >= 700 and e1 < 710");
+ test.assertRowCount(10);
+ test.closeConnection();
+
+ test = new QueryExecution(userTxn.getSource("pm2"));
+ test.execute("select * from g1 where e1 >= 700 and e1 < 710");
+ test.assertRowCount(10);
+ test.closeConnection();
+ }
+
+ /**
+ * Sources = 2
+ * Commands = 1, Update
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testMultipleSourceBulkRowInsert() throws Exception {
+
+
+ AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest() {
+ ArrayList list = new ArrayList();
+ public void testCase() throws Exception {
+ for (int i = 800; i < 807; i++) {
+ list.add("insert into pm1.g1 (e1, e2)
values("+i+",'"+i+"')");
+ list.add("insert into pm2.g1 (e1, e2)
values("+i+",'"+i+"')");
+ }
+ list.add("select pm1.g1.e1, pm1.g1.e2 into pm2.g2 from pm1.g1 where
pm1.g1.e1 >= 800");
+
+ // force the rollback by trying to insert an invalid row.
+ list.add("insert into pm1.g2 (e1, e2)
values(9999,'9999')");
+
+ // execute((String[])list.toArray(new String[list.size()]));
+ executeBatch((String[])list.toArray(new String[list.size()]), -1);
+ }
+
+ public boolean exceptionExpected() {
+ return true;
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g1 where e1 >= 800 and e1 < 807");
+ test.assertRowCount(7);
+ test.closeConnection();
+
+ test = new QueryExecution(userTxn.getSource("pm2"));
+ test.execute("select * from g1 where e1 >= 800 and e1 < 807");
+ test.assertRowCount(7);
+ test.execute("select * from g2 where e1 >= 800 and e1 < 807");
+ test.assertRowCount(7);
+ test.closeConnection();
+ }
+}
Added:
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/OnWrapTransactionTests.java
===================================================================
---
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/OnWrapTransactionTests.java
(rev 0)
+++
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/OnWrapTransactionTests.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2000-2007 MetaMatrix, Inc.
+ * All rights reserved.
+ */
+package org.teiid.test.testcases;
+
+import java.util.ArrayList;
+
+import org.teiid.test.framework.TransactionContainer;
+import org.teiid.test.framework.query.AbstractQueryTransactionTest;
+import org.teiid.test.framework.query.QueryExecution;
+import org.teiid.test.framework.transaction.OnWrapTransaction;
+
+import com.metamatrix.jdbc.api.AbstractQueryTest;
+
+
+
+
+public class OnWrapTransactionTests extends CommonTransactionTests {
+
+ public OnWrapTransactionTests(String testName) {
+ super(testName);
+ }
+
+
+ @Override
+ protected TransactionContainer getTransactionContainter() {
+ // TODO Auto-generated method stub
+ return new OnWrapTransaction();
+ }
+
+ /**
+ * Sources = 1
+ * Commands = multiple - Success
+ * Batching = Full Processing, Single Connector Batch
+ * result = rollback
+ */
+ public void testSingleSourceMultipleCommandsReferentialIntegrityRollback() throws
Exception {
+ AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest() {
+ public void testCase() throws Exception {
+ for (int i = 200; i < 210; i++) {
+ Integer val = new Integer(i);
+ execute("insert into pm1.g1 (e1, e2) values(?,?)", new
Object[] {val, val.toString()});
+ execute("insert into pm1.g2 (e1, e2) values(?,?)", new
Object[] {val, val.toString()});
+ }
+
+ // try to rollback, however since this autocommit=on above two are
already commited
+ execute("insert into pm1.g2 (e1, e2) values(?,?)", new Object[]
{new Integer(9999), "9999"});
+ }
+
+ public boolean exceptionExpected() {
+ return true;
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g1 where e1 >= 200 and e1 < 210");
+ test.assertRowCount(10);
+ test.execute("select * from g2 where e1 = 9999");
+ test.assertRowCount(0);
+ test.closeConnection();
+ }
+
+
+ /**
+ * Sources = 1
+ * Commands = multiple - Success
+ * Batching = Full Processing, Single Connector Batch
+ * result = rollback
+ */
+ public void testSingleSourceBatchCommandReferentialIntegrityRollback() throws
Exception {
+ AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest() {
+ public void testCase() throws Exception {
+ ArrayList list = new ArrayList();
+ for (int i = 200; i < 210; i++) {
+ list.add("insert into pm1.g1 (e1, e2)
values("+i+",'"+i+"')");
+ }
+
+ // try to rollback, since we are in single batch it must rollback
+ list.add("insert into pm1.g2 (e1, e2)
values(9999,'9999')");
+ executeBatch((String[])list.toArray(new String[list.size()]));
+ }
+
+ public boolean exceptionExpected() {
+ return true;
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g1 where e1 >= 200 and e1 < 210");
+ test.assertRowCount(0);
+ test.execute("select * from g2 where e1 = 9999");
+ test.assertRowCount(0);
+ test.closeConnection();
+ }
+
+ /**
+ * Sources = 2
+ * Commands = 1, Update
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testMultipleSourceBulkRowInsertRollback() throws Exception {
+ AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest() {
+ ArrayList list = new ArrayList();
+ public void testCase() throws Exception {
+ for (int i = 100; i < 110; i++) {
+ list.add("insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2)
values("+i+",'"+i+"',"+i+",'"+i+"')");
+ }
+ list.add("select pm1.g1.e1, pm1.g1.e2 into pm2.g2 from pm1.g1 where
pm1.g1.e1 >= 100");
+
+ // force the rollback by trying to insert an invalid row.
+ list.add("insert into pm1.g2 (e1, e2)
values(9999,'9999')");
+
+ executeBatch((String[])list.toArray(new String[list.size()]));
+ }
+
+ public boolean exceptionExpected() {
+ return true;
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g1 where e1 >= 100 and e1 < 110");
+ test.assertRowCount(0);
+ test.closeConnection();
+
+ test = new QueryExecution(userTxn.getSource("pm2"));
+ test.execute("select * from g1 where e1 >= 100 and e1 < 110");
+ test.assertRowCount(0);
+ test.execute("select * from g2 where e1 >= 100 and e1 < 110");
+ test.assertRowCount(0);
+ test.closeConnection();
+ }
+}
Added:
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/OptimisticWrapTransactionTests.java
===================================================================
---
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/OptimisticWrapTransactionTests.java
(rev 0)
+++
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/OptimisticWrapTransactionTests.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,491 @@
+/*
+ * Copyright (c) 2000-2007 MetaMatrix, Inc.
+ * All rights reserved.
+ */
+package org.teiid.test.testcases;
+
+import java.util.ArrayList;
+
+import org.teiid.test.framework.TransactionContainer;
+import org.teiid.test.framework.query.AbstractQueryTransactionTest;
+import org.teiid.test.framework.query.QueryExecution;
+import org.teiid.test.framework.transaction.OptimisticWrapTransaction;
+
+import com.metamatrix.jdbc.api.AbstractQueryTest;
+
+
+
+/**
+ * The main thing to test in this is, when the single source should is involved it should
work
+ * fine, when multiple sources involved it should fail.
+ */
+public class OptimisticWrapTransactionTests extends BaseAbstractTransactionTestCase {
+
+ public OptimisticWrapTransactionTests(String testName) {
+ super(testName);
+ }
+
+ protected TransactionContainer getTransactionContainter() {
+ return new OptimisticWrapTransaction();
+ }
+
+
///////////////////////////////////////////////////////////////////////////////////////////////
+ // Single Source - Rows below 500 (for insert/update/delete)
+
///////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Sources = 1
+ * Commands = 1, Select
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testSingleSourceSelect() throws Exception {
+ AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest() {
+ public void testCase() throws Exception {
+ execute("select * from pm1.g1 where pm1.g1.e1 < 100");
+ assertRowCount(100);
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+ }
+
+ /**
+ * Sources = 1
+ * Commands = 1, Update(prepared statement)
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testSingleSourcePreparedUpdate() throws Exception {
+ AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest() {
+ public void testCase() throws Exception {
+ execute("insert into pm1.g1 (e1, e2) values(?, ?)", new
Object[] {new Integer(102), "102"});
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g1 where e1 = 102");
+ test.assertRowCount(1);
+ test.closeConnection();
+ }
+
+ /**
+ * Sources = 1
+ * Commands = multiple - Success
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testSingleSourceMultipleCommands() throws Exception {
+ AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest() {
+ public void testCase() throws Exception {
+ execute("delete from pm1.g2 where pm1.g2.e1 >= ?", new
Object[] {new Integer(100)});
+ execute("delete from pm1.g1 where pm1.g1.e1 >= ?", new
Object[] {new Integer(100)});
+
+ execute("select * from pm1.g1");
+ assertRowCount(100);
+ for (int i = 100; i < 120; i++) {
+ Integer val = new Integer(i);
+ execute("insert into pm1.g1 (e1, e2) values(?,?)", new
Object[] {val, val.toString()});
+ execute("insert into pm1.g2 (e1, e2) values(?,?)", new
Object[] {val, val.toString()});
+ }
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g1 where e1 >= 100 and e1 < 120");
+ test.assertRowCount(20);
+ test.execute("select * from g2 where e1 >= 100 and e1 < 120");
+ test.assertRowCount(20);
+ test.closeConnection();
+ }
+
+ /**
+ * Sources = 1
+ * Commands = multiple - Success
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testSingleSourceBatchCommand() throws Exception {
+ AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest() {
+ public void testCase() throws Exception {
+ ArrayList list = new ArrayList();
+ list.add("delete from pm1.g2 where pm1.g2.e1 >= 100");
+ list.add("delete from pm1.g1 where pm1.g1.e1 >= 100");
+
+ for (int i = 200; i < 205; i++) {
+ list.add("insert into pm1.g1 (e1, e2)
values("+i+",'"+i+"')");
+ list.add("insert into pm1.g2 (e1, e2)
values("+i+",'"+i+"')");
+ }
+ executeBatch((String[])list.toArray(new String[list.size()]));
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g1 where e1 >= 200 and e1 < 205");
+ test.assertRowCount(5);
+ test.execute("select * from g2 where e1 >= 200 and e1 < 205");
+ test.assertRowCount(5);
+ test.closeConnection();
+ }
+
+ /**
+ * Sources = 1
+ * Commands = 1, Update(prepared statement)
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testSingleSourcePreparedUpdateRollback() throws Exception {
+ AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest() {
+ public void testCase() throws Exception {
+ execute("insert into pm1.g2 (e1, e2) values(?, ?)", new
Object[] {new Integer(9999), "9999"});
+ }
+
+ public boolean exceptionExpected() {
+ return true;
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g2 where e1 = 9999");
+ test.assertRowCount(0);
+ test.closeConnection();
+ }
+
+
+ /**
+ * Sources = 1
+ * Commands = multiple - Success
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testSingleSourceMultipleCommandsRollback() throws Exception {
+ AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest() {
+ public void testCase() throws Exception {
+ execute("delete from pm1.g2 where pm1.g2.e1 >= ?", new
Object[] {new Integer(100)});
+ execute("delete from pm1.g1 where pm1.g1.e1 >= ?", new
Object[] {new Integer(100)});
+
+ execute("select * from pm1.g1");
+ assertRowCount(100);
+
+ for (int i = 300; i < 310; i++) {
+ Integer val = new Integer(i);
+ execute("insert into pm1.g1 (e1, e2) values(?,?)", new
Object[] {val, val.toString()});
+ execute("insert into pm1.g2 (e1, e2) values(?,?)", new
Object[] {val, val.toString()});
+ }
+
+ // this will make it rollback
+ execute("insert into pm1.g2 (e1, e2) values(?, ?)", new
Object[] {new Integer(9999), "9999"});
+ }
+
+ public boolean exceptionExpected() {
+ return true;
+ }
+
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results (since they are not bundled in single command they
should be treated individually)
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g1 where e1 >= 300 and e1 < 310");
+ test.assertRowCount(10);
+ test.execute("select * from g2 where e1 >= 300 and e1 < 310");
+ test.assertRowCount(10);
+ test.execute("select * from g2 where e1 = 9999");
+ test.assertRowCount(0);
+ test.closeConnection();
+ }
+
+ /**
+ * Sources = 1
+ * Commands = multiple - Success
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testSingleSourceBatchCommandRollback() throws Exception {
+ AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest() {
+ public void testCase() throws Exception {
+ ArrayList list = new ArrayList();
+ list.add("delete from pm1.g2 where pm1.g2.e1 >= 100");
+ list.add("delete from pm1.g1 where pm1.g1.e1 >= 100");
+
+ for (int i = 400; i < 410; i++) {
+ list.add("insert into pm1.g1 (e1, e2)
values("+i+",'"+i+"')");
+ list.add("insert into pm1.g2 (e1, e2)
values("+i+",'"+i+"')");
+ }
+
+ // this will make it rollback
+ list.add("insert into pm1.g2 (e1, e2) values(9999,
'9999')");
+
+ executeBatch((String[])list.toArray(new String[list.size()]));
+ }
+
+ public boolean exceptionExpected() {
+ return true;
+ }
+
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results (all commands will trated as single under single
transaction)
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g1 where e1 >= 400 and e1 < 410");
+ test.assertRowCount(0);
+ test.execute("select * from g2 where e1 >= 400 and e1 < 410");
+ test.assertRowCount(0);
+ test.execute("select * from g2 where e1 = 9999");
+ test.assertRowCount(0);
+ test.closeConnection();
+ }
+
+
///////////////////////////////////////////////////////////////////////////////////////////////
+ // Multiple Sources - Rows from 500
+
///////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Sources = 2
+ * Commands = 1, Select
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testMultipleSourceSelect() throws Exception {
+ AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest() {
+ public void testCase() throws Exception {
+ execute("select * from pm1.g1 join pm2.g1 on pm1.g1.e1 = pm2.g1.e1
where pm1.g1.e1 < 100");
+ assertRowCount(100);
+ }
+
+ public void after() {
+ // selects are special case as they will not fail to use multiple
sources. The transaction
+ // source count only starts when there are updates to db, so this is OK
+ if (exceptionOccurred()) {
+ fail("should not have failed to involve multiple sources under
optimistic txn");
+ }
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+ }
+
+ /**
+ * Sources = 2
+ * Commands = 1, Select
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testMultipleSourceUpdate() throws Exception {
+ AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest() {
+ public void testCase() throws Exception {
+ Integer value = new Integer(500);
+ execute("insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2)
values(?,?,?,?)", new Object[] {value, value.toString(), value, value.toString()});
+ }
+
+ public boolean exceptionExpected() {
+ return true;
+ }
+
+ public void after() {
+ if (!exceptionOccurred()) {
+ fail("should have failed to involve multiple sources under
optimistic txn");
+ }
+ else {
+ assertTrue(getLastException().getMessage(),
getLastException().getMessage().indexOf("txnAutoWrap=OPTIMISTIC") != -1);
+ }
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+ }
+
+ /**
+ * Sources = 2
+ * Commands = multiple - Success
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testMultipleSourcesBatchCommand() throws Exception {
+ AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest() {
+ public void testCase() throws Exception {
+ ArrayList list = new ArrayList();
+ list.add("delete from pm1.g2 where pm1.g2.e1 >= 100");
+ list.add("delete from pm1.g1 where pm1.g1.e1 >= 100");
+
+ list.add("delete from pm2.g2 where pm2.g2.e1 >= 100");
+ list.add("delete from pm2.g1 where pm2.g1.e1 >= 100");
+
+ for (int i = 200; i < 210; i++) {
+ list.add("insert into pm1.g1 (e1, e2)
values("+i+",'"+i+"')");
+ list.add("insert into pm1.g2 (e1, e2)
values("+i+",'"+i+"')");
+
+ list.add("insert into pm1.g1 (e1, e2)
values("+i+",'"+i+"')");
+ list.add("insert into pm1.g2 (e1, e2)
values("+i+",'"+i+"')");
+ }
+ executeBatch((String[])list.toArray(new String[list.size()]));
+ }
+
+ public void after() {
+ if (!exceptionOccurred()) {
+ fail("should have failed to involve multiple sources under
optimistic txn");
+ }
+ else {
+ assertTrue(getLastException().getMessage(),
getLastException().getMessage().indexOf("txnAutoWrap=OPTIMISTIC") != -1);
+ }
+ }
+
+ public boolean exceptionExpected() {
+ return true;
+ }
+
+ };
+
+ getTransactionContainter().runTransaction(userTxn);
+ }
+
+ /**
+ * Sources = 2
+ * Commands = 1, Select
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testMultipleSourceVirtualSelect() throws Exception {
+ AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest() {
+ public void testCase() throws Exception {
+ execute("select * from vm.g1");
+ }
+
+ public void after() {
+ if (exceptionOccurred()) {
+ fail("should not have failed to involve multiple sources under
optimistic txn");
+ }
+ }
+ };
+
+ getTransactionContainter().runTransaction(userTxn);
+ }
+
+ /**
+ * Sources = 2
+ * Commands = 1, Select
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testMultipleSourceVirtualProceduralSelect() throws Exception {
+ AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest() {
+ public void testCase() throws Exception {
+ execute("select * from vm.p1");
+ }
+
+ public void after() {
+ if (exceptionOccurred()) {
+ fail("should have failed to involve multiple sources under
optimistic txn");
+ }
+ }
+ };
+
+ getTransactionContainter().runTransaction(userTxn);
+ }
+
+ /**
+ * Sources = 2
+ * Commands = 1, Select
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testMultipleSourceVirtualProcedure() throws Exception {
+ AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest() {
+ public void testCase() throws Exception {
+ execute("select * from vm.p2 where vm.p2.e1 = ? and vm.p2.e2 =
?", new Object[] {new Integer(200), "200"});
+ }
+
+ public boolean exceptionExpected() {
+ return true;
+ }
+
+ public void after() {
+ if (!exceptionOccurred()) {
+ fail("should have failed to involve multiple sources under
optimistic txn");
+ }
+ else {
+ assertTrue(getLastException().getMessage(),
getLastException().getMessage().indexOf("txnAutoWrap=OPTIMISTIC") != -1);
+ }
+ }
+ };
+
+ getTransactionContainter().runTransaction(userTxn);
+ }
+
+ public void testMultipleSourceVirtualProceduralSelectWithUpdate() throws Exception {
+ AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest() {
+ public void testCase() throws Exception {
+ execute("exec vm.p2(?, ?)", new Object[] {new Integer(200),
"200"});
+ }
+
+ public boolean exceptionExpected() {
+ return true;
+ }
+
+ public void after() {
+ if (!exceptionOccurred()) {
+ fail("should have failed to involve multiple sources under
optimistic txn");
+ }
+ else {
+ assertTrue(getLastException().getMessage(),
getLastException().getMessage().indexOf("txnAutoWrap=OPTIMISTIC") != -1);
+ }
+ }
+ };
+
+ getTransactionContainter().runTransaction(userTxn);
+ }
+
+ /**
+ * Sources = 2
+ * Commands = 1, Select
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testMultipleSourceVirtualUpdate() throws Exception {
+ AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest() {
+ public void testCase() throws Exception {
+ execute("delete from vm.g1 where vm.g1.pm1e1 > 100");
+ }
+
+ public void after() {
+ if (!exceptionOccurred()) {
+ fail("should have failed to involve multiple sources under
optimistic txn");
+ }
+ else {
+ assertTrue(getLastException().getMessage(),
getLastException().getMessage().indexOf("txnAutoWrap=OPTIMISTIC") != -1);
+ }
+ }
+
+ public boolean exceptionExpected() {
+ return true;
+ }
+
+ };
+
+ getTransactionContainter().runTransaction(userTxn);
+ }
+}
Added:
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/PessimisticWrapTransactionTests.java
===================================================================
---
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/PessimisticWrapTransactionTests.java
(rev 0)
+++
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/PessimisticWrapTransactionTests.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2000-2007 MetaMatrix, Inc.
+ * All rights reserved.
+ */
+package org.teiid.test.testcases;
+
+import java.util.ArrayList;
+
+import org.teiid.test.framework.TransactionContainer;
+import org.teiid.test.framework.query.AbstractQueryTransactionTest;
+import org.teiid.test.framework.query.QueryExecution;
+import org.teiid.test.framework.transaction.PessimisticWrapTransaction;
+
+import com.metamatrix.jdbc.api.AbstractQueryTest;
+
+
+public class PessimisticWrapTransactionTests extends CommonTransactionTests {
+
+ public PessimisticWrapTransactionTests(String testName) {
+ super(testName);
+ }
+
+ protected TransactionContainer getTransactionContainter() {
+ return new PessimisticWrapTransaction();
+ }
+
+ /**
+ * Sources = 1
+ * Commands = multiple - Success
+ * Batching = Full Processing, Single Connector Batch
+ * result = rollback
+ */
+ public void testSingleSourceMultipleCommandsReferentialIntegrityRollback() throws
Exception {
+ AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest() {
+ public void testCase() throws Exception {
+ for (int i = 200; i < 210; i++) {
+ Integer val = new Integer(i);
+ execute("insert into pm1.g1 (e1, e2) values(?,?)", new
Object[] {val, val.toString()});
+ execute("insert into pm1.g2 (e1, e2) values(?,?)", new
Object[] {val, val.toString()});
+ }
+
+ // try to rollback, however since this pessimistic above two are already
commited
+ execute("insert into pm1.g2 (e1, e2) values(?,?)", new Object[]
{new Integer(9999), "9999"});
+ }
+
+ public boolean exceptionExpected() {
+ return true;
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g1 where e1 >= 200 and e1 < 210");
+ test.assertRowCount(10);
+ test.execute("select * from g2 where e1 = 9999");
+ test.assertRowCount(0);
+ test.closeConnection();
+ }
+
+ /**
+ * Sources = 1
+ * Commands = multiple - Success
+ * Batching = Full Processing, Single Connector Batch
+ * result = rollback
+ */
+ public void testSingleSourceBatchCommandReferentialIntegrityRollback() throws
Exception {
+ AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest() {
+ public void testCase() throws Exception {
+ ArrayList list = new ArrayList();
+ for (int i = 200; i < 210; i++) {
+ list.add("insert into pm1.g1 (e1, e2)
values("+i+",'"+i+"')");
+ }
+
+ // try to rollback, since we are in single batch it must rollback
+ list.add("insert into pm1.g2 (e1, e2)
values(9999,'9999')");
+ executeBatch((String[])list.toArray(new String[list.size()]));
+ }
+
+ public boolean exceptionExpected() {
+ return true;
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g1 where e1 >= 200 and e1 < 210");
+ test.assertRowCount(0);
+ test.execute("select * from g2 where e1 = 9999");
+ test.assertRowCount(0);
+ test.closeConnection();
+ }
+
+ /**
+ * Sources = 2
+ * Commands = 1, Update
+ * Batching = Full Processing, Single Connector Batch
+ * result = commit
+ */
+ public void testMultipleSourceBulkRowInsertRollback() throws Exception {
+ AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest() {
+ ArrayList list = new ArrayList();
+ public void testCase() throws Exception {
+ for (int i = 100; i < 120; i++) {
+ list.add("insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2)
values("+i+",'"+i+"',"+i+",'"+i+"')");
+ }
+ list.add("select pm1.g1.e1, pm1.g1.e2 into pm2.g2 from pm1.g1 where
pm1.g1.e1 >= 100");
+
+ // force the rollback by trying to insert an invalid row.
+ list.add("insert into pm1.g2 (e1, e2)
values(9999,'9999')");
+
+ executeBatch((String[])list.toArray(new String[list.size()]));
+ }
+
+ public boolean exceptionExpected() {
+ return true;
+ }
+ };
+
+ // run test
+ getTransactionContainter().runTransaction(userTxn);
+
+ // now verify the results
+ AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
+ test.execute("select * from g1 where e1 >= 100 and e1 < 120");
+ test.assertRowCount(0);
+ test.closeConnection();
+
+ test = new QueryExecution(userTxn.getSource("pm2"));
+ test.execute("select * from g1 where e1 >= 100 and e1 < 120");
+ test.assertRowCount(0);
+ test.execute("select * from g2 where e1 >= 100 and e1 < 120");
+ test.assertRowCount(0);
+ test.closeConnection();
+ }
+}
Added:
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/StandaloneGlobalTransactionTests.java
===================================================================
---
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/StandaloneGlobalTransactionTests.java
(rev 0)
+++
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/StandaloneGlobalTransactionTests.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2000-2007 MetaMatrix, Inc.
+ * All rights reserved.
+ */
+package org.teiid.test.testcases;
+
+import org.teiid.test.framework.TransactionContainer;
+import org.teiid.test.framework.transaction.StandaloneGlobalTransaction;
+
+
+/**
+ * This is global transaction test to be used when transaction is external
+ * in places like inside app server
+ */
+public class StandaloneGlobalTransactionTests extends LocalTransactionTests {
+
+ public StandaloneGlobalTransactionTests(String testName) {
+ super(testName);
+ }
+
+ @Override
+ protected TransactionContainer getTransactionContainter() {
+
+ return new StandaloneGlobalTransaction();
+ }
+
+
+}
Added:
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/XATransactionDatasourceFalseOffTest.java
===================================================================
---
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/XATransactionDatasourceFalseOffTest.java
(rev 0)
+++
branches/JCA/test-integration/db/src/test/java/org/teiid/test/testcases/XATransactionDatasourceFalseOffTest.java 2009-12-01
21:17:40 UTC (rev 1614)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2000-2007 MetaMatrix, Inc.
+ * All rights reserved.
+ */
+package org.teiid.test.testcases;
+
+import org.teiid.test.framework.ConfigPropertyNames;
+import org.teiid.test.framework.ConfigPropertyNames.CONNECTION_STRATEGY_PROPS;
+
+
+/**
+ * Local Transaction Test
+ *
+ * Settings:
+ *
+ * - Transaction Type = local
+ * - Using Driver
+ * - Autocommit = True
+ * - TxnAutoWrap = Off
+ */
+//public class XATransactionDatasourceFalseOffTest extends
SingleSourceTransactionScenarios {
+
+ public class XATransactionDatasourceFalseOffTest extends TwoSourceTransactionScenarios
{
+
+
+
+ public XATransactionDatasourceFalseOffTest(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ //XATransactions currently doesn't support using sqlserver
+ //{@see TEIID-559}
+ this.addProperty(ConfigPropertyNames.EXCLUDE_DATASBASE_TYPES_PROP,
"sqlserver");
+
+ this.addProperty(ConfigPropertyNames.CONFIG_FILE, "xa-config.properties");
+
+ this.addProperty(ConfigPropertyNames.CONNECTION_TYPE,
ConfigPropertyNames.CONNECTION_TYPES.DATASOURCE_CONNECTION);
+ this.addProperty(CONNECTION_STRATEGY_PROPS.AUTOCOMMIT, "false");
+ this.addProperty(ConfigPropertyNames.USE_DATASOURCES_PROP, "derby,mysql");
+
+
+ }
+
+
+
+}