[jboss-svn-commits] JBL Code SVN: r37888 - in labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests: src/test/java/org/jboss/jbossts/txbridge/tests/common and 4 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Feb 16 05:19:33 EST 2012
Author: istudens at redhat.com
Date: 2012-02-16 05:19:32 -0500 (Thu, 16 Feb 2012)
New Revision: 37888
Added:
labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/inbound/utility/TestXAResourceCommon.java
Modified:
labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/build.xml
labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/pom.xml
labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/common/AbstractBasicTests.java
labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/common/AbstractCrashRecoveryTests.java
labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/inbound/junit/InboundCrashRecoveryTests.java
labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/inbound/utility/TestXAResource.java
labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/inbound/utility/TestXAResourceRecovered.java
labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/inbound/utility/TestXAResourceRecoveryHelper.java
labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/outbound/junit/OutboundCrashRecoveryTests.java
labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/outbound/utility/TestRecoveryModule.java
Log:
fixing TestXAResource and TestXAResourceRecovered instrumentation mismatch, JBTM-1053 JBQA-3924
Modified: labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/build.xml
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/build.xml 2012-02-15 15:58:00 UTC (rev 37887)
+++ labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/build.xml 2012-02-16 10:19:32 UTC (rev 37888)
@@ -1,19 +1,21 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<project name="txbridge-tests" default="test" basedir=".">
+<project name="txbridge-tests" default="dist" basedir=".">
- <import file="../../sharedbuild.xml"/>
+ <import file="../../sharedbuild.xml"/>
<property name="jbossts.version" value="4.16.localbuild-SNAPSHOT"/>
<property name="groupid" value="org.jboss.jbossts"/>
+ <property name="jboss.home" value="/tmp/jboss-as-7.1.0-SNAPSHOT"/>
+ <property name="standalone.xts.conf.path" value="${jboss.home}/docs/examples/configs/standalone-xts.xml"/>
- <target name="clean">
+ <target name="clean">
<mvn.macro>
<mvn.args>
<arg value="clean"/>
</mvn.args>
</mvn.macro>
- </target>
+ </target>
<target name="dist" depends="clean, install-deps">
<mvn.macro>
@@ -32,11 +34,21 @@
</target>
<target name="install-deps">
+ <!-- installs built jbossts bits to the local maven repository -->
<mvn-install-artifact.macro artifact="jbosstxbridge" file="${basedir}/../build/txbridge.jar" version="${jbossts.version}" />
<mvn-install-artifact.macro artifact="jbossjts" file="${basedir}/../../install/lib/jbossjts.jar" version="${jbossts.version}" />
<mvn-install-artifact.macro artifact="jbossxts-api" file="${basedir}/../../XTS/xts-install/lib/jbossxts-api.jar" version="${jbossts.version}" />
</target>
+ <target name="enable-recovery-listener">
+ <!-- recovery listener is needed by crash rec tests -->
+ <echo message="enabling the recovery listener in ${standalone.xts.conf.path}"/>
+ <replaceregexp
+ file="${standalone.xts.conf.path}"
+ match="<recovery-environment([^/]*)/>"
+ replace="<recovery-environment \1 recovery-listener="true"/>" />
+ </target>
+
<!-- ================== macros =================== -->
<macrodef name="mvn-install-artifact.macro">
<attribute name="artifact"/>
@@ -57,7 +69,7 @@
</mvn.args>
</mvn.macro>
</sequential>
- </macrodef>
+ </macrodef>
<macrodef name="mvn.macro">
<element name="mvn.args"/>
@@ -82,6 +94,6 @@
</then>
</if>
</sequential>
- </macrodef>
+ </macrodef>
</project>
Modified: labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/pom.xml
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/pom.xml 2012-02-15 15:58:00 UTC (rev 37887)
+++ labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/pom.xml 2012-02-16 10:19:32 UTC (rev 37888)
@@ -97,21 +97,6 @@
<version>${version.apache.httpcomponents}</version>
<scope>test</scope>
</dependency>
-
- <!-- this solves bad deps of Arq, 7.1.0.Final-SNAPSHOT needs these -->
- <dependency>
- <groupId>org.jboss.remoting3</groupId>
- <artifactId>jboss-remoting</artifactId>
- <version>3.2.0.CR9</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging</artifactId>
- <version>3.1.0.CR2</version>
- <scope>test</scope>
- </dependency>
</dependencies>
<repositories>
Modified: labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/common/AbstractBasicTests.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/common/AbstractBasicTests.java 2012-02-15 15:58:00 UTC (rev 37887)
+++ labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/common/AbstractBasicTests.java 2012-02-16 10:19:32 UTC (rev 37888)
@@ -26,8 +26,6 @@
import org.apache.http.impl.client.DefaultHttpClient;
import org.jboss.byteman.agent.submit.Submit;
import org.jboss.byteman.contrib.dtest.Instrumentor;
-import org.jboss.jbossts.txbridge.tests.inbound.utility.TestXAResource;
-import org.jboss.jbossts.txbridge.tests.outbound.utility.TestDurableParticipant;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.StringAsset;
@@ -59,7 +57,7 @@
.addPackage("org.jboss.jbossts.txbridge.tests.inbound.service")
.addPackage("org.jboss.jbossts.txbridge.tests.inbound.utility")
.addAsResource("inbound/jaxws-handlers-server.xml", "jaxws-handlers-server.xml")
- .addAsManifestResource("inbound/jboss-beans.xml", "jboss-beans.xml")
+// .addAsManifestResource("inbound/jboss-beans.xml", "jboss-beans.xml")
.addAsManifestResource(new StringAsset("Dependencies: org.jboss.xts,org.jboss.jts\n"), "MANIFEST.MF");
// archive.as(ZipExporter.class).exportTo(new File("/tmp/deployment.zip"), true);
return archive;
@@ -77,7 +75,7 @@
.addPackage("org.jboss.jbossts.txbridge.tests.outbound.service")
.addPackage("org.jboss.jbossts.txbridge.tests.outbound.utility")
.addAsResource("outbound/jaxws-handlers-server.xml", "jaxws-handlers-server.xml")
- .addAsManifestResource("outbound/jboss-beans.xml", "jboss-beans.xml")
+// .addAsManifestResource("outbound/jboss-beans.xml", "jboss-beans.xml")
.addAsManifestResource(new StringAsset("Dependencies: org.jboss.xts,org.jboss.jts\n"), "MANIFEST.MF");
return archive;
}
Modified: labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/common/AbstractCrashRecoveryTests.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/common/AbstractCrashRecoveryTests.java 2012-02-15 15:58:00 UTC (rev 37887)
+++ labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/common/AbstractCrashRecoveryTests.java 2012-02-16 10:19:32 UTC (rev 37888)
@@ -24,7 +24,6 @@
import org.jboss.arquillian.container.test.api.Config;
import org.jboss.arquillian.container.test.api.ContainerController;
import org.jboss.logging.Logger;
-import org.junit.Before;
import java.io.*;
import java.net.Socket;
@@ -49,8 +48,7 @@
protected abstract void instrumentationOnServerReboot() throws Exception;
- @Before
- public void setUp() throws Exception {
+ protected void cleanTxStore() throws Exception {
String jbossHome = System.getenv("JBOSS_HOME");
removeContents(new File(jbossHome, "standalone/data/tx-object-store/"));
}
@@ -59,7 +57,7 @@
protected void rebootServer(ContainerController controller) throws Exception {
instrumentor.removeLocalState();
- File rulesFile = File.createTempFile("jbosstxbridgetests", "btm");
+ File rulesFile = File.createTempFile("jbosstxbridgetests", ".btm");
rulesFile.deleteOnExit();
instrumentor.setRedirectedSubmissionsFile(rulesFile);
@@ -72,7 +70,7 @@
// start up the server
String javaVmArguments = System.getProperty("server.jvm.args").trim();
javaVmArguments = javaVmArguments.replaceFirst("byteman-dtest.jar", "byteman-dtest.jar,script:" + rulesFile.getCanonicalPath());
- log.info("javaVmArguments = " + javaVmArguments);
+ log.trace("javaVmArguments = " + javaVmArguments);
controller.start(CONTAINER, new Config().add("javaVmArguments", javaVmArguments).map());
}
@@ -85,8 +83,8 @@
int port = recoveryPropertyManager.getRecoveryEnvironmentBean().getRecoveryPort();
String host = recoveryPropertyManager.getRecoveryEnvironmentBean().getRecoveryAddress();
- System.err.println("doRecovery#host = " + host);
- System.err.println("doRecovery#port = " + port);
+ log.info("doRecovery#host = " + host);
+ log.info("doRecovery#port = " + port);
BufferedReader in = null;
PrintStream out = null;
@@ -105,9 +103,9 @@
// Receive pong message
String inMessage = in.readLine();
- System.err.println("inMessage = " + inMessage);
+ log.trace("inMessage = " + inMessage);
if (!inMessage.equals("DONE")) {
- System.err.println("Recovery failed with message: " + inMessage);
+ log.error("Recovery failed with message: " + inMessage);
}
} catch (Exception ex) {
ex.printStackTrace();
@@ -145,7 +143,7 @@
//System.err.println("Deleted: " + contents[index]);
contents[index].delete();
} else {
- System.err.println("Deleted: " + contents[index]);
+ log.info("Deleted: " + contents[index]);
contents[index].delete();
}
}
Modified: labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/inbound/junit/InboundCrashRecoveryTests.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/inbound/junit/InboundCrashRecoveryTests.java 2012-02-15 15:58:00 UTC (rev 37887)
+++ labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/inbound/junit/InboundCrashRecoveryTests.java 2012-02-16 10:19:32 UTC (rev 37888)
@@ -77,9 +77,11 @@
@Before
public void setUp() throws Exception {
+ cleanTxStore();
+
// start up the appserver
String javaVmArguments = System.getProperty("server.jvm.args").trim();
- log.info("javaVmArguments = " + javaVmArguments);
+ log.trace("javaVmArguments = " + javaVmArguments);
controller.start(CONTAINER, new Config().add("javaVmArguments", javaVmArguments).map());
// deploy the tests
deployer.deploy(INBOUND_SERVICE_DEPLOYMENT_NAME);
Modified: labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/inbound/utility/TestXAResource.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/inbound/utility/TestXAResource.java 2012-02-15 15:58:00 UTC (rev 37887)
+++ labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/inbound/utility/TestXAResource.java 2012-02-16 10:19:32 UTC (rev 37888)
@@ -31,85 +31,61 @@
*
* @author Jonathan Halliday (jonathan.halliday at redhat.com) 2010-01
*/
-public class TestXAResource implements XAResource {
+public class TestXAResource extends TestXAResourceCommon implements XAResource {
private static Logger log = Logger.getLogger(TestXAResource.class);
- private int txTimeout;
-
- private Xid currentXid;
-
- private int prepareReturnValue = XAResource.XA_OK;
-
+ @Override
public void commit(Xid xid, boolean b) throws XAException {
- log.trace("TestXAResource.commit(Xid=" + xid + ", b=" + b + ")");
- if (!xid.equals(currentXid)) {
- log.trace("TestXAResource.commit - wrong Xid!");
- }
-
- currentXid = null;
- TestXAResourceRecoveryHelper.getInstance().removeLog(xid);
+ super.commit(xid, b);
}
+ @Override
public void end(Xid xid, int i) throws XAException {
- log.trace("TestXAResource.end(Xid=" + xid + ", b=" + i + ")");
+ super.end(xid, i);
}
+ @Override
public void forget(Xid xid) throws XAException {
- log.trace("TestXAResource.forget(Xid=" + xid + ")");
- if (!xid.equals(currentXid)) {
- log.trace("TestXAResource.forget - wrong Xid!");
- }
- currentXid = null;
+ super.forget(xid);
}
+ @Override
public int getTransactionTimeout() throws XAException {
- log.trace("TestXAResource.getTransactionTimeout() [returning " + txTimeout + "]");
- return txTimeout;
+ return super.getTransactionTimeout();
}
+ @Override
public boolean isSameRM(XAResource xaResource) throws XAException {
- log.trace("TestXAResource.isSameRM(xaResource=" + xaResource + ")");
- return false;
+ return super.isSameRM(xaResource);
}
+ @Override
public int prepare(Xid xid) throws XAException {
- log.trace("TestXAResource.prepare(Xid=" + xid + ") returning " + prepareReturnValue);
-
- if (prepareReturnValue == XA_OK) {
- TestXAResourceRecoveryHelper.getInstance().logPrepared(xid);
- }
- return prepareReturnValue;
+ return super.prepare(xid);
}
+ @Override
public Xid[] recover(int i) throws XAException {
- log.trace("TestXAResource.recover(i=" + i + ")");
- return new Xid[0];
+ return super.recover(i);
}
+ @Override
public void rollback(Xid xid) throws XAException {
- log.trace("TestXAResource.rollback(Xid=" + xid + ")");
- if (!xid.equals(currentXid)) {
- log.trace("TestXAResource.rollback - wrong Xid!");
- }
- currentXid = null;
- TestXAResourceRecoveryHelper.getInstance().removeLog(xid);
+ super.rollback(xid);
}
+ @Override
public boolean setTransactionTimeout(int i) throws XAException {
- log.trace("TestXAResource.setTransactionTimeout(i=" + i + ")");
- txTimeout = i;
- return true;
+ return super.setTransactionTimeout(i);
}
+ @Override
public void start(Xid xid, int i) throws XAException {
- log.trace("TestXAResource.start(Xid=" + xid + ", i=" + i + ")");
- if (currentXid != null) {
- log.trace("TestXAResource.start - wrong Xid!");
- }
- currentXid = xid;
+ super.start(xid, i);
}
+ @Override
public String toString() {
- return new String("TestXAResourcee(" + txTimeout + ", " + currentXid + ")");
+ return new String("TestXAResource(" + super.toString() + ")");
}
}
Added: labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/inbound/utility/TestXAResourceCommon.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/inbound/utility/TestXAResourceCommon.java (rev 0)
+++ labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/inbound/utility/TestXAResourceCommon.java 2012-02-16 10:19:32 UTC (rev 37888)
@@ -0,0 +1,116 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package org.jboss.jbossts.txbridge.tests.inbound.utility;
+
+import org.jboss.logging.Logger;
+
+import javax.transaction.xa.XAException;
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
+
+/**
+ * Basic implementation of XAResource for use in tx test cases.
+ *
+ * @author Jonathan Halliday (jonathan.halliday at redhat.com) 2010-01
+ * @author Ivo Studensky (istudens at redhat.com)
+ */
+public abstract class TestXAResourceCommon implements XAResource {
+ private static Logger log = Logger.getLogger(TestXAResourceCommon.class);
+
+ private int txTimeout;
+
+ private Xid currentXid;
+
+ private int prepareReturnValue = XAResource.XA_OK;
+
+ public void commit(Xid xid, boolean b) throws XAException {
+ log.trace("TestXAResourceCommon.commit(Xid=" + xid + ", b=" + b + ")");
+ if (!xid.equals(currentXid)) {
+ log.trace("TestXAResourceCommon.commit - wrong Xid!");
+ }
+
+ currentXid = null;
+ TestXAResourceRecoveryHelper.getInstance().removeLog(xid);
+ }
+
+ public void end(Xid xid, int i) throws XAException {
+ log.trace("TestXAResourceCommon.end(Xid=" + xid + ", b=" + i + ")");
+ }
+
+ public void forget(Xid xid) throws XAException {
+ log.trace("TestXAResourceCommon.forget(Xid=" + xid + ")");
+ if (!xid.equals(currentXid)) {
+ log.trace("TestXAResourceCommon.forget - wrong Xid!");
+ }
+ currentXid = null;
+ }
+
+ public int getTransactionTimeout() throws XAException {
+ log.trace("TestXAResourceCommon.getTransactionTimeout() [returning " + txTimeout + "]");
+ return txTimeout;
+ }
+
+ public boolean isSameRM(XAResource xaResource) throws XAException {
+ log.trace("TestXAResourceCommon.isSameRM(xaResource=" + xaResource + ")");
+ return false;
+ }
+
+ public int prepare(Xid xid) throws XAException {
+ log.trace("TestXAResourceCommon.prepare(Xid=" + xid + ") returning " + prepareReturnValue);
+
+ if (prepareReturnValue == XA_OK) {
+ TestXAResourceRecoveryHelper.getInstance().logPrepared(xid);
+ }
+ return prepareReturnValue;
+ }
+
+ public Xid[] recover(int i) throws XAException {
+ log.trace("TestXAResourceCommon.recover(i=" + i + ")");
+ return new Xid[0];
+ }
+
+ public void rollback(Xid xid) throws XAException {
+ log.trace("TestXAResourceCommon.rollback(Xid=" + xid + ")");
+ if (!xid.equals(currentXid)) {
+ log.trace("TestXAResourceCommon.rollback - wrong Xid!");
+ }
+ currentXid = null;
+ TestXAResourceRecoveryHelper.getInstance().removeLog(xid);
+ }
+
+ public boolean setTransactionTimeout(int i) throws XAException {
+ log.trace("TestXAResourceCommon.setTransactionTimeout(i=" + i + ")");
+ txTimeout = i;
+ return true;
+ }
+
+ public void start(Xid xid, int i) throws XAException {
+ log.trace("TestXAResourceCommon.start(Xid=" + xid + ", i=" + i + ")");
+ if (currentXid != null) {
+ log.trace("TestXAResourceCommon.start - wrong Xid!");
+ }
+ currentXid = xid;
+ }
+
+ public String toString() {
+ return new String("TestXAResourceCommon(" + txTimeout + ", " + currentXid + ")");
+ }
+}
Modified: labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/inbound/utility/TestXAResourceRecovered.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/inbound/utility/TestXAResourceRecovered.java 2012-02-15 15:58:00 UTC (rev 37887)
+++ labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/inbound/utility/TestXAResourceRecovered.java 2012-02-16 10:19:32 UTC (rev 37888)
@@ -29,9 +29,22 @@
/**
* Implementation of XAResource for use in txbridge recovery tests.
*
+ * Note: TestXAResourceRecovered cannot directly extend TestXAResource, otherwise
+ * TestXAResource will be every time instrumented together with TestXAResourceRecovered
+ * which will deny the distinction between them and will increase the number of
+ * known instrumented instances of TestXAResource, for example in InboundCrashRecoveryTests#testCrashOneLog
+ * if the recovery process is run on the server side before the following assert:
+ * ...
+ * execute(baseURL + TestClient.URL_PATTERN, false);
+ * // if recovery process is run before the next assert and if TestXAResourceRecovered
+ * // extends TestXAResource then the assert will fail because of 2 known instances
+ * instrumentedTestXAResource.assertKnownInstances(1);
+ * ...
+ *
* @author Jonathan Halliday (jonathan.halliday at redhat.com) 2010-01
+ * @author Ivo Studensky (istudens at redhat.com)
*/
-public class TestXAResourceRecovered extends TestXAResource implements XAResource {
+public class TestXAResourceRecovered extends TestXAResourceCommon implements XAResource {
private static Logger log = Logger.getLogger(TestXAResourceRecovered.class);
@Override
@@ -62,4 +75,39 @@
TestXAResourceRecoveryHelper.getInstance().removeLog(xid);
}
+ @Override
+ public void end(Xid xid, int i) throws XAException {
+ super.end(xid, i);
+ }
+
+ @Override
+ public int getTransactionTimeout() throws XAException {
+ return super.getTransactionTimeout();
+ }
+
+ @Override
+ public boolean isSameRM(XAResource xaResource) throws XAException {
+ return super.isSameRM(xaResource);
+ }
+
+ @Override
+ public int prepare(Xid xid) throws XAException {
+ return super.prepare(xid);
+ }
+
+ @Override
+ public boolean setTransactionTimeout(int i) throws XAException {
+ return super.setTransactionTimeout(i);
+ }
+
+ @Override
+ public void start(Xid xid, int i) throws XAException {
+ super.start(xid, i);
+ }
+
+ @Override
+ public String toString() {
+ return new String("TestXAResourceRecovered(" + super.toString() + ")");
+ }
+
}
Modified: labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/inbound/utility/TestXAResourceRecoveryHelper.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/inbound/utility/TestXAResourceRecoveryHelper.java 2012-02-15 15:58:00 UTC (rev 37887)
+++ labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/inbound/utility/TestXAResourceRecoveryHelper.java 2012-02-16 10:19:32 UTC (rev 37888)
@@ -27,6 +27,10 @@
import com.arjuna.ats.jta.recovery.XAResourceRecoveryHelper;
import org.jboss.logging.Logger;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.ejb.Singleton;
+import javax.ejb.Startup;
import javax.transaction.xa.XAException;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
@@ -41,6 +45,8 @@
*
* @author Jonathan Halliday (jonathan.halliday at redhat.com) 2010-01
*/
+ at Singleton
+ at Startup
public class TestXAResourceRecoveryHelper implements XAResourceRecoveryHelper {
private static Logger log = Logger.getLogger(TestXAResourceRecoveryHelper.class);
@@ -59,18 +65,20 @@
/**
* MC lifecycle callback, used to register the recovery module with the transaction manager.
*/
- public void start() {
+ @PostConstruct
+ public void postConstruct() {
log.info("TestXAResourceRecoveryHelper starting");
getRecoveryModule().addXAResourceRecoveryHelper(getInstance());
- recoverFromDisk();
+ getInstance().recoverFromDisk();
}
/**
* MC lifecycle callback, used to unregister the recovery module from the transaction manager.
*/
- public void stop() {
+ @PreDestroy
+ public void preDestroy() {
log.info("TestXAResourceRecoveryHelper stopping");
getRecoveryModule().removeXAResourceRecoveryHelper(getInstance());
@@ -181,5 +189,4 @@
return logFile;
}
-
}
\ No newline at end of file
Modified: labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/outbound/junit/OutboundCrashRecoveryTests.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/outbound/junit/OutboundCrashRecoveryTests.java 2012-02-15 15:58:00 UTC (rev 37887)
+++ labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/outbound/junit/OutboundCrashRecoveryTests.java 2012-02-16 10:19:32 UTC (rev 37888)
@@ -75,9 +75,11 @@
@Before
public void setUp() throws Exception {
+ cleanTxStore();
+
// start up the appserver
String javaVmArguments = System.getProperty("server.jvm.args").trim();
- log.info("javaVmArguments = " + javaVmArguments);
+ log.trace("javaVmArguments = " + javaVmArguments);
controller.start(CONTAINER, new Config().add("javaVmArguments", javaVmArguments).map());
// deploy the tests
deployer.deploy(OUTBOUND_SERVICE_DEPLOYMENT_NAME);
Modified: labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/outbound/utility/TestRecoveryModule.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/outbound/utility/TestRecoveryModule.java 2012-02-15 15:58:00 UTC (rev 37887)
+++ labs/jbosstm/branches/JBOSSTS_4_16/txbridge/tests/src/test/java/org/jboss/jbossts/txbridge/tests/outbound/utility/TestRecoveryModule.java 2012-02-16 10:19:32 UTC (rev 37888)
@@ -25,6 +25,10 @@
import org.jboss.jbossts.xts.recovery.participant.at.XTSATRecoveryManager;
import org.jboss.jbossts.xts.recovery.participant.at.XTSATRecoveryModule;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.ejb.Singleton;
+import javax.ejb.Startup;
import java.io.ObjectInputStream;
/**
@@ -32,13 +36,16 @@
*
* @author Jonathan Halliday (jonathan.halliday at redhat.com) 2010-05
*/
+ at Singleton
+ at Startup
public class TestRecoveryModule implements XTSATRecoveryModule {
private static final Logger log = Logger.getLogger(TestRecoveryModule.class);
/**
* MC lifecycle callback, used to register components with the recovery manager.
*/
- public void start() {
+ @PostConstruct
+ public void postConstruct() {
log.info("TestRecoveryModule starting");
//FIXME this is ugly hack!! it seems that dependency names from jboss-beans.xml no longer work in AS7!?
@@ -59,7 +66,8 @@
/**
* MC lifecycle callback, used to unregister components from the recovery manager.
*/
- public void stop() {
+ @PreDestroy
+ public void preDestroy() {
log.info("TestRecoveryModule stopping");
XTSATRecoveryManager.getRecoveryManager().unregisterRecoveryModule(this);
More information about the jboss-svn-commits
mailing list