[jboss-cvs] JBoss Messaging SVN: r1987 - in trunk: src/main/org/jboss/jms/client/container and 9 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jan 18 16:20:08 EST 2007
Author: timfox
Date: 2007-01-18 16:20:08 -0500 (Thu, 18 Jan 2007)
New Revision: 1987
Removed:
trunk/src/main/org/jboss/jms/client/container/ConcurrencyInterceptor.java
trunk/src/main/org/jboss/jms/recovery/BridgeXAResourceRecovery.java
Modified:
trunk/build-messaging.xml
trunk/src/main/org/jboss/jms/client/container/ClusteringAspect.java
trunk/src/main/org/jboss/jms/tx/MessagingXAResource.java
trunk/tests/etc/jbossjta-properties.xml
trunk/tests/etc/log4j.xml
trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeTestBase.java
trunk/tests/src/org/jboss/test/messaging/jms/bridge/ReconnectTest.java
trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java
trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
trunk/tests/src/org/jboss/test/messaging/tools/aop/PoisonInterceptor.java
trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java
trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java
trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java
trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java
Log:
Bridge test stuff
Modified: trunk/build-messaging.xml
===================================================================
--- trunk/build-messaging.xml 2007-01-18 19:23:14 UTC (rev 1986)
+++ trunk/build-messaging.xml 2007-01-18 21:20:08 UTC (rev 1987)
@@ -410,7 +410,7 @@
<mkdir dir="${build.lib}"/>
<jar jarfile="${build.lib}/jboss-${module.name}.jar" manifest="${build.etc}/default.mf">
- <fileset dir="${build.classes}" includes="**" excludes="org/jboss/jms/recovery/*.class"/>
+ <fileset dir="${build.classes}" includes="**"/>
<fileset dir="${build.jar}">
<exclude name="*-service.xml"/>
<exclude name="*-ds.xml"/>
Modified: trunk/src/main/org/jboss/jms/client/container/ClusteringAspect.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/container/ClusteringAspect.java 2007-01-18 19:23:14 UTC (rev 1986)
+++ trunk/src/main/org/jboss/jms/client/container/ClusteringAspect.java 2007-01-18 21:20:08 UTC (rev 1987)
@@ -35,6 +35,7 @@
* It's a PER_INSTANCE aspect (one of these per each clustered ConnectionFactory instance)
*
* @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
*
* @version <tt>$Revision$</tt>
*
Deleted: trunk/src/main/org/jboss/jms/client/container/ConcurrencyInterceptor.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/container/ConcurrencyInterceptor.java 2007-01-18 19:23:14 UTC (rev 1986)
+++ trunk/src/main/org/jboss/jms/client/container/ConcurrencyInterceptor.java 2007-01-18 21:20:08 UTC (rev 1987)
@@ -1,104 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY 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 along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.jms.client.container;
-
-import org.jboss.aop.advice.Interceptor;
-import org.jboss.aop.joinpoint.Invocation;
-
-/**
- * Interceptor - useful in debugging to determine when concurrent access to objects is occurring
- * Not to be used in normal usage
- *
- * This interceptor is PER_INSTANCE.
- *
- * @author <a href="mailto:tim.fox at jboss.com>Tim Fox</a>
- */
-public class ConcurrencyInterceptor implements Interceptor
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- //private Thread currentThread;
-
- //debug
- //private String methodName;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- // Interceptor implementation ----------------------------------
-
- public String getName()
- {
- return "ConcurrencyInterceptor";
- }
-
- public Object invoke(Invocation invocation) throws Throwable
- {
- //checkThread(invocation);
-
-
- Object res = invocation.invokeNext();
- //unsetThread();
- return res;
- }
-
- // Class YYY overrides -------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Package Private -----------------------------------------------
-
- // Private -------------------------------------------------------
-
-// private synchronized void checkThread(Invocation inv) throws JMSException
-// {
-// if (currentThread != null)
-// {
-// if (!Thread.currentThread().equals(currentThread))
-// {
-// String thisMethodName = ((MethodInvocation)inv).getMethod().getName();
-// throw new JMSException("Attempting to execute " + thisMethodName + " but already executing " + methodName);
-// }
-// }
-// else
-// {
-// currentThread = Thread.currentThread();
-// //debug
-// methodName = ((MethodInvocation)inv).getMethod().getName();
-// }
-// }
-//
-// private synchronized void unsetThread()
-// {
-// currentThread = null;
-// }
-
- // Inner Classes -------------------------------------------------
-
-}
-
-
Deleted: trunk/src/main/org/jboss/jms/recovery/BridgeXAResourceRecovery.java
===================================================================
--- trunk/src/main/org/jboss/jms/recovery/BridgeXAResourceRecovery.java 2007-01-18 19:23:14 UTC (rev 1986)
+++ trunk/src/main/org/jboss/jms/recovery/BridgeXAResourceRecovery.java 2007-01-18 21:20:08 UTC (rev 1987)
@@ -1,230 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY 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 along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.jms.recovery;
-
-import java.io.InputStream;
-import java.sql.SQLException;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-import java.util.StringTokenizer;
-
-import javax.jms.XAConnection;
-import javax.jms.XAConnectionFactory;
-import javax.jms.XASession;
-import javax.naming.InitialContext;
-import javax.transaction.xa.XAResource;
-
-import org.jboss.logging.Logger;
-
-import com.arjuna.ats.jta.recovery.XAResourceRecovery;
-
-/**
- * A BridgeXAResourceRecovery
- *
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @version <tt>$Revision: 1.1 $</tt>
- *
- * $Id$
- *
- */
-public class BridgeXAResourceRecovery implements XAResourceRecovery
-{
- private static final Logger log = Logger.getLogger(BridgeXAResourceRecovery.class);
-
- private Hashtable jndiProperties;
-
- private String connectionFactoryLookup;
-
- private boolean returnedXAResource;
-
- private XAConnection conn;
-
- public synchronized XAResource getXAResource() throws SQLException
- {
- InitialContext ic = null;
-
- if (log.isTraceEnabled()) { log.trace(this + " getting XAResource"); }
-
- try
- {
- if (jndiProperties.isEmpty())
- {
- //Local initial context
-
- ic = new InitialContext();
- }
- else
- {
- ic = new InitialContext(jndiProperties);
- }
-
- XAConnectionFactory cf = (XAConnectionFactory)ic.lookup(connectionFactoryLookup);
-
- conn = cf.createXAConnection();
-
- XASession sess = conn.createXASession();
-
- XAResource res = sess.getXAResource();
-
- returnedXAResource = true;
-
- if (log.isTraceEnabled()) { log.trace(this + " returning " + res); }
-
- return res;
- }
- catch (Exception e)
- {
- log.warn("Failed to get XAResource", e);
-
- return null;
- }
- finally
- {
- if (ic != null)
- {
- try
- {
- ic.close();
- }
- catch (Exception ignore)
- {
- //Ignore
- }
- }
- }
-
- }
-
- public synchronized boolean hasMoreResources()
- {
- return !returnedXAResource;
- }
-
- public synchronized boolean initialise(String config)
- {
- if (log.isTraceEnabled()) { log.trace(this + " intialise: " + config); }
-
- StringTokenizer tok = new StringTokenizer(config, ",");
-
- if (tok.countTokens() != 2)
- {
- log.error("Invalid config: " + config);
- return false;
- }
-
- String provider = tok.nextToken();
-
- String propsFile = tok.nextToken();
-
- try
- {
- //The config should point to a properties file on the classpath that holds the actual config
- InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(propsFile);
-
- Properties props = new Properties();
-
- props.load(is);
-
- /*
- * provider1.jndi.prop1=xxxx
- * provider1.jndi.prop2=yyyy
- * provider1.jndi.prop3=zzzz
- *
- * provider1.xaconnectionfactorylookup=xyz
- *
- * provider2.jndi.prop1=xxxx
- * provider2.jndi.prop2=yyyy
- * provider2.jndi.prop3=zzzz
- *
- * provider2.xaconnectionfactorylookup=xyz
- *
- */
-
- Iterator iter = props.entrySet().iterator();
-
- String jndiPrefix = provider + ".jndi.";
-
- String cfKey = provider + ".xaconnectionfactorylookup";
-
- jndiProperties = new Hashtable();
-
- while (iter.hasNext())
- {
- Map.Entry entry = (Map.Entry)iter.next();
-
- String key = (String)entry.getKey();
- String value = (String)entry.getValue();
-
- if (key.startsWith(jndiPrefix))
- {
- String actualKey = key.substring(jndiPrefix.length());
-
- jndiProperties.put(actualKey, value);
- }
- else if (key.equals(cfKey))
- {
- connectionFactoryLookup = value;
- }
- }
-
- if (connectionFactoryLookup == null)
- {
- log.error("Key " + cfKey + " does not exist in config");
- return false;
- }
-
- if (log.isTraceEnabled()) { log.trace(this + " initialised"); }
-
- return true;
- }
- catch (Exception e)
- {
- log.error("Failed to load config file: " + config, e);
-
- return false;
- }
- }
-
- protected void finalize()
- {
- if (log.isTraceEnabled()) { log.trace(this + " finalizing"); }
-
- //I'd rather have some lifecycle method that gets called on this class by the recovery manager
- //but there doesn't seem to be one.
- //Therefore the only place I can close the connection is in the finalizer
- if (conn != null)
- {
- try
- {
- conn.close();
- }
- catch (Exception ignore)
- {
- //Ignore
- }
- }
- }
-
-}
Modified: trunk/src/main/org/jboss/jms/tx/MessagingXAResource.java
===================================================================
--- trunk/src/main/org/jboss/jms/tx/MessagingXAResource.java 2007-01-18 19:23:14 UTC (rev 1986)
+++ trunk/src/main/org/jboss/jms/tx/MessagingXAResource.java 2007-01-18 21:20:08 UTC (rev 1987)
@@ -183,7 +183,11 @@
{
if (trace) { log.trace(this + " recovering, flags: " + flags); }
- return rm.recover(flags, connection);
+ Xid[] xids = rm.recover(flags, connection);
+
+ if (trace) { log.trace("Recovered txs: " + xids); }
+
+ return xids;
}
public void rollback(Xid xid) throws XAException
Modified: trunk/tests/etc/jbossjta-properties.xml
===================================================================
--- trunk/tests/etc/jbossjta-properties.xml 2007-01-18 19:23:14 UTC (rev 1986)
+++ trunk/tests/etc/jbossjta-properties.xml 2007-01-18 21:20:08 UTC (rev 1987)
@@ -8,6 +8,12 @@
<properties depends="common" name="arjuna">
<!--
+ (Must be unique across all Arjuna instances.)
+ -->
+ <property name="com.arjuna.ats.arjuna.xa.nodeIdentifier" value="1"/>
+ <property name="com.arjuna.ats.jta.xaRecoveryNode" value="1"/>
+
+ <!--
Transaction Reaper Timeout (default is 120000 microseconds).
-->
<property
@@ -58,10 +64,7 @@
-->
<property
name="com.arjuna.ats.arjuna.objectstore.transactionSync" value="ON"/>
- <!--
- (Must be unique across all Arjuna instances.)
- -->
- <property name="com.arjuna.ats.arjuna.xa.nodeIdentifier" value="node0"/>
+
<!-- property
name="com.arjuna.ats.arjuna.coordinator.actionStore"
value="HashedActionStore"
@@ -113,7 +116,14 @@
-->
</properties>
<properties depends="arjuna" name="recoverymanager">
+
+ <property name="com.arjuna.ats.arjuna.xa.nodeIdentifier" value="1"/>
+ <property name="com.arjuna.ats.jta.xaRecoveryNode" value="1"/>
+
<!--
+ (Must be unique across all Arjuna instances.)
+ -->
+ <!--
Properties used only by the RecoveryManager.
-->
<!--
@@ -171,8 +181,13 @@
<!--
Periodic recovery modules to use. Invoked in sort-order of names.
-->
- <property
- name="com.arjuna.ats.arjuna.recovery.recoveryExtension1" value="com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule"/>
+ <!--
+ <property name="com.arjuna.ats.arjuna.recovery.recoveryExtension1" value="com.arjuna.ats.internal.arjuna.recovery.AtomicActionRecoveryModule"/>
+ <property name="com.arjuna.ats.arjuna.recovery.recoveryExtension2" value="com.arjuna.ats.internal.txoj.recovery.TORecoveryModule"/>
+ -->
+ <property name="com.arjuna.ats.arjuna.recovery.recoveryExtension3" value="com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule"/>
+
+
</properties>
<properties name="common">
<!-- CLF 2.0 properties -->
@@ -212,6 +227,8 @@
name="com.arjuna.ats.txoj.lockstore.allowNestedLocking" value="YES"/>
</properties>
<properties depends="arjuna" name="jta">
+ <property name="com.arjuna.ats.arjuna.xa.nodeIdentifier" value="1"/>
+ <property name="com.arjuna.ats.jta.xaRecoveryNode" value="1"/>
<!-- This used when deployed in the app server and we want to do a recovery of a JMS provider, the string after the semi colon
@@ -232,9 +249,12 @@
provider2.jndi.prop3=zzzz
provider2.xaconnectionfactorylookup=xyz
-->
+ <!--
<property name="com.arjuna.ats.jta.recovery.XAResourceRecovery.JBMESSAGINGBRIDGE_SERVER0" value="org.jboss.jms.recovery.BridgeXAResourceRecovery;server0,bridge-recovery.properties"/>
<property name="com.arjuna.ats.jta.recovery.XAResourceRecovery.JBMESSAGINGBRIDGE_SERVER1" value="org.jboss.jms.recovery.BridgeXAResourceRecovery;server1,bridge-recovery.properties"/>
+-->
+<property name="com.arjuna.ats.jta.recovery.XAResourceRecovery.JBM_TEST" value="org.jboss.test.messaging.jms.bridge.RecoveryTest.NullXAResourceRecovery"/>
<!--
Support subtransactions in the JTA layer?
Default is NO.
@@ -248,6 +268,7 @@
<!--
com.arjuna.ats.internal.jta.transaction.jts.UserTransactionImple
-->
+
</properties>
<properties depends="jta" name="jdbc">
<!--
Modified: trunk/tests/etc/log4j.xml
===================================================================
--- trunk/tests/etc/log4j.xml 2007-01-18 19:23:14 UTC (rev 1986)
+++ trunk/tests/etc/log4j.xml 2007-01-18 21:20:08 UTC (rev 1987)
@@ -24,7 +24,7 @@
<param name="Append" value="true"/>
<layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d %-5r %-5p [%c] @%t %m%n"/>
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p @%t [%c{1}] %m%n"/>
</layout>
</appender>
@@ -32,8 +32,9 @@
<errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
<param name="Target" value="System.out"/>
<param name="Threshold" value="INFO"/>
+ <!-- <param name="Threshold" value="TRACE#org.jboss.logging.XLevel"/> -->
<layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%t %d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
+ <param name="ConversionPattern" value="@%t %d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
</layout>
</appender>
@@ -45,12 +46,12 @@
<priority value="WARN"/>
</category>
- <category name="org.jboss">
+ <category name="org.jboss.remoting">
<priority value="INFO"/>
</category>
- <category name="org.jboss.remoting">
- <priority value="TRACE" class="org.jboss.logging.XLevel"/>
+ <category name="org.jboss">
+ <priority value="INFO"/>
</category>
<category name="org.jboss.messaging">
@@ -68,15 +69,19 @@
<!-- Ignoring trace from these: -->
<category name="org.jboss.jms.server.remoting.JMSServerInvocationHandler">
- <priority value="TRACE" class="org.jboss.logging.XLevel"/>
+ <priority value="DEBUG"/>
</category>
+ <category name="org.jboss.messaging.core.plugin.JDBCSupport">
+ <priority value="INFO"/>
+ </category>
+
<category name="org.jboss.test.messaging.tools.jmx.MockJBossSecurityManager">
<priority value="DEBUG"/>
</category>
<category name="org.jboss.jms.server.remoting.JMSWireFormat">
- <priority value="TRACE" class="org.jboss.logging.XLevel"/>
+ <priority value="DEBUG"/>
</category>
<root>
Modified: trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeTestBase.java 2007-01-18 19:23:14 UTC (rev 1986)
+++ trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeTestBase.java 2007-01-18 21:20:08 UTC (rev 1987)
@@ -24,6 +24,7 @@
import org.jboss.logging.Logger;
import org.jboss.test.messaging.MessagingTestCase;
import org.jboss.test.messaging.tools.ServerManagement;
+import org.jboss.test.messaging.tools.jmx.ServiceContainer;
/**
*
@@ -41,6 +42,8 @@
protected int nodeCount = 2;
+ protected ServiceContainer sc;
+
public BridgeTestBase(String name)
{
super(name);
@@ -49,7 +52,7 @@
protected void setUp() throws Exception
{
super.setUp();
-
+
log.info("Starting " + nodeCount + " servers");
if (ServerManagement.isRemote())
@@ -62,6 +65,12 @@
ServerManagement.start(i, "all,-transaction,jbossjta", i == 0);
}
}
+
+ //We need a local transaction and recovery manager
+ //We must start this after the remote servers have been created or it won't
+ //have deleted the database and the recovery manager may attempt to recover transactions
+ sc = new ServiceContainer("jbossjta");
+ sc.start(false);
}
@@ -99,6 +108,8 @@
}
}
+ sc.stop();
+
super.tearDown();
}
Modified: trunk/tests/src/org/jboss/test/messaging/jms/bridge/ReconnectTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/bridge/ReconnectTest.java 2007-01-18 19:23:14 UTC (rev 1986)
+++ trunk/tests/src/org/jboss/test/messaging/jms/bridge/ReconnectTest.java 2007-01-18 21:20:08 UTC (rev 1987)
@@ -41,6 +41,7 @@
import org.jboss.jms.server.bridge.JNDIConnectionFactoryFactory;
import org.jboss.logging.Logger;
import org.jboss.test.messaging.tools.ServerManagement;
+import org.jboss.test.messaging.tools.aop.PoisonInterceptor;
/**
*
@@ -644,8 +645,11 @@
for (int i = 0; i < NUM_MESSAGES / 2; i++)
{
TextMessage tm = sessSend.createTextMessage("message" + i);
+
+ prod.send(tm);
- prod.send(tm);
+ log.info("sent message:" + tm.getJMSMessageID());
+
}
Session sessRec = connDest.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -670,7 +674,7 @@
//but the branch on dest won't be - it will remain prepared
//This corresponds to a HeuristicMixedException
- ServerManagement.poisonTheServer(1);
+ ServerManagement.poisonTheServer(1, PoisonInterceptor.TYPE_2PC_COMMIT);
ServerManagement.nullServer(1);
@@ -684,7 +688,7 @@
//Since there will be a heuristically prepared branch on the consumer that needs to be rolled
//back
- Thread.sleep(20000);
+ Thread.sleep(10000);
//Restart the server
@@ -696,6 +700,9 @@
ServerManagement.deployQueue("destQueue", 1);
+ //Give enough time for transaction recovery to happen
+ Thread.sleep(20000);
+
log.info("Deployed queue");
log.info("Slept");
@@ -721,8 +728,11 @@
for (int i = NUM_MESSAGES / 2; i < NUM_MESSAGES; i++)
{
TextMessage tm = sessSend.createTextMessage("message" + i);
+
+ prod.send(tm);
- prod.send(tm);
+ log.info("sent message: " + tm.getJMSMessageID());
+
}
checkMessagesReceived(Bridge.QOS_ONCE_AND_ONLY_ONCE, cons, NUM_MESSAGES);
@@ -801,6 +811,7 @@
}
}
+
private void checkMessagesReceived(int qosMode, MessageConsumer cons, int numMessages) throws Exception
{
//Consume the messages
@@ -816,6 +827,8 @@
break;
}
+ log.info("received message:" + tm.getJMSMessageID());
+
msgs.add(tm.getText());
}
Modified: trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java 2007-01-18 19:23:14 UTC (rev 1986)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java 2007-01-18 21:20:08 UTC (rev 1987)
@@ -8,6 +8,7 @@
import org.jboss.test.messaging.jms.clustering.base.ClusteringTestBase;
import org.jboss.test.messaging.tools.ServerManagement;
+import org.jboss.test.messaging.tools.aop.PoisonInterceptor;
import org.jboss.jms.client.JBossConnection;
import org.jboss.jms.client.FailoverListener;
import org.jboss.jms.client.FailoverEvent;
@@ -1575,7 +1576,7 @@
((JBossConnection)conn).registerFailoverListener(failoverListener);
// poison the server
- ServerManagement.poisonTheServer(1);
+ ServerManagement.poisonTheServer(1, PoisonInterceptor.TYPE_CREATE_SESSION);
// this invocation will halt the server ...
Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
Modified: trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java 2007-01-18 19:23:14 UTC (rev 1986)
+++ trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java 2007-01-18 21:20:08 UTC (rev 1987)
@@ -621,10 +621,10 @@
* sorts of failures. I expect the name of this method to be refactored as we learn more about
* this type of testing.
*/
- public static void poisonTheServer(int serverIndex) throws Exception
+ public static void poisonTheServer(int serverIndex, int type) throws Exception
{
insureStarted(serverIndex);
- servers[serverIndex].getServer().poisonTheServer();
+ servers[serverIndex].getServer().poisonTheServer(type);
}
Modified: trunk/tests/src/org/jboss/test/messaging/tools/aop/PoisonInterceptor.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/aop/PoisonInterceptor.java 2007-01-18 19:23:14 UTC (rev 1986)
+++ trunk/tests/src/org/jboss/test/messaging/tools/aop/PoisonInterceptor.java 2007-01-18 21:20:08 UTC (rev 1987)
@@ -30,8 +30,20 @@
// Constants ------------------------------------------------------------------------------------
private static final Logger log = Logger.getLogger(PoisonInterceptor.class);
+
+ public static final int TYPE_CREATE_SESSION = 0;
+
+ public static final int TYPE_2PC_COMMIT = 1;
+
// Static ---------------------------------------------------------------------------------------
+
+ private static int type;
+
+ public static void setType(int type)
+ {
+ PoisonInterceptor.type = type;
+ }
// Attributes -----------------------------------------------------------------------------------
@@ -49,17 +61,20 @@
MethodInvocation mi = (MethodInvocation)invocation;
String methodName = mi.getMethod().getName();
- if ("createSessionDelegate".equals(methodName))
+ if ("createSessionDelegate".equals(methodName) && type == TYPE_CREATE_SESSION)
{
// Used by the failover tests to kill server in the middle of an invocation.
+ log.info("##### Crashing on createSessionDelegate!!");
+
crash(invocation.getTargetObject());
}
else if ("sendTransaction".equals(methodName))
{
TransactionRequest request = (TransactionRequest)mi.getArguments()[0];
- if (request.getRequestType() == TransactionRequest.TWO_PHASE_COMMIT_REQUEST)
+ if (request.getRequestType() == TransactionRequest.TWO_PHASE_COMMIT_REQUEST
+ && type == TYPE_2PC_COMMIT)
{
//Crash on 2pc commit - used in message bridge tests
Modified: trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java 2007-01-18 19:23:14 UTC (rev 1986)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java 2007-01-18 21:20:08 UTC (rev 1987)
@@ -87,7 +87,9 @@
import org.jboss.tm.TxManager;
import org.jboss.tm.usertx.client.ServerVMClientUserTransaction;
+import com.arjuna.ats.arjuna.recovery.RecoveryManager;
+
/**
* An MBeanServer and a configurable set of services (TransactionManager, Remoting, etc) available
* for testing.
@@ -182,6 +184,7 @@
private InitialContext initialContext;
private String jndiNamingFactory;
private Server hsqldbServer;
+ private RecoveryManager recoveryManager;
private boolean transaction;
private boolean jbossjta; //To use the ex-Arjuna tx mgr
@@ -394,6 +397,10 @@
// othewise we'll get an access error)
deleteAllData();
}
+ if (jbossjta)
+ {
+ startRecoveryManager();
+ }
if (remoting)
{
@@ -435,6 +442,14 @@
unloadJNDIContexts();
stopService(REMOTING_OBJECT_NAME);
+
+ if (jbossjta)
+ {
+ if (recoveryManager != null)
+ {
+ recoveryManager.stop();
+ }
+ }
if (jca)
{
@@ -993,7 +1008,7 @@
if (jbossjta)
{
log.info("Starting arjuna tx mgr");
- tm = com.arjuna.ats.jta.TransactionManager.transactionManager();
+ tm = com.arjuna.ats.jta.TransactionManager.transactionManager();
}
else
{
@@ -1017,6 +1032,19 @@
log.debug("bound " + USER_TRANSACTION_JNDI_NAME);
}
+
+ private void startRecoveryManager()
+ {
+ log.info("Starting arjuna recovery manager");
+
+ //Need to start the recovery manager manually - if deploying
+ //inside JBoss this wouldn't be necessary - since you would use
+ //the TransactionManagerService MBean which would start the recovery manager
+ //for you
+ recoveryManager = RecoveryManager.manager(RecoveryManager.INDIRECT_MANAGEMENT);
+
+ log.info("Started recovery manager");
+ }
private void startCachedConnectionManager(ObjectName on) throws Exception
{
Modified: trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java 2007-01-18 19:23:14 UTC (rev 1986)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java 2007-01-18 21:20:08 UTC (rev 1987)
@@ -25,14 +25,17 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.Set;
-import java.util.Map;
+
import javax.jms.Destination;
import javax.jms.Queue;
import javax.jms.Topic;
+import javax.management.NotificationListener;
import javax.management.ObjectName;
-import javax.management.NotificationListener;
import javax.transaction.UserTransaction;
+
+import org.jboss.aop.AspectXmlLoader;
import org.jboss.jms.server.DestinationManager;
import org.jboss.jms.server.ServerPeer;
import org.jboss.jms.util.XMLUtil;
@@ -41,14 +44,14 @@
import org.jboss.messaging.core.plugin.contract.PersistenceManager;
import org.jboss.remoting.ServerInvocationHandler;
import org.jboss.test.messaging.tools.ServerManagement;
+import org.jboss.test.messaging.tools.aop.PoisonInterceptor;
import org.jboss.test.messaging.tools.jboss.MBeanConfigurationElement;
import org.jboss.test.messaging.tools.jboss.ServiceDeploymentDescriptor;
import org.jboss.test.messaging.tools.jmx.MockJBossSecurityManager;
import org.jboss.test.messaging.tools.jmx.RemotingJMXWrapper;
+import org.jboss.test.messaging.tools.jmx.ServiceAttributeOverrides;
import org.jboss.test.messaging.tools.jmx.ServiceContainer;
-import org.jboss.test.messaging.tools.jmx.ServiceAttributeOverrides;
import org.jboss.test.messaging.tools.jndi.Constants;
-import org.jboss.aop.AspectXmlLoader;
import org.w3c.dom.Element;
/**
@@ -868,7 +871,7 @@
"Register listeners directly instead.");
}
- public void poisonTheServer() throws Exception
+ public void poisonTheServer(int type) throws Exception
{
URL url = this.getClass().getClassLoader().getResource("poison.xml");
AspectXmlLoader.deployXML(url);
@@ -877,6 +880,8 @@
// URL url = this.getClass().getClassLoader().getResource("poison.xml");
// AspectXmlLoader.undeployXML(url);
+
+ PoisonInterceptor.setType(type);
}
// Public --------------------------------------------------------
Modified: trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java 2007-01-18 19:23:14 UTC (rev 1986)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java 2007-01-18 21:20:08 UTC (rev 1987)
@@ -449,9 +449,9 @@
return pl.drain();
}
- public void poisonTheServer() throws Exception
+ public void poisonTheServer(int type) throws Exception
{
- server.poisonTheServer();
+ server.poisonTheServer(type);
}
// Public --------------------------------------------------------
Modified: trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java 2007-01-18 19:23:14 UTC (rev 1986)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java 2007-01-18 21:20:08 UTC (rev 1987)
@@ -267,6 +267,6 @@
*/
List pollNotificationListener(long listenerID) throws Exception;
- void poisonTheServer() throws Exception;
+ void poisonTheServer(int type) throws Exception;
}
More information about the jboss-cvs-commits
mailing list