[jboss-cvs] JBoss Messaging SVN: r6042 - in trunk/tests/jms-tests/src/org/jboss/test/messaging: jms and 6 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Mar 9 08:41:06 EDT 2009
Author: jmesnil
Date: 2009-03-09 08:41:05 -0400 (Mon, 09 Mar 2009)
New Revision: 6042
Removed:
trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/XAResourceRecoveryTest.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/ServiceAttributeOverrides.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/ServiceContainer.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/ServiceContainerConfiguration.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/StopRMIServer.java
Modified:
trunk/tests/jms-tests/src/org/jboss/test/messaging/JBMServerTestCase.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/MessagingTestCase.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/XATest.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/bridge/BridgeTestBase.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/message/JMSXDeliveryCountTest.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/stress/SeveralClientsStressTest.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/thirdparty/jbosssx/SecurityAssociationTest.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/ServerManagement.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/Server.java
Log:
test suite cleanup
* removed unused legacy code
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/JBMServerTestCase.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/JBMServerTestCase.java 2009-03-09 11:14:37 UTC (rev 6041)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/JBMServerTestCase.java 2009-03-09 12:41:05 UTC (rev 6042)
@@ -113,77 +113,48 @@
String banner =
"####################################################### Start " +
- (isRemote() ? "REMOTE" : "IN-VM") + " test: " + getName();
+ " test: " + getName();
log.info(banner);
-
+
try
{
//create any new server we need
- for (int i = servers.size(); i < getServerCount(); i++)
+ servers.add(ServerManagement.create(0));
+
+ //start the servers if needed
+ boolean started = false;
+ try
{
- servers.add(ServerManagement.create(i));
+ started = servers.get(0).isStarted();
}
- //kill off any servers we dont need anymore
- for (int i = getServerCount(); i < servers.size();)
+ catch (Exception e)
{
- try
- {
-
- servers.get(i).stop();
- }
- catch (Exception e)
- {
- //ignore, as it meay be remote and stopped anyway
- }
- servers.remove(i);
+ //ignore, incase its a remote server
}
- //start the servers if needed
- for (int i = 0; i < servers.size(); i++)
+ if (!started)
{
- boolean started = false;
- try
- {
- started = servers.get(i).isStarted();
- }
- catch (Exception e)
- {
- //ignore, incase its a remote server
- }
- if (!started)
- {
- if(i > getServerCount())
- {
- servers.get(i).stop();
- }
- else
- {
-// try
-// {
- servers.get(i).start(getContainerConfig(), getConfiguration(), i == 0);
-// }
-// catch (Exception e)
-// {
-// //if we are remote we will need recreating if we get here
-// servers.set(i, ServerManagement.create(i));
-// servers.get(i).start(getContainerConfig(), getConfiguration(), getClearDatabase() && i == 0);
-// }
- }
- //deploy the objects for this test
- deployAdministeredObjects(i);
- }
+ // try
+ // {
+ servers.get(0).start(getContainerConfig(), getConfiguration(), true);
+ // }
+ // catch (Exception e)
+ // {
+ // //if we are remote we will need recreating if we get here
+ // servers.set(i, ServerManagement.create(i));
+ // servers.get(i).start(getContainerConfig(), getConfiguration(), getClearDatabase() && i == 0);
+ // }
}
+ //deploy the objects for this test
+ deployAdministeredObjects(0);
lookUp();
}
catch (Exception e)
{
//if we get here we need to clean up for the next test
e.printStackTrace();
- for (int i = 0; i < getServerCount(); i++)
- {
- servers.get(i).stop();
- }
+ servers.get(0).stop();
throw e;
}
//empty the queues
@@ -197,25 +168,11 @@
checkNoSubscriptions(topic1);
checkNoSubscriptions(topic2);
checkNoSubscriptions(topic3);
-
- if (isRemote())
- {
- // log the test start in the remote log, this will make hunting through logs so much easier
- ServerManagement.log(ServerManagement.INFO, banner);
- }
}
- protected boolean isRemote()
- {
- return ServerManagement.isRemote();
- }
-
public void stop() throws Exception
{
- for (int i = 0; i < getServerCount(); i++)
- {
- servers.get(i).stop();
- }
+ servers.get(0).stop();
}
public String getContextFactory()
@@ -226,38 +183,26 @@
public void start() throws Exception
{
System.setProperty("java.naming.factory.initial", getContextFactory());
- for (int i = 0; i < getServerCount(); i++)
- {
- servers.get(i).start(getContainerConfig(), getConfiguration(), i != 0);
- }
+ servers.get(0).start(getContainerConfig(), getConfiguration(), false);
//deployAdministeredObjects();
}
public void startNoDelete() throws Exception
{
System.setProperty("java.naming.factory.initial", getContextFactory());
- for (int i = 0; i < getServerCount(); i++)
- {
- servers.get(i).start(getContainerConfig(), getConfiguration(), false);
- }
+ servers.get(0).start(getContainerConfig(), getConfiguration(), false);
//deployAdministeredObjects();
}
public void stopServerPeer() throws Exception
{
- for (int i = 0; i < getServerCount(); i++)
- {
- servers.get(i).stopServerPeer();
- }
+ servers.get(0).stopServerPeer();
}
public void startServerPeer() throws Exception
{
System.setProperty("java.naming.factory.initial", getContextFactory());
- for (int i = 0; i < getServerCount(); i++)
- {
- servers.get(i).startServerPeer(i);
- }
+ servers.get(0).startServerPeer(0);
//deployAdministeredObjects();
}
@@ -381,11 +326,6 @@
}
}
- public int getServerCount()
- {
- return 1;
- }
-
public InitialContext getInitialContext() throws Exception
{
return getInitialContext(0);
@@ -424,34 +364,22 @@
public void createQueue(String name) throws Exception
{
- for (int i = 0; i < getServerCount(); i++)
- {
- servers.get(i).createQueue(name, null);
- }
+ servers.get(0).createQueue(name, null);
}
public void createTopic(String name) throws Exception
{
- for (int i = 0; i < getServerCount(); i++)
- {
- servers.get(i).createTopic(name, null);
- }
+ servers.get(0).createTopic(name, null);
}
public void destroyQueue(String name) throws Exception
{
- for (int i = 0; i < getServerCount(); i++)
- {
- servers.get(i).destroyQueue(name, null);
- }
+ servers.get(0).destroyQueue(name, null);
}
public void destroyTopic(String name) throws Exception
{
- for (int i = 0; i < getServerCount(); i++)
- {
- servers.get(i).destroyTopic(name, null);
- }
+ servers.get(0).destroyTopic(name, null);
}
@@ -629,17 +557,14 @@
protected void removeAllMessages(String destName, boolean isQueue) throws Exception
{
- for (int i = 0; i < getServerCount(); i++)
+ try
{
- try
- {
- removeAllMessages(destName, isQueue, i);
- }
- catch (Exception e)
- {
- log.info("did not clear messages for " + destName);
- }
+ removeAllMessages(destName, isQueue, 0);
}
+ catch (Exception e)
+ {
+ log.info("did not clear messages for " + destName);
+ }
}
protected void removeAllMessages(String destName, boolean isQueue, int server) throws Exception
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/MessagingTestCase.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/MessagingTestCase.java 2009-03-09 11:14:37 UTC (rev 6041)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/MessagingTestCase.java 2009-03-09 12:41:05 UTC (rev 6042)
@@ -22,7 +22,6 @@
package org.jboss.test.messaging;
import org.jboss.messaging.core.logging.Logger;
-import org.jboss.test.messaging.tools.ServerManagement;
import org.jboss.test.messaging.util.ProxyAssertSupport;
/**
@@ -61,41 +60,20 @@
String banner =
"####################################################### Start " +
- (isRemote() ? "REMOTE" : "IN-VM") + " test: " + getName();
+ " test: " + getName();
log.info(banner);
-
- if (isRemote())
- {
- // log the test start in the remote log, this will make hunting through logs so much easier
- ServerManagement.log(ServerManagement.INFO, banner);
- }
}
protected void tearDown() throws Exception
{
String banner =
"####################################################### Stop " +
- (isRemote() ? "REMOTE" : "IN-VM") + " test: " + getName();
+ " test: " + getName();
- log.info(banner);
-
- if (isRemote())
- {
- // log the test stop in the remote log, this will make hunting through logs so much easier
- ServerManagement.log(ServerManagement.INFO, banner);
- }
+ log.info(banner);
}
- /**
- * @return true if this test is ran in "remote" mode, i.e. the server side of the test runs in a
- * different VM than this one (that is running the client side)
- */
- protected boolean isRemote()
- {
- return ServerManagement.isRemote();
- }
-
// Private -------------------------------------------------------
// Inner classes -------------------------------------------------
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java 2009-03-09 11:14:37 UTC (rev 6041)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/CTSMiscellaneousTest.java 2009-03-09 12:41:05 UTC (rev 6042)
@@ -40,7 +40,6 @@
import org.jboss.messaging.jms.client.JBossConnectionFactory;
import org.jboss.messaging.utils.Pair;
import org.jboss.test.messaging.JBMServerTestCase;
-import org.jboss.test.messaging.tools.container.ServiceAttributeOverrides;
/**
* Safeguards for previously detected TCK failures.
@@ -60,8 +59,6 @@
// Attributes ----------------------------------------------------
protected static JBossConnectionFactory cf;
- protected ServiceAttributeOverrides overrides;
-
private static final String ORG_JBOSS_MESSAGING_SERVICE_LBCONNECTION_FACTORY = "StrictTCKConnectionFactory";
// Constructors --------------------------------------------------
Deleted: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/XAResourceRecoveryTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/XAResourceRecoveryTest.java 2009-03-09 11:14:37 UTC (rev 6041)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/XAResourceRecoveryTest.java 2009-03-09 12:41:05 UTC (rev 6042)
@@ -1,452 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * 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.test.messaging.jms;
-
-import javax.jms.Queue;
-import javax.naming.InitialContext;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
-import com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple;
-
-import org.jboss.messaging.jms.client.JBossConnectionFactory;
-import org.jboss.test.messaging.JBMServerTestCase;
-import org.jboss.test.messaging.tools.ServerManagement;
-import org.jboss.test.messaging.tools.container.ServiceContainer;
-import org.jboss.tm.TxUtils;
-
-/**
- *
- * A XAResourceRecoveryTest
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @version <tt>$Revision: 1.1 $</tt>
- *
- * $Id$
- *
- */
-public class XAResourceRecoveryTest extends JBMServerTestCase
-{
- protected ServiceContainer sc;
-
- protected JBossConnectionFactory cf1;
-
- protected TransactionManager tm;
-
- protected Transaction suspendedTx;
-
- protected static Queue otherQueue;
-
- public int getServerCount()
- {
- return 2;
- }
-
- protected void setUp() throws Exception
- {
- super.setUp();
-
- // 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
-
- if (ServerManagement.isRemote())
- {
- tm = new TransactionManagerImple();
- }
- else
- {
- InitialContext localIc = getInitialContext();
-
- tm = (TransactionManager)localIc.lookup(ServiceContainer.TRANSACTION_MANAGER_JNDI_NAME);
- }
-
- assertTrue(tm instanceof TransactionManagerImple);
-
- createQueue("OtherQueue", 1);
-
- //Hashtable props1 = ServerManagement.getJNDIEnvironment(1);
-
- InitialContext ic1 = getInitialContext(1);
-
- cf1 = (JBossConnectionFactory) ic1.lookup("/XAConnectionFactory");
-
- otherQueue = (Queue) ic1.lookup("/queue/OtherQueue");
-
- checkOtherQueueEmpty();
-
- // Now install local JMSProviderAdaptor classes
-
- //Properties p1 = new Properties();
- //p1.putAll(ServerManagement.getJNDIEnvironment(1));
-
- /*JMSProviderAdapter targetAdaptor = new TestJMSProviderAdaptor(p1,
- "/XAConnectionFactory", "adaptor1");
-
- sc.installJMSProviderAdaptor("adaptor1", targetAdaptor);
-*/
- //sc.startRecoveryManager();
-
- suspendedTx = tm.suspend();
- }
-
- public void tearDown() throws Exception
- {
- try
- {
- destroyQueue("OtherQueue", 1);
- } catch (Exception ignore)
- {
- }
-
- if (TxUtils.isUncommitted(tm))
- {
- // roll it back
- try
- {
- tm.rollback();
- } catch (Throwable ignore)
- {
- // The connection will probably be closed so this may well throw an
- // exception
- }
- }
- if (tm.getTransaction() != null)
- {
- Transaction tx = tm.suspend();
- if (tx != null)
- log.warn("Transaction still associated with thread " + tx
- + " at status " + TxUtils.getStatusAsString(tx.getStatus()));
- }
-
- if (suspendedTx != null)
- {
- tm.resume(suspendedTx);
- }
-
- super.tearDown();
- }
-
- // poison is not available.. commenting out the test
- // TODO Review this test
-// public void testRecoveryOnSend() throws Exception
-// {
-// XAConnection conn0 = null;
-//
-// XAConnection conn1 = null;
-//
-// Connection conn2 = null;
-//
-// Connection conn3 = null;
-//
-// try
-// {
-// conn0 = getConnectionFactory().createXAConnection();
-//
-// XASession sess0 = conn0.createXASession();
-//
-// MessageProducer prod0 = sess0.createProducer(queue1);
-//
-// XAResource res0 = sess0.getXAResource();
-//
-// conn1 = cf1.createXAConnection();
-//
-// XASession sess1 = conn1.createXASession();
-//
-// MessageProducer prod1 = sess1.createProducer(otherQueue);
-//
-// XAResource res1 = sess1.getXAResource();
-//
-// tm.begin();
-//
-// Transaction tx = tm.getTransaction();
-//
-// tx.enlistResource(res0);
-//
-// tx.enlistResource(res1);
-//
-// TextMessage tm0 = sess0.createTextMessage("message0");
-//
-// prod0.send(tm0);
-//
-// TextMessage tm1 = sess1.createTextMessage("message1");
-//
-// prod1.send(tm1);
-//
-// // Poison server 1 so it crashes on commit of dest but after prepare
-//
-// // This means the transaction branch on source will get commmitted
-// // but the branch on dest won't be - it will remain prepared
-// // This corresponds to a HeuristicMixedException
-//
-// poisonTheServer(1, PoisonInterceptor.TYPE_2PC_COMMIT);
-//
-// tx.delistResource(res0, XAResource.TMSUCCESS);
-//
-// tx.delistResource(res1, XAResource.TMSUCCESS);
-//
-// tx.commit();
-//
-// conn0.close();
-//
-// conn1.close();
-//
-// // Now restart the server
-//
-// //ServerManagement.start(1, "all", false);
-//
-// deployQueue("OtherQueue", 1);
-//
-// //Hashtable props1 = ServerManagement.getJNDIEnvironment(1);
-//
-// InitialContext ic1 = getInitialContext();
-//
-// cf1 = (JBossConnectionFactory) ic1.lookup("/XAConnectionFactory");
-//
-// otherQueue = (Queue) ic1.lookup("/queue/OtherQueue");
-//
-// conn2 = getConnectionFactory().createConnection();
-//
-// Session sess2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
-//
-// MessageConsumer cons2 = sess2.createConsumer(queue1);
-//
-// conn2.start();
-//
-// TextMessage rm0 = (TextMessage) cons2.receive(2000);
-//
-// assertNotNull(rm0);
-//
-// assertEquals(tm0.getText(), rm0.getText());
-//
-// checkEmpty(queue1);
-//
-// // Now even though the commit on the second server failed since the
-// // server was dead, the recovery manager should kick in
-// // eventually and recover it.
-//
-// conn3 = cf1.createConnection();
-//
-// Session sess3 = conn3.createSession(false, Session.AUTO_ACKNOWLEDGE);
-//
-// MessageConsumer cons3 = sess3.createConsumer(otherQueue);
-//
-// conn3.start();
-//
-// TextMessage rm1 = (TextMessage) cons3.receive(60000);
-//
-// assertNotNull(rm1);
-//
-// assertEquals(tm1.getText(), rm1.getText());
-//
-// checkOtherQueueEmpty();
-// }
-// finally
-// {
-// if (conn0 != null)
-// {
-// conn0.close();
-// }
-// if (conn1 != null)
-// {
-// conn1.close();
-// }
-// if (conn2 != null)
-// {
-// conn2.close();
-// }
-// if (conn3 != null)
-// {
-// conn3.close();
-// }
-// }
-// }
-//
-// public void testRecoveryOnAck() throws Exception
-// {
-// XAConnection conn0 = null;
-//
-// XAConnection conn1 = null;
-//
-// Connection conn2 = null;
-//
-// Connection conn3 = null;
-//
-// try
-// {
-// conn0 = getConnectionFactory().createXAConnection();
-//
-// XASession sess0 = conn0.createXASession();
-//
-// MessageProducer prod0 = sess0.createProducer(queue1);
-//
-// XAResource res0 = sess0.getXAResource();
-//
-// conn1 = cf1.createXAConnection();
-//
-// XASession sess1 = conn1.createXASession();
-//
-// MessageConsumer cons1 = sess1.createConsumer(otherQueue);
-//
-// XAResource res1 = sess1.getXAResource();
-//
-// conn1.start();
-//
-// // first send a few messages to server 1
-//
-// conn2 = cf1.createConnection();
-//
-// Session sess2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
-//
-// MessageProducer prod2 = sess2.createProducer(otherQueue);
-//
-// TextMessage tm1 = sess1.createTextMessage("message1");
-//
-// prod2.send(tm1);
-//
-// TextMessage tm2 = sess1.createTextMessage("message2");
-//
-// prod2.send(tm2);
-//
-// conn2.close();
-//
-// tm.begin();
-//
-// Transaction tx = tm.getTransaction();
-//
-// tx.enlistResource(res0);
-//
-// tx.enlistResource(res1);
-//
-// TextMessage tm0 = sess0.createTextMessage("message0");
-//
-// prod0.send(tm0);
-//
-// // Consume one of the messages on dest
-//
-// TextMessage rm1 = (TextMessage) cons1.receive(1000);
-//
-// assertNotNull(rm1);
-//
-// assertEquals(tm1.getText(), rm1.getText());
-//
-// // Poison server 1 so it crashes on commit of dest but after prepare
-//
-// // This means the transaction branch on source will get commmitted
-// // but the branch on dest won't be - it will remain prepared
-// // This corresponds to a HeuristicMixedException
-//
-// ServerManagement.poisonTheServer(1, PoisonInterceptor.TYPE_2PC_COMMIT);
-//
-// tx.delistResource(res0, XAResource.TMSUCCESS);
-//
-// tx.delistResource(res1, XAResource.TMSUCCESS);
-//
-// tx.commit();
-//
-// conn0.close();
-//
-// conn1.close();
-//
-// // Now restart the server
-//
-// //ServerManagement.start(1, "all", false);
-//
-// deployQueue("OtherQueue");
-//
-// //Hashtable props1 = getInitialContext();
-//
-// InitialContext ic1 = getInitialContext();
-//
-// cf1 = (JBossConnectionFactory) ic1.lookup("/XAConnectionFactory");
-//
-// otherQueue = (Queue) ic1.lookup("/queue/OtherQueue");
-//
-// conn2 = getConnectionFactory().createConnection();
-//
-// sess2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
-//
-// MessageConsumer cons2 = sess2.createConsumer(queue1);
-//
-// conn2.start();
-//
-// TextMessage rm0 = (TextMessage) cons2.receive(2000);
-//
-// assertNotNull(rm0);
-//
-// assertEquals(tm0.getText(), rm0.getText());
-//
-// checkEmpty(queue1);
-//
-// // Now even though the commit on the second server failed since the
-// // server was dead, the recovery manager should kick in
-// // eventually and recover it.
-//
-// conn3 = ((ConnectionFactory) cf1).createConnection();
-//
-// Session sess3 = conn3.createSession(false, Session.AUTO_ACKNOWLEDGE);
-//
-// MessageConsumer cons3 = sess3.createConsumer(otherQueue);
-//
-// conn3.start();
-//
-// TextMessage rm2 = (TextMessage) cons3.receive(60000);
-//
-// assertNotNull(rm2);
-//
-// // tm1 should have been acked on recovery
-//
-// assertEquals(tm2.getText(), rm2.getText());
-//
-// checkOtherQueueEmpty();
-// }
-// finally
-// {
-// if (conn0 != null)
-// {
-// conn0.close();
-// }
-// if (conn1 != null)
-// {
-// conn1.close();
-// }
-// if (conn2 != null)
-// {
-// conn2.close();
-// }
-// if (conn3 != null)
-// {
-// conn3.close();
-// }
-// }
-// }
-
- private void checkOtherQueueEmpty() throws Exception
- {
-
- Integer messageCount = getMessageCountForQueue("OtherQueue", 1);
-
- assertEquals(0, messageCount.intValue());
- }
-}
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/XATest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/XATest.java 2009-03-09 11:14:37 UTC (rev 6041)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/XATest.java 2009-03-09 12:41:05 UTC (rev 6042)
@@ -48,9 +48,7 @@
import org.jboss.messaging.core.client.impl.ClientSessionImpl;
import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.transaction.impl.XidImpl;
import org.jboss.test.messaging.JBMServerTestCase;
-import org.jboss.test.messaging.tools.ServerManagement;
import org.jboss.tm.TxUtils;
/**
@@ -97,10 +95,7 @@
assertTrue(tm instanceof TransactionManagerImple);
- if (!ServerManagement.isRemote())
- {
- suspendedTx = tm.suspend();
- }
+ suspendedTx = tm.suspend();
}
public void tearDown() throws Exception
@@ -134,93 +129,6 @@
// Public --------------------------------------------------------
-
- // See http://jira.jboss.org/jira/browse/JBMESSAGING-825
- // Need to test that ids with trailing zeros are dealt with properly - sybase has the habit
- // of truncating trailing zeros in varbinary columns
- public void testXidsWithTrailingZeros() throws Exception
- {
- if (!ServerManagement.isRemote())
- {
- return;
- }
-
- XAConnection conn1 = null;
-
- try
- {
- conn1 = xacf.createXAConnection();
-
- XASession sess1 = conn1.createXASession();
-
- XAResource res1 = sess1.getXAResource();
-
- byte[] branchQualifier = new byte[] { 1, 2, 3, 4, 5, 6, 0, 0, 0, 0 };
-
- byte[] globalTxId = new byte[] { 6, 5, 4, 3, 2, 1, 0, 0, 0, 0 };
-
- Xid trailing = new XidImpl(branchQualifier, 12435, globalTxId);
-
- res1.start(trailing, XAResource.TMNOFLAGS);
-
- MessageProducer prod1 = sess1.createProducer(queue1);
-
- TextMessage tm1 = sess1.createTextMessage("testing1");
-
- prod1.send(tm1);
-
- res1.end(trailing, XAResource.TMSUCCESS);
-
- res1.prepare(trailing);
-
- //Now "crash" the server
-
- stopServerPeer();
-
- startServerPeer();
-
- deployAndLookupAdministeredObjects();
-
- conn1.close();
-
- conn1 = xacf.createXAConnection();
-
- XAResource res = conn1.createXASession().getXAResource();
-
- Xid[] xids = res.recover(XAResource.TMSTARTRSCAN);
- assertEquals(1, xids.length);
-
- Xid[] xids2 = res.recover(XAResource.TMENDRSCAN);
- assertEquals(0, xids2.length);
-
- Xid trailing2 = xids[0];
-
- assertTrue(trailing.getFormatId() == trailing2.getFormatId());
-
- assertEqualByteArrays(trailing.getGlobalTransactionId(), trailing2.getGlobalTransactionId());
-
- assertEqualByteArrays(trailing.getBranchQualifier(), trailing2.getBranchQualifier());
-
- res.commit(trailing, false);
- }
- finally
- {
- removeAllMessages(queue1.getQueueName(), true, 0);
-
- if (conn1 != null)
- {
- try
- {
- conn1.close();
- }
- catch (Exception e)
- {
- //Ignore
- }
- }
- }
- }
-
public void test2PCSendCommit1PCOptimization() throws Exception
{
//Since both resources have same RM, TM will probably use 1PC optimization
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/bridge/BridgeTestBase.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/bridge/BridgeTestBase.java 2009-03-09 11:14:37 UTC (rev 6041)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/bridge/BridgeTestBase.java 2009-03-09 12:41:05 UTC (rev 6042)
@@ -45,7 +45,6 @@
import org.jboss.messaging.jms.bridge.impl.JNDIDestinationFactory;
import org.jboss.test.messaging.JBMServerTestCase;
import org.jboss.test.messaging.tools.ServerManagement;
-import org.jboss.test.messaging.tools.container.ServiceContainer;
/**
*
@@ -61,8 +60,6 @@
{
private static final Logger log = Logger.getLogger(BridgeTestBase.class);
- protected static ServiceContainer sc;
-
protected static ConnectionFactoryFactory cff0, cff1;
protected static ConnectionFactory cf0, cf1;
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/message/JMSXDeliveryCountTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/message/JMSXDeliveryCountTest.java 2009-03-09 11:14:37 UTC (rev 6041)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/message/JMSXDeliveryCountTest.java 2009-03-09 12:41:05 UTC (rev 6042)
@@ -31,7 +31,6 @@
import javax.jms.XAConnection;
import javax.jms.XAConnectionFactory;
import javax.jms.XASession;
-import javax.naming.InitialContext;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
import javax.transaction.xa.XAException;
@@ -41,7 +40,6 @@
import com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple;
import org.jboss.test.messaging.JBMServerTestCase;
-import org.jboss.test.messaging.tools.ServerManagement;
/**
*
@@ -491,18 +489,7 @@
XAConnection xaConn = null;
Connection conn = null;
- TransactionManager mgr;
- if (ServerManagement.isRemote())
- {
- mgr = new TransactionManagerImple();
- }
- else
- {
- InitialContext localIc = getInitialContext();
-
- mgr = new TransactionManagerImple();
- //getTransactionManager();
- }
+ TransactionManager mgr = new TransactionManagerImple();
Transaction toResume = null;
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/stress/SeveralClientsStressTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/stress/SeveralClientsStressTest.java 2009-03-09 11:14:37 UTC (rev 6041)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/stress/SeveralClientsStressTest.java 2009-03-09 12:41:05 UTC (rev 6042)
@@ -219,7 +219,7 @@
if (startServer)
{
- ServerManagement.start(0, "all", null, true);
+ ServerManagement.start(0, "all", true);
createQueue("testQueue");
}
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/thirdparty/jbosssx/SecurityAssociationTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/thirdparty/jbosssx/SecurityAssociationTest.java 2009-03-09 11:14:37 UTC (rev 6041)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/thirdparty/jbosssx/SecurityAssociationTest.java 2009-03-09 12:41:05 UTC (rev 6042)
@@ -67,11 +67,6 @@
*/
public void testSecurityAssociation() throws Exception
{
- if(ServerManagement.isRemote())
- {
- fail("This test is supposed to be run in a local configuration");
- }
-
Principal nabopolassar = new SimplePrincipal("nabopolassar");
Set principals = new HashSet();
principals.add(nabopolassar);
@@ -140,11 +135,6 @@
*/
public void testGuestAuthorizedSend() throws Exception
{
- if(ServerManagement.isRemote())
- {
- fail("This test is supposed to be run in a local configuration");
- }
-
MockJBossSecurityManager sm =
(MockJBossSecurityManager)ic.lookup(MockJBossSecurityManager.TEST_SECURITY_DOMAIN);
assertTrue(sm.isSimulateJBossJaasSecurityManager());
@@ -216,11 +206,6 @@
*/
public void testAuthorizedSend() throws Exception
{
- if(ServerManagement.isRemote())
- {
- fail("This test is supposed to be run in a local configuration");
- }
-
MockJBossSecurityManager sm =
(MockJBossSecurityManager)ic.lookup(MockJBossSecurityManager.TEST_SECURITY_DOMAIN);
assertTrue(sm.isSimulateJBossJaasSecurityManager());
@@ -289,11 +274,6 @@
protected void setUp() throws Exception
{
- if (ServerManagement.isRemote())
- {
- fail("This test is supposed to be run in a local configuration");
- }
-
super.setUp();
final String secureQueueConfig =
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/ServerManagement.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/ServerManagement.java 2009-03-09 11:14:37 UTC (rev 6041)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/ServerManagement.java 2009-03-09 12:41:05 UTC (rev 6042)
@@ -21,21 +21,16 @@
*/
package org.jboss.test.messaging.tools;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
import java.rmi.Naming;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
-import org.jboss.kernel.spi.deployment.KernelDeployment;
import org.jboss.messaging.core.logging.Logger;
import org.jboss.test.messaging.tools.container.InVMInitialContextFactory;
import org.jboss.test.messaging.tools.container.LocalTestServer;
import org.jboss.test.messaging.tools.container.RMITestServer;
-import org.jboss.test.messaging.tools.container.RemoteInitialContextFactory;
import org.jboss.test.messaging.tools.container.Server;
-import org.jboss.test.messaging.tools.container.ServiceAttributeOverrides;
/**
@@ -52,8 +47,6 @@
{
// Constants -----------------------------------------------------
- public static final int MAX_SERVER_COUNT = 10;
-
// logging levels used by the remote client to forward log output on a remote server
public static int FATAL = 0;
public static int ERROR = 1;
@@ -71,70 +64,26 @@
private static List<Server> servers = new ArrayList<Server>();
- public static boolean isLocal()
- {
- return !"true".equals(System.getProperty("remote"));
- }
-
- public static boolean isRemote()
- {
- return !isLocal();
- }
-
- public static boolean isClustered()
- {
- return "true".equals(System.getProperty("test.clustered"));
- }
-
-
/**
- * May return null if the corresponding server is not initialized.
- */
- public synchronized static Server getServer(int i)
- {
- return servers.get(i);
- }
-
-
- /**
* Makes sure that a "hollow" TestServer (either local or remote, depending on the nature of the
* test), exists and it's ready to be started.
*/
public static synchronized Server create(int i) throws Exception
{
- if (isLocal())
- {
- log.info("Attempting to create local server " + i);
- return new LocalTestServer(i);
- }
- else
- {
- //Need to spawn a new server - we DON'T use start-rmi-server any more, so we know if the servers[i] is null
- //the server is not there - killing a server sets servers[i] to null
- log.info("Attempting to create remote server " + i);
- return ServerManagement.spawn(i);
- }
-
+ log.info("Attempting to create local server " + i);
+ return new LocalTestServer(i);
}
public static void start(int i, String config, boolean clearDatabase) throws Exception
{
- start(i, config, null, clearDatabase);
+ start(i, config, clearDatabase, true);
}
- public static void start(int i, String config,
- ServiceAttributeOverrides attrOverrides,
- boolean clearDatabase) throws Exception
- {
- start(i, config, attrOverrides, clearDatabase, true);
- }
-
/**
* When this method correctly completes, the server (local or remote) is started and fully
* operational (the service container and the server peer are created and started).
*/
public static void start(int i, String config,
- ServiceAttributeOverrides attrOverrides,
boolean clearDatabase,
boolean startMessagingServer) throws Exception
{
@@ -157,21 +106,9 @@
public static void stop() throws Exception
{
- stop(0);
+ servers.get(0).stop();
}
- /**
- * The method stops the local or remote server, bringing it to a "hollow" state. A stopped
- * server is identical with a server that has just been created, but not started.
- *
- * @return true if the server was effectively stopped, or false if the server was alreayd stopped
- * when the method was invoked.
- */
- public static boolean stop(int i) throws Exception
- {
- return servers.get(i).stop();
- }
-
public static synchronized void kill(int i) throws Exception
{
log.info("Attempting to kill server " + i);
@@ -262,266 +199,6 @@
return destroyed;
}
- /**
- * For a local test, is a noop, but for a remote test, the method call spawns a new VM
- */
- private static synchronized Server spawn(final int i) throws Exception
- {
- if (isLocal())
- {
- return null;
- }
-
- StringBuffer sb = new StringBuffer();
-
- sb.append("java").append(' ');
-
- sb.append("-Xmx512M").append(' ');
-
- String remoteDebugIndex = "";//System.getProperty("test.remote.debug.index");
- if (remoteDebugIndex != null)
- {
- //sb.append("-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5006 ");
- }
-
-
- String objectStoreDir = System.getProperty("objectstore.dir");
-
- if (objectStoreDir != null)
- {
- sb.append("-Dobjectstore.dir=" + objectStoreDir).append(" ");
- }
-
- String moduleOutput = System.getProperty("module.output");
- if (moduleOutput == null)
- {
- moduleOutput = "./output";
- }
-
- sb.append("-Dmodule.output=").append(moduleOutput).append(' ');
-
- String bindAddress = System.getProperty("test.bind.address");
- if (bindAddress == null)
- {
- bindAddress = "localhost";
- }
-
- sb.append("-Dtest.bind.address=").append(bindAddress).append(' ');
-
- //Use test.bind.address for the jgroups.bind_addr
-
- String jgroupsBindAddr = bindAddress;
-
- sb.append("-D").append("jgroups.bind_addr").append("=")
- .append(jgroupsBindAddr).append(' ');
-
- String database = System.getProperty("test.database");
- if (database != null)
- {
- sb.append("-Dtest.database=").append(database).append(' ');
- }
-
- String serialization = System.getProperty("test.serialization");
- if (serialization != null)
- {
- sb.append("-Dtest.serialization=").append(serialization).append(' ');
- }
-
- sb.append("-Dtest.server.index=").append(i).append(' ');
-
- String clustered = System.getProperty("test.clustered");
- if (clustered != null && clustered.trim().length() == 0)
- {
- clustered = null;
- }
- if (clustered != null)
- {
- sb.append("-Dtest.clustered=").append(clustered).append(' ');
- }
-
- String remoting = System.getProperty("test.remoting");
- if (remoting != null)
- {
- sb.append("-Dtest.remoting=").append(remoting).append(' ');
- }
-
- String groupName = System.getProperty("jboss.messaging.groupname");
- log.info("******* GROUP NAME IS " + groupName);
- if (groupName != null)
- {
- sb.append("-Djboss.messaging.groupname=").append(groupName).append(' ');
- }
-
- String dataChannelUDPPort = System.getProperty("jboss.messaging.datachanneludpport");
- log.info("*** data UDP port is " + dataChannelUDPPort);
- if (dataChannelUDPPort != null)
- {
- sb.append("-Djboss.messaging.datachanneludpport=").append(dataChannelUDPPort).append(' ');
- }
-
- String controlChannelUDPPort = System.getProperty("jboss.messaging.controlchanneludpport");
- log.info("*** control UDP port is " + controlChannelUDPPort);
- if (controlChannelUDPPort != null)
- {
- sb.append("-Djboss.messaging.controlchanneludpport=").append(controlChannelUDPPort).append(' ');
- }
-
- String dataChannelUDPAddress = System.getProperty("jboss.messaging.datachanneludpaddress");
- log.info("*** data UDP address is " + dataChannelUDPAddress);
- if (dataChannelUDPAddress != null)
- {
- sb.append("-Djboss.messaging.datachanneludpaddress=").append(dataChannelUDPAddress).append(' ');
- }
-
- String controlChannelUDPAddress = System.getProperty("jboss.messaging.controlchanneludpaddress");
- log.info("*** control UDP address is " + controlChannelUDPAddress);
- if (controlChannelUDPAddress != null)
- {
- sb.append("-Djboss.messaging.controlchanneludpaddress=").append(controlChannelUDPAddress).append(' ');
- }
-
- sb.append("-Djava.naming.factory.initial=org.jboss.test.messaging.tools.container.InVMInitialContextFactory ");
- String ipttl = System.getProperty("jboss.messaging.ipttl");
- log.info("*** ip_ttl is " + ipttl);
- if (ipttl != null)
- {
- sb.append("-Djboss.messaging.ipttl=").append(ipttl).append(' ');
- }
-
- String testLogfileSuffix = System.getProperty("test.logfile.suffix");
-
- if (testLogfileSuffix == null)
- {
- testLogfileSuffix = "undefined-test-type";
- }
- else
- {
- int pos;
- if ((pos = testLogfileSuffix.lastIndexOf("client")) != -1)
- {
- testLogfileSuffix = testLogfileSuffix.substring(0, pos) + "server";
- }
-
- // We need to add the i even in the non manageConfirmations case since we can have multiple
- // non manageConfirmations servers
- testLogfileSuffix += i;
- }
-
- sb.append("-Dtest.logfile.suffix=").append(testLogfileSuffix).append(' ');
-
- String classPath = System.getProperty("java.class.path");
-
- if (System.getProperty("os.name").equals("Linux"))
- {
- sb.append("-cp").append(" ").append(classPath).append(" ");
- }
- else
- {
- sb.append("-cp").append(" \"").append(classPath).append("\" ");
- }
-
- // As there is a problem with Multicast and JGroups on Linux (in certain JDKs)
- // The stack introduced by multiplexer might fail under Linux if we don't have this
- if (System.getProperty("os.name").equals("Linux"))
- {
- sb.append(" -Djava.net.preferIPv4Stack=true ");
- }
-
- sb.append("org.jboss.test.messaging.tools.container.RMITestServer");
-
- String commandLine = sb.toString();
-
- Process process = Runtime.getRuntime().exec(commandLine);
-
- log.trace("process: " + process);
-
- // if you ever need to debug the spawing process, turn this flag to true:
-
- String parameterVerbose = "true";//System.getProperty("test.spawn.verbose");
- final boolean verbose = parameterVerbose != null && parameterVerbose.equals("true");
-
- final BufferedReader rs = new BufferedReader(new InputStreamReader(process.getInputStream()));
- final BufferedReader re = new BufferedReader(new InputStreamReader(process.getErrorStream()));
-
- new Thread(new Runnable()
- {
- public void run()
- {
- try
- {
- String line;
-
- while ((line = rs.readLine()) != null)
- {
- if (verbose)
- {
- System.out.println("SERVER " + i + " STDOUT: " + line);
- }
- }
- }
- catch (Exception e)
- {
- log.error("exception", e);
- }
- }
-
- }, "Server " + i + " STDOUT reader thread").start();
-
- new Thread(new Runnable()
- {
- public void run()
- {
- try
- {
- String line;
-
- while ((line = re.readLine()) != null)
- {
- if (verbose)
- {
- System.out.println("SERVER " + i + " STDERR: " + line);
- }
- }
- }
- catch (Exception e)
- {
- log.error("exception", e);
- }
- }
-
- }, "Server " + i + " STDERR reader thread").start();
-
- // put the invoking thread on wait until the server is actually up and running and bound
- // in the RMI registry
-
- log.info("spawned server " + i + ", waiting for it to come online");
-
- Server s = acquireRemote(500, i, true);
-
- log.info("Server contacted");
-
- if (s == null)
- {
- log.error("Cannot contact newly spawned server " + i + ", most likely the attempt failed, timing out ...");
- throw new Exception("Cannot contact newly spawned server " + i + ", most likely the attempt failed, timing out ...");
- }
-
- return s;
- }
-
-
- public static KernelDeployment deploy(String resource) throws Throwable
- {
-
- return servers.get(0).deploy(resource);
- }
-
- public static void undeploy(KernelDeployment on) throws Throwable
- {
-
- servers.get(0).undeploy(on);
- }
-
public static void log(int level, String text)
{
log(level, text, 0);
@@ -529,24 +206,14 @@
public static void log(int level, String text, int index)
{
- if (isRemote())
+ try
{
- if (servers.get(index) == null)
- {
- log.debug("The remote server " + index + " has not been created yet " +
- "so this log won't make it to the server!");
- return;
- }
-
- try
- {
- servers.get(index).log(level, text);
- }
- catch (Exception e)
- {
- log.error("failed to forward the logging request to the remote server", e);
- }
+ servers.get(0).log(level, text);
}
+ catch (Exception e)
+ {
+ log.error("failed to forward the logging request to the remote server", e);
+ }
}
public static void startServerPeer() throws Exception
@@ -588,14 +255,7 @@
public static Hashtable getJNDIEnvironment(int serverIndex)
{
- if (isLocal())
- {
- return InVMInitialContextFactory.getJNDIEnvironment(serverIndex);
- }
- else
- {
- return RemoteInitialContextFactory.getJNDIEnvironment(serverIndex);
- }
+ return InVMInitialContextFactory.getJNDIEnvironment(serverIndex);
}
public static Server acquireRemote(int initialRetries, int index, boolean quiet)
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java 2009-03-09 11:14:37 UTC (rev 6041)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java 2009-03-09 12:41:05 UTC (rev 6042)
@@ -40,7 +40,6 @@
import javax.management.ObjectName;
import javax.naming.InitialContext;
-import org.jboss.kernel.spi.deployment.KernelDeployment;
import org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl;
import org.jboss.messaging.core.config.TransportConfiguration;
import org.jboss.messaging.core.logging.Logger;
@@ -188,66 +187,6 @@
stop();
}
- public KernelDeployment deploy(String resourceName) throws Exception
- {
- try
- {
- return bootstrap.deploy(resourceName);
- }
- catch (Throwable e)
- {
- // RMI can only throw Exception or its subclasses... This is case we ever implement Server as remote again
- if (e instanceof Exception)
- {
- throw (Exception)e;
- }
- else
- {
- throw new Exception(e.toString(), e);
- }
- }
- }
-
- public KernelDeployment deployXML(String name, String xml) throws Exception
- {
- try
- {
- return bootstrap.deploy(name, xml);
- }
- catch (Throwable e)
- {
- // RMI can only throw Exception or its subclasses... This is case we ever implement Server as remote again
- if (e instanceof Exception)
- {
- throw (Exception)e;
- }
- else
- {
- throw new Exception(e.toString(), e);
- }
- }
- }
-
- public void undeploy(KernelDeployment deployment) throws Exception
- {
- try
- {
- bootstrap.undeploy(deployment);
- }
- catch (Throwable e)
- {
- // RMI can only throw Exception or its subclasses... This is case we ever implement Server as remote again
- if (e instanceof Exception)
- {
- throw (Exception)e;
- }
- else
- {
- throw new Exception(e.toString(), e);
- }
- }
- }
-
public void log(int level, String text)
{
if (ServerManagement.FATAL == level)
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java 2009-03-09 11:14:37 UTC (rev 6041)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java 2009-03-09 12:41:05 UTC (rev 6042)
@@ -35,7 +35,6 @@
import javax.management.ObjectName;
import javax.naming.InitialContext;
-import org.jboss.kernel.spi.deployment.KernelDeployment;
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.management.ObjectNames;
import org.jboss.messaging.core.security.Role;
@@ -184,21 +183,6 @@
//noop - nothing to be done
}
- public KernelDeployment deploy(String mbeanConfiguration) throws Exception
- {
- return server.deploy(mbeanConfiguration);
- }
-
- public void undeploy(KernelDeployment deployment) throws Exception
- {
- server.undeploy(deployment);
- }
-
- public KernelDeployment deployXML(String name, String xml) throws Exception
- {
- return server.deployXML(name, xml);
- }
-
public void log(int level, String text) throws Exception
{
server.log(level, text);
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/Server.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/Server.java 2009-03-09 11:14:37 UTC (rev 6041)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/Server.java 2009-03-09 12:41:05 UTC (rev 6042)
@@ -28,7 +28,6 @@
import javax.naming.InitialContext;
-import org.jboss.kernel.spi.deployment.KernelDeployment;
import org.jboss.messaging.core.security.Role;
import org.jboss.messaging.core.server.MessagingServer;
import org.jboss.messaging.jms.server.JMSServerManager;
@@ -72,14 +71,6 @@
*/
void ping() throws Exception;
-
- /** Deploys a XML on the MicroContainer */
- KernelDeployment deployXML(String name, String xml) throws Exception;
-
- KernelDeployment deploy(String resource) throws Exception;
-
- void undeploy(KernelDeployment undeploy) throws Exception;
-
/**
* Only for remote use!
*/
Deleted: trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/ServiceAttributeOverrides.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/ServiceAttributeOverrides.java 2009-03-09 11:14:37 UTC (rev 6041)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/ServiceAttributeOverrides.java 2009-03-09 12:41:05 UTC (rev 6042)
@@ -1,83 +0,0 @@
-/**
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.test.messaging.tools.container;
-
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.management.ObjectName;
-
-/**
- * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- */
-public class ServiceAttributeOverrides implements Serializable
-{
- // Constants ------------------------------------------------------------------------------------
-
- private static final long serialVersionUID = 2347829429579213573L;
-
- // Static ---------------------------------------------------------------------------------------
-
- // Attributes -----------------------------------------------------------------------------------
-
- // Map<ObjectName - Map<attrName<String>-attrValue<Object>>
- private Map map;
-
- // Constructors ---------------------------------------------------------------------------------
-
- public ServiceAttributeOverrides()
- {
- map = new HashMap();
- }
-
- // Public ---------------------------------------------------------------------------------------
-
- /**
- * @return a Map<attributeName<String>-attributeValue<Object>>. Can be empty, but never null.
- */
- public Map get(ObjectName on)
- {
- Map attrs = (Map)map.get(on);
-
- if (attrs == null)
- {
- attrs = Collections.EMPTY_MAP;
- }
- return attrs;
- }
-
- public void put(ObjectName on, String attrName, Object attrValue)
- {
- Map attrs = (Map)map.get(on);
-
- if (attrs == null)
- {
- attrs = new HashMap();
- map.put(on, attrs);
- }
-
- attrs.put(attrName, attrValue);
- }
-
- public Map getMap()
- {
- return map;
- }
-
- // Package protected ----------------------------------------------------------------------------
-
- // Protected ------------------------------------------------------------------------------------
-
- // Private --------------------------------------------------------------------------------------
-
- // Inner classes --------------------------------------------------------------------------------
-}
Deleted: trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/ServiceContainer.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/ServiceContainer.java 2009-03-09 11:14:37 UTC (rev 6041)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/ServiceContainer.java 2009-03-09 12:41:05 UTC (rev 6042)
@@ -1,144 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
-* 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.test.messaging.tools.container;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.management.ObjectName;
-
-/**
- * An MBeanServer and a configurable set of services (TransactionManager, Remoting, etc) available
- * for testing.
- *
- * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
- * @version <tt>$Revision$</tt>
- * <p/>
- * $Id$
- */
-public class ServiceContainer
-{
- // Constants ------------------------------------------------------------------------------------
-
- //private static final Logger log = Logger.getLogger(ServiceContainer.class);
-
-
- public static final String DO_NOT_USE_MESSAGING_MARSHALLERS = "DO_NOT_USE_MESSAGING_MARSHALLERS";
-
- // Static ---------------------------------------------------------------------------------------
-
- public static ObjectName SERVICE_CONTROLLER_OBJECT_NAME;
- public static ObjectName CLASS_LOADER_OBJECT_NAME;
- public static ObjectName TRANSACTION_MANAGER_OBJECT_NAME;
- public static ObjectName CACHED_CONNECTION_MANAGER_OBJECT_NAME;
-
- public static ObjectName DEFAULTDS_MANAGED_CONNECTION_FACTORY_OBJECT_NAME;
- public static ObjectName DEFAULTDS_MANAGED_CONNECTION_POOL_OBJECT_NAME;
- public static ObjectName DEFAULTDS_CONNECTION_MANAGER_OBJECT_NAME;
- public static ObjectName DEFAULTDS_WRAPPER_DATA_SOURCE_SERVICE_OBJECT_NAME;
-
- public static ObjectName JMS_MANAGED_CONNECTION_FACTORY_OBJECT_NAME;
- public static ObjectName JMS_MANAGED_CONNECTION_POOL_OBJECT_NAME;
- public static ObjectName JMS_CONNECTION_MANAGER_OBJECT_NAME;
- public static ObjectName JMS_CONNECTION_FACTORY_BINDING_SERVICE_OBJECT_NAME;
-
- public static ObjectName REMOTING_OBJECT_NAME;
-
- // Used only on testcases where Socket and HTTP are deployed at the same time
- public static ObjectName HTTP_REMOTING_OBJECT_NAME;
-
- public static ObjectName SERVER_PEER_OBJECT_NAME;
-
- public static String DATA_SOURCE_JNDI_NAME = "java:/DefaultDS";
- public static String TRANSACTION_MANAGER_JNDI_NAME = "java:/TransactionManager";
- public static String USER_TRANSACTION_JNDI_NAME = "UserTransaction";
- public static String JCA_JMS_CONNECTION_FACTORY_JNDI_NAME = "java:/JCAConnectionFactory";
-
- // Must match the value in remoting-http-service.xml
- public static long HTTP_CONNECTOR_CALLBACK_POLL_PERIOD = 102;
-
- // List<ObjectName>
- private List connFactoryObjectNames = new ArrayList();
-
- static
- {
- try
- {
- SERVICE_CONTROLLER_OBJECT_NAME =
- new ObjectName("jboss.system:service=ServiceController");
- CLASS_LOADER_OBJECT_NAME =
- new ObjectName("jboss.system:service=ClassLoader");
- TRANSACTION_MANAGER_OBJECT_NAME =
- new ObjectName("jboss:service=TransactionManager");
- CACHED_CONNECTION_MANAGER_OBJECT_NAME =
- new ObjectName("jboss.jca:service=CachedConnectionManager");
-
- DEFAULTDS_CONNECTION_MANAGER_OBJECT_NAME =
- new ObjectName("jboss.jca:name=DefaultDS,service=LocalTxCM");
- DEFAULTDS_MANAGED_CONNECTION_FACTORY_OBJECT_NAME =
- new ObjectName("jboss.jca:name=DefaultDS,service=ManagedConnectionFactory");
- DEFAULTDS_MANAGED_CONNECTION_POOL_OBJECT_NAME =
- new ObjectName("jboss.jca:name=DefaultDS,service=ManagedConnectionPool");
- DEFAULTDS_WRAPPER_DATA_SOURCE_SERVICE_OBJECT_NAME =
- new ObjectName("jboss.jca:name=DefaultDS,service=DataSourceBinding");
-
- JMS_MANAGED_CONNECTION_FACTORY_OBJECT_NAME =
- new ObjectName("jboss.jca:service=ManagedConnectionFactory,name=JCAConnectionFactory");
- JMS_MANAGED_CONNECTION_POOL_OBJECT_NAME =
- new ObjectName("jboss.jca:service=ManagedConnectionPool,name=JCAConnectionFactory");
- JMS_CONNECTION_MANAGER_OBJECT_NAME =
- new ObjectName("jboss.jca:service=TxCM,name=JCAConnectionFactory");
- JMS_CONNECTION_FACTORY_BINDING_SERVICE_OBJECT_NAME =
- new ObjectName("jboss.jca:service=ConnectionFactoryBinding,name=JCAConnectionFactory");
-
- REMOTING_OBJECT_NAME =
- new ObjectName("jboss.messaging:service=Connector,transport=bisocket");
-
- HTTP_REMOTING_OBJECT_NAME =
- new ObjectName("jboss.messaging:service=Connector,transport=http");
-
- SERVER_PEER_OBJECT_NAME =
- new ObjectName("jboss.messaging:service=ServerPeer");
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- public static String getCurrentAddress() throws Exception
- {
- String currentAddress = System.getProperty("test.bind.address");
-
- if (currentAddress == null)
- {
- currentAddress = "localhost";
- }
- return currentAddress;
- }
-
- // Attributes -----------------------------------------------------------------------------------
-
- private ServiceContainerConfiguration config;
-
- // Inner classes --------------------------------------------------------------------------------
-}
Deleted: trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/ServiceContainerConfiguration.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/ServiceContainerConfiguration.java 2009-03-09 11:14:37 UTC (rev 6041)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/ServiceContainerConfiguration.java 2009-03-09 12:41:05 UTC (rev 6042)
@@ -1,439 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * 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.test.messaging.tools.container;
-
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-import org.jboss.messaging.utils.XMLUtil;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- */
-class ServiceContainerConfiguration
-{
- // Constants -----------------------------------------------------
-
- public static final boolean DEFAULT_CLUSTERED_MODE = false;
-
- // Static --------------------------------------------------------
-
- public static String getHypersonicDatabase(String connectionURL)
- {
- StringTokenizer st = new StringTokenizer(connectionURL, ":");
-
- if (!"jdbc".equals(st.nextToken()) || !"hsqldb".equals(st.nextToken()))
- {
- throw new IllegalArgumentException("Invalid Hypersonic connection URL: " + connectionURL);
- }
-
- String s = st.nextToken();
- String s2 = st.nextToken();
-
- return s + ":" + s2;
- }
-
- public static String getHypersonicDbname(String connectionURL)
- {
- StringTokenizer st = new StringTokenizer(connectionURL, ":");
-
- if (!"jdbc".equals(st.nextToken()) || !"hsqldb".equals(st.nextToken()))
- {
- throw new IllegalArgumentException("Invalid Hypersonic connection URL: " + connectionURL);
- }
-
- String s = st.nextToken();
- String s2 = st.nextToken();
-
- return s + s2;
- }
-
- public static void validateTransactionIsolation(String s) throws IllegalArgumentException
- {
- if (!"NONE".equals(s) && !"TRANSACTION_READ_COMMITTED".equals(s))
- {
- throw new IllegalArgumentException("Invalid transaction isolation: " + s);
- }
- }
-
- // Attributes ----------------------------------------------------
-
- private String database;
- private Map dbConfigurations;
- private String remotingTransport;
- private Boolean clusteredMode;
-
- // Constructors --------------------------------------------------
-
- public ServiceContainerConfiguration(InputStream is) throws Exception
- {
- dbConfigurations = new HashMap();
- parse(is);
- validate();
- }
-
- // Public --------------------------------------------------------
-
- public String getDatabaseName()
- {
- return database;
- }
-
- public String getDatabaseConnectionURL()
- {
- DatabaseConfiguration dbc = (DatabaseConfiguration)dbConfigurations.get(database);
- return dbc.getDatabaseConnectionURL();
- }
-
- public String getDatabaseDriverClass()
- {
- DatabaseConfiguration dbc = (DatabaseConfiguration)dbConfigurations.get(database);
- return dbc.getDatabaseDriverClass();
- }
-
- public String getDatabaseTransactionIsolation()
- {
- DatabaseConfiguration dbc = (DatabaseConfiguration)dbConfigurations.get(database);
- return dbc.getDatabaseTransactionIsolation();
- }
-
- public String getDatabaseUserName()
- {
- DatabaseConfiguration dbc = (DatabaseConfiguration)dbConfigurations.get(database);
- return dbc.getDatabaseUserName();
- }
-
- public String getDatabasePassword()
- {
- DatabaseConfiguration dbc = (DatabaseConfiguration)dbConfigurations.get(database);
- return dbc.getDatabasePassword();
- }
-
- /**
- * @return the transport the container wants the Remoting Connector to use.
- */
- public String getRemotingTransport()
- {
- return remotingTransport;
- }
-
- /**
- * @return the manageConfirmations mode in which the container should run an individual test.
- */
- public boolean isClustered()
- {
- return clusteredMode.booleanValue();
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- private void parse(InputStream is) throws Exception
- {
- Reader reader = new InputStreamReader(is);
- String currentDatabase = null;
- String currentRemotingTransport = null;
- boolean currentClusteredMode = DEFAULT_CLUSTERED_MODE;
-
- try
- {
- Element root = org.jboss.messaging.utils.XMLUtil.readerToElement(reader);
-
- if (!"container".equals(root.getNodeName()))
- {
- throw new Exception("Invalid root element: " + root.getNodeName());
- }
-
- if (root.hasChildNodes())
- {
- NodeList nl = root.getChildNodes();
- for(int i = 0; i < nl.getLength(); i++)
- {
- Node n = nl.item(i);
- int type = n.getNodeType();
-
- if (type == Node.TEXT_NODE ||
- type == Node.COMMENT_NODE)
- {
- continue;
- }
-
- String name = n.getNodeName();
-
- if ("database-configurations".equals(name))
- {
- parseDatabaseConfigurations(n);
- }
- else if ("database".equals(name))
- {
- currentDatabase = org.jboss.messaging.utils.XMLUtil.getTextContent(n);
- }
- else if ("remoting-transport".equals(name))
- {
- currentRemotingTransport = org.jboss.messaging.utils.XMLUtil.getTextContent(n);
- }
- else if ("manageConfirmations".equals(name))
- {
- currentClusteredMode = Boolean.getBoolean(org.jboss.messaging.utils.XMLUtil.getTextContent(n));
- }
- else
- {
- throw new Exception("Unexpected child <" + name + "> of node " +
- root.getNodeName() + ", type " + type);
- }
- }
- }
-
- setCurrentDatabase(currentDatabase);
- setCurrentRemotingTransport(currentRemotingTransport);
- setCurrentClusteredMode(currentClusteredMode);
- }
- finally
- {
- reader.close();
- }
- }
-
- /**
- * Always the value of "test.database" system property takes precedence over the configuration
- * file value.
- */
- private void setCurrentDatabase(String xmlConfigDatabase)
- {
- database = System.getProperty("test.database");
- if (database == null)
- {
- database = xmlConfigDatabase;
- }
- }
-
- private void setCurrentRemotingTransport(String xmlRemotingTransport)
- {
- remotingTransport = System.getProperty("test.remoting");
- if (remotingTransport == null)
- {
- remotingTransport = xmlRemotingTransport;
- }
- }
-
-
- /**
- * Always the value of "test.clustered" system property takes precedence over the configuration
- * file value.
- */
- private void setCurrentClusteredMode(boolean xmlClusteredMode) throws Exception
- {
- String s = System.getProperty("test.clustered");
- if (s != null)
- {
- clusteredMode = Boolean.valueOf(s);
- }
-
- if (clusteredMode == null)
- {
- clusteredMode = new Boolean(xmlClusteredMode);
- }
- }
-
- private void validate() throws Exception
- {
- // make sure that I have a corresponding "database-configuration"
- if (database == null)
- {
- throw new Exception("No configured database!");
- }
-
- if (dbConfigurations.get(database) == null)
- {
- throw new Exception("No such database configuration: \"" + database + "\"");
- }
- }
-
- private void parseDatabaseConfigurations(Node dbcs) throws Exception
- {
- if (!"database-configurations".equals(dbcs.getNodeName()))
- {
- throw new Exception("Expecting <database-configurations> and got <" +
- dbcs.getNodeName() + ">");
- }
-
- if (dbcs.hasChildNodes())
- {
- NodeList nl = dbcs.getChildNodes();
- for(int i = 0; i < nl.getLength(); i++)
- {
- Node n = nl.item(i);
-
- if (n.getNodeType() == Node.TEXT_NODE)
- {
- continue;
- }
- parseDatabaseConfiguration(n);
- }
- }
- }
-
- private void parseDatabaseConfiguration(Node dbcn) throws Exception
- {
- if (!"database-configuration".equals(dbcn.getNodeName()))
- {
- throw new Exception("Expecting <database-configuration> and got <" +
- dbcn.getNodeName() + ">");
- }
-
- NamedNodeMap attrs = dbcn.getAttributes();
- Node nameNode = attrs.getNamedItem("name");
- String configName = nameNode.getNodeValue();
- DatabaseConfiguration dbc = new DatabaseConfiguration();
- dbConfigurations.put(configName, dbc);
-
- if (dbcn.hasChildNodes())
- {
- NodeList nl = dbcn.getChildNodes();
- for(int i = 0; i < nl.getLength(); i++)
- {
- Node n = nl.item(i);
-
- if (n.getNodeType() == Node.TEXT_NODE)
- {
- continue;
- }
-
- String name = n.getNodeName();
- String value = XMLUtil.getTextContent(n);
-
- if ("url".equals(name))
- {
- dbc.setDatabaseConnectionURL(value);
- }
- else if ("driver".equals(name))
- {
- dbc.setDatabaseDriverClass(value);
- }
- else if ("isolation".equals(name))
- {
- String s = value.toUpperCase();
- validateTransactionIsolation(s);
- dbc.setDatabaseTransactionIsolation(s);
- }
- else if ("username".equals(name))
- {
- dbc.setDatabaseUserName(value);
- }
- else if ("password".equals(name))
- {
- dbc.setDatabasePassword(value);
- }
- else
- {
- throw new IllegalArgumentException("Unknown element: " + name);
- }
- }
- }
- }
-
- // Inner classes -------------------------------------------------
-
- private class DatabaseConfiguration
- {
- private String connectionURL;
- private String driverClass;
- private String transactionIsolation;
- private String username;
- private String password;
-
- void setDatabaseConnectionURL(String s)
- {
- StringTokenizer st = new StringTokenizer(s, ":");
- if (!st.hasMoreTokens())
- {
- throw new IllegalArgumentException("Invalid connection URL: " + s);
- }
- st.nextToken();
- if (!st.hasMoreTokens())
- {
- throw new IllegalArgumentException("Invalid connection URL: " + s);
- }
-
- this.connectionURL = s;
- }
-
- String getDatabaseConnectionURL()
- {
- return connectionURL;
- }
-
- void setDatabaseDriverClass(String s)
- {
- this.driverClass = s;
- }
-
- String getDatabaseDriverClass()
- {
- return driverClass;
- }
-
- void setDatabaseTransactionIsolation(String s)
- {
- this.transactionIsolation = s;
- }
-
- String getDatabaseTransactionIsolation()
- {
- return transactionIsolation;
- }
-
- void setDatabaseUserName(String s)
- {
- this.username = s;
- }
-
- String getDatabaseUserName()
- {
- return username;
- }
-
- void setDatabasePassword(String s)
- {
- this.password = s;
- }
-
- String getDatabasePassword()
- {
- return password;
- }
- }
-}
Deleted: trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/StopRMIServer.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/StopRMIServer.java 2009-03-09 11:14:37 UTC (rev 6041)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/StopRMIServer.java 2009-03-09 12:41:05 UTC (rev 6042)
@@ -1,134 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
-* 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.test.messaging.tools.container;
-
-import java.rmi.Naming;
-
-import org.jboss.messaging.core.logging.Logger;
-import org.jboss.test.messaging.tools.ServerManagement;
-
-/**
- * A utility to stop runaway rmi servers.
- *
- * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
- * @version <tt>$Revision: 2876 $</tt>
- *
- * $Id: StopRMIServer.java 2876 2007-07-11 18:00:52Z timfox $
- */
-public class StopRMIServer
-{
- // Constants -----------------------------------------------------
-
- private static final Logger log = Logger.getLogger(StopRMIServer.class);
-
- // Static --------------------------------------------------------
-
- public static void main(String[] args) throws Exception
- {
-
- String host = System.getProperty("test.bind.address");
- if (host == null)
- {
- host = "localhost";
- }
-
- int index = -1; // -1 implies kill all servers
-
- String serverIndex = System.getProperty("test.server.index");
-
- if (serverIndex != null)
- {
- index = Integer.parseInt(serverIndex);
- }
-
- if (index != -1)
- {
- killServer(host, index);
- }
- else
- {
- //Kill em all
- for (int i = 0; i < ServerManagement.MAX_SERVER_COUNT; i++)
- {
- killServer(host, i);
- }
- }
- }
-
- // Attributes ----------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- private static void killServer(String host, int index) throws Exception
- {
- String name =
- "//" + host + ":" + RMITestServer.DEFAULT_REGISTRY_PORT + "/" +
- RMITestServer.RMI_SERVER_PREFIX + index;
-
- Server server;
- try
- {
- server = (Server)Naming.lookup(name);
- }
- catch(Throwable t)
- {
- //Ignore
- return;
- }
-
- try
- {
- server.kill();
- }
- catch (Throwable t)
- {
- //Ignore
- }
-
- try
- {
- while(true)
- {
- server.ping();
- Thread.sleep(100);
- }
- }
- catch (Throwable e)
- {
- //Ok
- }
-
- log.info("Killed remote server " + index);
- }
-
-
- // Inner classes -------------------------------------------------
-
-}
More information about the jboss-cvs-commits
mailing list