[jboss-cvs] JBoss Messaging SVN: r2962 - trunk/tests/src/org/jboss/test/messaging/jms/clustering.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Aug 6 14:40:27 EDT 2007
Author: timfox
Date: 2007-08-06 14:40:27 -0400 (Mon, 06 Aug 2007)
New Revision: 2962
Removed:
trunk/tests/src/org/jboss/test/messaging/jms/clustering/ServerManagementTest.java
Modified:
trunk/tests/src/org/jboss/test/messaging/jms/clustering/TemporaryDestinationTest.java
trunk/tests/src/org/jboss/test/messaging/jms/clustering/XAFailoverTest.java
Log:
Tests speedup
Deleted: trunk/tests/src/org/jboss/test/messaging/jms/clustering/ServerManagementTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/ServerManagementTest.java 2007-08-06 18:11:35 UTC (rev 2961)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/ServerManagementTest.java 2007-08-06 18:40:27 UTC (rev 2962)
@@ -1,143 +0,0 @@
-/**
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.test.messaging.jms.clustering;
-
-import javax.management.ObjectName;
-import javax.naming.InitialContext;
-
-import org.jboss.test.messaging.MessagingTestCase;
-import org.jboss.test.messaging.tools.ServerManagement;
-
-/**
- * Test spawning functionality of the ServerManagment. Used mostly in a clustered testing
- * environment.
- *
- * DO NOT extend ClusteringTestBase, I need direct control over start()/stop()!
- *
- * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- */
-public class ServerManagementTest extends MessagingTestCase
-{
- // Constants -----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public ServerManagementTest(String name)
- {
- super(name);
- }
-
- // Public --------------------------------------------------------
-
- public void testStartServer() throws Exception
- {
- ServerManagement.start(0, "all");
- ServerManagement.start(0, "all");
- }
-
- public void testSimpleSpawn() throws Exception
- {
- if (!ServerManagement.isRemote())
- {
- fail("This test must be run in remote mode!");
- }
-
- try
- {
- log.info("Starting server 7");
-
- ServerManagement.start(7, "all");
-
- Integer index = (Integer)ServerManagement.
- getAttribute(7, new ObjectName("jboss.messaging:service=ServerPeer"), "ServerPeerID");
-
- assertEquals(7, index.intValue());
-
- InitialContext ic = new InitialContext(ServerManagement.getJNDIEnvironment(7));
-
- ic.bind("/xxx", "yyy");
-
- assertEquals("yyy", ic.lookup("/xxx"));
- }
- finally
- {
- log.info("Killing server 7");
- ServerManagement.kill(7);
- }
- }
-
- public void testRessurect() throws Exception
- {
- if (!ServerManagement.isRemote())
- {
- fail("This test must be run in remote mode!");
- }
-
- try
- {
- ServerManagement.start(1, "all");
-
- ServerManagement.kill(1);
-
- // wait a bit for the server to die
-
- log.info("Sleeping for 10 seconds ...");
-
- Thread.sleep(10000);
-
- // resurrect the server
-
- ServerManagement.start(1, "all");
-
- Integer index = (Integer)ServerManagement.
- getAttribute(1, new ObjectName("jboss.messaging:service=ServerPeer"), "ServerPeerID");
-
- assertEquals(1, index.intValue());
-
- InitialContext ic = new InitialContext(ServerManagement.getJNDIEnvironment(1));
-
- ic.bind("/xxx", "yyy");
-
- assertEquals("yyy", ic.lookup("/xxx"));
- }
- finally
- {
- ServerManagement.kill(1);
- }
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- protected void setUp() throws Exception
- {
- super.setUp();
-
- log.debug("setup done");
- }
-
- protected void tearDown() throws Exception
- {
- super.tearDown();
-
- // TODO: clean up spawned servers
-
- }
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Modified: trunk/tests/src/org/jboss/test/messaging/jms/clustering/TemporaryDestinationTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/TemporaryDestinationTest.java 2007-08-06 18:11:35 UTC (rev 2961)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/TemporaryDestinationTest.java 2007-08-06 18:40:27 UTC (rev 2962)
@@ -42,7 +42,7 @@
*
* $Id$
*/
-public class TemporaryDestinationTest extends ClusteringTestBase
+public class TemporaryDestinationTest extends NewClusteringTestBase
{
// Constants ------------------------------------------------------------------------------------
@@ -223,24 +223,8 @@
nodeCount = 2;
super.setUp();
-
- log.debug("setup done");
}
- protected void tearDown() throws Exception
- {
- super.tearDown();
-
- for (int i = 0; i < nodeCount; i++)
- {
- if (ServerManagement.isStarted(i))
- {
- ServerManagement.log(ServerManagement.INFO, "Undeploying Server " + i, i);
- ServerManagement.stop(i);
- }
- }
- }
-
// Private --------------------------------------------------------------------------------------
// Inner classes --------------------------------------------------------------------------------
Modified: trunk/tests/src/org/jboss/test/messaging/jms/clustering/XAFailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/XAFailoverTest.java 2007-08-06 18:11:35 UTC (rev 2961)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/XAFailoverTest.java 2007-08-06 18:40:27 UTC (rev 2962)
@@ -38,7 +38,7 @@
* $Id$
*
*/
-public class XAFailoverTest extends ClusteringTestBase
+public class XAFailoverTest extends NewClusteringTestBase
{
// Constants ------------------------------------------------------------------------------------
@@ -91,15 +91,6 @@
{
tm.resume(suspended);
}
-
- for (int i = 0; i < nodeCount; i++)
- {
- if (ServerManagement.isStarted(i))
- {
- ServerManagement.log(ServerManagement.INFO, "Undeploying Server " + i, i);
- ServerManagement.stop(i);
- }
- }
}
public void testSimpleXAConnectionFailover() throws Exception
@@ -489,27 +480,24 @@
prod.send(sent1);
sess.close();
+
+ conn0.close();
+
+ conn1.close();
}
xaConn0.start();
xaConn1.start();
-
// register a failover listener
SimpleFailoverListener failoverListener = new SimpleFailoverListener();
((JBossConnection)xaConn1).registerFailoverListener(failoverListener);
-
-
-
-
-
+
tm.begin();
Transaction tx = tm.getTransaction();
-
-
-
+
//receive and send a message on each
// node 0
@@ -538,9 +526,7 @@
//Make sure the consumer is closed otherwise message might be sucked
cons0.close();
-
-
-
+
//node 1
XASession sess1 = xaConn1.createXASession();
@@ -566,9 +552,7 @@
prod1.send(msg1);
cons1.close();
-
-
-
+
tx.delistResource(res0, XAResource.TMSUCCESS);
tx.delistResource(res1, XAResource.TMSUCCESS);
@@ -661,7 +645,6 @@
conn.close();
}
}
-
}
finally
{
@@ -676,9 +659,6 @@
}
}
-
-
-
public void testSendAndReceiveFailAfterPrepareAndRetryCommit() throws Exception
{
XAConnection xaConn1 = null;
@@ -689,7 +669,6 @@
// Sending a messages
{
-
Connection conn1 = createConnectionOnServer(cf, 1);
assertEquals(1, getServerId(conn1));
@@ -707,7 +686,6 @@
conn1.close();
}
-
try
{
xaConn1 = createXAConnectionOnServer(xaCF, 1);
@@ -715,12 +693,10 @@
xaConn1.start();
-
// register a failover listener
SimpleFailoverListener failoverListener = new SimpleFailoverListener();
- ((JBossConnection)xaConn1).registerFailoverListener(failoverListener);
+ ((JBossConnection)xaConn1).registerFailoverListener(failoverListener);
-
XASession sess1 = xaConn1.createXASession();
XAResource res1 = sess1.getXAResource();
@@ -728,8 +704,7 @@
MessageProducer prod1 = sess1.createProducer(queue[1]);
MessageConsumer cons1 = sess1.createConsumer(queue[1]);
-
-
+
tm.begin();
Transaction tx = tm.getTransaction();
@@ -740,8 +715,7 @@
XAResource dummy = new DummyXAResource();
tx.enlistResource(dummy);
-
-
+
//receive a message
TextMessage received = (TextMessage)cons1.receive(2000);
@@ -903,6 +877,10 @@
prod.send(sent1);
sess.close();
+
+ conn0.close();
+
+ conn1.close();
}
try
@@ -956,8 +934,7 @@
//Make sure the consumer is closed otherwise message might be sucked
cons0.close();
-
-
+
//node 1
XASession sess1 = xaConn1.createXASession();
@@ -983,9 +960,7 @@
prod1.send(msg1);
cons1.close();
-
-
-
+
tx.delistResource(res0, XAResource.TMSUCCESS);
tx.delistResource(res1, XAResource.TMSUCCESS);
@@ -1095,8 +1070,6 @@
}
}
-
-
// Inner classes --------------------------------------------------------------------------------
static class DummyXAResource implements XAResource
@@ -1150,10 +1123,6 @@
public void start(Xid arg0, int arg1) throws XAException
{
-
- }
-
- }
-
-
+ }
+ }
}
More information about the jboss-cvs-commits
mailing list