Author: jmesnil
Date: 2010-03-29 04:17:41 -0400 (Mon, 29 Mar 2010)
New Revision: 8992
Modified:
trunk/src/main/org/hornetq/api/jms/management/TopicControl.java
trunk/src/main/org/hornetq/jms/management/impl/JMSTopicControlImpl.java
trunk/src/main/org/hornetq/jms/server/JMSServerManager.java
trunk/tests/src/org/hornetq/tests/integration/jms/server/management/TopicControlTest.java
trunk/tests/src/org/hornetq/tests/integration/jms/server/management/TopicControlUsingJMSTest.java
Log:
TopicControl fixes
* fixed calls to JMSServerManager methods dealing with Topic JNDI bindings
* fixed tests checking TopicControl's JNDIBindings
* changes TopicControl.getJNDIBindings() return type to String[] (so that
serialization works when using management messages)
Modified: trunk/src/main/org/hornetq/api/jms/management/TopicControl.java
===================================================================
--- trunk/src/main/org/hornetq/api/jms/management/TopicControl.java 2010-03-29 04:53:24
UTC (rev 8991)
+++ trunk/src/main/org/hornetq/api/jms/management/TopicControl.java 2010-03-29 08:17:41
UTC (rev 8992)
@@ -59,7 +59,7 @@
* Returns the JNDI bindings associated to this connection factory.
*/
@Operation(desc = "Returns the list of JNDI bindings associated")
- List<String> getJNDIBindings();
+ String[] getJNDIBindings();
/**
* Add the JNDI binding to this destination
Modified: trunk/src/main/org/hornetq/jms/management/impl/JMSTopicControlImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/management/impl/JMSTopicControlImpl.java 2010-03-29
04:53:24 UTC (rev 8991)
+++ trunk/src/main/org/hornetq/jms/management/impl/JMSTopicControlImpl.java 2010-03-29
08:17:41 UTC (rev 8992)
@@ -89,12 +89,13 @@
*/
public void addJNDI(String jndi) throws Exception
{
- jmsServerManager.addQueueToJndi(managedTopic.getName(), jndi);
+ jmsServerManager.addTopicToJndi(managedTopic.getName(), jndi);
}
- public List<String> getJNDIBindings()
+ public String[] getJNDIBindings()
{
- return jmsServerManager.getJNDIOnQueue(managedTopic.getName());
+ List<String> names =
jmsServerManager.getJNDIOnTopic(managedTopic.getName());
+ return (String[])names.toArray(new String[names.size()]);
}
Modified: trunk/src/main/org/hornetq/jms/server/JMSServerManager.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/JMSServerManager.java 2010-03-29 04:53:24 UTC
(rev 8991)
+++ trunk/src/main/org/hornetq/jms/server/JMSServerManager.java 2010-03-29 08:17:41 UTC
(rev 8992)
@@ -58,6 +58,8 @@
*/
boolean createQueue(String queueName, String selectorString, boolean durable, String
...jndi) throws Exception;
+ boolean addTopicToJndi(final String topicName, final String jndiBinding) throws
Exception;
+
boolean addQueueToJndi(final String queueName, final String jndiBinding) throws
Exception;
boolean addConnectionFactoryToJNDI(final String name, final String jndiBinding) throws
Exception;
Modified:
trunk/tests/src/org/hornetq/tests/integration/jms/server/management/TopicControlTest.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/integration/jms/server/management/TopicControlTest.java 2010-03-29
04:53:24 UTC (rev 8991)
+++
trunk/tests/src/org/hornetq/tests/integration/jms/server/management/TopicControlTest.java 2010-03-29
08:17:41 UTC (rev 8992)
@@ -34,6 +34,7 @@
import org.hornetq.jms.server.impl.JMSServerManagerImpl;
import org.hornetq.tests.integration.management.ManagementControlHelper;
import org.hornetq.tests.integration.management.ManagementTestBase;
+import org.hornetq.tests.unit.util.InVMContext;
import org.hornetq.tests.util.RandomUtil;
import org.hornetq.utils.json.JSONArray;
@@ -63,6 +64,8 @@
protected HornetQDestination topic;
+ private String topicBinding = "/topic/" + RandomUtil.randomString();
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -76,6 +79,9 @@
Assert.assertEquals(topic.getTopicName(), topicControl.getName());
Assert.assertEquals(topic.getAddress(), topicControl.getAddress());
Assert.assertEquals(topic.isTemporary(), topicControl.isTemporary());
+ Object[] bindings = topicControl.getJNDIBindings();
+ assertEquals(1, bindings.length);
+ Assert.assertEquals(topicBinding , bindings[0]);
}
public void testGetXXXSubscriptionsCount() throws Exception
@@ -419,14 +425,14 @@
serverManager = new JMSServerManagerImpl(server);
serverManager.start();
- serverManager.setContext(new NullInitialContext());
+ serverManager.setContext(new InVMContext());
serverManager.activated();
clientID = RandomUtil.randomString();
subscriptionName = RandomUtil.randomString();
String topicName = RandomUtil.randomString();
- serverManager.createTopic(topicName, topicName);
+ serverManager.createTopic(topicName, topicBinding);
topic = (HornetQDestination)HornetQJMSClient.createTopic(topicName);
}
Modified:
trunk/tests/src/org/hornetq/tests/integration/jms/server/management/TopicControlUsingJMSTest.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/integration/jms/server/management/TopicControlUsingJMSTest.java 2010-03-29
04:53:24 UTC (rev 8991)
+++
trunk/tests/src/org/hornetq/tests/integration/jms/server/management/TopicControlUsingJMSTest.java 2010-03-29
08:17:41 UTC (rev 8992)
@@ -13,6 +13,8 @@
package org.hornetq.tests.integration.jms.server.management;
+import static org.hornetq.tests.util.RandomUtil.randomString;
+
import javax.jms.Connection;
import javax.jms.QueueConnection;
import javax.jms.QueueSession;
@@ -33,6 +35,7 @@
import org.hornetq.jms.client.HornetQDestination;
import org.hornetq.jms.server.impl.JMSServerManagerImpl;
import org.hornetq.tests.integration.management.ManagementTestBase;
+import org.hornetq.tests.unit.util.InVMContext;
import org.hornetq.tests.util.RandomUtil;
public class TopicControlUsingJMSTest extends ManagementTestBase
@@ -58,6 +61,8 @@
private QueueSession session;
+ private String topicBinding = "/topic/" + randomString();
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -69,7 +74,9 @@
Assert.assertEquals(topic.getTopicName(),
proxy.retrieveAttributeValue("name"));
Assert.assertEquals(topic.getAddress(),
proxy.retrieveAttributeValue("address"));
Assert.assertEquals(topic.isTemporary(),
proxy.retrieveAttributeValue("temporary"));
- Assert.assertEquals(topic.getName(),
proxy.retrieveAttributeValue("JNDIBinding"));
+ Object[] bindings =
(Object[])proxy.retrieveAttributeValue("JNDIBindings");
+ assertEquals(1, bindings.length);
+ Assert.assertEquals(topicBinding, bindings[0]);
}
public void testGetXXXSubscriptionsCount() throws Exception
@@ -343,14 +350,14 @@
serverManager = new JMSServerManagerImpl(server);
serverManager.start();
- serverManager.setContext(new NullInitialContext());
+ serverManager.setContext(new InVMContext());
serverManager.activated();
clientID = RandomUtil.randomString();
subscriptionName = RandomUtil.randomString();
String topicName = RandomUtil.randomString();
- serverManager.createTopic(topicName, topicName);
+ serverManager.createTopic(topicName, topicBinding );
topic = (HornetQDestination)HornetQJMSClient.createTopic(topicName);
HornetQConnectionFactory cf =
(HornetQConnectionFactory)HornetQJMSClient.createConnectionFactory(new
TransportConfiguration(InVMConnectorFactory.class.getName()));