[jboss-cvs] JBossAS SVN: r91746 - in branches/JBPAPP_5_0/testsuite: src/main/org/jboss/test/crashrecovery/ASCrashRecovery01 and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Jul 28 18:19:01 EDT 2009
Author: istudens at redhat.com
Date: 2009-07-28 18:19:01 -0400 (Tue, 28 Jul 2009)
New Revision: 91746
Modified:
branches/JBPAPP_5_0/testsuite/imports/config/tests-crash-recovery.xml
branches/JBPAPP_5_0/testsuite/src/main/org/jboss/test/crashrecovery/ASCrashRecovery01/TestWithJPA.java
branches/JBPAPP_5_0/testsuite/src/main/org/jboss/test/crashrecovery/crash/CrashHelper.java
branches/JBPAPP_5_0/testsuite/src/resources/crashrecovery/resources/mysql50-xa-ds.xml
branches/JBPAPP_5_0/testsuite/src/resources/crashrecovery/resources/mysql51-xa-ds.xml
branches/JBPAPP_5_0/testsuite/src/resources/crashrecovery/scripts/as-tests.xml
Log:
added Sybase 15 and Mysql 5.1 databases, wiping txs in doubt after test run by default, JBQA-2176
Modified: branches/JBPAPP_5_0/testsuite/imports/config/tests-crash-recovery.xml
===================================================================
--- branches/JBPAPP_5_0/testsuite/imports/config/tests-crash-recovery.xml 2009-07-28 22:17:54 UTC (rev 91745)
+++ branches/JBPAPP_5_0/testsuite/imports/config/tests-crash-recovery.xml 2009-07-28 22:19:01 UTC (rev 91746)
@@ -57,8 +57,9 @@
<sysproperty key="org.apache.ant.lib" value="${org.apache.ant.lib}" />
<sysproperty key="build.reports" value="${build.reports}" />
<sysproperty key="sm.legacy.shutdown" value="true" />
+ <!--sysproperty key="jbossas.startup.timeout" value="240" /-->
+ <sysproperty key="jbossas.shutdown.timeout" value="120" />
<sysproperty key="wipeOutTxsInDoubtBeforeTest" value="${wipeOutTxsInDoubtBeforeTest}" />
- <sysproperty key="wipeOutTxsInDoubt" value="${wipeOutTxsInDoubt}" />
<env key="JBOSS_HOME" value="${jbosstest.dist}" />
<!--arg value="-verbose"/-->
<arg value="-f"/>
Modified: branches/JBPAPP_5_0/testsuite/src/main/org/jboss/test/crashrecovery/ASCrashRecovery01/TestWithJPA.java
===================================================================
--- branches/JBPAPP_5_0/testsuite/src/main/org/jboss/test/crashrecovery/ASCrashRecovery01/TestWithJPA.java 2009-07-28 22:17:54 UTC (rev 91745)
+++ branches/JBPAPP_5_0/testsuite/src/main/org/jboss/test/crashrecovery/ASCrashRecovery01/TestWithJPA.java 2009-07-28 22:19:01 UTC (rev 91746)
@@ -158,6 +158,8 @@
wipeOutTxsInDoubt();
Set<RecoveredXid> xidsInDoubt = lookupCrashHelper().checkXidsInDoubt();
+ if (isDebug)
+ print(xidsInDoubt.size() + " txs in doubt in database before test run");
// name of this test will be the primary key for test record in DB
String testEntityPK = getName();
@@ -170,13 +172,21 @@
print("crashTest result: " + result);
// checking the state of DB after recovering
- boolean dbChanged = checkDatabase(testEntityPK);
- print("checkDatabase result: " + dbChanged);
-
+ boolean dbChanged = true;
+ if (result)
+ {
+ dbChanged = checkDatabase(testEntityPK);
+ print("checkDatabase result: " + dbChanged);
+ }
+
Set<RecoveredXid> xidsInDoubtAfterTest = lookupCrashHelper().checkXidsInDoubt();
- if (xidsInDoubt.size() != xidsInDoubtAfterTest.size())
- print("There are " + (xidsInDoubtAfterTest.size() - xidsInDoubt.size()) + " new xids in doubt in database after the test");
-
+ if (isDebug)
+ print(xidsInDoubt.size() + " txs in doubt in database after test run");
+ if (xidsInDoubt.size() != xidsInDoubtAfterTest.size())
+ {
+ print((xidsInDoubtAfterTest.size() - xidsInDoubt.size()) + " new txs in doubt in database after this test run");
+ }
+
if (wipeOutTxsInDoubt || wipeOutTxsInDoubtAfterTest)
wipeOutTxsInDoubt(xidsInDoubt, xidsInDoubtAfterTest);
Modified: branches/JBPAPP_5_0/testsuite/src/main/org/jboss/test/crashrecovery/crash/CrashHelper.java
===================================================================
--- branches/JBPAPP_5_0/testsuite/src/main/org/jboss/test/crashrecovery/crash/CrashHelper.java 2009-07-28 22:17:54 UTC (rev 91745)
+++ branches/JBPAPP_5_0/testsuite/src/main/org/jboss/test/crashrecovery/crash/CrashHelper.java 2009-07-28 22:19:01 UTC (rev 91746)
@@ -22,10 +22,7 @@
package org.jboss.test.crashrecovery.crash;
import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
import javax.ejb.Stateless;
@@ -67,7 +64,7 @@
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public boolean wipeOutTxsInDoubt(Set<RecoveredXid> xidsToRecover)
{
- log.debug("wipe out txs in doubt");
+ log.info("wipe out txs in doubt");
try
{
AppServerJDBCXARecovery appServerRecovery = new AppServerJDBCXARecovery();
@@ -103,19 +100,20 @@
if (txInDoubt.length > 1)
{
- log.error("There are more then 1 txs in doubt in the DB, we are not alone.");
+ log.error("There are more then 1 txs in doubt in the DB, we are not the only one.");
return false;
}
- log.debug("There are " + txInDoubt.length + " xids in doubt");
+ log.info("There are " + txInDoubt.length + " xids in doubt");
for (int k=0; k < txInDoubt.length; k++)
{
- if (xidsToRecover == null || xidsToRecover.contains(convertToRecoveredXid(txInDoubt[k])))
+ RecoveredXid xid = convertToRecoveredXid(txInDoubt[k]);
+ if (xidsToRecover == null || xidsToRecover.contains(xid))
{
try
{
- log.debug("rollbacking of Xid " + txInDoubt[k]);
+ log.info("rollbacking of Xid " + xid);
xares.rollback(txInDoubt[k]);
}
catch (Exception e)
@@ -154,7 +152,7 @@
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public Set<RecoveredXid> checkXidsInDoubt()
{
- Xid[] xidsInDoubt = null;
+ Set<RecoveredXid> xids = new HashSet<RecoveredXid>();
try
{
AppServerJDBCXARecovery appServerRecovery = new AppServerJDBCXARecovery();
@@ -167,10 +165,15 @@
try
{
- xidsInDoubt = xares.recover(XAResource.TMSTARTRSCAN);
+ Xid[] xidsInDoubt = xares.recover(XAResource.TMSTARTRSCAN);
if (xidsInDoubt != null)
- log.debug("There are " + xidsInDoubt.length + " xids in doubt");
+ {
+ log.info("There are " + xidsInDoubt.length + " xids in doubt");
+
+ for (int k=0; k < xidsInDoubt.length; k++)
+ xids.add(convertToRecoveredXid(xidsInDoubt[k]));
+ }
}
catch (XAException e)
{
@@ -196,11 +199,6 @@
log.error("Cannot get any XAResource by AppServerJDBCXARecovery", e);
}
- Set<RecoveredXid> xids = new HashSet<RecoveredXid>();
- if (xidsInDoubt != null)
- for (int k=0; k < xidsInDoubt.length; k++)
- xids.add(convertToRecoveredXid(xidsInDoubt[k]));
-
return xids;
}
Modified: branches/JBPAPP_5_0/testsuite/src/resources/crashrecovery/resources/mysql50-xa-ds.xml
===================================================================
--- branches/JBPAPP_5_0/testsuite/src/resources/crashrecovery/resources/mysql50-xa-ds.xml 2009-07-28 22:17:54 UTC (rev 91745)
+++ branches/JBPAPP_5_0/testsuite/src/resources/crashrecovery/resources/mysql50-xa-ds.xml 2009-07-28 22:19:01 UTC (rev 91746)
@@ -1,33 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- See http://www.jboss.org/community/wiki/Multiple1PC for information about local-tx-datasource -->
<!-- $Id: mysql-ds.xml 88948 2009-05-15 14:09:08Z jesper.pedersen $ -->
<!-- Datasource config for MySQL using 3.0.9 available from:
http://www.mysql.com/downloads/api-jdbc-stable.html
-->
<datasources>
- <local-tx-datasource>
+ <xa-datasource>
<jndi-name>CrashRecoveryDS</jndi-name>
- <connection-url>jdbc:mysql://vmg08.mw.lab.eng.bos.redhat.com:3306/crashrec</connection-url>
- <driver-class>com.mysql.jdbc.Driver</driver-class>
- <user-name>crashrec</user-name>
- <password>crashrec</password>
- <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
- <!-- should only be used on drivers after 3.22.1 with "ping" support
- <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker</valid-connection-checker-class-name>
- -->
+ <track-connection-by-tx>true</track-connection-by-tx>
+ <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
+ <xa-datasource-property name="ServerName">vmg08.mw.lab.eng.bos.redhat.com</xa-datasource-property>
+ <xa-datasource-property name="PortNumber">3306</xa-datasource-property>
+ <xa-datasource-property name="DatabaseName">crashrec</xa-datasource-property>
+ <xa-datasource-property name="User">crashrec</xa-datasource-property>
+ <xa-datasource-property name="Password">crashrec</xa-datasource-property>
+ <exception-sorter-class-name>com.mysql.jdbc.integration.jboss.ExtendedMysqlExceptionSorter</exception-sorter-class-name>
<!-- sql to call when connection is created
<new-connection-sql>some arbitrary sql</new-connection-sql>
-->
- <!-- sql to call on an existing pooled connection when it is obtained from pool - MySQLValidConnectionChecker is preferred for newer drivers
- <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
- -->
+ <valid-connection-checker-class-name>com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker</valid-connection-checker-class-name>
<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
<metadata>
<type-mapping>mySQL</type-mapping>
</metadata>
- </local-tx-datasource>
+ </xa-datasource>
</datasources>
Modified: branches/JBPAPP_5_0/testsuite/src/resources/crashrecovery/resources/mysql51-xa-ds.xml
===================================================================
--- branches/JBPAPP_5_0/testsuite/src/resources/crashrecovery/resources/mysql51-xa-ds.xml 2009-07-28 22:17:54 UTC (rev 91745)
+++ branches/JBPAPP_5_0/testsuite/src/resources/crashrecovery/resources/mysql51-xa-ds.xml 2009-07-28 22:19:01 UTC (rev 91746)
@@ -7,25 +7,25 @@
-->
<datasources>
- <local-tx-datasource>
+ <xa-datasource>
<jndi-name>CrashRecoveryDS</jndi-name>
- <connection-url>jdbc:mysql://vmg02.mw.lab.eng.bos.redhat.com:3306/crashrec</connection-url>
- <driver-class>com.mysql.jdbc.Driver</driver-class>
- <user-name>crashrec</user-name>
- <password>crashrec</password>
- <!--exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name-->
+ <track-connection-by-tx>true</track-connection-by-tx>
+ <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
+ <xa-datasource-property name="ServerName">vmg02.mw.lab.eng.bos.redhat.com</xa-datasource-property>
+ <xa-datasource-property name="PortNumber">3306</xa-datasource-property>
+ <xa-datasource-property name="DatabaseName">crashrec</xa-datasource-property>
+ <xa-datasource-property name="User">crashrec</xa-datasource-property>
+ <xa-datasource-property name="Password">crashrec</xa-datasource-property>
<exception-sorter-class-name>com.mysql.jdbc.integration.jboss.ExtendedMysqlExceptionSorter</exception-sorter-class-name>
- <!-- should only be used on drivers after 3.22.1 with "ping" support -->
- <!--valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker</valid-connection-checker-class-name-->
- <valid-connection-checker-class-name>com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker</valid-connection-checker-class-name>
<!-- sql to call when connection is created
<new-connection-sql>some arbitrary sql</new-connection-sql>
-->
+ <valid-connection-checker-class-name>com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker</valid-connection-checker-class-name>
<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
<metadata>
<type-mapping>mySQL</type-mapping>
</metadata>
- </local-tx-datasource>
+ </xa-datasource>
</datasources>
Modified: branches/JBPAPP_5_0/testsuite/src/resources/crashrecovery/scripts/as-tests.xml
===================================================================
--- branches/JBPAPP_5_0/testsuite/src/resources/crashrecovery/scripts/as-tests.xml 2009-07-28 22:17:54 UTC (rev 91745)
+++ branches/JBPAPP_5_0/testsuite/src/resources/crashrecovery/scripts/as-tests.xml 2009-07-28 22:19:01 UTC (rev 91746)
@@ -63,14 +63,14 @@
<target name="want-all-dbs">
<property name="want.psql_8.2" value="true" />
- <!--property name="want.psql_8.3" value="true" />
- <property name="want.sybase_12" value="true" />
+ <property name="want.psql_8.3" value="true" />
+ <!-- DEPRECATED property name="want.sybase_12" value="true" /-->
<property name="want.sybase_15" value="true" />
- <property name="want.oracle_10" value="true" />
+ <property name="want.mysql_5.0" value="true" />
+ <!--property name="want.oracle_10" value="true" />
<property name="want.oracle_11" value="true" />
<property name="want.mssql_2005" value="true" />
<property name="want.mssql_2008" value="true" />
- <property name="want.mysql_5.0" value="true" />
<property name="want.mysql_5.1" value="true" />
<property name="want.db2_8.2" value="true" />
<property name="want.db2_9.7" value="true" /-->
@@ -243,6 +243,9 @@
<param name="specs" value="prepare_ex"/><param name="reverseOrder" value="true"/><param name="rollbackExpected" value="true"/>
</antcall>
<antcall target="execute-crash-recovery-test">
+ <param name="specs" value="prepare_halt"/><param name="reverseOrder" value="false"/><param name="rollbackExpected" value="true"/>
+ </antcall>
+ <antcall target="execute-crash-recovery-test">
<param name="specs" value="prepare_halt"/><param name="reverseOrder" value="true"/><param name="rollbackExpected" value="true"/>
</antcall>
<antcall target="execute-crash-recovery-test">
@@ -251,9 +254,6 @@
<antcall target="execute-crash-recovery-test">
<param name="specs" value="commit_halt"/><param name="reverseOrder" value="true"/><param name="rollbackExpected" value="false"/>
</antcall>
- <antcall target="execute-crash-recovery-test">
- <param name="specs" value="prepare_halt"/><param name="reverseOrder" value="false"/><param name="rollbackExpected" value="true"/>
- </antcall>
</sequential>
</target>
More information about the jboss-cvs-commits
mailing list