[jboss-cvs] JBoss Messaging SVN: r6019 - in trunk/tests/jms-tests/src/org/jboss/test/messaging: jms and 4 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Mar 6 09:46:41 EST 2009
Author: jmesnil
Date: 2009-03-06 09:46:41 -0500 (Fri, 06 Mar 2009)
New Revision: 6019
Removed:
trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/bridge/BridgeMBeanTest.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/Command.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/util/JNDITest.java
Modified:
trunk/tests/jms-tests/src/org/jboss/test/messaging/JBMServerTestCase.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/DurableSubscriptionTest.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/XATest.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 dead code
* removed JMX code (was only used by BridgeMBeanTest)
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-06 13:32:05 UTC (rev 6018)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/JBMServerTestCase.java 2009-03-06 14:46:41 UTC (rev 6019)
@@ -38,7 +38,6 @@
import javax.jms.Topic;
import javax.jms.TopicConnectionFactory;
import javax.jms.XAConnectionFactory;
-import javax.management.ObjectName;
import javax.naming.InitialContext;
import javax.transaction.TransactionManager;
@@ -48,7 +47,6 @@
import org.jboss.messaging.core.security.Role;
import org.jboss.messaging.core.server.MessagingServer;
import org.jboss.messaging.jms.server.JMSServerManager;
-import org.jboss.messaging.jms.server.management.SubscriptionInfo;
import org.jboss.test.messaging.tools.ServerManagement;
import org.jboss.test.messaging.tools.container.Server;
import org.jboss.test.messaging.util.ProxyAssertSupport;
@@ -649,21 +647,6 @@
servers.get(server).removeAllMessages(destName, isQueue);
}
- protected int getNoSubscriptions(Topic topic)
- throws Exception
- {
- return getNoSubscriptions(topic, 0);
- }
-
- protected int getNoSubscriptions(Topic topic, int server)
- throws Exception
- {
- ObjectName destObjectName = new ObjectName("jboss.messaging.destination:service=Topic,name=" + topic.getTopicName());
-
- Integer messageCount = (Integer) ServerManagement.getAttribute(server, destObjectName, "AllSubscriptionsCount");
- return messageCount.intValue();
- }
-
protected boolean assertRemainingMessages(int expected) throws Exception
{
Integer messageCount = servers.get(0).getMessageCountForQueue("Queue1");
@@ -759,7 +742,7 @@
servers.get(server).undeployConnectionFactory(objectName);
}
- protected List<SubscriptionInfo> listAllSubscribersForTopic(String s) throws Exception
+ protected List<String> listAllSubscribersForTopic(String s) throws Exception
{
return servers.get(0).listAllSubscribersForTopic(s);
}
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/DurableSubscriptionTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/DurableSubscriptionTest.java 2009-03-06 13:32:05 UTC (rev 6018)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/DurableSubscriptionTest.java 2009-03-06 14:46:41 UTC (rev 6019)
@@ -36,9 +36,7 @@
import javax.jms.Topic;
import javax.jms.TopicSubscriber;
-import org.jboss.messaging.jms.server.management.SubscriptionInfo;
-
/**
* Tests focused on durable subscription behavior. More durable subscription tests can be found in
* MessageConsumerTest.
@@ -80,16 +78,14 @@
s.createDurableSubscriber(topic1, "monicabelucci");
- List<SubscriptionInfo> subs = listAllSubscribersForTopic("Topic1");
+ List<String> subs = listAllSubscribersForTopic("Topic1");
assertNotNull(subs);
assertEquals(1, subs.size());
- SubscriptionInfo info = subs.get(0);
+ assertEquals("monicabelucci", subs.get(0));
- assertEquals("monicabelucci", info.getName());
-
prod.send(s.createTextMessage("k"));
conn.close();
@@ -98,10 +94,8 @@
assertEquals(1, subs.size());
- info = subs.get(0);
+ assertEquals("monicabelucci", subs.get(0));
- assertEquals("monicabelucci", info.getName());
-
conn = cf.createConnection();
conn.setClientID("brookeburke");
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-06 13:32:05 UTC (rev 6018)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/XATest.java 2009-03-06 14:46:41 UTC (rev 6019)
@@ -51,7 +51,6 @@
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.TransactionManagerLocator;
import org.jboss.tm.TxUtils;
/**
Deleted: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/bridge/BridgeMBeanTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/bridge/BridgeMBeanTest.java 2009-03-06 13:32:05 UTC (rev 6018)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/bridge/BridgeMBeanTest.java 2009-03-06 14:46:41 UTC (rev 6019)
@@ -1,736 +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.bridge;
-
-import java.io.ByteArrayOutputStream;
-import java.util.Properties;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.Destination;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.management.ObjectName;
-import javax.naming.InitialContext;
-
-import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.jms.bridge.QualityOfServiceMode;
-import org.jboss.test.messaging.tools.ServerManagement;
-
-/**
- * A BridgeMBeanTest
- *
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @version <tt>$Revision: 1.1 $</tt>
- *
- * $Id$
- *
- */
-public class BridgeMBeanTest extends BridgeTestBase
-{
- private static final Logger log = Logger.getLogger(BridgeMBeanTest.class);
-
- private static ObjectName sourceProviderLoader;
-
- private static ObjectName targetProviderLoader;
-
- public void setUp() throws Exception
- {
- boolean first = firstTime;
-
- super.setUp();
-
- if (first)
- {
- Properties props1 = new Properties();
- props1.putAll(ServerManagement.getJNDIEnvironment(0));
-
- Properties props2 = new Properties();
- props2.putAll(ServerManagement.getJNDIEnvironment(1));
-
- installJMSProviderLoader(0, props1, "/XAConnectionFactory", "adaptor1");
-
- installJMSProviderLoader(0, props2, "/XAConnectionFactory", "adaptor2");
-
- sourceProviderLoader = new ObjectName("jboss.messaging:service=JMSProviderLoader,name=adaptor1");
- targetProviderLoader = new ObjectName("jboss.messaging:service=JMSProviderLoader,name=adaptor2");
- }
- }
-
- public void tearDown() throws Exception
- {
- super.tearDown();
- }
-
- public void testStopStartPauseResume() throws Exception
- {
- Connection connSource = null;
-
- Connection connTarget = null;
-
- ObjectName on = null;
-
- try
- {
- on = deployBridge(0, "Bridge1", sourceProviderLoader, targetProviderLoader,
- "/queue/sourceQueue", "/queue/targetQueue",
- null, null, null, null,
- QualityOfServiceMode.AT_MOST_ONCE, null, 1,
- -1, null, null, 5000, -1, false);
- log.info("Deployed bridge");
-
- ServerManagement.getServer(0).invoke(on, "create", new Object[0], new String[0]);
-
- log.info("Created bridge");
-
- connSource = cf0.createConnection();
-
- connTarget = cf1.createConnection();
-
- connTarget.start();
-
- connSource.start();
-
- final int NUM_MESSAGES = 50;
-
- Session sessSource = connSource.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- MessageProducer prod = sessSource.createProducer(sourceQueue);
-
- Session sessTarget = connTarget.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- MessageConsumer cons = sessTarget.createConsumer(targetQueue);
-
- for (int i = 0; i < NUM_MESSAGES; i++)
- {
- TextMessage tm = sessSource.createTextMessage("message" + i);
-
- prod.send(tm);
- }
-
- //It's stopped so no messages should be received
-
- checkEmpty(targetQueue, 1);
-
- //Start it
-
- log.info("Starting bridge");
- ServerManagement.getServer(0).invoke(on, "start", new Object[0], new String[0]);
- log.info("Started bridge");
-
- //Now should receive the messages
-
- for (int i = 0; i < NUM_MESSAGES; i++)
- {
- TextMessage tm = (TextMessage)cons.receive(2000);
-
- assertNotNull(tm);
-
- assertEquals("message" + i, tm.getText());
- }
-
- checkEmpty(targetQueue, 1);
-
- //Send some more
-
- for (int i = NUM_MESSAGES; i < 2 * NUM_MESSAGES; i++)
- {
- TextMessage tm = sessSource.createTextMessage("message" + i);
-
- prod.send(tm);
- }
-
- //These should be received too
-
- for (int i = NUM_MESSAGES; i < 2 * NUM_MESSAGES; i++)
- {
- TextMessage tm = (TextMessage)cons.receive(2000);
-
- assertNotNull(tm);
-
- assertEquals("message" + i, tm.getText());
- }
-
- checkEmpty(targetQueue, 1);
-
- //Pause it
-
- ServerManagement.getServer(0).invoke(on, "pause", new Object[0], new String[0]);
-
- boolean isPaused = ((Boolean)ServerManagement.getAttribute(on, "Paused")).booleanValue();
-
- assertTrue(isPaused);
-
- // Send some more
-
- for (int i = 2 * NUM_MESSAGES; i < 3 * NUM_MESSAGES; i++)
- {
- TextMessage tm = sessSource.createTextMessage("message" + i);
-
- prod.send(tm);
- }
-
- //These shouldn't be received
-
- checkEmpty(targetQueue, 1);
-
- // Resume
-
- ServerManagement.getServer(0).invoke(on, "resume", new Object[0], new String[0]);
-
- //Now messages should be received
-
- for (int i = 2 * NUM_MESSAGES; i < 3 * NUM_MESSAGES; i++)
- {
- TextMessage tm = (TextMessage)cons.receive(2000);
-
- assertNotNull(tm);
-
- assertEquals("message" + i, tm.getText());
- }
-
- checkEmpty(targetQueue, 1);
-
- isPaused = ((Boolean)ServerManagement.getAttribute(on, "Paused")).booleanValue();
-
- assertFalse(isPaused);
-
- //Stop
-
- ServerManagement.getServer(0).invoke(on, "stop", new Object[0], new String[0]);
-
- boolean isStarted = ((Boolean)ServerManagement.getAttribute(on, "Started")).booleanValue();
-
- assertFalse(isStarted);
- }
- finally
- {
- if (connSource != null)
- {
- connSource.close();
- }
-
- if (connTarget != null)
- {
- connTarget.close();
- }
-
- try
- {
- if (on != null)
- {
- ServerManagement.getServer(0).invoke(on, "stop", new Object[0], new String[0]);
- ServerManagement.getServer(0).invoke(on, "destroy", new Object[0], new String[0]);
- }
- }
- catch(Exception e)
- {
- //Ignore
- }
- }
- }
-
- public void testDeploy() throws Exception
- {
- ObjectName on = null;
-
- try
- {
- on = deployBridge(0, "Bridge2", sourceProviderLoader, targetProviderLoader,
- "/queue/sourceQueue", "/queue/targetQueue",
- null, null, null, null,
- QualityOfServiceMode.ONCE_AND_ONLY_ONCE, null, 1,
- -1, null, null, 5000, -1, false);
-
- log.trace("Constructed bridge");
-
- ServerManagement.getServer(0).invoke(on, "create", new Object[0], new String[0]);
-
- log.trace("Created bridge");
-
- {
- ObjectName sourceProviderLoader2 = (ObjectName)ServerManagement.getAttribute(on, "SourceProviderLoader");
- assertEquals(sourceProviderLoader, sourceProviderLoader2);
- ServerManagement.setAttribute(on, "SourceProviderLoader", "jboss.messaging:service=JMSProviderLoader,name=blah");
- sourceProviderLoader2 = (ObjectName)ServerManagement.getAttribute(on, "SourceProviderLoader");
- assertEquals(new ObjectName("jboss.messaging:service=JMSProviderLoader,name=blah"), sourceProviderLoader2);
- ServerManagement.setAttribute(on, "SourceProviderLoader", sourceProviderLoader.toString());
- }
-
- {
- ObjectName targetProviderLoader2 = (ObjectName)ServerManagement.getAttribute(on, "TargetProviderLoader");
- assertEquals(targetProviderLoader, targetProviderLoader2);
- ServerManagement.setAttribute(on, "TargetProviderLoader", "jboss.messaging:service=JMSProviderLoader,name=blah2");
- targetProviderLoader2 = (ObjectName)ServerManagement.getAttribute(on, "TargetProviderLoader");
- assertEquals(new ObjectName("jboss.messaging:service=JMSProviderLoader,name=blah2"), targetProviderLoader2);
- ServerManagement.setAttribute(on, "TargetProviderLoader", targetProviderLoader.toString());
-
- }
-
- {
- String destLookup = (String)ServerManagement.getAttribute(on, "SourceDestinationLookup");
- assertEquals("/queue/sourceQueue", destLookup);
- ServerManagement.setAttribute(on, "SourceDestinationLookup", "/queue/WibbleQueue");
- destLookup = (String)ServerManagement.getAttribute(on, "SourceDestinationLookup");
- assertEquals("/queue/WibbleQueue", destLookup);
- ServerManagement.setAttribute(on, "SourceDestinationLookup", "/queue/sourceQueue");
- }
-
- {
- String destLookup = (String)ServerManagement.getAttribute(on, "TargetDestinationLookup");
- assertEquals("/queue/targetQueue", destLookup);
- ServerManagement.setAttribute(on, "TargetDestinationLookup", "/queue/WibbleQueue");
- destLookup = (String)ServerManagement.getAttribute(on, "TargetDestinationLookup");
- assertEquals("/queue/WibbleQueue", destLookup);
- ServerManagement.setAttribute(on, "TargetDestinationLookup", "/queue/targetQueue");
- }
-
- {
- String username = (String)ServerManagement.getAttribute(on, "SourceUsername");
- assertEquals(null, username);
- ServerManagement.setAttribute(on, "SourceUsername", "bob");
- username = (String)ServerManagement.getAttribute(on, "SourceUsername");
- assertEquals("bob", username);
- ServerManagement.setAttribute(on, "SourceUsername", null);
- }
-
- {
- String password = (String)ServerManagement.getAttribute(on, "SourcePassword");
- assertEquals(null, password);
- ServerManagement.setAttribute(on, "SourcePassword", "eek");
- password = (String)ServerManagement.getAttribute(on, "SourcePassword");
- assertEquals("eek", password);
- ServerManagement.setAttribute(on, "SourcePassword", null);
- }
-
- {
- String username = (String)ServerManagement.getAttribute(on, "TargetUsername");
- assertEquals(null, username);
- ServerManagement.setAttribute(on, "TargetUsername", "bob");
- username = (String)ServerManagement.getAttribute(on, "TargetUsername");
- assertEquals("bob", username);
- ServerManagement.setAttribute(on, "TargetUsername", null);
- }
-
- {
- String password = (String)ServerManagement.getAttribute(on, "TargetPassword");
- assertEquals(null, password);
- ServerManagement.setAttribute(on, "TargetPassword", "eek");
- password = (String)ServerManagement.getAttribute(on, "TargetPassword");
- assertEquals("eek", password);
- ServerManagement.setAttribute(on, "TargetPassword", null);
- }
-
- {
- Integer qos = (Integer)ServerManagement.getAttribute(on, "QualityOfServiceMode");
- assertEquals(QualityOfServiceMode.ONCE_AND_ONLY_ONCE.intValue(), qos.intValue());
- ServerManagement.setAttribute(on, "QualityOfServiceMode", String.valueOf(QualityOfServiceMode.AT_MOST_ONCE.intValue()));
- qos = (Integer)ServerManagement.getAttribute(on, "QualityOfServiceMode");
- assertEquals(new Integer(QualityOfServiceMode.AT_MOST_ONCE.intValue()), qos);
- ServerManagement.setAttribute(on, "QualityOfServiceMode", String.valueOf(QualityOfServiceMode.ONCE_AND_ONLY_ONCE.intValue()));
- }
-
- {
- String selector = (String)ServerManagement.getAttribute(on, "Selector");
- assertEquals(null, selector);
- ServerManagement.setAttribute(on, "Selector", "god='dead'");
- selector = (String)ServerManagement.getAttribute(on, "Selector");
- assertEquals("god='dead'", selector);
- ServerManagement.setAttribute(on, "Selector", null);
- }
-
- {
- Integer maxBatchSize = (Integer)ServerManagement.getAttribute(on, "MaxBatchSize");
- assertEquals(1, maxBatchSize.intValue());
- ServerManagement.setAttribute(on, "MaxBatchSize", "10");
- maxBatchSize = (Integer)ServerManagement.getAttribute(on, "MaxBatchSize");
- assertEquals(10, maxBatchSize.intValue());
- ServerManagement.setAttribute(on, "MaxBatchSize", "1");
- }
-
- {
- Long maxBatchTime = (Long)ServerManagement.getAttribute(on, "MaxBatchTime");
- assertEquals(-1, maxBatchTime.longValue());
- ServerManagement.setAttribute(on, "MaxBatchTime", "3000");
- maxBatchTime = (Long)ServerManagement.getAttribute(on, "MaxBatchTime");
- assertEquals(3000, maxBatchTime.longValue());
- ServerManagement.setAttribute(on, "MaxBatchTime", "-1");
- }
-
- {
- String subName = (String)ServerManagement.getAttribute(on, "SubName");
- assertEquals(null, subName);
- ServerManagement.setAttribute(on, "SubName", "submarine");
- subName = (String)ServerManagement.getAttribute(on, "SubName");
- assertEquals("submarine", subName);
- ServerManagement.setAttribute(on, "SubName", null);
- }
-
- {
- String clientID = (String)ServerManagement.getAttribute(on, "ClientID");
- assertEquals(null, clientID);
- ServerManagement.setAttribute(on, "ClientID", "clientid-123");
- clientID = (String)ServerManagement.getAttribute(on, "ClientID");
- assertEquals("clientid-123", clientID);
- ServerManagement.setAttribute(on, "ClientID", null);
- }
-
- {
- Long failureRetryInterval = (Long)ServerManagement.getAttribute(on, "FailureRetryInterval");
- assertEquals(5000, failureRetryInterval.longValue());
- ServerManagement.setAttribute(on, "FailureRetryInterval", "10000");
- failureRetryInterval = (Long)ServerManagement.getAttribute(on, "FailureRetryInterval");
- assertEquals(10000, failureRetryInterval.longValue());
- ServerManagement.setAttribute(on, "FailureRetryInterval", "5000");
- }
-
- {
- Integer maxRetries = (Integer)ServerManagement.getAttribute(on, "MaxRetries");
- assertEquals(-1, maxRetries.intValue());
- ServerManagement.setAttribute(on, "MaxRetries", "1000");
- maxRetries = (Integer)ServerManagement.getAttribute(on, "MaxRetries");
- assertEquals(1000, maxRetries.intValue());
- ServerManagement.setAttribute(on, "MaxRetries", "-1");
- }
-
- ServerManagement.getServer(0).invoke(on, "start", new Object[0], new String[0]);
-
- //Should not be able to change attributes when bridge is started - need to stop first
-
- {
- ObjectName sourceProviderLoader2 = (ObjectName)ServerManagement.getAttribute(on, "SourceProviderLoader");
- assertEquals(sourceProviderLoader, sourceProviderLoader2);
- ServerManagement.setAttribute(on, "SourceProviderLoader", "jboss.messaging:service=JMSProviderLoader,name=blah");
- sourceProviderLoader2 = (ObjectName)ServerManagement.getAttribute(on, "SourceProviderLoader");
- assertEquals(sourceProviderLoader, sourceProviderLoader2);
- }
-
- {
- ObjectName targetProviderLoader2 = (ObjectName)ServerManagement.getAttribute(on, "TargetProviderLoader");
- assertEquals(targetProviderLoader, targetProviderLoader2);
- ServerManagement.setAttribute(on, "TargetProviderLoader", "jboss.messaging:service=JMSProviderLoader,name=blah2");
- targetProviderLoader2 = (ObjectName)ServerManagement.getAttribute(on, "TargetProviderLoader");
- assertEquals(targetProviderLoader, targetProviderLoader2);
-
- }
-
- {
- String destLookup = (String)ServerManagement.getAttribute(on, "SourceDestinationLookup");
- assertEquals("/queue/sourceQueue", destLookup);
- ServerManagement.setAttribute(on, "SourceDestinationLookup", "/queue/WibbleQueue");
- destLookup = (String)ServerManagement.getAttribute(on, "SourceDestinationLookup");
- assertEquals("/queue/sourceQueue", destLookup);
- }
-
- {
- String destLookup = (String)ServerManagement.getAttribute(on, "TargetDestinationLookup");
- assertEquals("/queue/targetQueue", destLookup);
- ServerManagement.setAttribute(on, "TargetDestinationLookup", "/queue/WibbleQueue");
- destLookup = (String)ServerManagement.getAttribute(on, "TargetDestinationLookup");
- assertEquals("/queue/targetQueue", destLookup);
- }
-
- {
- String username = (String)ServerManagement.getAttribute(on, "SourceUsername");
- assertEquals(null, username);
- ServerManagement.setAttribute(on, "SourceUsername", "bob");
- username = (String)ServerManagement.getAttribute(on, "SourceUsername");
- assertEquals(null, username);
- }
-
- {
- String password = (String)ServerManagement.getAttribute(on, "SourcePassword");
- assertEquals(null, password);
- ServerManagement.setAttribute(on, "SourcePassword", "eek");
- password = (String)ServerManagement.getAttribute(on, "SourcePassword");
- assertEquals(null, password);
- }
-
- {
- String username = (String)ServerManagement.getAttribute(on, "TargetUsername");
- assertEquals(null, username);
- ServerManagement.setAttribute(on, "TargetUsername", "bob");
- username = (String)ServerManagement.getAttribute(on, "TargetUsername");
- assertEquals(null, username);
- }
-
- {
- String password = (String)ServerManagement.getAttribute(on, "TargetPassword");
- assertEquals(null, password);
- ServerManagement.setAttribute(on, "TargetPassword", "eek");
- password = (String)ServerManagement.getAttribute(on, "TargetPassword");
- assertEquals(null, password);
- }
-
- {
- Integer qos = (Integer)ServerManagement.getAttribute(on, "QualityOfServiceMode");
- assertEquals(QualityOfServiceMode.ONCE_AND_ONLY_ONCE.intValue(), qos.intValue());
- ServerManagement.setAttribute(on, "QualityOfServiceMode", String.valueOf(QualityOfServiceMode.AT_MOST_ONCE.intValue()));
- qos = (Integer)ServerManagement.getAttribute(on, "QualityOfServiceMode");
- assertEquals(new Integer(QualityOfServiceMode.ONCE_AND_ONLY_ONCE.intValue()), qos);
- }
-
- {
- String selector = (String)ServerManagement.getAttribute(on, "Selector");
- assertEquals(null, selector);
- ServerManagement.setAttribute(on, "Selector", "god='dead'");
- selector = (String)ServerManagement.getAttribute(on, "Selector");
- assertEquals(null, selector);
- }
-
- {
- Integer maxBatchSize = (Integer)ServerManagement.getAttribute(on, "MaxBatchSize");
- assertEquals(1, maxBatchSize.intValue());
- ServerManagement.setAttribute(on, "MaxBatchSize", "10");
- maxBatchSize = (Integer)ServerManagement.getAttribute(on, "MaxBatchSize");
- assertEquals(1, maxBatchSize.intValue());
- }
-
- {
- Long maxBatchTime = (Long)ServerManagement.getAttribute(on, "MaxBatchTime");
- assertEquals(-1, maxBatchTime.longValue());
- ServerManagement.setAttribute(on, "MaxBatchTime", "3000");
- maxBatchTime = (Long)ServerManagement.getAttribute(on, "MaxBatchTime");
- assertEquals(-1, maxBatchTime.longValue());
- }
-
- {
- String subName = (String)ServerManagement.getAttribute(on, "SubName");
- assertEquals(null, subName);
- ServerManagement.setAttribute(on, "SubName", "submarine");
- subName = (String)ServerManagement.getAttribute(on, "SubName");
- assertEquals(null, subName);
- }
-
- {
- String clientID = (String)ServerManagement.getAttribute(on, "ClientID");
- assertEquals(null, clientID);
- ServerManagement.setAttribute(on, "ClientID", "clientid-123");
- clientID = (String)ServerManagement.getAttribute(on, "ClientID");
- assertEquals(null, clientID);
- }
-
- {
- Long failureRetryInterval = (Long)ServerManagement.getAttribute(on, "FailureRetryInterval");
- assertEquals(5000, failureRetryInterval.longValue());
- ServerManagement.setAttribute(on, "FailureRetryInterval", "10000");
- failureRetryInterval = (Long)ServerManagement.getAttribute(on, "FailureRetryInterval");
- assertEquals(5000, failureRetryInterval.longValue());
- }
-
- {
- Integer maxRetries = (Integer)ServerManagement.getAttribute(on, "MaxRetries");
- assertEquals(-1, maxRetries.intValue());
- ServerManagement.setAttribute(on, "MaxRetries", "1000");
- maxRetries = (Integer)ServerManagement.getAttribute(on, "MaxRetries");
- assertEquals(-1, maxRetries.intValue());
- }
-
- Properties props1 = new Properties();
- props1.putAll(ServerManagement.getJNDIEnvironment(0));
- Properties props2 = new Properties();
- props2.putAll(ServerManagement.getJNDIEnvironment(1));
- InitialContext icSource = getInitialContext(0);
- InitialContext icTarget = getInitialContext(1);
-
- log.trace("Checking bridged bridge");
-
- checkBridged(icSource, icTarget, "/ConnectionFactory", "/ConnectionFactory",
- "/queue/sourceQueue", "/queue/targetQueue");
-
- log.trace("Checked bridge");
-
- }
- finally
- {
- try
- {
- if (on != null)
- {
- ServerManagement.getServer(0).invoke(on, "stop", new Object[0], new String[0]);
- ServerManagement.getServer(0).invoke(on, "destroy", new Object[0], new String[0]);
- }
- }
- catch(Exception e)
- {
- //Ignore
- }
- }
-
- }
-
-
- private ObjectName deployBridge(int server, String bridgeName,
- ObjectName sourceProviderLoader, ObjectName targetProviderLoader,
- String sourceDestLookup, String targetDestLookup,
- String sourceUsername, String sourcePassword,
- String targetUsername, String targetPassword,
- QualityOfServiceMode qos, String selector, int maxBatchSize,
- long maxBatchTime, String subName, String clientID,
- long failureRetryInterval, int maxRetries, boolean addMessageIDInHeader) throws Exception
- {
- String config =
- "<mbean code=\"org.jboss.messaging.jms.server.bridge.BridgeService\" " +
- "name=\"jboss.messaging:service=Bridge,name=" + bridgeName + "\" " +
- "xmbean-dd=\"xmdesc/Bridge-xmbean.xml\">" +
- "<attribute name=\"SourceProviderLoader\">" + sourceProviderLoader + "</attribute>"+
- "<attribute name=\"TargetProviderLoader\">" + targetProviderLoader + "</attribute>"+
- "<attribute name=\"SourceDestinationLookup\">" + sourceDestLookup + "</attribute>"+
- "<attribute name=\"TargetDestinationLookup\">" + targetDestLookup + "</attribute>";
- if (sourceUsername != null)
- {
- config += "<attribute name=\"SourceUsername\">" + sourceUsername + "</attribute>";
- }
- if (sourcePassword != null)
- {
- config += "<attribute name=\"SourcePassword\">" + sourcePassword +"</attribute>";
- }
- if (targetUsername != null)
- {
- config += "<attribute name=\"TargetUsername\">" + targetUsername +"</attribute>";
- }
- if (targetPassword != null)
- {
- config += "<attribute name=\"TargetPassword\">" + targetPassword + "</attribute>";
- }
- config += "<attribute name=\"QualityOfServiceMode\">" + qos.intValue() +"</attribute>";
- if (selector != null)
- {
- config += "<attribute name=\"Selector\">" + selector + "</attribute>";
- }
- config += "<attribute name=\"MaxBatchSize\">" + maxBatchSize + "</attribute>"+
- "<attribute name=\"MaxBatchTime\">" + maxBatchTime +"</attribute>";
- if (subName != null)
- {
- config += "<attribute name=\"SubName\">" + subName + "</attribute>";
- }
- if (clientID != null)
- {
- config += "<attribute name=\"ClientID\">" + clientID + "</attribute>";
- }
- config += "<attribute name=\"FailureRetryInterval\">" + failureRetryInterval + "</attribute>";
-
- config += "<attribute name=\"MaxRetries\">" + maxRetries +"</attribute>";
-
- config += "<attribute name=\"AddMessageIDInHeader\">" + addMessageIDInHeader + "</attribute>";
- config += "</mbean>";
-
- // TODO: this has to be fixed
- // return ServerManagement.getServer(server).deploy(config);
- return null;
- }
-
- private void checkBridged(InitialContext icSource, InitialContext icTarget,
- String sourceCFLookup, String targetCFLookup,
- String sourceDestLookup, String targetDestLookup)
- throws Exception
- {
- Connection connSource = null;
-
- Connection connTarget = null;
-
- try
- {
- ConnectionFactory cf0 = (ConnectionFactory)icSource.lookup(sourceCFLookup);
-
- ConnectionFactory cf1 = (ConnectionFactory)icTarget.lookup(targetCFLookup);
-
- Destination destSource = (Destination)icSource.lookup(sourceDestLookup);
-
- Destination destTarget = (Destination)icTarget.lookup(targetDestLookup);
-
- connSource = cf0.createConnection();
-
- connTarget = cf1.createConnection();
-
- connTarget.start();
-
- connSource.start();
-
- final int NUM_MESSAGES = 50;
-
- Session sessSource = connSource.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- MessageProducer prod = sessSource.createProducer(destSource);
-
- Session sessTarget = connTarget.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- MessageConsumer cons = sessTarget.createConsumer(destTarget);
-
- for (int i = 0; i < NUM_MESSAGES; i++)
- {
- TextMessage tm = sessSource.createTextMessage("message" + i);
-
- prod.send(tm);
- }
-
- for (int i = 0; i < NUM_MESSAGES; i++)
- {
- TextMessage tm = (TextMessage)cons.receive(10000);
-
- assertNotNull(tm);
-
- assertEquals("message" + i, tm.getText());
- }
- }
- finally
- {
- if (connSource != null)
- {
- connSource.close();
- }
-
- if (connTarget != null)
- {
- connTarget.close();
- }
- }
- }
-
- private void installJMSProviderLoader(int server, Properties props, String factoryRef, String name)
- throws Exception
- {
- ByteArrayOutputStream boa = new ByteArrayOutputStream();
- props.store(boa, "");
- String propsString = new String(boa.toByteArray());
-
- String config =
- "<mbean code=\"org.jboss.jms.jndi.JMSProviderLoader\"" +
- " name=\"jboss.messaging:service=JMSProviderLoader,name=" + name + "\">" +
- "<attribute name=\"ProviderName\">" + name + "</attribute>" +
- "<attribute name=\"ProviderAdapterClass\">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>" +
- "<attribute name=\"FactoryRef\">" + factoryRef + "</attribute>" +
- "<attribute name=\"QueueFactoryRef\">" + factoryRef + "</attribute>" +
- "<attribute name=\"TopicFactoryRef\">" + factoryRef + "</attribute>" +
- "<attribute name=\"Properties\">" + propsString + "</attribute></mbean>";
-
- log.info("Installing bridge: " + config);
-
- // TODO: this has to be fixed
- // ServerManagement.getServer(0).deploy(config);
- }
-
-}
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-06 13:32:05 UTC (rev 6018)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/ServerManagement.java 2009-03-06 14:46:41 UTC (rev 6019)
@@ -25,22 +25,13 @@
import java.io.InputStreamReader;
import java.rmi.Naming;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.Hashtable;
-import java.util.Iterator;
import java.util.List;
-import java.util.Map;
-import javax.management.Notification;
-import javax.management.NotificationListener;
-import javax.management.ObjectName;
-import javax.transaction.UserTransaction;
-
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.NotificationListenerID;
import org.jboss.test.messaging.tools.container.RMITestServer;
import org.jboss.test.messaging.tools.container.RemoteInitialContextFactory;
import org.jboss.test.messaging.tools.container.Server;
@@ -80,10 +71,6 @@
private static List<Server> servers = new ArrayList<Server>();
-
- // Map<NotificationListener - NotificationListenerPoller>
- private static Map notificationListenerPollers = new HashMap();
-
public static boolean isLocal()
{
return !"true".equals(System.getProperty("remote"));
@@ -535,93 +522,6 @@
servers.get(0).undeploy(on);
}
- public static Object getAttribute(ObjectName on, String attribute) throws Exception
- {
- return getAttribute(0, on, attribute);
- }
-
- public static Object getAttribute(int serverIndex, ObjectName on, String attribute)
- throws Exception
- {
-
- return servers.get(serverIndex).getAttribute(on, attribute);
- }
-
-
- public static void setAttribute(ObjectName on, String name, String valueAsString)
- throws Exception
- {
-
- servers.get(0).setAttribute(on, name, valueAsString);
- }
-
- public static Object invoke(ObjectName on, String operationName,
- Object[] params, String[] signature) throws Exception
- {
-
- return servers.get(0).invoke(on, operationName, params, signature);
- }
-
- public static void addNotificationListener(int serverIndex, ObjectName on,
- NotificationListener listener) throws Exception
- {
-
-
- if (isLocal())
- {
- // add the listener directly to the server
- servers.get(serverIndex).addNotificationListener(on, listener);
- }
- else
- {
- // is remote, need to poll
- NotificationListenerPoller p =
- new NotificationListenerPoller(servers.get(serverIndex),
- on, listener);
-
- synchronized (notificationListenerPollers)
- {
- notificationListenerPollers.put(listener, p);
- }
-
- new Thread(p, "Poller for " + Integer.toHexString(p.hashCode())).start();
- }
- }
-
- public static void removeNotificationListener(int serverIndex, ObjectName on,
- NotificationListener listener) throws Exception
- {
-
-
- if (isLocal())
- {
- // remove the listener directly
- servers.get(serverIndex).removeNotificationListener(on, listener);
- }
- else
- {
- // is remote
-
- NotificationListenerPoller p = null;
- synchronized (notificationListenerPollers)
- {
- p = (NotificationListenerPoller) notificationListenerPollers.remove(listener);
- }
-
- if (p != null)
- {
- // stop the polling thread
- p.stop();
- }
- }
- }
-
- public static UserTransaction getUserTransaction() throws Exception
- {
-
- return servers.get(0).getUserTransaction();
- }
-
public static void log(int level, String text)
{
log(level, text, 0);
@@ -687,38 +587,6 @@
servers.get(0).stopServerPeer();
}
-// public static boolean isServerPeerStarted() throws Exception
-// {
-//
-// return servers.get(0).isServerPeerStarted();
-// }
-
- public static ObjectName getServerPeerObjectName() throws Exception
- {
-
- return servers.get(0).getServerPeerObjectName();
- }
-
-// public static MessageStore getMessageStore() throws Exception
-// {
-//
-// return servers.get(0).getMessageStore();
-// }
-
-// public static DestinationManager getDestinationManager()
-// throws Exception
-// {
-//
-// return servers.get(0).getDestinationManager();
-// }
-//
-// public static StorageManager getPersistenceManager()
-// throws Exception
-// {
-//
-// return servers.get(0).getPersistenceManager();
-// }
-
public static void configureSecurityForDestination(String destName, String config)
throws Exception
{
@@ -832,63 +700,4 @@
// }
// Inner classes -------------------------------------------------
- private static long listenerIDCounter = 0;
-
- static class NotificationListenerPoller implements Runnable
- {
- public static final int POLL_INTERVAL = 500;
-
- private long id;
- private Server server;
- private NotificationListener listener;
- private volatile boolean running;
-
- private synchronized static long generateID()
- {
- return listenerIDCounter++;
- }
-
- NotificationListenerPoller(Server server, ObjectName on, NotificationListener listener)
- throws Exception
- {
- id = generateID();
- this.server = server;
-
- server.addNotificationListener(on, new NotificationListenerID(id));
-
- this.listener = listener;
- this.running = true;
- }
-
- public void run()
- {
- while (running)
- {
- try
- {
- List notifications = server.pollNotificationListener(id);
-
- for (Iterator i = notifications.iterator(); i.hasNext();)
- {
- Notification n = (Notification) i.next();
- listener.handleNotification(n, null);
- }
-
- Thread.sleep(POLL_INTERVAL);
- }
- catch (Exception e)
- {
- log.error(e);
- stop();
- }
- }
- }
-
- public void stop()
- {
- running = false;
- }
- }
-
-
}
Deleted: trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/Command.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/Command.java 2009-03-06 13:32:05 UTC (rev 6018)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/Command.java 2009-03-06 14:46:41 UTC (rev 6019)
@@ -1,46 +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.Serializable;
-
-/**
- *
- * A Command.
- *
- * This interface is implemented by any classes that wish to be executed on a server
- *
- * @author <a href="tim.fox at jboss.com">Tim Fox</a>
- * @version <tt>$Revision: 1935 $</tt>
- *
- * $Id: Command.java 1935 2007-01-09 23:29:20Z clebert.suconic at jboss.com $
- */
-public interface Command extends Serializable
-{
- /**
- *
- * @param server The server where this command is being executed at
- * @return
- * @throws Exception
- */
- public Object execute(Server server) throws Exception;
-}
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-06 13:32:05 UTC (rev 6018)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java 2009-03-06 14:46:41 UTC (rev 6019)
@@ -29,11 +29,7 @@
import java.io.File;
import java.lang.management.ManagementFactory;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
@@ -41,24 +37,19 @@
import java.util.Set;
import javax.management.MBeanServerInvocationHandler;
-import javax.management.NotificationListener;
import javax.management.ObjectName;
import javax.naming.InitialContext;
-import javax.transaction.UserTransaction;
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;
import org.jboss.messaging.core.management.ObjectNames;
-import org.jboss.messaging.core.persistence.StorageManager;
import org.jboss.messaging.core.postoffice.Binding;
import org.jboss.messaging.core.postoffice.BindingType;
-import org.jboss.messaging.core.remoting.server.RemotingService;
import org.jboss.messaging.core.security.Role;
import org.jboss.messaging.core.server.MessagingServer;
import org.jboss.messaging.core.server.Queue;
-import org.jboss.messaging.core.settings.impl.AddressSettings;
import org.jboss.messaging.integration.bootstrap.JBMBootstrapServer;
import org.jboss.messaging.jms.JBossQueue;
import org.jboss.messaging.jms.JBossTopic;
@@ -103,11 +94,6 @@
// Attributes -----------------------------------------------------------------------------------
- private ServiceContainer sc;
-
- // the server MBean itself
- private ObjectName serverPeerObjectName;
-
private int serverIndex;
JBMBootstrapServer bootstrap;
@@ -263,31 +249,6 @@
}
}
- public Object getAttribute(ObjectName on, String attribute) throws Exception
- {
- return null;// sc.getAttribute(on, attribute);
- }
-
- public void setAttribute(ObjectName on, String name, String valueAsString) throws Exception
- {
- // sc.setAttribute(on, name, valueAsString);
- }
-
- public Object invoke(ObjectName on, String operationName, Object[] params, String[] signature) throws Exception
- {
- return null;// sc.invoke(on, operationName, params, signature);
- }
-
- public void addNotificationListener(ObjectName on, NotificationListener listener) throws Exception
- {
- // sc.addNotificationListener(on, listener);
- }
-
- public void removeNotificationListener(ObjectName on, NotificationListener listener) throws Exception
- {
- // sc.removeNotificationListener(on, listener);
- }
-
public void log(int level, String text)
{
if (ServerManagement.FATAL == level)
@@ -356,16 +317,6 @@
}
}
- public boolean isServerPeerStarted() throws Exception
- {
- return this.getJMSServerManager().isStarted();
- }
-
- public ObjectName getServerPeerObjectName()
- {
- return serverPeerObjectName;
- }
-
/**
* Only for in-VM use!
*/
@@ -511,38 +462,12 @@
}
}
- public Object executeCommand(Command command) throws Exception
- {
- return command.execute(this);
- }
-
- public UserTransaction getUserTransaction() throws Exception
- {
- // return sc.getUserTransaction();
- return null;
- }
-
- public List pollNotificationListener(long listenerID) throws Exception
- {
- throw new IllegalStateException("Poll doesn't make sense on a local server. " + "Register listeners directly instead.");
- }
-
- public void flushManagedConnectionPool()
- {
- // sc.flushManagedConnectionPool();
- }
-
// Public ---------------------------------------------------------------------------------------
// Package protected ----------------------------------------------------------------------------
// Protected ------------------------------------------------------------------------------------
- protected ServiceContainer getServiceContainer()
- {
- return sc;
- }
-
protected void overrideServerPeerConfiguration(MBeanConfigurationElement config,
int serverPeerID,
String defaultQueueJNDIContext,
@@ -627,14 +552,20 @@
}
}
- public List<SubscriptionInfo> listAllSubscribersForTopic(String s) throws Exception
+ public List<String> listAllSubscribersForTopic(String s) throws Exception
{
ObjectName objectName = ObjectNames.getJMSTopicObjectName(s);
TopicControlMBean topic = (TopicControlMBean)MBeanServerInvocationHandler.newProxyInstance(ManagementFactory.getPlatformMBeanServer(),
objectName,
TopicControlMBean.class,
false);
- return Arrays.asList(topic.listAllSubscriptionInfos());
+ SubscriptionInfo[] subInfos = topic.listAllSubscriptionInfos();
+ List<String> subs = new ArrayList<String>();
+ for (SubscriptionInfo info : subInfos)
+ {
+ subs.add(info.getName());
+ }
+ return subs;
}
public Set<Role> getSecurityConfig() throws Exception
@@ -648,15 +579,6 @@
getMessagingServer().getSecurityRepository().addMatch("#", defConfig);
}
- public void setRedeliveryDelayOnDestination(String dest, boolean queue, long delay) throws Exception
- {
- SimpleString condition = new SimpleString((queue ? "queuejms." : "topicjms.") + dest);
- AddressSettings addressSettings = new AddressSettings();
- addressSettings.setRedeliveryDelay(delay);
- // FIXME we need to expose queue attributes in another way
- // getMessagingServer().getServerManagement().setQueueAttributes(condition, addressSettings);
- }
-
// Inner classes --------------------------------------------------------------------------------
}
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-06 13:32:05 UTC (rev 6018)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java 2009-03-06 14:46:41 UTC (rev 6019)
@@ -25,19 +25,15 @@
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;
-import java.util.Arrays;
-import java.util.Collections;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import javax.management.MBeanServerInvocationHandler;
-import javax.management.NotificationListener;
import javax.management.ObjectName;
import javax.naming.InitialContext;
-import javax.transaction.UserTransaction;
import org.jboss.kernel.spi.deployment.KernelDeployment;
import org.jboss.messaging.core.logging.Logger;
@@ -129,7 +125,6 @@
protected RemoteTestServer server;
private RMINamingDelegate namingDelegate;
- private Map proxyListeners;
// Constructors --------------------------------------------------
@@ -137,7 +132,6 @@
{
namingDelegate = new RMINamingDelegate(index);
server = new RemoteTestServer(index);
- proxyListeners = new HashMap();
}
// Server implementation -----------------------------------------
@@ -205,67 +199,6 @@
return server.deployXML(name, xml);
}
-
-
-
- public Object getAttribute(ObjectName on, String attribute) throws Exception
- {
- return server.getAttribute(on, attribute);
- }
-
- public void setAttribute(ObjectName on, String name, String valueAsString) throws Exception
- {
- server.setAttribute(on, name, valueAsString);
- }
-
- public Object invoke(ObjectName on, String operationName, Object[] params, String[] signature)
- throws Exception
- {
- return server.invoke(on, operationName, params, signature);
- }
-
- public void addNotificationListener(ObjectName on, NotificationListener listener)
- throws Exception
- {
- if (!(listener instanceof NotificationListenerID))
- {
- throw new IllegalArgumentException("A RMITestServer can only handle NotificationListenerIDs!");
- }
-
- long id = ((NotificationListenerID)listener).getID();
-
- ProxyNotificationListener pl = new ProxyNotificationListener();
-
- synchronized(proxyListeners)
- {
- proxyListeners.put(new Long(id), pl);
- }
-
- server.addNotificationListener(on, pl);
- }
-
- public void removeNotificationListener(ObjectName on, NotificationListener listener)
- throws Exception
- {
-
- if (!(listener instanceof NotificationListenerID))
- {
- throw new IllegalArgumentException("A RMITestServer can only handle NotificationListenerIDs!");
- }
-
- long id = ((NotificationListenerID)listener).getID();
-
- ProxyNotificationListener pl = null;
-
- synchronized(proxyListeners)
- {
- pl = (ProxyNotificationListener)proxyListeners.remove(new Long(id));
- }
-
- server.removeNotificationListener(on, pl);
- }
-
-
public void log(int level, String text) throws Exception
{
server.log(level, text);
@@ -293,26 +226,6 @@
server.stopServerPeer();
}
- public void stopDestinationManager() throws Exception
- {
- //To change body of implemented methods use File | Settings | File Templates.
- }
-
- public void startDestinationManager() throws Exception
- {
- //To change body of implemented methods use File | Settings | File Templates.
- }
-
- public boolean isServerPeerStarted() throws Exception
- {
- return server.isServerPeerStarted();
- }
-
- public ObjectName getServerPeerObjectName() throws Exception
- {
- return server.getServerPeerObjectName();
- }
-
public boolean isStarted() throws Exception
{
return server.isStarted();
@@ -402,38 +315,6 @@
server.configureSecurityForDestination(destName, isQueue, roles);
}
- public Object executeCommand(Command command) throws Exception
- {
- return server.executeCommand(command);
- }
-
- public UserTransaction getUserTransaction() throws Exception
- {
- return server.getUserTransaction();
- }
-
- public List pollNotificationListener(long listenerID) throws Exception
- {
- ProxyNotificationListener pl = null;
-
- synchronized(proxyListeners)
- {
- pl = (ProxyNotificationListener)proxyListeners.get(new Long(listenerID));
- }
-
- if (pl == null)
- {
- return Collections.EMPTY_LIST;
- }
-
- return pl.drain();
- }
-
- public void flushManagedConnectionPool()
- {
- server.flushManagedConnectionPool();
- }
-
// Public --------------------------------------------------------
// Package protected ---------------------------------------------
@@ -471,12 +352,18 @@
}
- public List<SubscriptionInfo> listAllSubscribersForTopic(String s) throws Exception
+ public List<String> listAllSubscribersForTopic(String s) throws Exception
{
ObjectName objectName = ObjectNames.getJMSTopicObjectName(s);
TopicControlMBean topic = (TopicControlMBean) MBeanServerInvocationHandler.newProxyInstance(
ManagementFactory.getPlatformMBeanServer(), objectName, TopicControlMBean.class, false);
- return Arrays.asList(topic.listAllSubscriptionInfos());
+ SubscriptionInfo[] subInfos = topic.listAllSubscriptionInfos();
+ List<String> subs = new ArrayList<String>();
+ for (SubscriptionInfo info : subInfos)
+ {
+ subs.add(info.getName());
+ }
+ return subs;
}
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-06 13:32:05 UTC (rev 6018)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/tools/container/Server.java 2009-03-06 14:46:41 UTC (rev 6019)
@@ -26,17 +26,12 @@
import java.util.List;
import java.util.Set;
-import javax.management.NotificationListener;
-import javax.management.ObjectName;
import javax.naming.InitialContext;
-import javax.transaction.UserTransaction;
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.JBossDestination;
import org.jboss.messaging.jms.server.JMSServerManager;
-import org.jboss.messaging.jms.server.management.SubscriptionInfo;
/**
* The remote interface exposed by TestServer.
@@ -85,17 +80,6 @@
void undeploy(KernelDeployment undeploy) throws Exception;
- Object getAttribute(ObjectName on, String attribute) throws Exception;
-
- void setAttribute(ObjectName on, String name, String valueAsString) throws Exception;
-
- Object invoke(ObjectName on, String operationName, Object[] params, String[] signature)
- throws Exception;
-
- void addNotificationListener(ObjectName on, NotificationListener listener) throws Exception;
-
- void removeNotificationListener(ObjectName on, NotificationListener listener) throws Exception;
-
/**
* Only for remote use!
*/
@@ -114,10 +98,6 @@
void stopServerPeer() throws Exception;
- boolean isServerPeerStarted() throws Exception;
-
- ObjectName getServerPeerObjectName() throws Exception;
-
boolean isStarted() throws Exception;
/**
@@ -234,24 +214,6 @@
*/
void configureSecurityForDestination(String destName, boolean isQueue, Set<Role> roles) throws Exception;
- /**
- * Executes a command on the server
- *
- * @param command
- * @return the return value
- * @throws Exception
- */
- Object executeCommand(Command command) throws Exception;
-
- UserTransaction getUserTransaction() throws Exception;
-
- /**
- * @return List<Notification>
- */
- List pollNotificationListener(long listenerID) throws Exception;
-
- void flushManagedConnectionPool() throws Exception;
-
MessagingServer getMessagingServer() throws Exception;
InitialContext getInitialContext() throws Exception;
@@ -260,7 +222,7 @@
Integer getMessageCountForQueue(String queueName) throws Exception;
- List<SubscriptionInfo> listAllSubscribersForTopic(String s) throws Exception;
+ List<String> listAllSubscribersForTopic(String s) throws Exception;
Set<Role> getSecurityConfig() throws Exception;
Deleted: trunk/tests/jms-tests/src/org/jboss/test/messaging/util/JNDITest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/util/JNDITest.java 2009-03-06 13:32:05 UTC (rev 6018)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/util/JNDITest.java 2009-03-06 14:46:41 UTC (rev 6019)
@@ -1,126 +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.util;
-
-import java.util.Hashtable;
-
-import javax.management.ObjectName;
-import javax.naming.InitialContext;
-
-import org.jboss.messaging.core.logging.Logger;
-import org.jboss.test.messaging.MessagingTestCase;
-import org.jboss.test.messaging.tools.ServerManagement;
-
-/**
- * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
- *
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- */
-public class JNDITest extends MessagingTestCase
-{
- // Constants ------------------------------------------------------------------------------------
-
- private static final Logger log = Logger.getLogger(JNDITest.class);
-
- // Static ---------------------------------------------------------------------------------------
-
- // Attributes -----------------------------------------------------------------------------------
-
- // Constructors ---------------------------------------------------------------------------------
-
- // Public ---------------------------------------------------------------------------------------
-
- public void testInterServerJNDI() throws Throwable
- {
- // this test doesn't make sense in a colocated topology.
-
- if (!isRemote())
- {
- return;
- }
-
- try
- {
- ServerManagement.start(0, "all", true);
- ServerManagement.start(1, "all", false);
-
- // deploy an initial context "consumer" service on server 0
-
- String serviceName = "test:service=JNDITesterService";
- ObjectName on = new ObjectName(serviceName);
-
- String serviceConfig =
- "<mbean code=\"org.jboss.test.messaging.util.JNDITesterService\"\n" +
- " name=\"" + serviceName + "\">\n" +
- "</mbean>";
-
- ServerManagement.deploy(serviceConfig);
-
- // Deploy something into the server 1 JNDI namespace
-
- InitialContext ic = new InitialContext(ServerManagement.getJNDIEnvironment(1));
-
- ic.bind("/", "bingo");
-
- log.debug("deployed");
-
- // feed the service with an JNDI environment from server 1
-
- Hashtable environment = ServerManagement.getJNDIEnvironment(1);
- String s = (String)ServerManagement.
- invoke(on, "installAndUseJNDIEnvironment",
- new Object[] { environment, "/" },
- new String[] { "java.util.Hashtable", "java.lang.String" });
-
- assertEquals("bingo", s);
-
- }
- finally
- {
- ServerManagement.stop(1);
- ServerManagement.kill(1);
- ServerManagement.stop(0);
- }
- }
-
- // Package protected ----------------------------------------------------------------------------
-
- // Protected ------------------------------------------------------------------------------------
-
- protected void setUp() throws Exception
- {
- super.setUp();
- }
-
- protected void tearDown() throws Exception
- {
- super.tearDown();
- }
-
- // Private --------------------------------------------------------------------------------------
-
- // Inner classes --------------------------------------------------------------------------------
-
-
-}
More information about the jboss-cvs-commits
mailing list