[teiid-commits] teiid SVN: r1712 - in trunk/test-integration/db/src: test/java/org/teiid/test/testcases and 1 other directory.
teiid-commits at lists.jboss.org
teiid-commits at lists.jboss.org
Tue Jan 5 17:22:10 EST 2010
Author: vhalbert at redhat.com
Date: 2010-01-05 17:22:10 -0500 (Tue, 05 Jan 2010)
New Revision: 1712
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/framework/query/AbstractQueryTransactionTest.java
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/CommonTransactionTests.java
Log:
Teiid 781 - fixed the Timeout test, changed to look at the cause exception in order to match the expected results.
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-01-05 20:32:42 UTC (rev 1711)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/query/AbstractQueryTransactionTest.java 2010-01-05 22:22:10 UTC (rev 1712)
@@ -56,6 +56,9 @@
protected ConnectionStrategy connStrategy;
+ // because only a SQLException is accounted for in AbstractQueryTest,
+ // the applicationException is used to when unaccounted for exceptions occur. This could
+ // unintentional errors from the driver or ctc client test code.
private Throwable applicationException=null;
public AbstractQueryTransactionTest() {
@@ -102,9 +105,6 @@
statement.setExecutionProperty(
CONNECTION_STRATEGY_PROPS.TXN_AUTO_WRAP,
txnautowrap);
-
-
-// this.print("TransactionAutoWrap = " + txnautowrap);
}
String fetchSizeStr = executionProperties
@@ -298,7 +298,13 @@
return super.getLastException();
}
if (this.applicationException != null) {
- return new SQLException(this.applicationException.getClass().getName() + ":" + this.applicationException.getMessage());
+ if (this.applicationException instanceof SQLException) {
+ return (SQLException) this.applicationException;
+ }
+
+ com.metamatrix.jdbc.MMSQLException mm = new com.metamatrix.jdbc.MMSQLException(this.applicationException.getMessage());
+ return mm;
+
}
return null;
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-01-05 20:32:42 UTC (rev 1711)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/testcases/CommonTransactionTests.java 2010-01-05 22:22:10 UTC (rev 1712)
@@ -6,6 +6,7 @@
import java.sql.SQLException;
import java.util.ArrayList;
+import java.util.concurrent.TimeoutException;
import org.teiid.test.framework.TransactionContainer;
import org.teiid.test.framework.query.AbstractQueryTransactionTest;
@@ -516,9 +517,28 @@
}
else {
if (getLastException() != null) {
- String msg = getLastException().getMessage();
- 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 );
+
+ String msg = "NA";
+ SQLException s = getLastException();
+
+ Throwable t = s.getCause();
+ if (t instanceof TimeoutException) {
+ msg = t.getMessage();
+ } else if (s instanceof com.metamatrix.jdbc.MMSQLException) {
+ com.metamatrix.jdbc.MMSQLException mm = (com.metamatrix.jdbc.MMSQLException) t;
+ if (mm.getNextException() != null) {
+ SQLException next = mm.getNextException();
+ msg = next.getMessage();
+ } else {
+ msg = mm.getMessage();
+ }
+ } else {
+
+ msg = s.getMessage();
+ }
+ 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 );
} else {
fail("Program Error: it indicates exception occured, but no exception is found" );
}
More information about the teiid-commits
mailing list