Author: vhalbert(a)redhat.com
Date: 2010-06-10 12:23:19 -0400 (Thu, 10 Jun 2010)
New Revision: 2214
Added:
trunk/test-integration/db/src/main/resources/ctc_tests/runclienttest.sh
Modified:
trunk/test-integration/db/howto
trunk/test-integration/db/pom.xml
trunk/test-integration/db/src/assembly/binaries.xml
trunk/test-integration/db/src/main/java/org/teiid/test/client/QueryScenario.java
trunk/test-integration/db/src/main/java/org/teiid/test/client/TestClient.java
trunk/test-integration/db/src/main/java/org/teiid/test/client/ctc/CTCQueryScenario.java
trunk/test-integration/db/src/main/java/org/teiid/test/client/ctc/XMLExpectedResults.java
trunk/test-integration/db/src/main/java/org/teiid/test/client/ctc/XMLQueryReader.java
trunk/test-integration/db/src/main/java/org/teiid/test/framework/ConfigPropertyLoader.java
trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategy.java
trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategyFactory.java
trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/DataSourceConnection.java
trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/DriverConnection.java
trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/JEEConnection.java
trunk/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSource.java
trunk/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSourceFactory.java
trunk/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSourceMgr.java
trunk/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataStore.java
trunk/test-integration/db/src/main/java/org/teiid/test/framework/query/AbstractQueryTransactionTest.java
trunk/test-integration/db/src/main/java/org/teiid/test/framework/transaction/StandaloneGlobalTransaction.java
trunk/test-integration/db/src/main/java/org/teiid/test/util/PropUtils.java
trunk/test-integration/db/src/main/resources/default-config.properties
trunk/test-integration/db/src/main/resources/xa-config.properties
trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java
trunk/test-integration/db/src/test/java/org/teiid/dynamicvdb/TestVDBLessExecution.java
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/AutoWrapTransactionTests.java
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/BaseAbstractTransactionTestCase.java
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/CommonTransactionTests.java
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionTests.java
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/OffWrapTransactionTests.java
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/OnWrapTransactionTests.java
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/StandaloneGlobalTransactionTests.java
Log:
TEIID-889 - the testcases didn't work because the framework and tests have not
updated due to the removal of the embedded option, as well as, the changes to the VDB,
connector related files, etc. Therefore, the following changes are made to handle these
changes and work with an existing running server.
Modified: trunk/test-integration/db/howto
===================================================================
--- trunk/test-integration/db/howto 2010-06-10 04:22:03 UTC (rev 2213)
+++ trunk/test-integration/db/howto 2010-06-10 16:23:19 UTC (rev 2214)
@@ -10,9 +10,9 @@
==========================================
- Unit test should be created under db/src/test/java
-- See LocalTransactionDriverFalseOffTest.java as an example
+- See LocalTransactionTest.java as an example
-- Test should extend org.teiid.transaction.test.BaseAbstractTransactionTestCase
+- Test should extend org.teiid.test.testcases.BaseAbstractTransactionTestCase
- NOTE: the following is used in a post test phase of validating the data in the
datasource
Modified: trunk/test-integration/db/pom.xml
===================================================================
--- trunk/test-integration/db/pom.xml 2010-06-10 04:22:03 UTC (rev 2213)
+++ trunk/test-integration/db/pom.xml 2010-06-10 16:23:19 UTC (rev 2214)
@@ -35,6 +35,11 @@
<artifactId>jta</artifactId>
<version>1.1</version>
</dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-client</artifactId>
+ </dependency>
<dependency>
<groupId>org.jboss.teiid</groupId>
@@ -43,6 +48,11 @@
<scope>compile</scope>
</dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ </dependency>
+
<dependency>
<groupId>org.jboss.teiid</groupId>
<artifactId>teiid-common-core</artifactId>
@@ -137,54 +147,77 @@
<version>1.0</version>
</dependency>
+ <dependency>
+ <groupId>postgresql</groupId>
+ <artifactId>postgresql</artifactId>
+ <version>${postgresql.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>${derby.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <version>${mysql.connector.version}</version>
+ </dependency>
+
</dependencies>
- <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-surefire-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.2-beta-2</version>
- <configuration>
- <descriptors>
- <descriptor>src/assembly/binaries.xml</descriptor>
- </descriptors>
- <outputDirectory>target/distribution</outputDirectory>
- <workDirectory>target/assembly/work</workDirectory>
- </configuration>
- <executions>
- <execution>
- <id>make-assembly</id>
- <phase>package</phase>
- <goals>
- <goal>attached</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
+ <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-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
- <profiles>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-beta-2</version>
+ <configuration>
+ <descriptors>
+
<descriptor>src/assembly/binaries.xml</descriptor>
+ </descriptors>
+
<outputDirectory>target/distribution</outputDirectory>
+
<workDirectory>target/assembly/work</workDirectory>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>attached</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+
<profile>
<id>runalltests</id>
<build>
@@ -252,7 +285,11 @@
<profile>
<id>runsingletest</id>
-
+ <activation>
+ <property>
+ <name>classname</name>
+ </property>
+ </activation>
<build>
<plugins>
@@ -263,7 +300,7 @@
<additionalClasspathElement>${basedir}/lib/ojdbc6.jar</additionalClasspathElement>
<additionalClasspathElement>${basedir}/lib/sqljdbc4.jar</additionalClasspathElement>
<additionalClasspathElement>${basedir}/lib/db2jcc4.jar</additionalClasspathElement>
- </additionalClasspathElements>
+ </additionalClasspathElements>
<systemProperties>
<property>
<name>usedatasources</name>
Modified: trunk/test-integration/db/src/assembly/binaries.xml
===================================================================
--- trunk/test-integration/db/src/assembly/binaries.xml 2010-06-10 04:22:03 UTC (rev
2213)
+++ trunk/test-integration/db/src/assembly/binaries.xml 2010-06-10 16:23:19 UTC (rev
2214)
@@ -80,10 +80,12 @@
<fileSet>
-
+ <directory>src/main/resources/ctc_tests</directory>
+ <outputDirectory>.</outputDirectory>
<includes>
<include>runclienttest.sh</include>
</includes>
+
<fileMode>755</fileMode>
</fileSet>
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/client/QueryScenario.java
===================================================================
---
trunk/test-integration/db/src/main/java/org/teiid/test/client/QueryScenario.java 2010-06-10
04:22:03 UTC (rev 2213)
+++
trunk/test-integration/db/src/main/java/org/teiid/test/client/QueryScenario.java 2010-06-10
16:23:19 UTC (rev 2214)
@@ -93,50 +93,50 @@
validateResultsMode(this.props);
// TODO: deployprops.loc not needed in remote testing
- try {
- setupVDBs(this.getProperties());
- } catch (IOException e) {
- throw new TransactionRuntimeException(e.getMessage());
- }
+// try {
+// setupVDBs(this.getProperties());
+// } catch (IOException e) {
+// throw new TransactionRuntimeException(e.getMessage());
+// }
}
- protected void setupVDBs(Properties props) throws IOException {
+ // protected void setupVDBs(Properties props) throws IOException {
// NOTE: this is probably a hack, because the only way I could get all
// the vdb's available when running multiple scenarions
// was to update the deploy.properties by setting the vdb.definition
// property containing the location of
// all the vdbs
-
- // if disabled, no configuration of the vdb is needed
- if (ConfigPropertyLoader.getInstance().isDataStoreDisabled()) {
- return;
- }
-
- String deployPropLoc = props.getProperty("deployprops.loc");
- Properties deployProperties = PropertiesUtils.load(deployPropLoc);
+//
+// // if disabled, no configuration of the vdb is needed
+// if (ConfigPropertyLoader.getInstance().isDataStoreDisabled()) {
+// return;
+// }
+//
+// String deployPropLoc = props.getProperty("deployprops.loc");
+// Properties deployProperties = PropertiesUtils.load(deployPropLoc);
+//
+// // set the vdb.definition property that contains all the vdbs
+// String vdb_loc = props.getProperty("vdb.loc");
+// File vdbfiles[] = FileUtils.findAllFilesInDirectoryHavingExtension(vdb_loc,
".vdb");
+// if (vdbfiles == null || vdbfiles.length == 0) {
+// throw new TransactionRuntimeException((new StringBuilder()).append(
+// "No vdbs found in directory ").append(vdb_loc).toString());
+// }
+// StringBuffer vdbdef = new StringBuffer();
+//
+// for (int i = 0; i < vdbfiles.length; i++) {
+// vdbdef.append(vdbfiles[i].getAbsolutePath() + ";");
+// }
+// TestLogger.log("===== Connect to VDBs: " + vdbdef.toString());
+//
+// deployProperties.setProperty("vdb.definition", vdbdef.toString());
+// PropertiesUtils.print(deployPropLoc, deployProperties,"Updated for
vdb.definition");
- // set the vdb.definition property that contains all the vdbs
- String vdb_loc = props.getProperty("vdb.loc");
- File vdbfiles[] = FileUtils.findAllFilesInDirectoryHavingExtension(vdb_loc,
".vdb");
- if (vdbfiles == null || vdbfiles.length == 0) {
- throw new TransactionRuntimeException((new StringBuilder()).append(
- "No vdbs found in directory ").append(vdb_loc).toString());
- }
- StringBuffer vdbdef = new StringBuffer();
+ // }
- for (int i = 0; i < vdbfiles.length; i++) {
- vdbdef.append(vdbfiles[i].getAbsolutePath() + ";");
- }
- TestLogger.log("===== Connect to VDBs: " + vdbdef.toString());
-
- deployProperties.setProperty("vdb.definition", vdbdef.toString());
- PropertiesUtils.print(deployPropLoc, deployProperties,"Updated for
vdb.definition");
- }
-
-
protected void validateResultsMode(Properties props) {
// Determine from property what to do with query results
String resultModeStr = props.getProperty(
Modified: trunk/test-integration/db/src/main/java/org/teiid/test/client/TestClient.java
===================================================================
---
trunk/test-integration/db/src/main/java/org/teiid/test/client/TestClient.java 2010-06-10
04:22:03 UTC (rev 2213)
+++
trunk/test-integration/db/src/main/java/org/teiid/test/client/TestClient.java 2010-06-10
16:23:19 UTC (rev 2214)
@@ -37,6 +37,7 @@
import org.teiid.test.framework.TransactionContainer;
import org.teiid.test.framework.connection.DataSourceConnection;
import org.teiid.test.framework.connection.DriverConnection;
+import org.teiid.test.framework.datasource.DataSourceMgr;
import org.teiid.test.framework.exception.QueryTestFailedException;
import org.teiid.test.framework.exception.TransactionRuntimeException;
@@ -164,62 +165,67 @@
TestClientTransaction userTxn = new TestClientTransaction(queryset);
Iterator<String> qsetIt = queryset.getQuerySetIDs().iterator();
+ TestResultsSummary summary = new TestResultsSummary(queryset.getResultsMode());
- TestResultsSummary summary = new TestResultsSummary(queryset.getResultsMode());
-
- // iterate over the query set ID's, which there
- // should be 1 for each file to be processed
- while (qsetIt.hasNext()) {
- querySetID = qsetIt.next();
-
- TestLogger.logInfo("Start Test Query ID [" + querySetID + "]");
-
- queryTests = queryset.getQueries(querySetID);
-
- // the iterator to process the query tests
- Iterator<QueryTest> queryTestIt = null;
- queryTestIt = queryTests.iterator();
-
- ExpectedResults expectedResults = queryset.getExpectedResults(querySetID);
-
-
-
-
- long beginTS = System.currentTimeMillis();
- long endTS = 0;
-
- while (queryTestIt.hasNext()) {
- QueryTest q = queryTestIt.next();
+ try {
+
+ // iterate over the query set ID's, which there
+ // should be 1 for each file to be processed
+ while (qsetIt.hasNext()) {
+ querySetID = qsetIt.next();
+
+ TestLogger.logInfo("Start Test Query ID [" + querySetID +
"]");
+
+ queryTests = queryset.getQueries(querySetID);
+
+ // the iterator to process the query tests
+ Iterator<QueryTest> queryTestIt = null;
+ queryTestIt = queryTests.iterator();
+
+ ExpectedResults expectedResults = queryset.getExpectedResults(querySetID);
+
+
+ long beginTS = System.currentTimeMillis();
+ long endTS = 0;
+
+ while (queryTestIt.hasNext()) {
+ QueryTest q = queryTestIt.next();
+
+ userTxn.init(summary, expectedResults, q);
- userTxn.init(summary, expectedResults, q);
-
- // run test
- try {
- tc.runTransaction(userTxn);
- } catch (Throwable t) {
- TestLogger.logInfo("Testcase run error: " +
t.getLocalizedMessage());
- }
-
+ // run test
+ try {
+ tc.runTransaction(userTxn);
+ } catch (Throwable t) {
+ TestLogger.logInfo("Testcase run error: " +
t.getLocalizedMessage());
+ }
+
+ }
+
+ endTS = System.currentTimeMillis();
+
+ TestLogger.logInfo("End Test Query ID [" + querySetID +
"]");
+
+ summary.printResults(queryset, querySetID,beginTS, endTS);
+
}
- endTS = System.currentTimeMillis();
-
- TestLogger.logInfo("End Test Query ID [" + querySetID +
"]");
-
- summary.printResults(queryset, querySetID,beginTS, endTS);
-
+
+ } finally {
+ try {
+ summary.printTotals(queryset);
+ summary.cleanup();
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+
+ // cleanup all connections created for this test.
+
+ DataSourceMgr.getInstance().shutdown();
+// userTxn.getConnectionStrategy().shutdown();
+ ConfigPropertyLoader.reset();
}
-
-
- summary.printTotals(queryset);
- summary.cleanup();
-
- // cleanup all connections created for this test.
- userTxn.getConnectionStrategy().shutdown();
- ConfigPropertyLoader.reset();
-
-
}
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/client/ctc/CTCQueryScenario.java
===================================================================
---
trunk/test-integration/db/src/main/java/org/teiid/test/client/ctc/CTCQueryScenario.java 2010-06-10
04:22:03 UTC (rev 2213)
+++
trunk/test-integration/db/src/main/java/org/teiid/test/client/ctc/CTCQueryScenario.java 2010-06-10
16:23:19 UTC (rev 2214)
@@ -62,11 +62,11 @@
validateResultsMode(this.getProperties());
- try {
- setupVDBs(this.getProperties());
- } catch (IOException e) {
- throw new TransactionRuntimeException(e.getMessage());
- }
+// try {
+// setupVDBs(this.getProperties());
+// } catch (IOException e) {
+// throw new TransactionRuntimeException(e.getMessage());
+// }
}
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/client/ctc/XMLExpectedResults.java
===================================================================
---
trunk/test-integration/db/src/main/java/org/teiid/test/client/ctc/XMLExpectedResults.java 2010-06-10
04:22:03 UTC (rev 2213)
+++
trunk/test-integration/db/src/main/java/org/teiid/test/client/ctc/XMLExpectedResults.java 2010-06-10
16:23:19 UTC (rev 2214)
@@ -753,7 +753,7 @@
QueryScenario set = ClassFactory.createQueryScenario("testscenario");
- _instance.setProperty(XMLQueryReader.PROP_QUERY_FILES_ROOT_DIR, new
File("target/classes/").getAbsolutePath() );
+ _instance.setProperty(XMLQueryReader.PROP_QUERY_FILES_ROOT_DIR, new
File("src/main/resources/").getAbsolutePath() );
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/client/ctc/XMLQueryReader.java
===================================================================
---
trunk/test-integration/db/src/main/java/org/teiid/test/client/ctc/XMLQueryReader.java 2010-06-10
04:22:03 UTC (rev 2213)
+++
trunk/test-integration/db/src/main/java/org/teiid/test/client/ctc/XMLQueryReader.java 2010-06-10
16:23:19 UTC (rev 2214)
@@ -123,7 +123,7 @@
String msg = "Query file doesn't exist or cannot be read: " +
queryFileName + ", ignoring and continuing";
TestLogger.log(msg);
throw new TransactionRuntimeException(msg); //$NON-NLS-1$ //$NON-NLS-2$
- } else {
+ }
// Get query set name
// String querySet = getQuerySetName(queryFileName) ; //$NON-NLS-1$
@@ -144,7 +144,7 @@
TestLogger.log(msg);
throw new IOException(msg); //$NON-NLS-1$ //$NON-NLS-2$
}
- }
+
// return queries;
}
@@ -170,7 +170,7 @@
}
_instance.setProperty(PROP_QUERY_FILES_ROOT_DIR, new File(
- "target/classes/").getAbsolutePath());
+ "src/main/resources/").getAbsolutePath());
try {
XMLQueryReader reader = new XMLQueryReader("scenario_id",
_instance.getProperties());
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/framework/ConfigPropertyLoader.java
===================================================================
---
trunk/test-integration/db/src/main/java/org/teiid/test/framework/ConfigPropertyLoader.java 2010-06-10
04:22:03 UTC (rev 2213)
+++
trunk/test-integration/db/src/main/java/org/teiid/test/framework/ConfigPropertyLoader.java 2010-06-10
16:23:19 UTC (rev 2214)
@@ -5,7 +5,6 @@
import java.util.Properties;
import org.teiid.core.util.PropertiesUtils;
-import org.teiid.test.framework.datasource.DataSourceFactory;
import org.teiid.test.framework.datasource.DataStore;
import org.teiid.test.util.PropUtils;
@@ -44,22 +43,22 @@
private Map<String, String>modelAssignedDatabaseType = new HashMap<String,
String>(5);
- private DataSourceFactory dsfactory = null;
-
private ConfigPropertyLoader() {
}
public static synchronized ConfigPropertyLoader getInstance() {
- boolean diff = differentConfigProp();
+ boolean diff = differentConfigProp();
- if (_instance != null && !diff) {
- return _instance;
- }
if (_instance != null) {
- cleanup();
- }
+ if (!diff) {
+ return _instance;
+ }
+
+ reset();
+ }
+
_instance = new ConfigPropertyLoader();
_instance.initialize();
@@ -71,7 +70,7 @@
/**
* because a config file could be different for the subsequent test, check
* to see if the file is different.
- * @return
+ * @return boolean
*/
private static boolean differentConfigProp( ) {
String filename = System.getProperty(ConfigPropertyNames.CONFIG_FILE);
@@ -86,27 +85,21 @@
return false;
}
-
- private static synchronized void cleanup() {
-
- _instance.modelAssignedDatabaseType.clear();
- _instance.props.clear();
- if (_instance.dsfactory != null) {
- _instance.dsfactory.cleanup();
- }
-
- reset();
-
- _instance = null;
- LAST_CONFIG_FILE=null;
- }
/**
* Called after each test to reset any per test settings.
*/
public static synchronized void reset() {
+ if (_instance == null) return;
+
_instance.overrides.clear();
+
+ _instance.modelAssignedDatabaseType.clear();
+ _instance.props.clear();
+
+ _instance = null;
+ LAST_CONFIG_FILE=null;
}
@@ -114,14 +107,9 @@
private void initialize() {
props = PropUtils.loadProperties(LAST_CONFIG_FILE, null);
- dsfactory = new DataSourceFactory(this);
}
- public DataSourceFactory getDataSourceFactory() {
- return this.dsfactory;
- }
-
public String getProperty(String key) {
String rtn = null;
rtn = overrides.getProperty(key);
@@ -162,7 +150,7 @@
* preconfigured and should not be touched by the {@link DataStore}
* processing.
*
- * @return
+ * @return boolean
*/
public boolean isDataStoreDisabled() {
String disable_config = this.getProperty(
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategy.java
===================================================================
---
trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategy.java 2010-06-10
04:22:03 UTC (rev 2213)
+++
trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategy.java 2010-06-10
16:23:19 UTC (rev 2214)
@@ -4,29 +4,14 @@
*/
package org.teiid.test.framework.connection;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
import java.sql.Connection;
-import java.util.Iterator;
-import java.util.List;
import java.util.Properties;
-import java.util.Set;
import javax.sql.XAConnection;
-import org.teiid.adminapi.Admin;
-import org.teiid.adminapi.AdminFactory;
-import org.teiid.adminapi.Model;
-import org.teiid.adminapi.VDB;
import org.teiid.core.util.PropertiesUtils;
-import org.teiid.jdbc.ConnectionImpl;
-import org.teiid.jdbc.JDBCURL;
import org.teiid.test.framework.ConfigPropertyLoader;
-import org.teiid.test.framework.TestLogger;
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.datasource.DataStore;
import org.teiid.test.framework.exception.QueryTestFailedException;
@@ -41,10 +26,9 @@
// closed and reconnected all the time
private boolean useProxy = false;
- public ConnectionStrategy(Properties props, DataSourceFactory dsf) {
+ public ConnectionStrategy(Properties props) {
this.env = PropertiesUtils.clone(props);
- // this.dsFactory = dsf;
}
/*
@@ -55,6 +39,7 @@
* Returns a connection
*
* @return Connection
+ * @throws QueryTestFailedException
*/
public abstract Connection getConnection() throws QueryTestFailedException;
@@ -73,6 +58,9 @@
}
+ /**
+ * @throws QueryTestFailedException
+ */
public Connection getAdminConnection() throws QueryTestFailedException {
return null;
}
@@ -83,6 +71,9 @@
return autoCommit;
}
+ /**
+ * @throws QueryTestFailedException
+ */
public XAConnection getXAConnection() throws QueryTestFailedException {
return null;
}
@@ -106,56 +97,59 @@
this.env.setProperty(key, value);
}
+ /**
+ * @throws QueryTestFailedException
+ */
void configure() throws QueryTestFailedException {
-
- if (this.isDataStoreDisabled()) {
- return;
- } else {
-
- // commenting out until embedded testing is made available and its required to
configure
- // the vdb and bindings in this mannder
-
- if (true)
- return;
- }
-
- try {
- // the the driver strategy is going to be used to connection
- // directly to the connector binding
- // source, then no administration can be done
- Admin admin = AdminFactory.getInstance().createAdmin(
- this.env.getProperty("admin.user"),
- this.env.getProperty("admin.password").toCharArray(),
- this.env.getProperty("admin.url"));
-
- java.sql.Connection conn = getConnection();
-
- if (!(conn instanceof ConnectionImpl)) {
- TestLogger
- .log("ConnectionStrategy configuration: connection is not of type MMConnection
and therefore no vdb setup will be performed");
- return;
- }
-
-
- // setupVDBConnectorBindings(admin);
-
- // admin.restart();
-
- int sleep = 5;
-
- TestLogger.log("Bouncing the system..(wait " + sleep + "
seconds)"); //$NON-NLS-1$
- Thread.sleep(1000 * sleep);
- TestLogger.log("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();
-
- }
+//
+// if (this.isDataStoreDisabled()) {
+// return;
+// } else {
+//
+// // commenting out until embedded testing is made available and its required to
configure
+// // the vdb and bindings in this mannder
+//
+// if (true)
+// return;
+// }
+//
+// try {
+// // the the driver strategy is going to be used to connection
+// // directly to the connector binding
+// // source, then no administration can be done
+// Admin admin = AdminFactory.getInstance().createAdmin(
+// this.env.getProperty("admin.user"),
+// this.env.getProperty("admin.password").toCharArray(),
+// this.env.getProperty("admin.url"));
+//
+// java.sql.Connection conn = getConnection();
+//
+// if (!(conn instanceof ConnectionImpl)) {
+// TestLogger
+// .log("ConnectionStrategy configuration: connection is not of type MMConnection
and therefore no vdb setup will be performed");
+// return;
+// }
+//
+//
+// // setupVDBConnectorBindings(admin);
+//
+// // admin.restart();
+//
+// int sleep = 5;
+//
+// TestLogger.log("Bouncing the system..(wait " + sleep + "
seconds)"); //$NON-NLS-1$
+// Thread.sleep(1000 * sleep);
+// TestLogger.log("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
@@ -257,23 +251,23 @@
ConnectionStrategy cs = null;
if (identifier == null) {
- cs = new DriverConnection(ds.getProperties(), null);
+ cs = new DriverConnection(ds.getProperties());
} else {
- cs = new DriverConnection(ds.getProperties(), null);
+ cs = new DriverConnection(ds.getProperties());
}
- conn = cs.getConnection();
+// conn = cs.getConnection();
+//
+// conn = (Connection) Proxy.newProxyInstance(Thread.currentThread()
+// .getContextClassLoader(),
+// new Class[] { java.sql.Connection.class },
+// new CloseInterceptor(conn));
- conn = (Connection) Proxy.newProxyInstance(Thread.currentThread()
- .getContextClassLoader(),
- new Class[] { java.sql.Connection.class },
- new CloseInterceptor(conn));
+ ds.setConnection(cs.getConnection());
- ds.setConnection(conn);
+ return ds.getConnection();
- return conn;
-
}
public synchronized XAConnection createDataSourceConnection(
@@ -296,48 +290,48 @@
ConnectionStrategy cs = null;
if (identifier == null) {
- cs = new DataSourceConnection(ds.getProperties(), null);
+ cs = new DataSourceConnection(ds.getProperties());
} else {
- cs = new DataSourceConnection(ds.getProperties(), null);
+ cs = new DataSourceConnection(ds.getProperties());
}
- conn = cs.getXAConnection();
+// conn = cs.getXAConnection();
+//
+// conn = (XAConnection) Proxy.newProxyInstance(Thread.currentThread()
+// .getContextClassLoader(),
+// new Class[] { javax.sql.XAConnection.class },
+// new CloseInterceptor(conn));
- conn = (XAConnection) Proxy.newProxyInstance(Thread.currentThread()
- .getContextClassLoader(),
- new Class[] { javax.sql.XAConnection.class },
- new CloseInterceptor(conn));
+ ds.setXAConnection(cs.getXAConnection());
- ds.setXAConnection(conn);
+ return ds.getXAConnection();
- return conn;
-
}
- class CloseInterceptor implements InvocationHandler {
+// class CloseInterceptor implements InvocationHandler {
+//
+// Connection conn;
+// XAConnection xaconn;
+//
+// CloseInterceptor(Object conn) {
+// if (conn instanceof Connection) {
+// this.conn = (Connection) conn;
+// } else {
+// this.xaconn = (XAConnection) 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();
+// }
+// }
+// }
- Connection conn;
- XAConnection xaconn;
-
- CloseInterceptor(Object conn) {
- if (conn instanceof Connection) {
- this.conn = (Connection) conn;
- } else {
- this.xaconn = (XAConnection) 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();
- }
- }
- }
-
}
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategyFactory.java
===================================================================
---
trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategyFactory.java 2010-06-10
04:22:03 UTC (rev 2213)
+++
trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategyFactory.java 2010-06-10
16:23:19 UTC (rev 2214)
@@ -37,15 +37,15 @@
if
(type.equalsIgnoreCase(ConfigPropertyNames.CONNECTION_TYPES.DRIVER_CONNECTION)) {
// pass in null to create new strategy
- strategy = new DriverConnection(props,
configLoader.getDataSourceFactory());
+ strategy = new DriverConnection(props);
TestLogger.log("Created Driver Strategy");
}
else if
(type.equalsIgnoreCase(ConfigPropertyNames.CONNECTION_TYPES.DATASOURCE_CONNECTION)) {
- strategy = new DataSourceConnection(props,
configLoader.getDataSourceFactory());
+ strategy = new DataSourceConnection(props);
TestLogger.log("Created DataSource Strategy");
}
else if
(type.equalsIgnoreCase(ConfigPropertyNames.CONNECTION_TYPES.JNDI_CONNECTION)) {
- strategy = new JEEConnection(props,
configLoader.getDataSourceFactory());
+ strategy = new JEEConnection(props);
TestLogger.log("Created JEE Strategy");
}
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/DataSourceConnection.java
===================================================================
---
trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/DataSourceConnection.java 2010-06-10
04:22:03 UTC (rev 2213)
+++
trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/DataSourceConnection.java 2010-06-10
16:23:19 UTC (rev 2214)
@@ -16,7 +16,6 @@
import org.teiid.jdbc.BaseDataSource;
import org.teiid.jdbc.TeiidDataSource;
import org.teiid.test.framework.TestLogger;
-import org.teiid.test.framework.datasource.DataSourceFactory;
import org.teiid.test.framework.exception.QueryTestFailedException;
import org.teiid.test.framework.exception.TransactionRuntimeException;
@@ -56,9 +55,8 @@
private XAConnection xaConnection;
- public DataSourceConnection(Properties props,
- DataSourceFactory dsf) throws QueryTestFailedException {
- super(props, dsf);
+ public DataSourceConnection(Properties props) throws QueryTestFailedException {
+ super(props);
}
public void validate() {
@@ -103,6 +101,7 @@
}
+ @Override
public Connection getConnection() throws QueryTestFailedException {
try {
return getXAConnection().getConnection();
@@ -114,6 +113,7 @@
}
}
+ @Override
public synchronized XAConnection getXAConnection()
throws QueryTestFailedException {
if (xaConnection == null) {
@@ -175,7 +175,7 @@
if (this.xaConnection != null) {
this.xaConnection.close();
}
- } catch (SQLException e) {
+ } catch (Exception e) {
// ignore..
}
this.xaConnection = null;
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/DriverConnection.java
===================================================================
---
trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/DriverConnection.java 2010-06-10
04:22:03 UTC (rev 2213)
+++
trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/DriverConnection.java 2010-06-10
16:23:19 UTC (rev 2214)
@@ -10,7 +10,6 @@
import java.util.Properties;
import org.teiid.test.framework.TestLogger;
-import org.teiid.test.framework.datasource.DataSourceFactory;
import org.teiid.test.framework.exception.QueryTestFailedException;
import org.teiid.test.framework.exception.TransactionRuntimeException;
@@ -44,9 +43,8 @@
private Connection connection;
- public DriverConnection(Properties props,
- DataSourceFactory dsf) throws QueryTestFailedException {
- super(props, dsf);
+ public DriverConnection(Properties props) throws QueryTestFailedException {
+ super(props);
validate();
}
@@ -112,7 +110,7 @@
private Connection getJDBCConnection(String driver, String url,
String user, String passwd) throws QueryTestFailedException {
- TestLogger.log("Creating Driver Connection: \"" + url +
"\""); //$NON-NLS-1$ //$NON-NLS-2$
+ TestLogger.log("Creating Driver Connection: \"" + url +
"\"" + " user:password - " + (user!=null?user:"NA") +
":" + (passwd!=null?passwd:"NA")); //$NON-NLS-1$ //$NON-NLS-2$
Connection conn = null;
try {
@@ -131,6 +129,7 @@
}
+ @Override
public void shutdown() {
super.shutdown();
if (this.connection != null) {
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/JEEConnection.java
===================================================================
---
trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/JEEConnection.java 2010-06-10
04:22:03 UTC (rev 2213)
+++
trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/JEEConnection.java 2010-06-10
16:23:19 UTC (rev 2214)
@@ -26,9 +26,8 @@
private String jndi_name = null;
- public JEEConnection(Properties props,
- DataSourceFactory dsf) throws QueryTestFailedException {
- super(props, dsf);
+ public JEEConnection(Properties props) throws QueryTestFailedException {
+ super(props);
}
public Connection getConnection() throws QueryTestFailedException {
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSource.java
===================================================================
---
trunk/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSource.java 2010-06-10
04:22:03 UTC (rev 2213)
+++
trunk/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSource.java 2010-06-10
16:23:19 UTC (rev 2214)
@@ -1,5 +1,9 @@
package org.teiid.test.framework.datasource;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Properties;
@@ -27,7 +31,9 @@
// for the duration of all tests so thats there's not
// disconnect/connect being performed over and over
private Connection conn=null;
+ private Connection proxyconn = null;
private XAConnection xaconn=null;
+ private XAConnection proxyxaconn=null;
public DataSource(String name, String group, Properties properties) {
@@ -65,30 +71,42 @@
public Connection getConnection() throws QueryTestFailedException {
if (this.conn == null) return null;
-
+
try {
if (this.conn.isClosed()) {
this.conn = null;
+ this.proxyconn = null;
}
} catch (SQLException e) {
this.conn = null;
+ this.proxyconn = null;
}
- return this.conn;
+ return this.proxyconn;
}
public void setConnection(Connection c) {
this.conn = c;
+
+ this.proxyconn = (Connection) Proxy.newProxyInstance(Thread.currentThread()
+ .getContextClassLoader(),
+ new Class[] { java.sql.Connection.class },
+ new CloseInterceptor(conn));
}
public XAConnection getXAConnection() throws QueryTestFailedException {
- return this.xaconn;
+ return this.proxyxaconn;
}
public void setXAConnection(XAConnection xaconn) {
this.xaconn = xaconn;
+
+ this.proxyxaconn = (XAConnection) Proxy.newProxyInstance(Thread.currentThread()
+ .getContextClassLoader(),
+ new Class[] { XAConnection.class },
+ new CloseInterceptor(xaconn));
}
public void shutdown() {
@@ -103,19 +121,45 @@
this.conn = null;
- try {
- if (this.xaconn != null) {
- this.xaconn.close();
+ if (this.xaconn != null) {
+ try {
+ this.xaconn.close();
+ } catch (Exception e) {
+ // ignore..
}
- } catch (SQLException e) {
- // ignore..
- }
+ }
+
this.xaconn = null;
}
+
-
+ class CloseInterceptor implements InvocationHandler {
+ Connection conn;
+ XAConnection xaconn;
+
+ CloseInterceptor(Object conn) {
+ if (conn instanceof Connection) {
+ this.conn = (Connection) conn;
+ } else {
+ this.xaconn = (XAConnection) 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();
+ }
+ }
+ }
+
}
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSourceFactory.java
===================================================================
---
trunk/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSourceFactory.java 2010-06-10
04:22:03 UTC (rev 2213)
+++
trunk/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSourceFactory.java 2010-06-10
16:23:19 UTC (rev 2214)
@@ -91,11 +91,7 @@
// 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
@@ -124,7 +120,7 @@
public DataSourceFactory(ConfigPropertyLoader config) {
this.configprops = PropertiesUtils.clone(config.getProperties(), null, true);
this.requiredDataBaseTypes = config.getModelAssignedDatabaseTypes();
- config();
+
}
public Properties getConfigProperties() {
@@ -143,8 +139,10 @@
*
* @since
*/
- private void config() {
+ protected void config(DataSourceMgr dsmgr) {
TestLogger.logDebug("Configure Datasource Factory ");
+
+ dsmgr = DataSourceMgr.getInstance();
Map<String, DataSource> availDatasources = dsmgr.getDataSources();
@@ -211,8 +209,10 @@
// 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);
+ if (useDBTypes.size() > 0) {
+ if ( usedstypeprop.contains(ds.getDBType())) {
+ availDS.put(ds.getName(), ds);
+ }
} else {
availDS.put(ds.getName(), ds);
}
@@ -269,8 +269,7 @@
return (metDBRequiredTypes ? this.availDS.size() :0);
}
- public synchronized DataSource getDatasource(String datasourceid,
- String modelName) throws QueryTestFailedException {
+ public synchronized DataSource getDatasource(String modelName) throws
QueryTestFailedException {
DataSource ds = null;
// map the datasource to the model and datasourceid
@@ -288,11 +287,7 @@
// 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);
@@ -316,7 +311,7 @@
}
} else if (useDS != null) {
- String dsname = useDS.get(datasourceid);
+ String dsname = useDS.get(modelName);
if (dsname != null) {
ds = availDS.get(dsname);
if (ds == null) {
@@ -372,29 +367,22 @@
}
}
-
- if (ds == null) {
- throw new QueryTestFailedException(
- "Unable to assign a datasource for model:datasourceid "
- + modelName + ":" + datasourceid);
-
+
+ if (ds != null) {
+ assignedDataSources.add(ds.getName());
}
- assignedDataSources.add(ds.getName());
-
- dsmgr.setDataSource(key, ds);
return ds;
}
public void cleanup() {
- dsmgr.clear();
assignedDataSources.clear();
- requiredDataBaseTypes.clear();
+// requiredDataBaseTypes.clear();
if (useDS != null) useDS.clear();
- if (availDS != null) availDS.clear();
+// if (availDS != null) availDS.clear();
}
@@ -407,7 +395,7 @@
DataSourceFactory factory = new DataSourceFactory(config);
try {
- if (factory.getDatasource("1", "model1") == null) {
+ if (factory.getDatasource("model1") == null) {
throw new TransactionRuntimeException("No datasource was not found");
}
@@ -430,7 +418,7 @@
try {
- DataSource dsfind = factory.getDatasource("2", "model2");
+ DataSource dsfind = factory.getDatasource( "model2");
if (dsfind == null) {
throw new TransactionRuntimeException("No datasource was not found as the 2nd
datasource");
@@ -445,7 +433,7 @@
}
- dsfind = factory.getDatasource("1", "model1");
+ dsfind = factory.getDatasource( "model1");
if (dsfind == null) {
throw new TransactionRuntimeException("No datasource was not found as the 2nd
datasource");
@@ -476,7 +464,7 @@
for (int i=0; i<n; i++) {
String k = String.valueOf(i);
- DataSource ds1 = factory.getDatasource(k, "model" + k);
+ DataSource ds1 = factory.getDatasource( "model" + k);
if (ds1 == null) {
throw new TransactionRuntimeException("No datasource was found for:
model:" + k);
@@ -486,7 +474,7 @@
}
- DataSource reuse = factory.getDatasource(String.valueOf(n + 1), "model1");
+ DataSource reuse = factory.getDatasource( "model1");
if (reuse != null) {
} else {
@@ -508,7 +496,7 @@
factory = new DataSourceFactory(config);
- DataSource ds1 = factory.getDatasource("1","pm1");
+ DataSource ds1 = factory.getDatasource("pm1");
if (!ds1.getDBType().equalsIgnoreCase(DataSourceFactory.DataBaseTypes.ORACLE)) {
throw new TransactionRuntimeException("Required DB Type of oracle for model pm1
is :" + ds1.getDBType());
}
@@ -528,7 +516,7 @@
factory = new DataSourceFactory(config);
- DataSource ds2 = factory.getDatasource("2","pm2");
+ DataSource ds2 = factory.getDatasource("pm2");
if (!ds2.getDBType().equalsIgnoreCase(DataSourceFactory.DataBaseTypes.SQLSERVER)) {
throw new TransactionRuntimeException("Required DB Type of sqlserver for model
pm2 is :" + ds2.getDBType());
}
@@ -548,12 +536,12 @@
factory = new DataSourceFactory(config);
- DataSource ds3a = factory.getDatasource("2","pm2");
+ DataSource ds3a = factory.getDatasource("pm2");
if (!ds3a.getDBType().equalsIgnoreCase(DataSourceFactory.DataBaseTypes.SQLSERVER)) {
throw new TransactionRuntimeException("Required DB Type of sqlserver for model
pm12 is :" + ds3a.getDBType());
}
- DataSource ds3b = factory.getDatasource("2","pm1");
+ DataSource ds3b = factory.getDatasource("pm1");
if (!ds3b.getDBType().equalsIgnoreCase(DataSourceFactory.DataBaseTypes.ORACLE)) {
throw new TransactionRuntimeException("Required DB Type of oracle for model pm1
is :" + ds3b.getDBType());
}
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSourceMgr.java
===================================================================
---
trunk/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSourceMgr.java 2010-06-10
04:22:03 UTC (rev 2213)
+++
trunk/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSourceMgr.java 2010-06-10
16:23:19 UTC (rev 2214)
@@ -38,7 +38,7 @@
* 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/";
+ public static final String
DEFAULT_DATASOURCES_LOC="./src/main/resources/datasources/";
/**
* When run from maven, the {@link ConfigPropertyNames#OVERRIDE_DATASOURCES_LOC} will
be assigned
@@ -58,8 +58,12 @@
private Map<String, DataSource> modelToDatasourceMap = new HashMap<String,
DataSource>(); // key
// =
// modelname
+
+ private DataSourceFactory dsfactory = null;
+
private DataSourceMgr() {
+
}
public static synchronized DataSourceMgr getInstance() {
@@ -76,6 +80,10 @@
}
return _instance;
}
+
+ private static synchronized void reset() {
+ _instance = null;
+ }
public Map<String, DataSource> getDataSources() {
Map<String, DataSource> ds = new HashMap<String, DataSource>(
@@ -88,31 +96,86 @@
return allDatasourcesMap.size();
}
+ @SuppressWarnings("deprecation")
public DataSource getDataSource(String modelname) {
if (modelToDatasourceMap.containsKey(modelname)) {
return modelToDatasourceMap.get(modelname);
}
- return null;
+
+ try {
+ DataSource ds = dsfactory.getDatasource( modelname);
+
+ if (ds == null) {
+ printAllDatasources();
+
+ try {
+ Thread.sleep(100000);
+ } catch (InterruptedException e) {
+ }
+ Thread.currentThread().getThreadGroup().stop();
+
+
+// throw new QueryTestFailedException(
+// "Unable to assign a datasource for model "
+// + modelname );
+
+ }
+ modelToDatasourceMap.put(modelname, ds);
+ return ds;
+ } catch (QueryTestFailedException e) {
+ throw new TransactionRuntimeException(e);
+ }
}
- void clear() {
- modelToDatasourceMap.clear();
+ private void printAllDatasources() {
+ Iterator<String> it=allDatasourcesMap.keySet().iterator();
+ while(it.hasNext()) {
+ String key = it.next();
+ DataSource ds = allDatasourcesMap.get(key);
+ TestLogger.log("DataSource: " + ds.getName());
+
+ }
+
}
+
public void shutdown() {
- if (allDatasourcesMap == null || allDatasourcesMap.size() == 0) {
- return;
+ TestLogger.log("Shutting down data sources");
+
+ if (allDatasourcesMap != null && allDatasourcesMap.size() > 0) {
+ Iterator<String> it=allDatasourcesMap.keySet().iterator();
+ while(it.hasNext()) {
+ String key = it.next();
+ DataSource ds = allDatasourcesMap.get(key);
+ try {
+ ds.shutdown();
+ } catch (Throwable t) {
+
+ }
+ }
+
+ allDatasourcesMap.clear();
}
- Iterator<String> it=allDatasourcesMap.keySet().iterator();
- while(it.hasNext()) {
- String key = (String) it.next();
- DataSource ds = allDatasourcesMap.get(key);
- ds.shutdown();
+ if (modelToDatasourceMap != null || modelToDatasourceMap.size() > 0) {
+ Iterator<String> it=modelToDatasourceMap.keySet().iterator();
+ while(it.hasNext()) {
+ String key = it.next();
+ DataSource ds = modelToDatasourceMap.get(key);
+ try {
+ ds.shutdown();
+ } catch (Throwable t) {
+
+ }
+ }
+
+ modelToDatasourceMap.clear();
}
- allDatasourcesMap.clear();
+ dsfactory.cleanup();
+ DataSourceMgr.reset();
+
}
public void setDataSource(String modelName, DataSource ds) {
@@ -158,6 +221,10 @@
TestLogger.logDebug("Number of total datasource mappings loaded "
+ allDatasourcesMap.size());
+
+
+ dsfactory = new DataSourceFactory(ConfigPropertyLoader.getInstance());
+ dsfactory.config(this);
}
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataStore.java
===================================================================
---
trunk/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataStore.java 2010-06-10
04:22:03 UTC (rev 2213)
+++
trunk/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataStore.java 2010-06-10
16:23:19 UTC (rev 2214)
@@ -63,20 +63,22 @@
Statement stmt = c.createStatement();
- stmt.addBatch("delete from g2");
- stmt.addBatch("delete from g1");
+ try {
+ stmt.execute("delete from g2");
+ stmt.execute("delete from g1");
+
+ for (int i = 0; i < 100; i++) {
+ stmt.execute("insert into g1 (e1, e2)
values("+i+",'"+i+"')");
+ }
+
+
+ for (int i = 0; i < 50; i++) {
+ stmt.execute("insert into g2 (e1, e2)
values("+i+",'"+i+"')");
+ }
- for (int i = 0; i < 100; i++) {
- stmt.addBatch("insert into g1 (e1, e2)
values("+i+",'"+i+"')");
+ } finally {
+ stmt.close();
}
-
-
- for (int i = 0; i < 50; i++) {
- stmt.addBatch("insert into g2 (e1, e2)
values("+i+",'"+i+"')");
- }
-
- stmt.executeBatch();
- stmt.close();
}
@@ -106,11 +108,13 @@
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();
+ try {
+ stmt.execute("delete from g2 where e1 >= 50");
//$NON-NLS-1$
+ stmt.execute("delete from g1 where e1 >= 100");
+
+ } finally {
+ stmt.close();
+ }
}
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/framework/query/AbstractQueryTransactionTest.java
===================================================================
---
trunk/test-integration/db/src/main/java/org/teiid/test/framework/query/AbstractQueryTransactionTest.java 2010-06-10
04:22:03 UTC (rev 2213)
+++
trunk/test-integration/db/src/main/java/org/teiid/test/framework/query/AbstractQueryTransactionTest.java 2010-06-10
16:23:19 UTC (rev 2214)
@@ -79,20 +79,13 @@
}
-
-// @Override
-// protected void compareResults(BufferedReader resultReader,
-// BufferedReader expectedReader) throws IOException {
-// assertEquals(read(expectedReader, compareResultsCaseSensitive()), read(
-// resultReader, compareResultsCaseSensitive()));
-// }
-
@Override
public ConnectionStrategy getConnectionStrategy() {
// TODO Auto-generated method stub
return this.connStrategy;
}
+ @SuppressWarnings("deprecation")
@Override
protected void assignExecutionProperties(Statement stmt) {
if (stmt instanceof org.teiid.jdbc.TeiidStatement) {
@@ -189,7 +182,7 @@
* This is because each test could potentially use an include/exclude datasource
option
* that could change the mappings between tests.
* @param identifier
- * @return
+ * @return Connection
* @throws QueryTestFailedException
*/
public Connection getSource(String identifier)
@@ -227,7 +220,7 @@
* Indicates what should be done when a failure occurs in
* {@link #testCase()}
*
- * @return
+ * @return boolean
*
* @since
*/
@@ -263,16 +256,8 @@
* end of the test.
*/
public void cleanup() {
- super.closeConnection();
-
ConfigPropertyLoader.reset();
-
- // cleanup all connections created for this test.
- if (connStrategy != null) {
- connStrategy.shutdown();
- }
-
}
@Override
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/framework/transaction/StandaloneGlobalTransaction.java
===================================================================
---
trunk/test-integration/db/src/main/java/org/teiid/test/framework/transaction/StandaloneGlobalTransaction.java 2010-06-10
04:22:03 UTC (rev 2213)
+++
trunk/test-integration/db/src/main/java/org/teiid/test/framework/transaction/StandaloneGlobalTransaction.java 2010-06-10
16:23:19 UTC (rev 2214)
@@ -22,6 +22,7 @@
super();
}
+ @Override
protected void before(TransactionQueryTestCase test) {
try {
xid = createXid();
@@ -41,6 +42,7 @@
return new XidImpl(0, gid, bid);
}
+ @Override
protected void after(TransactionQueryTestCase test) {
boolean delistSuccessful = false;
boolean commit = false;
Modified: trunk/test-integration/db/src/main/java/org/teiid/test/util/PropUtils.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/util/PropUtils.java 2010-06-10
04:22:03 UTC (rev 2213)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/util/PropUtils.java 2010-06-10
16:23:19 UTC (rev 2214)
@@ -5,6 +5,7 @@
import java.io.InputStream;
import java.util.Properties;
+import org.junit.Assert;
import org.teiid.core.util.PropertiesUtils;
import org.teiid.test.framework.ConfigPropertyLoader;
import org.teiid.test.framework.exception.TransactionRuntimeException;
@@ -15,6 +16,7 @@
public static Properties loadProperties(String filename, Properties defaults) {
+ Assert.assertNotNull(filename);
InputStream in = null;
Properties props = new Properties();
if (defaults != null) {
Added: trunk/test-integration/db/src/main/resources/ctc_tests/runclienttest.sh
===================================================================
--- trunk/test-integration/db/src/main/resources/ctc_tests/runclienttest.sh
(rev 0)
+++ trunk/test-integration/db/src/main/resources/ctc_tests/runclienttest.sh 2010-06-10
16:23:19 UTC (rev 2214)
@@ -0,0 +1,155 @@
+#!/bin/sh
+
+# This script will run the client tests
+
+#============================
+# REQUIRED PROPERTIES
+#
+
+#============================
+# OPTIONAL PROPERTIES
+#
+# (if not set, will default to files within the db project)
+# - QUERYSETDIR - directory location where the test querties can be found
+# - SCENARIODIR - directory location where the scenario files found and determine which
query sets and vdbs to use,
+# - DATASOURCEDIR - root directory location to find the various datasources to use
+# - CONFIGFILE - specify the configuration file to use (override ctc-test.properties)
+
+######################################################
+# DEBUGGING OPTION
+#
+# JBEDSP_DEBUG - uncomment to enable the output of debug messages.
+#
+# JBEDSP_DEBUG=true
+#
+
+if [ -z "${QUERYSETDIR}" ]
+ then
+
+ QUERYSETDIR='./src/main/resources/ctc_tests/queries'
+
+fi
+
+if [ -z "${SCENARIODIR}" ]
+ then
+
+ SCENARIODIR='./src/main/resources/ctc_tests/scenarios'
+
+fi
+
+
+if [ -z "${DATASOURCEDIR}" ]
+ then
+
+ DATASOURCEDIR='./src/main/resources/datasources'
+fi
+
+echo "Use Datasource directory: ${DATASOURCEDIR}"
+
+#--------------------
+
+# resolve links - $0 may be a softlink
+LOC="$0"
+
+while [ -h "$LOC" ] ; do
+ ls=`ls -ld "$LOC"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '.*/.*' > /dev/null; then
+ LOC="$link"
+ else
+ LOC=`dirname "$LOC"`/"$link"
+ fi
+done
+
+LOCDIR=`dirname "$LOC"`
+PRGDIR=`cd "$LOCDIR"; pwd`
+
+cd "${PRGDIR}"
+
+echo "============================"
+echo "Running tests from ${PRGDIR}"
+echo "============================"
+
+# check if running from the kit
+if [ -f "${PRGDIR}/resources/ctc_tests/ctc.xml" ]; then
+ CTCXML=${PRGDIR}/resources/ctc_tests/ctc.xml
+else
+ CTCXML='./src/main/resources/ctc_tests/ctc.xml'
+
+fi
+
+
+ANT_ARGS=" -Dscenario.dir=${SCENARIODIR}"
+ANT_ARGS="${ANT_ARGS} -Dqueryset.artifacts.dir=${QUERYSETDIR}"
+#ANT_ARGS="${ANT_ARGS} -Dvdb.artifacts.dir=${vdb.artifacts.dir}"
+ANT_ARGS="${ANT_ARGS} -Dproj.dir=${PRGDIR}"
+
+# default to the ip address used to start the server
+SVRNAME="0.0.0.0"
+
+if [ ! -z "${SERVERNAME}" ]
+ then
+
+ SVRNAME=${SERVERNAME}
+
+fi
+
+ANT_ARGS="${ANT_ARGS} -Dserver.host.name=${SVRNAME}"
+
+
+if [ ! -z "${XMLCLZZ}" ]
+ then
+
+ ANT_ARGS="${ANT_ARGS} -Dquery.scenario.classname=$XMLCLZZ"
+
+fi
+
+if [ ! -z "${CONFIGFILE}" ]
+ then
+
+ ANT_ARGS="${ANT_ARGS} -Dconfig.file=${CONFIGFILE}"
+
+fi
+
+if [ ! -z "${PROPFILE}" ]
+ then
+
+ ANT_ARGS=" -propertyfile $PROPFILE $ANT_ARGS "
+
+fi
+
+
+ANT_OPTS="-Xmx512m"
+ANT_HOME=${PRGDIR}/ant
+
+# uncomment for additional debugging info in the logfile
+# turn on debug for additional debugging info in the logfile
+if [ -n "$JBEDSP_DEBUG" ]; then
+ ANT_ARGS="${ANT_ARGS} -verbose"
+ fi
+
+if [ ! -x "${PRGDIR}/log" ]; then
+ echo "Create ${PRGDIR}/log directory"
+ mkdir "${PRGDIR}"/log
+fi
+
+if [ -n "${JAVA_OPTS}" ]; then
+ ANT_OPTS="${JAVA_OPTS} $ANT_OPTS "
+fi
+
+CP="${PRGDIR}:${PRGDIR}/ant/*"
+
+LOGLEVEL=info
+
+echo "ANT BUILDFILE=${CTCXML}"
+echo "ANT_HOME=${ANT_HOME}"
+echo "ANT_ARGS=${ANT_ARGS}"
+echo "CP=$CP"
+
+java -cp "${CP}" -Dant.home="${ANT_HOME}" $ANT_OPTS
org.apache.tools.ant.Main $ANT_ARGS -buildfile ${CTCXML}
+
+
+
+
+
+
Property changes on:
trunk/test-integration/db/src/main/resources/ctc_tests/runclienttest.sh
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: trunk/test-integration/db/src/main/resources/default-config.properties
===================================================================
--- trunk/test-integration/db/src/main/resources/default-config.properties 2010-06-10
04:22:03 UTC (rev 2213)
+++ trunk/test-integration/db/src/main/resources/default-config.properties 2010-06-10
16:23:19 UTC (rev 2214)
@@ -1,8 +1,8 @@
##########################################
-# Common Properties for everybody
+# Common Properties for the default test of using the Teiid Driver
##########################################
-connection-type=datasource
+connection-type=driver
process-batch = 20
connector-batch = 20
@@ -14,16 +14,17 @@
##########################################
# properties for Teiid connection
##########################################
-#driver=org.teiid.jdbc.TeiidDriver
-driver=com.metamatrix.jdbc.EmbeddedDataSource
+driver=org.teiid.jdbc.TeiidDriver
+URL=jdbc:metamatrix:Transaction@mm://127.0.0.1:31000
-#URL=jdbc:teiid:Transaction@mm://localhost:31000
-URL=jdbc:metamatrix:Transaction@target/classes/transactions/transaction.properties;user=admin;password=teiid
+#;user=admin;password=admin
+
+
User=admin
Password=teiid
DatabaseName=Transaction
-#ServerName=localhost
-ServerName=target/classes/transactions/transaction.properties
+ServerName=localhost
+#ServerName=target/classes/transactions/transaction.properties
PortNumber=31000
application-name=txn-test
@@ -42,7 +43,8 @@
# 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.
+# By providing the numerical order, it indicates which datasource to assign based on the
order when the "usedatasources" property is
+# specified. If not specified, the numerical order has no impact.
#
# If -Dusedatasources is not set, then the datasource will be assigned randomly when
obtaining a datasource.
#
Modified: trunk/test-integration/db/src/main/resources/xa-config.properties
===================================================================
--- trunk/test-integration/db/src/main/resources/xa-config.properties 2010-06-10 04:22:03
UTC (rev 2213)
+++ trunk/test-integration/db/src/main/resources/xa-config.properties 2010-06-10 16:23:19
UTC (rev 2214)
@@ -1,7 +1,9 @@
##########################################
-# Common Properties for everybody
+# Common Properties for the test that use the Teiid Datasource in order to obtain a
connection
##########################################
+connection-type=datasource
+
process-batch = 20
connector-batch = 20
@@ -13,12 +15,12 @@
# properties for Teiid connection
##########################################
driver=org.teiid.jdbc.TeiidDataSource
-URL=jdbc:metamatrix:Transaction@target/classes/transactions/transaction.properties;user=admin;password=teiid
+URL=jdbc:metamatrix:Transaction@mm://127.0.0.1:31000
User=admin
Password=teiid
DatabaseName=Transaction
-ServerName=target/classes/transactions/transaction.properties
-PortNumber=0
+ServerName=localhost
+PortNumber=31000
application-name=txn-test
# jboss
@@ -42,30 +44,6 @@
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
-
#-----------------------------
Modified:
trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java
===================================================================
---
trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java 2010-06-10
04:22:03 UTC (rev 2213)
+++
trunk/test-integration/db/src/test/java/org/teiid/adminapi/jboss/TestConnectorBindings.java 2010-06-10
16:23:19 UTC (rev 2214)
@@ -37,7 +37,7 @@
import org.teiid.core.util.ObjectConverterUtil;
import org.teiid.core.util.UnitTestUtil;
-
+@Ignore
@SuppressWarnings("nls")
public class TestConnectorBindings extends BaseConnection {
static ServerDatasourceConnection ds;
Modified:
trunk/test-integration/db/src/test/java/org/teiid/dynamicvdb/TestVDBLessExecution.java
===================================================================
---
trunk/test-integration/db/src/test/java/org/teiid/dynamicvdb/TestVDBLessExecution.java 2010-06-10
04:22:03 UTC (rev 2213)
+++
trunk/test-integration/db/src/test/java/org/teiid/dynamicvdb/TestVDBLessExecution.java 2010-06-10
16:23:19 UTC (rev 2214)
@@ -25,6 +25,7 @@
import java.sql.Connection;
import java.sql.DatabaseMetaData;
+import org.junit.Ignore;
import org.junit.Test;
import org.teiid.core.util.UnitTestUtil;
import org.teiid.jdbc.AbstractMMQueryTestCase;
@@ -33,6 +34,7 @@
/**
* Test the DatabaseMetadata results using the Parts VDB.
*/
+@Ignore
public class TestVDBLessExecution extends AbstractMMQueryTestCase {
private static final String DQP_PROP_FILE = UnitTestUtil.getTestDataPath() +
"/vdbless/dqp.properties;user=test"; //$NON-NLS-1$
Modified:
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/AutoWrapTransactionTests.java
===================================================================
---
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/AutoWrapTransactionTests.java 2010-06-10
04:22:03 UTC (rev 2213)
+++
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/AutoWrapTransactionTests.java 2010-06-10
16:23:19 UTC (rev 2214)
@@ -6,6 +6,7 @@
import java.util.ArrayList;
+import org.junit.Test;
import org.teiid.jdbc.AbstractQueryTest;
import org.teiid.test.framework.ConfigPropertyNames;
import org.teiid.test.framework.TransactionContainer;
@@ -16,9 +17,6 @@
public class AutoWrapTransactionTests extends CommonTransactionTests {
- public AutoWrapTransactionTests(String testName) {
- super(testName);
- }
protected TransactionContainer getTransactionContainter() {
@@ -31,6 +29,7 @@
* Batching = Full Processing, Single Connector Batch
* result = rollback
*/
+ @Test
public void testSingleSourceMultipleCommandsReferentialIntegrityRollback() throws
Exception {
AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testSingleSourceMultipleCommandsReferentialIntegrityRollback")
{
public void testCase() throws Exception {
@@ -58,7 +57,7 @@
test.assertRowCount(10);
test.execute("select * from g2 where e1 = 9999");
test.assertRowCount(0);
- test.closeConnection();
+
}
/**
@@ -67,6 +66,7 @@
* Batching = Full Processing, Single Connector Batch
* result = rollback
*/
+ @Test
public void testSingleSourceBatchCommandReferentialIntegrityRollback() throws
Exception {
AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testSingleSourceBatchCommandReferentialIntegrityRollback")
{
public void testCase() throws Exception {
@@ -94,7 +94,7 @@
test.assertRowCount(0);
test.execute("select * from g2 where e1 = 9999");
test.assertRowCount(0);
- test.closeConnection();
+
}
/**
@@ -103,6 +103,7 @@
* Batching = Full Processing, Single Connector Batch
* result = commit
*/
+ @Test
public void testMultipleSourceBulkRowInsertRollback() throws Exception {
AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testMultipleSourceBulkRowInsertRollback") {
ArrayList list = new ArrayList();
@@ -130,13 +131,11 @@
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();
}
}
Modified:
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/BaseAbstractTransactionTestCase.java
===================================================================
---
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/BaseAbstractTransactionTestCase.java 2010-06-10
04:22:03 UTC (rev 2213)
+++
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/BaseAbstractTransactionTestCase.java 2010-06-10
16:23:19 UTC (rev 2214)
@@ -1,42 +1,47 @@
package org.teiid.test.testcases;
-import junit.framework.TestCase;
-
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
import org.teiid.test.framework.ConfigPropertyLoader;
import org.teiid.test.framework.TransactionContainer;
+import org.teiid.test.framework.datasource.DataSourceMgr;
-public abstract class BaseAbstractTransactionTestCase extends TestCase {
+public abstract class BaseAbstractTransactionTestCase {
- public BaseAbstractTransactionTestCase(String name) {
- super(name);
-
-
- }
protected abstract TransactionContainer getTransactionContainter();
-
- @Override
- protected void setUp() throws Exception {
- // TODO Auto-generated method stub
- super.setUp();
+ @BeforeClass
+ public static void beforeAll() throws Exception {
+ ConfigPropertyLoader.reset();
+ ConfigPropertyLoader.getInstance();
}
- @Override
- protected void tearDown() throws Exception {
- // TODO Auto-generated method stub
- super.tearDown();
+ @Before
+ public void beforeEach() throws Exception {
}
+ @After
+ public void afterEach() throws Exception {
+ }
+
protected void addProperty(String key, String value) {
ConfigPropertyLoader.getInstance().setProperty(key, value);
}
+
+ @AfterClass
+ public static void afterAll() {
+ DataSourceMgr.getInstance().shutdown();
+ }
+
+
-
}
Modified:
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/CommonTransactionTests.java
===================================================================
---
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/CommonTransactionTests.java 2010-06-10
04:22:03 UTC (rev 2213)
+++
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/CommonTransactionTests.java 2010-06-10
16:23:19 UTC (rev 2214)
@@ -8,6 +8,9 @@
import java.util.ArrayList;
import java.util.concurrent.TimeoutException;
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
import org.teiid.jdbc.AbstractQueryTest;
import org.teiid.jdbc.TeiidSQLException;
import org.teiid.test.framework.TransactionContainer;
@@ -20,12 +23,7 @@
*/
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];
@@ -76,6 +74,7 @@
* Batching = Full Processing, Single Connector Batch
* result = commit
*/
+ @Test
public void testSingleSourceSelect() throws Exception {
AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testSingleSourceSelect") {
public void testCase() throws Exception {
@@ -97,6 +96,7 @@
* Batching = Full Processing, Single Connector Batch
* result = commit
*/
+ @Test
public void testSingleSourceUpdate() throws Exception {
AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testSingleSourceUpdate") {
public void testCase() throws Exception {
@@ -111,7 +111,6 @@
AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
test.execute("select * from g1 where e1 = 100");
test.assertRowCount(1);
- test.closeConnection();
}
@@ -121,6 +120,7 @@
* Batching = Full Processing, Single Connector Batch
* result = commit
*/
+ @Test
public void testSingleSourcePreparedUpdate() throws Exception {
AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testSingleSourcePreparedUpdate") {
@@ -136,7 +136,7 @@
AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
test.execute("select * from g1 where e1 = 102");
test.assertRowCount(1);
- test.closeConnection();
+
}
/**
@@ -145,6 +145,7 @@
* Batching = Full Processing, Single Connector Batch
* result = commit
*/
+ @Test
public void testSingleSourceMultipleCommands() throws Exception {
AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testSingleSourceMultipleCommands") {
public void testCase() throws Exception {
@@ -171,7 +172,7 @@
test.assertRowCount(10);
test.execute("select * from g2 where e1 >= 100");
test.assertRowCount(10);
- test.closeConnection();
+
}
/**
@@ -180,6 +181,7 @@
* Batching = Partial Processing, Single Connector Batch
* result = commit
*/
+ @Test
public void testSingleSourcePartialProcessing() throws Exception {
AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testSingleSourcePartialProcessing") {
public void testCase() throws Exception {
@@ -202,6 +204,7 @@
* Batching = Full Processing, Single Connector Batch
* result = commit
*/
+ @Test
public void testMultipleSourceSelect() throws Exception {
AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testMultipleSourceSelect") {
public void testCase() throws Exception {
@@ -220,6 +223,7 @@
* Batching = Full Processing, Single Connector Batch
* result = commit
*/
+ @Test
public void testMultipleSourceVirtualSelect() throws Exception {
AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testMultipleSourceVirtualSelect") {
public void testCase() throws Exception {
@@ -238,6 +242,7 @@
* Batching = Full Processing, Single Connector Batch
* result = commit
*/
+ @Test
public void testMultipleSourceUpdate() throws Exception {
AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testMultipleSourceUpdate") {
public void testCase() throws Exception {
@@ -257,7 +262,6 @@
test = new QueryExecution(userTxn.getSource("pm2"));
test.execute("select * from g1 where e2 = '500'");
test.assertRowCount(1);
- test.closeConnection();
}
/**
@@ -266,6 +270,7 @@
* Batching = Full Processing, Single Connector Batch
* result = commit
*/
+ @Test
public void testMultipleSourceSelectInto() throws Exception {
AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testMultipleSourceSelectInto") {
public void testCase() throws Exception {
@@ -281,12 +286,10 @@
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();
}
/**
@@ -295,6 +298,7 @@
* Batching = Full Processing, Single Connector Batch
* result = commit
*/
+ @Test
public void testMultipleSourceBulkRowInsert() throws Exception {
AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testMultipleSourceBulkRowInsert") {
public void testCase() throws Exception {
@@ -313,14 +317,12 @@
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();
}
/**
@@ -329,6 +331,7 @@
* Batching = Full Processing, Single Connector Batch
* result = commit
*/
+ @Test
public void testMultipleSourcePreparedUpdate() throws Exception {
AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testMultipleSourcePreparedUpdate") {
public void testCase() throws Exception {
@@ -344,12 +347,11 @@
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();
+
}
@@ -359,6 +361,7 @@
* Batching = Full Processing, Single Connector Batch
* result = commit
*/
+ @Test
public void testMultipleSourceMultipleCommands() throws Exception {
AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testMultipleSourceMultipleCommands") {
public void testCase() throws Exception {
@@ -404,7 +407,7 @@
} else {
test.assertResultsSetEquals(new String[] {"e2[varchar]",
"blah"});
}
- test.closeConnection();
+
}
/**
@@ -413,6 +416,7 @@
* Batching = Full Processing, Single Connector Batch
* result = commit
*/
+ @Test
public void testMultipleSourceMultipleVirtualCommands() throws Exception {
AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testMultipleSourceMultipleVirtualCommands") {
public void testCase() throws Exception {
@@ -448,7 +452,7 @@
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();
+
}
/**
@@ -457,6 +461,7 @@
* Batching = Full Processing, Single Connector Batch
* result = rollback
*/
+ @Test
public void testMultipleSourceMultipleCommandsCancel() throws Exception {
AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testMultipleSourceMultipleCommandsCancel") {
@@ -492,7 +497,6 @@
test.assertRowCount(0);
test.execute("select distinct e2 from g1 where e1 >= 600 and e1 <
650");
test.assertRowCount(0);
- test.closeConnection();
}
/**
@@ -501,6 +505,7 @@
* Batching = Full Processing, Single Connector Batch
* result = rollback
*/
+ @Test
public void testMultipleSourceTimeout() throws Exception{
AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testMultipleSourceTimeout") {
public void testCase() throws Exception {
@@ -513,7 +518,7 @@
public void after() {
if (!exceptionOccurred()) {
- fail("should have failed with time out exception");
+ Assert.assertTrue("should have failed with time out
exception", false );
}
else {
if (getLastException() != null) {
@@ -538,9 +543,9 @@
}
boolean isfound = (msg.indexOf("Operation timed out before
completion") != -1 ? true : false);
- assertTrue("Exception Message didnt match 'Operation timed out
before completion' found: " + msg, isfound );
+ Assert.assertTrue("Exception Message didnt match 'Operation
timed out before completion' found: " + msg, isfound );
} else {
- fail("Program Error: it indicates exception occured, but no
exception is found" );
+ Assert.assertTrue("Program Error: it indicates exception occured,
but no exception is found", false );
}
}
}
@@ -555,7 +560,7 @@
test.assertRowCount(0);
test.execute("select distinct e2 from g1 where e1 >= 600 and e1 <
750");
test.assertRowCount(0);
- test.closeConnection();
+
}
@@ -589,7 +594,9 @@
* 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 {
+ @Ignore
+ @Test
+ public void testMultipleSourcePartialProcessingUsingLimit() throws Exception {
AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testMultipleSourcePartialProcessingUsingLimit") {
public void testCase() throws Exception {
execute("select * from vm.g1 where pm1e1 < 100 limit 10");
@@ -609,7 +616,9 @@
* 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 {
+ @Ignore
+ @Test
+ public void testMultipleSourcePartialProcessingUsingMakedep() 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");
Modified:
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionTests.java
===================================================================
---
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionTests.java 2010-06-10
04:22:03 UTC (rev 2213)
+++
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionTests.java 2010-06-10
16:23:19 UTC (rev 2214)
@@ -4,6 +4,7 @@
*/
package org.teiid.test.testcases;
+import org.junit.Test;
import org.teiid.jdbc.AbstractQueryTest;
import org.teiid.test.framework.TransactionContainer;
import org.teiid.test.framework.query.AbstractQueryTransactionTest;
@@ -20,11 +21,6 @@
public class LocalTransactionTests extends CommonTransactionTests {
- public LocalTransactionTests(String testName) {
- super(testName);
- }
-
-
@Override
protected TransactionContainer getTransactionContainter() {
// TODO Auto-generated method stub
@@ -37,16 +33,19 @@
* Batching = Full Processing, Single Connector Batch
* result = rollback
*/
+ @Test
public void testSingleSourceMultipleCommandsExplicitRollback() throws Exception {
AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testSingleSourceMultipleCommandsExplicitRollback")
{
- public void testCase() throws Exception {
+ @Override
+ 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() {
+ @Override
+ public boolean rollbackAllways() {
return true;
}
};
@@ -60,7 +59,7 @@
test.assertRowCount(0);
test.execute("select * from g2 where e1 >= 200 and e1 < 220");
test.assertRowCount(0);
- test.closeConnection();
+
}
/**
@@ -69,6 +68,7 @@
* Batching = Full Processing, Single Connector Batch
* result = rollback
*/
+ @Test
public void testSingleSourceMultipleCommandsReferentialIntegrityRollback() throws
Exception {
AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testSingleSourceMultipleCommandsReferentialIntegrityRollback")
{
public void testCase() throws Exception {
@@ -94,7 +94,7 @@
AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
test.execute("select * from g1 where e1 >= 200 and e1 < 220");
test.assertRowCount(0);
- test.closeConnection();
+
}
/**
@@ -103,6 +103,7 @@
* Batching = Full Processing, Single Connector Batch
* result = rollback
*/
+ @Test
public void testMultipleSourceMultipleCommandsExplicitRollback() throws Exception {
AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testMultipleSourceMultipleCommandsExplicitRollback")
{
public void testCase() throws Exception {
@@ -131,12 +132,11 @@
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();
+
}
/**
@@ -145,6 +145,7 @@
* Batching = Full Processing, Single Connector Batch
* result = rollback
*/
+ @Test
public void testMultipleSourceMultipleCommandsReferentialIntegrityRollback() throws
Exception {
AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testMultipleSourceMultipleCommandsReferentialIntegrityRollback")
{
public void testCase() throws Exception {
@@ -174,12 +175,12 @@
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();
+
}
/**
@@ -188,6 +189,7 @@
* Batching = Full Processing, Single Connector Batch
* result = commit
*/
+ @Test
public void testMultipleSourceBulkRowInsertRollback() throws Exception {
AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testMultipleSourceBulkRowInsertRollback") {
public void testCase() throws Exception {
@@ -213,14 +215,12 @@
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();
}
/**
@@ -229,6 +229,7 @@
* Batching = Full Processing, Single Connector Batch
* result = commit
*/
+ @Test
public void testMultipleSourceMultipleVirtualCommandsRollback() throws Exception {
AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testMultipleSourceMultipleVirtualCommandsRollback")
{
public void testCase() throws Exception {
@@ -267,6 +268,6 @@
test.assertRowCount(0);
test.execute("select distinct e2 from g1 where e1 >= 600 and e1 <
615");
test.assertRowCount(0);
- test.closeConnection();
+
}
}
Modified:
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/OffWrapTransactionTests.java
===================================================================
---
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/OffWrapTransactionTests.java 2010-06-10
04:22:03 UTC (rev 2213)
+++
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/OffWrapTransactionTests.java 2010-06-10
16:23:19 UTC (rev 2214)
@@ -5,6 +5,7 @@
package org.teiid.test.testcases;
import java.util.ArrayList;
+import org.junit.Test;
import org.teiid.jdbc.AbstractQueryTest;
import org.teiid.test.framework.TransactionContainer;
@@ -16,12 +17,8 @@
public class OffWrapTransactionTests extends BaseAbstractTransactionTestCase {
-
-
- public OffWrapTransactionTests(String testName) {
- super(testName);
- }
+
@Override
protected TransactionContainer getTransactionContainter() {
return new TxnAutoTransaction(TXN_AUTO_WRAP_OPTIONS.AUTO_WRAP_OFF);
@@ -35,6 +32,7 @@
* Batching = Full Processing, Single Connector Batch
* result = commit
*/
+ @Test
public void testSingleSourceSelect() throws Exception {
AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testSingleSourceSelect") {
@@ -56,6 +54,7 @@
* Batching = Full Processing, Single Connector Batch
* result = commit
*/
+ @Test
public void testSingleSourceUpdate() throws Exception {
AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testSingleSourceUpdate") {
public void testCase() throws Exception {
@@ -70,7 +69,6 @@
AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
test.execute("select * from g1 where e1 = 100");
test.assertRowCount(1);
- test.closeConnection();
}
/**
@@ -79,6 +77,7 @@
* Batching = Full Processing, Single Connector Batch
* result = commit
*/
+ @Test
public void testSingleSourceMultipleCommands() throws Exception {
AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testSingleSourceMultipleCommands") {
public void testCase() throws Exception {
@@ -102,7 +101,7 @@
test.assertRowCount(10);
test.execute("select * from g2 where e1 >= 100");
test.assertRowCount(10);
- test.closeConnection();
+
}
/**
@@ -111,6 +110,7 @@
* Batching = Full Processing, Single Connector Batch
* result = rollback
*/
+ @Test
public void testSingleSourceMultipleCommandsReferentialIntegrityRollback() throws
Exception {
AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testSingleSourceMultipleCommandsReferentialIntegrityRollback")
{
public void testCase() throws Exception {
@@ -136,7 +136,7 @@
AbstractQueryTest test = new QueryExecution(userTxn.getSource("pm1"));
test.execute("select * from g1 where e1 >= 200");
test.assertRowCount(10);
- test.closeConnection();
+
}
///////////////////////////////////////////////////////////////////////////////////////////////
@@ -149,6 +149,7 @@
* Batching = Full Processing, Single Connector Batch
* result = commit
*/
+ @Test
public void testMultipleSourceSelect() throws Exception {
AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testMultipleSourceSelect") {
public void testCase() throws Exception {
@@ -167,6 +168,7 @@
* Batching = Full Processing, Single Connector Batch
* result = commit
*/
+ @Test
public void testMultipleSourceUpdate() throws Exception {
AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testMultipleSourceUpdate") {
public void testCase() throws Exception {
@@ -181,12 +183,10 @@
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();
}
/**
@@ -195,6 +195,7 @@
* Batching = Full Processing, Single Connector Batch
* result = rollback
*/
+ @Test
public void testMultipleSourceMultipleCommandsReferentialIntegrityRollback() throws
Exception {
AbstractQueryTransactionTest userTxn = new
AbstractQueryTransactionTest("testMultipleSourceMultipleCommandsReferentialIntegrityRollback")
{
@@ -225,12 +226,12 @@
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();
+
}
/**
@@ -239,6 +240,7 @@
* Batching = Full Processing, Single Connector Batch
* result = commit
*/
+ @Test
public void testMultipleSourceBulkRowInsert() throws Exception {
@@ -270,13 +272,12 @@
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();
+
}
}
Modified:
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/OnWrapTransactionTests.java
===================================================================
---
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/OnWrapTransactionTests.java 2010-06-10
04:22:03 UTC (rev 2213)
+++
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/OnWrapTransactionTests.java 2010-06-10
16:23:19 UTC (rev 2214)
@@ -23,6 +23,8 @@
import java.util.ArrayList;
+import org.junit.Ignore;
+import org.junit.Test;
import org.teiid.jdbc.AbstractQueryTest;
import org.teiid.test.framework.TransactionContainer;
import org.teiid.test.framework.ConfigPropertyNames.TXN_AUTO_WRAP_OPTIONS;
@@ -36,9 +38,6 @@
*/
public class OnWrapTransactionTests extends CommonTransactionTests {
- public OnWrapTransactionTests(String testName) {
- super(testName);
- }
@Override
protected TransactionContainer getTransactionContainter() {
@@ -49,6 +48,7 @@
* Sources = 1 Commands = multiple Success Batching = Full Processing,
* Single Connector Batch result = rollback
*/
+ @Test
public void testSingleSourceMultipleCommandsReferentialIntegrityRollback()
throws Exception {
AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest(
@@ -82,13 +82,13 @@
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
*/
+ @Test
public void testSingleSourceBatchCommandReferentialIntegrityRollback()
throws Exception {
AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest(
@@ -120,26 +120,25 @@
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
*/
+ @Test
public void testMultipleSourceBulkRowInsertRollback() throws Exception {
AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest(
"testMultipleSourceBulkRowInsertRollback") {
- ArrayList list = new ArrayList();
+ ArrayList<String> list = new ArrayList<String>();
+ @Override
public void testCase() throws Exception {
for (int i = 100; i < 110; i++) {
- list
- .add("insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2) values("
+ 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");
+ 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')");
@@ -147,6 +146,7 @@
executeBatch((String[]) list.toArray(new String[list.size()]));
}
+ @Override
public boolean exceptionExpected() {
return true;
}
@@ -159,13 +159,19 @@
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();
}
+
+ @Ignore
+ @Test
+ @Override
+ public void testMultipleSourceTimeout() throws Exception{
+
+ }
+
}
Modified:
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/StandaloneGlobalTransactionTests.java
===================================================================
---
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/StandaloneGlobalTransactionTests.java 2010-06-10
04:22:03 UTC (rev 2213)
+++
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/StandaloneGlobalTransactionTests.java 2010-06-10
16:23:19 UTC (rev 2214)
@@ -4,6 +4,13 @@
*/
package org.teiid.test.testcases;
+import java.util.Properties;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.teiid.test.framework.ConfigPropertyNames;
import org.teiid.test.framework.TransactionContainer;
import org.teiid.test.framework.transaction.StandaloneGlobalTransaction;
@@ -13,16 +20,46 @@
* in places like inside app server
*/
public class StandaloneGlobalTransactionTests extends LocalTransactionTests {
+
+ private static Properties SYS_PROPS;
+
+ @BeforeClass
+ public static void beforeAll() throws Exception {
+ SYS_PROPS = (Properties) System.getProperties().clone();
+
+ System.setProperty(ConfigPropertyNames.CONFIG_FILE, "xa-config.properties");
- public StandaloneGlobalTransactionTests(String testName) {
- super(testName);
}
@Override
+ @Before
+ public void beforeEach() throws Exception {
+ super.beforeEach();
+ }
+
+ @Override
+ @After
+ public void afterEach() throws Exception {
+ super.afterEach();
+
+ }
+
+
+ @Override
protected TransactionContainer getTransactionContainter() {
return new StandaloneGlobalTransaction();
}
+
+ @AfterClass
+ public static void afterAll() {
+
+ System.setProperties(SYS_PROPS);
+ }
+
+
+
+
}