teiid SVN: r1461 - trunk/test-integration/db/src/main/java/org/teiid/test/framework.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-09-22 18:05:47 -0400 (Tue, 22 Sep 2009)
New Revision: 1461
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionContainer.java
Log:
Teiid 773 - reorganized how datasources are referenced at all stages of a test
Modified: trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionContainer.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionContainer.java 2009-09-22 22:01:35 UTC (rev 1460)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionContainer.java 2009-09-22 22:05:47 UTC (rev 1461)
@@ -9,8 +9,6 @@
import java.util.Set;
import org.teiid.test.framework.connection.ConnectionStrategy;
-import org.teiid.test.framework.datasource.DataSourceMgr;
-import org.teiid.test.framework.datasource.DataSourceSetupFactory;
import org.teiid.test.framework.exception.QueryTestFailedException;
import org.teiid.test.framework.exception.TransactionRuntimeException;
16 years, 7 months
teiid SVN: r1460 - in trunk/test-integration/db/src/test/java/org/teiid/test: framework/datasource and 1 other directories.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-09-22 18:01:35 -0400 (Tue, 22 Sep 2009)
New Revision: 1460
Modified:
trunk/test-integration/db/src/test/java/org/teiid/test/framework/AbstractQueryTransactionTest.java
trunk/test-integration/db/src/test/java/org/teiid/test/framework/datasource/DataSourceSetupFactory.java
trunk/test-integration/db/src/test/java/org/teiid/test/framework/datasource/SingleDataSourceSetup.java
trunk/test-integration/db/src/test/java/org/teiid/test/framework/datasource/TwoDataSourceSetup.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/SingleSourceTransactionScenarios.java
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/TwoSourceTransactionScenarios.java
Log:
Teiid 773 - reorganized how datasources are referenced at all stages of a test
Modified: trunk/test-integration/db/src/test/java/org/teiid/test/framework/AbstractQueryTransactionTest.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/framework/AbstractQueryTransactionTest.java 2009-09-22 22:00:58 UTC (rev 1459)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/framework/AbstractQueryTransactionTest.java 2009-09-22 22:01:35 UTC (rev 1460)
@@ -5,23 +5,26 @@
package org.teiid.test.framework;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.io.BufferedReader;
import java.io.IOException;
+import java.sql.Connection;
import java.sql.Statement;
+import java.util.Map;
import java.util.Properties;
import javax.sql.XAConnection;
import org.teiid.test.framework.connection.ConnectionStrategy;
import org.teiid.test.framework.connection.ConnectionStrategyFactory;
+import org.teiid.test.framework.connection.ConnectionUtil;
+import org.teiid.test.framework.datasource.DataSource;
import org.teiid.test.framework.datasource.DataSourceSetupFactory;
+import org.teiid.test.framework.exception.QueryTestFailedException;
import org.teiid.test.framework.exception.TransactionRuntimeException;
import com.metamatrix.jdbc.api.AbstractQueryTest;
-import com.metamatrix.jdbc.api.ExecutionProperties;
/**
@@ -33,10 +36,12 @@
*
*/
public abstract class AbstractQueryTransactionTest extends AbstractQueryTest implements TransactionQueryTest{
- Properties executionProperties = null;
- String testname = "NA";
+ protected Properties executionProperties = null;
+ protected String testname = "NA";
+ protected Map<String, DataSource> datasources = null;
+
public AbstractQueryTransactionTest() {
super();
}
@@ -50,7 +55,16 @@
return this.testname;
}
+ /**
+ * Called to set the datasources used during this test
+ *
+ * @since
+ */
+ public void setDataSources(Map<String, DataSource> datasources) {
+ this.datasources = datasources;
+ }
+
public void setExecutionProperties(Properties props) {
assertNotNull(props);
this.executionProperties = props;
@@ -85,20 +99,35 @@
return true;
}
- @Override
- public void setupDataSource() {
+
+ /**
+ * Override <code>setupDataSource</code> if there is different mechinism for
+ * setting up the datasources for the testcase
+ *
+ * @since
+ */
+ @Override
+ public void setupDataSources() {
DataSourceSetup dss = null;
try {
- dss = DataSourceSetupFactory.createDataSourceSetup(getNumberRequiredDataSources());
+ dss = DataSourceSetupFactory.createDataSourceSetup(this.datasources);
dss.setup();
} catch(Exception e) {
throw new TransactionRuntimeException(e.getMessage());
}
- }
+ }
+
+
+ public Connection getSource(String identifier) throws QueryTestFailedException {
+ return ConnectionUtil.getConnection(identifier, this.datasources);
+ }
+
+ public XAConnection getXASource(String identifier) throws QueryTestFailedException {
+ return ConnectionUtil.getXAConnection(identifier, this.datasources);
+ }
-
/**
* Implement testCase(), it is the entry point to the execution of the test.
* @throws Exception
@@ -137,7 +166,13 @@
public void after() {
}
+
+ @Override
+ public void validateTestCase() throws Exception {
+
+ }
+
/**
* At end of each test, clean up the connection factory so that it can be
* established at the start of the next test.
Modified: trunk/test-integration/db/src/test/java/org/teiid/test/framework/datasource/DataSourceSetupFactory.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/framework/datasource/DataSourceSetupFactory.java 2009-09-22 22:00:58 UTC (rev 1459)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/framework/datasource/DataSourceSetupFactory.java 2009-09-22 22:01:35 UTC (rev 1460)
@@ -1,24 +1,26 @@
package org.teiid.test.framework.datasource;
+import java.util.Map;
+
import org.teiid.test.framework.DataSourceSetup;
import org.teiid.test.framework.exception.QueryTestFailedException;
public class DataSourceSetupFactory {
- public static DataSourceSetup createDataSourceSetup(int numOfDataSources) throws QueryTestFailedException {
+ public static DataSourceSetup createDataSourceSetup(Map<String, DataSource> datasources) throws QueryTestFailedException {
DataSourceSetup dss = null;
- switch (numOfDataSources) {
+ switch (datasources.size()) {
case 1:
- dss = new SingleDataSourceSetup();
+ dss = new SingleDataSourceSetup(datasources);
break;
case 2:
- dss = new TwoDataSourceSetup();
+ dss = new TwoDataSourceSetup(datasources);
break;
default:
- throw new QueryTestFailedException("Number of datasources " + numOfDataSources + " is not supported");
+ throw new QueryTestFailedException("Number of datasources " + datasources.size() + " is not supported");
}
Modified: trunk/test-integration/db/src/test/java/org/teiid/test/framework/datasource/SingleDataSourceSetup.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/framework/datasource/SingleDataSourceSetup.java 2009-09-22 22:00:58 UTC (rev 1459)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/framework/datasource/SingleDataSourceSetup.java 2009-09-22 22:01:35 UTC (rev 1460)
@@ -4,6 +4,8 @@
*/
package org.teiid.test.framework.datasource;
+import java.util.Map;
+
import org.teiid.test.framework.DataSourceSetup;
import org.teiid.test.framework.QueryExecution;
import org.teiid.test.framework.connection.ConnectionUtil;
@@ -16,7 +18,13 @@
* This performs the data setup for SingleSource test cases
*/
public class SingleDataSourceSetup implements DataSourceSetup {
+
+ private Map ds=null;
+ public SingleDataSourceSetup(Map datasources) {
+ this.ds = datasources;
+ }
+
@Override
public void setup() throws Exception {
@@ -28,7 +36,7 @@
// Only one of the models are needed because pm1 and pm2 point to the same datasource
- AbstractQueryTest test1 = new QueryExecution(ConnectionUtil.getSource("pm1")); //$NON-NLS-1$
+ AbstractQueryTest test1 = new QueryExecution(ConnectionUtil.getConnection("pm1", ds) ); //$NON-NLS-1$
test1.execute("delete from g2"); //$NON-NLS-1$
test1.execute("delete from g1"); //$NON-NLS-1$
Modified: trunk/test-integration/db/src/test/java/org/teiid/test/framework/datasource/TwoDataSourceSetup.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/framework/datasource/TwoDataSourceSetup.java 2009-09-22 22:00:58 UTC (rev 1459)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/framework/datasource/TwoDataSourceSetup.java 2009-09-22 22:01:35 UTC (rev 1460)
@@ -4,6 +4,8 @@
*/
package org.teiid.test.framework.datasource;
+import java.util.Map;
+
import org.teiid.test.framework.DataSourceSetup;
import org.teiid.test.framework.QueryExecution;
import org.teiid.test.framework.connection.ConnectionUtil;
@@ -16,7 +18,12 @@
* This performs the data setup for SingleSource test cases
*/
public class TwoDataSourceSetup implements DataSourceSetup {
+ private Map ds=null;
+ public TwoDataSourceSetup(Map datasources) {
+ this.ds = datasources;
+ }
+
@Override
public void setup() throws Exception {
@@ -27,7 +34,8 @@
System.out.println("Run TwoSource Setup...");
- AbstractQueryTest test1 = new QueryExecution(ConnectionUtil.getSource("pm1")); //$NON-NLS-1$
+ AbstractQueryTest test1 = new QueryExecution(ConnectionUtil.getConnection("pm1", ds));//$NON-NLS-1$
+
test1.execute("delete from g2"); //$NON-NLS-1$
test1.execute("delete from g1"); //$NON-NLS-1$
@@ -55,7 +63,7 @@
test1.execute("select * from g2 ");
test1.assertRowCount(100);
- AbstractQueryTest test2 = new QueryExecution(ConnectionUtil.getSource("pm2")); //$NON-NLS-1$
+ AbstractQueryTest test2 = new QueryExecution(ConnectionUtil.getConnection("pm2", ds));//$NON-NLS-1$
test2.execute("delete from g2"); //$NON-NLS-1$
test2.execute("delete from g1"); //$NON-NLS-1$
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 2009-09-22 22:00:58 UTC (rev 1459)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/testcases/BaseAbstractTransactionTestCase.java 2009-09-22 22:01:35 UTC (rev 1460)
@@ -35,12 +35,12 @@
}
- public Connection getSource(String identifier) throws QueryTestFailedException {
- return ConnectionUtil.getSource(identifier);
- }
-
- public XAConnection getXASource(String identifier) throws QueryTestFailedException {
- return ConnectionUtil.getXASource(identifier);
- }
+// public Connection getSource(String identifier) throws QueryTestFailedException {
+// return ConnectionUtil.getSource(identifier);
+// }
+//
+// public XAConnection getXASource(String identifier) throws QueryTestFailedException {
+// return ConnectionUtil.getXASource(identifier);
+// }
}
Modified: trunk/test-integration/db/src/test/java/org/teiid/test/testcases/SingleSourceTransactionScenarios.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/testcases/SingleSourceTransactionScenarios.java 2009-09-22 22:00:58 UTC (rev 1459)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/testcases/SingleSourceTransactionScenarios.java 2009-09-22 22:01:35 UTC (rev 1460)
@@ -4,8 +4,11 @@
*/
package org.teiid.test.testcases;
+import java.util.Map;
+
import org.teiid.test.framework.AbstractQueryTransactionTest;
import org.teiid.test.framework.QueryExecution;
+import org.teiid.test.framework.datasource.DataSource;
import com.metamatrix.jdbc.api.AbstractQueryTest;
@@ -37,10 +40,8 @@
execute("select * from pm1.g1 where pm1.g1.e1 < 100");
assertRowCount(100);
}
-
- public void validateTestCase() throws Exception {
-
- }
+
+
};
// run test
@@ -68,6 +69,7 @@
test.closeConnection();
}
+
};
// run test
@@ -151,9 +153,7 @@
execute("select * from pm1.g1 where pm1.g1.e1 < 100 limit 10");
assertRowCount(10);
}
-
- public void validateTestCase() throws Exception {
- }
+
};
// run test
@@ -168,15 +168,7 @@
* result = rollback
*/
- public void testSingleSourceMultipleCommandsExplicitRollback() throws Exception {
- // now it's empty
- AbstractQueryTest test = new QueryExecution(getSource("pm1"));
- //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();
+ public void testSingleSourceMultipleCommandsExplicitRollback() throws Exception {
AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testSingleSourceMultipleCommandsExplicitRollback") {
Modified: trunk/test-integration/db/src/test/java/org/teiid/test/testcases/TwoSourceTransactionScenarios.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/testcases/TwoSourceTransactionScenarios.java 2009-09-22 22:00:58 UTC (rev 1459)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/testcases/TwoSourceTransactionScenarios.java 2009-09-22 22:01:35 UTC (rev 1460)
@@ -45,9 +45,7 @@
public int getNumberRequiredDataSources(){
return 2;
}
-
- public void validateTestCase() throws Exception {
- }
+
};
// run test
@@ -70,8 +68,7 @@
public int getNumberRequiredDataSources(){
return 2;
}
- public void validateTestCase() throws Exception {
- }
+
};
16 years, 7 months
teiid SVN: r1459 - in trunk/test-integration/db/src/main/java/org/teiid/test/framework: connection and 2 other directories.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-09-22 18:00:58 -0400 (Tue, 22 Sep 2009)
New Revision: 1459
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionContainer.java
trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionQueryTest.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/ConnectionUtil.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/transaction/LocalTransaction.java
Log:
Teiid 773 - reorganized how datasources are referenced at all stages of a test
Modified: trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionContainer.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionContainer.java 2009-09-22 20:00:09 UTC (rev 1458)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionContainer.java 2009-09-22 22:00:58 UTC (rev 1459)
@@ -6,9 +6,11 @@
import java.sql.Connection;
import java.util.Properties;
+import java.util.Set;
import org.teiid.test.framework.connection.ConnectionStrategy;
import org.teiid.test.framework.datasource.DataSourceMgr;
+import org.teiid.test.framework.datasource.DataSourceSetupFactory;
import org.teiid.test.framework.exception.QueryTestFailedException;
import org.teiid.test.framework.exception.TransactionRuntimeException;
@@ -31,36 +33,25 @@
}
- /**
- * Returns <code>true</code> if the test <b>CANNOT</b> be run due to not have the right
- * number of datasources available.
- *
- */
- protected boolean turnOffTest (int numberofDataSources) {
- boolean rtn = DataSourceMgr.getInstance().hasAvailableDataSource(numberofDataSources);
- if (!rtn) {
- return true;
- }
+ protected Set getDataSources() {
+ Set dss = null;
- return false;
- }
-
+
+ return dss;
+ }
+
+
protected void before(TransactionQueryTest test){}
protected void after(TransactionQueryTest test) {}
public void runTransaction(TransactionQueryTest test) {
-
- if (turnOffTest(test.getNumberRequiredDataSources())) {
- detail("Turn Off Transaction test: " + test.getTestName() + ", doesn't have the number of required datasources");
- return;
-
- }
-
+
detail("Start transaction test: " + test.getTestName());
try {
- test.setupDataSource();
+ test.setDataSources(connStrategy.getDataSources());
+ test.setupDataSources();
debug(" setConnection");
test.setConnection(getConnection());
@@ -77,12 +68,6 @@
// run the test
test.testCase();
- }catch(Throwable e) {
- if (!test.exceptionExpected()) {
- e.printStackTrace();
- }
- throw new TransactionRuntimeException(e.getMessage());
- }finally {
debug(" test.after");
test.after();
@@ -92,6 +77,14 @@
detail("End transaction test: " + test.getTestName());
+
+ }catch(Throwable e) {
+ if (!test.exceptionExpected()) {
+ e.printStackTrace();
+ }
+ throw new TransactionRuntimeException(e.getMessage());
+ }finally {
+
}
if (test.exceptionExpected() && !test.exceptionOccurred()) {
@@ -136,6 +129,8 @@
protected void detail(String message) {
System.out.println(message);
}
+
+
}
Modified: trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionQueryTest.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionQueryTest.java 2009-09-22 20:00:09 UTC (rev 1458)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/TransactionQueryTest.java 2009-09-22 22:00:58 UTC (rev 1459)
@@ -1,10 +1,13 @@
package org.teiid.test.framework;
import java.sql.Connection;
+import java.util.Map;
import java.util.Properties;
import javax.sql.XAConnection;
+import org.teiid.test.framework.datasource.DataSource;
+
/**
* The TransactionQueryTest interface represents the transaction test framework from which
* the @link TransactionContainer operates.
@@ -30,6 +33,15 @@
/**
+ * Called by the @link TransactionContainer to set the datasoures used to create the connector bindings.
+ * @param datasources
+ *
+ * @since
+ */
+ void setDataSources(Map<String, DataSource> datasources);
+
+
+ /**
* Returns the connection being used in the test.
* @return
*
@@ -64,12 +76,12 @@
/**
* Called by the {@link TransactionContainer} prior to testcase processing so that
- * the datasource data can be setup for the specific testcase.
+ * the datasources can be setup for the specific testcase.
*
*
* @since
*/
- void setupDataSource();
+ void setupDataSources();
/**
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 2009-09-22 20:00:09 UTC (rev 1458)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategy.java 2009-09-22 22:00:58 UTC (rev 1459)
@@ -9,7 +9,9 @@
import java.lang.reflect.Method;
import java.sql.Connection;
import java.util.Collection;
+import java.util.HashMap;
import java.util.Iterator;
+import java.util.Map;
import java.util.Properties;
import javax.sql.XAConnection;
@@ -18,7 +20,7 @@
import org.teiid.adminapi.AdminOptions;
import org.teiid.adminapi.Model;
import org.teiid.adminapi.VDB;
-import org.teiid.connector.jdbc.JDBCPropertyNames;
+import org.teiid.test.framework.datasource.DataSource;
import org.teiid.test.framework.datasource.DataSourceMgr;
import org.teiid.test.framework.exception.QueryTestFailedException;
import org.teiid.test.framework.exception.TransactionRuntimeException;
@@ -60,6 +62,9 @@
public static final String FETCH_SIZE = ExecutionProperties.PROP_FETCH_SIZE;
public static final String EXEC_IN_BATCH = "execute.in.batch"; //$NON-NLS-1$
+
+
+ private Map<String, DataSource> datasources = null;
public ConnectionStrategy(Properties props) throws QueryTestFailedException {
@@ -101,6 +106,10 @@
return env;
}
+ public Map<String, DataSource> getDataSources() {
+ return this.datasources;
+ }
+
class CloseInterceptor implements InvocationHandler {
Connection conn;
@@ -123,6 +132,8 @@
void configure() throws QueryTestFailedException {
+ datasources = new HashMap<String, DataSource>(3);
+
String ac = this.env.getProperty(AUTOCOMMIT, "true");
this.autoCommit = Boolean.getBoolean(ac);
@@ -140,16 +151,16 @@
Admin admin = (Admin)c.getAdminAPI();
- boolean update = false;
+ // boolean update = false;
Properties p = new Properties();
if (this.env.getProperty(PROCESS_BATCH) != null) {
p.setProperty("metamatrix.buffer.processorBatchSize", this.env.getProperty(PROCESS_BATCH)); //$NON-NLS-1$
- update = true;
+ // update = true;
}
if (this.env.getProperty(CONNECTOR_BATCH) != null) {
p.setProperty("metamatrix.buffer.connectorBatchSize", this.env.getProperty(CONNECTOR_BATCH)); //$NON-NLS-1$
- update = true;
+ // update = true;
}
// update the system.
@@ -206,6 +217,8 @@
org.teiid.test.framework.datasource.DataSource ds = DataSourceMgr.getInstance().getDatasource(useName, m.getName());
if (ds != null) {
+ datasources.put(m.getName(), ds);
+
System.out.println("Setting up Connector Binding of Type: " + ds.getConnectorType()); //$NON-NLS-1$
AdminOptions ao = new AdminOptions(AdminOptions.OnConflict.OVERWRITE);
@@ -232,21 +245,5 @@
}
- /**
- * The datasource_identifier must match one of the mappings in the file
- * at {@see} src/main/resources/datasources/datasource_mapping.txt
- * @param datasource_identifier
- * @return
- *
- * @since
- */
-// public XAConnection getXASource(String datasource_identifier) {
-// return null;
-// }
-//
-// public Connection getSource(String datasource_identifier) {
-// return null;
-// }
-
}
Modified: trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionUtil.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionUtil.java 2009-09-22 20:00:09 UTC (rev 1458)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionUtil.java 2009-09-22 22:00:58 UTC (rev 1459)
@@ -1,78 +1,112 @@
package org.teiid.test.framework.connection;
import java.sql.Connection;
+import java.util.Map;
import java.util.Properties;
import javax.sql.XAConnection;
import org.teiid.test.framework.ConfigPropertyLoader;
+import org.teiid.test.framework.datasource.DataSource;
import org.teiid.test.framework.datasource.DataSourceMgr;
import org.teiid.test.framework.exception.QueryTestFailedException;
import org.teiid.test.framework.exception.TransactionRuntimeException;
// identifier should be the model name that is identfied in the config properties
public class ConnectionUtil {
- public static final Connection getSource(String identifier)
- throws QueryTestFailedException {
+ public static final Connection getConnection(String identifier, Map<String, DataSource> datasources) throws QueryTestFailedException {
+ DataSource ds = null;
if (identifier != null) {
- String mappedName = ConfigPropertyLoader.getProperty(identifier);
-
- if (mappedName == null) {
- throw new TransactionRuntimeException("Identifier mapping "
- + identifier
- + " is not defined in the config properties file");
+ ds = datasources.get(identifier);
+ if (ds == null) {
+ throw new TransactionRuntimeException("DataSource is not mapped to Identifier "
+ + identifier);
}
+
+ }
+
+ return ConnectionStrategyFactory.getInstance().createDriverStrategy(identifier,
+ ds.getProperties()).getConnection();
- Properties sourceProps;
- try {
- sourceProps = DataSourceMgr.getInstance()
- .getDatasourceProperties(mappedName, identifier);
- } catch (QueryTestFailedException e) {
- throw new TransactionRuntimeException(e);
- }
-
- if (sourceProps == null) {
- throw new TransactionRuntimeException("Identifier "
- + identifier + " mapped to " + mappedName
- + " has no datasource properties");
- }
-
- return ConnectionStrategyFactory.getInstance().createDriverStrategy(identifier,
- sourceProps).getConnection();
-
- }
- throw new RuntimeException("No Connection by name :" + identifier); //$NON-NLS-1$
}
-
- public static final XAConnection getXASource(String identifier)
- throws QueryTestFailedException {
+
+ public static final XAConnection getXAConnection(String identifier, Map<String, DataSource> datasources) throws QueryTestFailedException {
+ DataSource ds = null;
if (identifier != null) {
- String mappedName = ConfigPropertyLoader.getProperty(identifier);
-
- if (mappedName == null) {
- throw new TransactionRuntimeException("Identifier mapping "
- + identifier
- + " is not defined in the config properties file");
+ ds = datasources.get(identifier);
+ if (ds == null) {
+ throw new TransactionRuntimeException("DataSource is not mapped to Identifier "
+ + identifier);
}
+
+ }
+
+ return ConnectionStrategyFactory.getInstance().createDataSourceStrategy(
+ identifier, ds.getProperties()).getXAConnection();
- Properties sourceProps;
- try {
- sourceProps = DataSourceMgr.getInstance()
- .getDatasourceProperties(mappedName, identifier);
- } catch (QueryTestFailedException e) {
- throw new TransactionRuntimeException(e);
- }
-
- if (sourceProps == null) {
- throw new TransactionRuntimeException("Identifier "
- + identifier + " mapped to " + mappedName
- + " has no datasource properties");
- }
-
- return ConnectionStrategyFactory.getInstance().createDataSourceStrategy(
- identifier, sourceProps).getXAConnection();
- }
- throw new RuntimeException("No Connection by name :" + identifier); //$NON-NLS-1$
}
+
+// public static final Connection getSource(String identifier)
+// throws QueryTestFailedException {
+// if (identifier != null) {
+// String mappedName = ConfigPropertyLoader.getProperty(identifier);
+//
+// if (mappedName == null) {
+// throw new TransactionRuntimeException("Identifier mapping "
+// + identifier
+// + " is not defined in the config properties file");
+// }
+//
+// Properties sourceProps;
+// try {
+// sourceProps = DataSourceMgr.getInstance()
+// .getDatasourceProperties(mappedName, identifier);
+// } catch (QueryTestFailedException e) {
+// throw new TransactionRuntimeException(e);
+// }
+//
+// if (sourceProps == null) {
+// throw new TransactionRuntimeException("Identifier "
+// + identifier + " mapped to " + mappedName
+// + " has no datasource properties");
+// }
+//
+// return ConnectionStrategyFactory.getInstance().createDriverStrategy(identifier,
+// sourceProps).getConnection();
+//
+// }
+// throw new RuntimeException("No Connection by name :" + identifier); //$NON-NLS-1$
+// }
+//
+// public static final XAConnection getXASource(String identifier)
+// throws QueryTestFailedException {
+// if (identifier != null) {
+// String mappedName = ConfigPropertyLoader.getProperty(identifier);
+//
+// if (mappedName == null) {
+// throw new TransactionRuntimeException("Identifier mapping "
+// + identifier
+// + " is not defined in the config properties file");
+// }
+//
+// Properties sourceProps;
+// try {
+// sourceProps = DataSourceMgr.getInstance()
+// .getDatasourceProperties(mappedName, identifier);
+// } catch (QueryTestFailedException e) {
+// throw new TransactionRuntimeException(e);
+// }
+//
+// if (sourceProps == null) {
+// throw new TransactionRuntimeException("Identifier "
+// + identifier + " mapped to " + mappedName
+// + " has no datasource properties");
+// }
+//
+// return ConnectionStrategyFactory.getInstance().createDataSourceStrategy(
+// identifier, sourceProps).getXAConnection();
+// }
+// throw new RuntimeException("No Connection by name :" + identifier); //$NON-NLS-1$
+// }
}
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 2009-09-22 20:00:09 UTC (rev 1458)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSourceMgr.java 2009-09-22 22:00:58 UTC (rev 1459)
@@ -45,13 +45,14 @@
private static DataSourceMgr _instance = null;
- private Map<String, Map<String, DataSource>>dstypeMap = new HashMap<String, Map<String, DataSource>>(); //key=datasourcetype
+ private Map<String, Map<String, DataSource>>dsGroupMap = new HashMap<String, Map<String, DataSource>>(); //key=datasourcetype
private Map<String, DataSource> allDatasourcesMap = new HashMap<String, DataSource>(); // key=datasource name
private Map<String, DataSource> modelToDatasourceMap = new HashMap<String, DataSource>(); // key=modelname + "_" + datasourcename
// key=modelname + "_" + groupname
+ private Set<String> dbTypes = new HashSet<String>();
// this set is use to track datasources that have already been assigned
private Set<String> assignedDataSources = new HashSet<String>();
@@ -87,7 +88,7 @@
* @since
*/
public static synchronized void reset() {
-
+ if (_instance == null) return;
//
_instance.modelToDatasourceMap.clear();
_instance.assignedDataSources.clear();
@@ -98,26 +99,21 @@
return allDatasourcesMap.size();
}
- public boolean hasAvailableDataSource(int numRequiredDataSources) {
- // reset the mapping at the start of each test
- _instance.modelToDatasourceMap.clear();
-
- Set excludedDBTypes = getExcludedDBTypes();
-
- int cntexcluded = 0;
- Iterator<DataSource> it= allDatasourcesMap.values().iterator();
- while(it.hasNext()) {
- DataSource ds = it.next();
- if (excludedDBTypes.contains(ds.getDBType())) {
- cntexcluded++;
- }
- }
-
- return(numRequiredDataSources <= (numberOfAvailDataSources() - cntexcluded));
-
- }
+// public boolean hasAvailableDataSource(int numRequiredDataSources) {
+// // reset the mapping at the start of each test
+// _instance.modelToDatasourceMap.clear();
+//
+// Set<String>excludedDBTypes = getExcludedDBTypes();
+//
+// Set<String> xSet = new HashSet<String>(dbTypes);
+//
+// xSet.removeAll(excludedDBTypes);
+//
+// return(numRequiredDataSources <= (xSet.size()));
+//
+// }
- private Set getExcludedDBTypes() {
+ private Set<String> getExcludedDBTypes() {
String excludeprop = ConfigPropertyLoader.getProperty(ConfigPropertyNames.EXCLUDE_DATASBASE_TYPES_PROP);
@@ -154,9 +150,9 @@
Set excludedDBTypes = getExcludedDBTypes();
- if (dstypeMap.containsKey(datasourceid)) {
+ if (dsGroupMap.containsKey(datasourceid)) {
- Map datasources = dstypeMap.get(datasourceid);
+ Map datasources = dsGroupMap.get(datasourceid);
Iterator<DataSource> it= datasources.values().iterator();
// need to go thru all the datasources to know if any has already been assigned
@@ -219,14 +215,7 @@
}
- public Properties getDatasourceProperties(String datasourceid, String modelname)
- throws QueryTestFailedException {
- DataSource ds = getDatasource(datasourceid, modelname);
- return ds.getProperties();
-
- }
-
private void loadDataSourceMappings()
throws QueryTestFailedException {
@@ -259,7 +248,7 @@
for (Iterator<Element> it = rootElements.iterator(); it.hasNext();) {
Element type = it.next();
- String typename = type.getAttributeValue(Property.Attributes.NAME);
+ String groupname = type.getAttributeValue(Property.Attributes.NAME);
List<Element> typeElements = type.getChildren();
if (typeElements != null) {
@@ -267,9 +256,9 @@
for (Iterator<Element> typeit = typeElements.iterator(); typeit.hasNext();) {
Element e = typeit.next();
- addDataSource(e, typename, datasources, limitds);
+ addDataSource(e, groupname, datasources, limitds);
}
- dstypeMap.put(typename, datasources);
+ dsGroupMap.put(groupname, datasources);
allDatasourcesMap.putAll(datasources);
}
@@ -277,19 +266,19 @@
}
- if (dstypeMap == null || dstypeMap.isEmpty()) {
+ if (dsGroupMap == null || dsGroupMap.isEmpty()) {
throw new TransactionRuntimeException(
"No Datasources were found in the mappings file");
}
- System.out.println("Number of datasource groups loaded " + dstypeMap.size());
+ System.out.println("Number of datasource groups loaded " + dsGroupMap.size());
System.out.println("Number of total datasource mappings loaded " + allDatasourcesMap.size());
}
- private static void addDataSource(Element element, String group, Map<String, DataSource> datasources, Set<String> include) {
+ private void addDataSource(Element element, String group, Map<String, DataSource> datasources, Set<String> include) {
String name = element.getAttributeValue(Property.Attributes.NAME);
Properties props = getProperties(element);
@@ -312,7 +301,7 @@
group,
props);
-
+ dbTypes.add(ds.getDBType());
datasources.put(ds.getName(), ds);
System.out.println("Loaded datasource " + ds.getName());
@@ -406,7 +395,7 @@
throw new RuntimeException("Datasources are not the same");
}
System.out.println("Value for ds_mysql: "
- + mgr.getDatasourceProperties("ds_oracle", "model1"));
+ + mgr.getDatasource("ds_oracle", "model1").getProperties());
// boolean shouldbeavail = mgr.hasAvailableDataSource("nonxa", DataSource.ExclusionTypeBitMask.ORACLE);
// if (!shouldbeavail) {
Modified: trunk/test-integration/db/src/main/java/org/teiid/test/framework/transaction/LocalTransaction.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/framework/transaction/LocalTransaction.java 2009-09-22 20:00:09 UTC (rev 1458)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/transaction/LocalTransaction.java 2009-09-22 22:00:58 UTC (rev 1459)
@@ -35,7 +35,7 @@
}
protected void after(TransactionQueryTest test) {
- boolean exception = false;
+ // boolean exception = false;
try {
if (test.rollbackAllways()|| test.exceptionOccurred()) {
test.getConnection().rollback();
@@ -45,7 +45,7 @@
test.getConnection().commit();
}
} catch (SQLException se) {
- exception = true;
+// exception = true;
// if exception, try to trigger the rollback
try {
test.getConnection().rollback();
@@ -58,13 +58,13 @@
} 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);
- }
- }
+// if (!exception) {
+// try {
+// test.getConnection().setAutoCommit(true);
+// } catch (SQLException e) {
+// throw new RuntimeException(e);
+// }
+// }
}
}
16 years, 7 months
teiid SVN: r1458 - in trunk/test-integration/db/src/main/java/org/teiid/test/framework: connection and 1 other directories.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-09-22 16:00:09 -0400 (Tue, 22 Sep 2009)
New Revision: 1458
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/connection/ConnectionStrategyFactory.java
trunk/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSourceMgr.java
Log:
Teiid 773 - setting up the xa transaction tests
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 2009-09-22 19:59:09 UTC (rev 1457)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/ConfigPropertyLoader.java 2009-09-22 20:00:09 UTC (rev 1458)
@@ -49,6 +49,13 @@
}
}
+ public static void cleanup() {
+ Properties p = System.getProperties();
+ p.remove(ConfigPropertyNames.CONFIG_FILE);
+ p.remove(ConfigPropertyNames.EXCLUDE_DATASBASE_TYPES_PROP);
+
+ }
+
public static void main(String[] args) {
System.setProperty("test", "value");
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 2009-09-22 19:59:09 UTC (rev 1457)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategyFactory.java 2009-09-22 20:00:09 UTC (rev 1458)
@@ -47,9 +47,7 @@
}
private void shutdown() {
- Properties p = System.getProperties();
- p.remove(ConfigPropertyNames.CONFIG_FILE);
-
+ ConfigPropertyLoader.cleanup();
if (driversources != null) {
shutDownSources(driversources);
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 2009-09-22 19:59:09 UTC (rev 1457)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSourceMgr.java 2009-09-22 20:00:09 UTC (rev 1458)
@@ -6,6 +6,7 @@
import java.io.IOException;
import java.io.InputStream;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -55,7 +56,6 @@
private Set<String> assignedDataSources = new HashSet<String>();
private int lastassigned = 0;
- private Set<String> excludedDBTypes = null;
private DataSourceMgr() {
@@ -78,15 +78,20 @@
return _instance;
}
+ /**
+ * reset is called when a predetermined set of datasources are going to be set
+ * This is to ensure any exclusions / inclusions are considered for the
+ * next executed set of test.
+ *
+ *
+ * @since
+ */
public static synchronized void reset() {
-
- _instance.dstypeMap.clear();
- _instance.allDatasourcesMap.clear();
+
+ //
_instance.modelToDatasourceMap.clear();
_instance.assignedDataSources.clear();
- _instance = null;
-
}
public int numberOfAvailDataSources() {
@@ -95,18 +100,9 @@
public boolean hasAvailableDataSource(int numRequiredDataSources) {
// reset the mapping at the start of each test
- _instance.modelToDatasourceMap.clear();
- excludedDBTypes = new HashSet<String>(3);
+ _instance.modelToDatasourceMap.clear();
-
- String excludeprop = ConfigPropertyLoader.getProperty(ConfigPropertyNames.EXCLUDE_DATASBASE_TYPES_PROP);
-
- if (excludeprop == null || excludeprop.length() == 0) {
- return (numRequiredDataSources <= numberOfAvailDataSources());
- }
-
- List<String> eprops = StringUtil.split(excludeprop, ",");
- excludedDBTypes.addAll(eprops);
+ Set excludedDBTypes = getExcludedDBTypes();
int cntexcluded = 0;
Iterator<DataSource> it= allDatasourcesMap.values().iterator();
@@ -121,7 +117,22 @@
}
+ private Set getExcludedDBTypes() {
+
+ String excludeprop = ConfigPropertyLoader.getProperty(ConfigPropertyNames.EXCLUDE_DATASBASE_TYPES_PROP);
+
+ if (excludeprop == null || excludeprop.length() == 0) {
+ return Collections.EMPTY_SET;
+ }
+ Set<String> excludedDBTypes = new HashSet<String>(3);
+
+ List<String> eprops = StringUtil.split(excludeprop, ",");
+ excludedDBTypes.addAll(eprops);
+ return excludedDBTypes;
+ }
+
+
public DataSource getDatasource(String datasourceid, String modelName)
throws QueryTestFailedException {
DataSource ds = null;
@@ -141,7 +152,8 @@
return modelToDatasourceMap.get(key);
}
-
+ Set excludedDBTypes = getExcludedDBTypes();
+
if (dstypeMap.containsKey(datasourceid)) {
Map datasources = dstypeMap.get(datasourceid);
16 years, 7 months
teiid SVN: r1457 - trunk/test-integration/db/src/test/java/org/teiid/test/testcases.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-09-22 15:59:09 -0400 (Tue, 22 Sep 2009)
New Revision: 1457
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/XATransactionDatasourceFalseOffTest.java
Log:
Teiid 773 - setting up the xa transaction tests
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 2009-09-22 19:32:10 UTC (rev 1456)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/testcases/BaseAbstractTransactionTestCase.java 2009-09-22 19:59:09 UTC (rev 1457)
@@ -14,6 +14,7 @@
import org.teiid.test.framework.TransactionContainer;
import org.teiid.test.framework.connection.ConnectionUtil;
+import org.teiid.test.framework.datasource.DataSourceMgr;
import org.teiid.test.framework.exception.QueryTestFailedException;
import org.teiid.test.framework.transaction.TransactionFactory;
@@ -24,6 +25,11 @@
super(name);
}
+ @Override
+ protected void setUp() throws Exception {
+ DataSourceMgr.reset();
+ }
+
protected TransactionContainer getTransactionContainter() throws QueryTestFailedException {
return TransactionFactory.create();
}
Modified: trunk/test-integration/db/src/test/java/org/teiid/test/testcases/XATransactionDatasourceFalseOffTest.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/testcases/XATransactionDatasourceFalseOffTest.java 2009-09-22 19:32:10 UTC (rev 1456)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/testcases/XATransactionDatasourceFalseOffTest.java 2009-09-22 19:59:09 UTC (rev 1457)
@@ -30,6 +30,7 @@
@Override
protected void setUp() throws Exception {
+ super.setUp();
//XATransactions currently doesn't support using sqlserver
//{@see TEIID-559}
16 years, 7 months
teiid SVN: r1456 - trunk/test-integration/db/src/main/java/org/teiid/test/framework/datasource.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-09-22 15:32:10 -0400 (Tue, 22 Sep 2009)
New Revision: 1456
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSourceMgr.java
Log:
Teiid 773 - setting up the xa transaction tests
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 2009-09-22 19:09:08 UTC (rev 1455)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSourceMgr.java 2009-09-22 19:32:10 UTC (rev 1456)
@@ -94,8 +94,11 @@
}
public boolean hasAvailableDataSource(int numRequiredDataSources) {
-
+ // reset the mapping at the start of each test
+ _instance.modelToDatasourceMap.clear();
excludedDBTypes = new HashSet<String>(3);
+
+
String excludeprop = ConfigPropertyLoader.getProperty(ConfigPropertyNames.EXCLUDE_DATASBASE_TYPES_PROP);
if (excludeprop == null || excludeprop.length() == 0) {
16 years, 7 months
teiid SVN: r1455 - trunk/test-integration.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-09-22 15:09:08 -0400 (Tue, 22 Sep 2009)
New Revision: 1455
Modified:
trunk/test-integration/pom.xml
Log:
Teiid 773 - setting up the xa transaction tests
Modified: trunk/test-integration/pom.xml
===================================================================
--- trunk/test-integration/pom.xml 2009-09-22 19:08:41 UTC (rev 1454)
+++ trunk/test-integration/pom.xml 2009-09-22 19:09:08 UTC (rev 1455)
@@ -79,6 +79,10 @@
<artifactId>teiid-engine</artifactId>
<type>test-jar</type>
</dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-txn-jbossts</artifactId>
+ </dependency>
<!-- internal dependencies that are only used by integration testing -->
<dependency>
16 years, 7 months
teiid SVN: r1454 - in trunk/test-integration/db/src/test/java/org/teiid/test: testcases and 1 other directory.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-09-22 15:08:41 -0400 (Tue, 22 Sep 2009)
New Revision: 1454
Modified:
trunk/test-integration/db/src/test/java/org/teiid/test/framework/AbstractQueryTransactionTest.java
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/SingleSourceTransactionScenarios.java
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/TwoSourceTransactionScenarios.java
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/XATransactionDatasourceFalseOffTest.java
Log:
Teiid 773 - setting up the xa transaction tests
Modified: trunk/test-integration/db/src/test/java/org/teiid/test/framework/AbstractQueryTransactionTest.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/framework/AbstractQueryTransactionTest.java 2009-09-22 19:08:03 UTC (rev 1453)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/framework/AbstractQueryTransactionTest.java 2009-09-22 19:08:41 UTC (rev 1454)
@@ -138,10 +138,14 @@
}
+ /**
+ * At end of each test, clean up the connection factory so that it can be
+ * established at the start of the next test.
+ */
public void cleanup() {
ConnectionStrategyFactory.destroyInstance();
- this.closeConnection();
+ // this.closeConnection();
}
@Override
Modified: trunk/test-integration/db/src/test/java/org/teiid/test/testcases/SingleSourceTransactionScenarios.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/testcases/SingleSourceTransactionScenarios.java 2009-09-22 19:08:03 UTC (rev 1453)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/testcases/SingleSourceTransactionScenarios.java 2009-09-22 19:08:41 UTC (rev 1454)
@@ -45,11 +45,7 @@
// run test
getTransactionContainter().runTransaction(userTxn);
-
- // there is nothing to verify here..
-
- System.out.println("Complete testSingleSourceSelect");
-
+
}
@@ -76,9 +72,6 @@
// run test
getTransactionContainter().runTransaction(userTxn);
-
-
- System.out.println("Complete testSingleSourceUpdate");
}
@@ -105,10 +98,7 @@
// run test
getTransactionContainter().runTransaction(userTxn);
-
-
- System.out.println("Complete testSingleSourcePreparedUpdate");
-
+
}
/**
@@ -147,9 +137,6 @@
// run test
getTransactionContainter().runTransaction(userTxn);
-
- System.out.println("Complete testSingleSourceMultipleCommands");
-
}
/**
@@ -171,8 +158,6 @@
// run test
getTransactionContainter().runTransaction(userTxn);
-
- System.out.println("Complete testSingleSourcePartialProcessing");
}
@@ -223,9 +208,7 @@
// run test
getTransactionContainter().runTransaction(userTxn);
-
- System.out.println("Complete testSingleSourceMultipleCommandsExplicitRollback");
-
+
}
/**
@@ -264,8 +247,6 @@
// run test
getTransactionContainter().runTransaction(userTxn);
-
- System.out.println("Complete testSingleSourceMultipleCommandsReferentialIntegrityRollback");
}
Modified: trunk/test-integration/db/src/test/java/org/teiid/test/testcases/TwoSourceTransactionScenarios.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/testcases/TwoSourceTransactionScenarios.java 2009-09-22 19:08:03 UTC (rev 1453)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/testcases/TwoSourceTransactionScenarios.java 2009-09-22 19:08:41 UTC (rev 1454)
@@ -52,9 +52,7 @@
// run test
getTransactionContainter().runTransaction(userTxn);
-
- System.out.println("Complete testMultipleSourceSelect");
-
+
}
/**
@@ -64,7 +62,7 @@
* result = commit
*/
public void testMultipleSourceViewSelect() throws Exception {
- AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceVirtualSelect") {
+ AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceViewSelect") {
public void testCase() throws Exception {
execute("select * from vm.g1 where vm.g1.pm1e1 < 100");
assertRowCount(100);
@@ -80,9 +78,7 @@
// run test
getTransactionContainter().runTransaction(userTxn);
-
- System.out.println("Complete testMultipleSourceVirtualSelect");
-
+
}
/**
@@ -92,7 +88,7 @@
* result = commit
*/
public void testMultipleSourceViewUpdate() throws Exception {
- AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceUpdate") {
+ AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceViewUpdate") {
public void testCase() throws Exception {
execute("insert into vm.g1 (pm1e1, pm1e2, pm2e1, pm2e2) values(500, '500', 500, '500')");
}
@@ -120,9 +116,7 @@
// run test
getTransactionContainter().runTransaction(userTxn);
-
- System.out.println("Complete testMultipleSourceUpdate");
-
+
}
/**
@@ -161,8 +155,6 @@
// run test
getTransactionContainter().runTransaction(userTxn);
-
- System.out.println("Complete testMultipleSourceViewSelectInto");
}
@@ -209,10 +201,7 @@
// run test
getTransactionContainter().runTransaction(userTxn);
-
- System.out.println("Complete testMultipleSourceViewBulkRowInsert");
-
- }
+ }
/**
* Sources = 2
@@ -261,10 +250,7 @@
// run test
getTransactionContainter().runTransaction(userTxn);
-
-
- System.out.println("Complete testMultipleSourceViewBulkRowInsertRollback");
-
+
}
@@ -303,9 +289,7 @@
// run test
getTransactionContainter().runTransaction(userTxn);
-
- System.out.println("Complete testMultipleSourceViewPreparedUpdate");
-
+
}
@@ -368,10 +352,7 @@
// run test
getTransactionContainter().runTransaction(userTxn);
-
- System.out.println("Complete testMultipleSourceMultipleCommands");
-
-
+
}
/**
@@ -421,9 +402,7 @@
// run test
getTransactionContainter().runTransaction(userTxn);
- System.out.println("Complete testMultipleSourceViewMultipleCommands");
-
}
/**
@@ -484,9 +463,6 @@
// run test
getTransactionContainter().runTransaction(userTxn);
-
- System.out.println("Complete testMultipleSourceViewMultipleCommandsRollback");
-
}
@@ -544,8 +520,6 @@
};
getTransactionContainter().runTransaction(userTxn);
-
- System.out.println("Complete testMultipleSourceMultipleCommandsCancel");
}
@@ -604,8 +578,6 @@
// run test
getTransactionContainter().runTransaction(userTxn);
- System.out.println("Complete testMultipleSourceMultipleCommandsExplicitRollback");
-
}
/**
@@ -658,9 +630,6 @@
// run test
getTransactionContainter().runTransaction(userTxn);
-
- System.out.println("Complete testMultipleSourceMultipleCommandsReferentialIntegrityRollback");
-
}
@@ -713,10 +682,7 @@
};
getTransactionContainter().runTransaction(userTxn);
-
-
- System.out.println("Complete testMultipleSourceTimeout");
-
+
}
@@ -769,9 +735,7 @@
// run test
getTransactionContainter().runTransaction(userTxn);
-
- System.out.println("Complete testMultipleSourceViewPartialProcessingUsingLimit");
-
+
}
/**
@@ -801,9 +765,7 @@
// run test
getTransactionContainter().runTransaction(userTxn);
-
- System.out.println("Complete testMultipleSourcePartialProcessingUsingMakedep");
-
+
}
Modified: trunk/test-integration/db/src/test/java/org/teiid/test/testcases/XATransactionDatasourceFalseOffTest.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/testcases/XATransactionDatasourceFalseOffTest.java 2009-09-22 19:08:03 UTC (rev 1453)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/testcases/XATransactionDatasourceFalseOffTest.java 2009-09-22 19:08:41 UTC (rev 1454)
@@ -18,19 +18,28 @@
* - Autocommit = True
* - TxnAutoWrap = Off
*/
-public class XATransactionDatasourceFalseOffTest extends TwoSourceTransactionScenarios {
-
+//public class XATransactionDatasourceFalseOffTest extends SingleSourceTransactionScenarios {
+
+ public class XATransactionDatasourceFalseOffTest extends TwoSourceTransactionScenarios {
+
+
+
public XATransactionDatasourceFalseOffTest(String name) {
super(name);
}
@Override
protected void setUp() throws Exception {
+
+ //XATransactions currently doesn't support using sqlserver
+ //{@see TEIID-559}
+ System.setProperty(ConfigPropertyNames.EXCLUDE_DATASBASE_TYPES_PROP, "sqlserver");
+
System.setProperty(ConfigPropertyNames.CONFIG_FILE, "xa-config.properties");
System.setProperty(ConfigPropertyNames.CONNECTION_TYPE, ConfigPropertyNames.CONNECTION_TYPES.DATASOURCE_CONNECTION);
System.setProperty(ConnectionStrategy.AUTOCOMMIT, "false");
- System.setProperty(ConnectionStrategy.TXN_AUTO_WRAP, "off");
+ // System.setProperty(ConnectionStrategy.TXN_AUTO_WRAP, "on");
}
16 years, 7 months
teiid SVN: r1453 - trunk/test-integration/db/src/main/resources.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-09-22 15:08:03 -0400 (Tue, 22 Sep 2009)
New Revision: 1453
Modified:
trunk/test-integration/db/src/main/resources/default-config.properties
trunk/test-integration/db/src/main/resources/xa-config.properties
Log:
Teiid 773 - setting up the xa transaction tests
Modified: trunk/test-integration/db/src/main/resources/default-config.properties
===================================================================
--- trunk/test-integration/db/src/main/resources/default-config.properties 2009-09-22 19:07:41 UTC (rev 1452)
+++ trunk/test-integration/db/src/main/resources/default-config.properties 2009-09-22 19:08:03 UTC (rev 1453)
@@ -18,9 +18,9 @@
##########################################
#driver=org.teiid.jdbc.TeiidDriver
driver=com.metamatrix.jdbc.EmbeddedDataSource
-URL=jdbc:metamatrix:Transaction@target/classes/transactions/transaction.properties
-User=metamatrixadmin
-Password=mm
+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
Modified: trunk/test-integration/db/src/main/resources/xa-config.properties
===================================================================
--- trunk/test-integration/db/src/main/resources/xa-config.properties 2009-09-22 19:07:41 UTC (rev 1452)
+++ trunk/test-integration/db/src/main/resources/xa-config.properties 2009-09-22 19:08:03 UTC (rev 1453)
@@ -15,9 +15,9 @@
# properties for Teiid connection
##########################################
driver=com.metamatrix.jdbc.EmbeddedDataSource
-URL=jdbc:metamatrix:Transaction@target/classes/transactions/transaction.properties
-User=metamatrixadmin
-Password=mm
+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
16 years, 7 months
teiid SVN: r1452 - trunk/test-integration/db/src/main/resources/transactions.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-09-22 15:07:41 -0400 (Tue, 22 Sep 2009)
New Revision: 1452
Modified:
trunk/test-integration/db/src/main/resources/transactions/transaction.properties
Log:
Teiid 773 - setting up the xa transaction tests
Modified: trunk/test-integration/db/src/main/resources/transactions/transaction.properties
===================================================================
--- trunk/test-integration/db/src/main/resources/transactions/transaction.properties 2009-09-22 19:06:54 UTC (rev 1451)
+++ trunk/test-integration/db/src/main/resources/transactions/transaction.properties 2009-09-22 19:07:41 UTC (rev 1452)
@@ -16,6 +16,8 @@
processName=integrationTest
+#xa.txnstore_dir=./txndir
+
#dqp.workdir=./tmp/
#only for testing, as this takes more time to start and shutdown
16 years, 7 months