[hornetq-commits] JBoss hornetq SVN: r9004 - in trunk: src/main/org/hornetq/jms/management/impl and 16 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Mon Mar 29 23:58:51 EDT 2010
Author: clebert.suconic at jboss.com
Date: 2010-03-29 23:58:50 -0400 (Mon, 29 Mar 2010)
New Revision: 9004
Added:
trunk/tests/src/org/hornetq/tests/integration/jms/client/StoreConfigTest.java
Removed:
trunk/tests/src/org/hornetq/tests/integration/jms/client/CreateCFTest.java
Modified:
trunk/src/main/org/hornetq/core/settings/impl/AddressSettings.java
trunk/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java
trunk/src/main/org/hornetq/jms/persistence/JMSStorageManager.java
trunk/src/main/org/hornetq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java
trunk/src/main/org/hornetq/jms/persistence/impl/nullpm/NullJMSStorageManagerImpl.java
trunk/src/main/org/hornetq/jms/server/JMSServerManager.java
trunk/src/main/org/hornetq/jms/server/impl/JMSServerDeployer.java
trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
trunk/tests/jms-tests/src/org/hornetq/jms/tests/tools/container/LocalTestServer.java
trunk/tests/src/org/hornetq/tests/integration/jms/FloodServerTest.java
trunk/tests/src/org/hornetq/tests/integration/jms/bridge/BridgeTestBase.java
trunk/tests/src/org/hornetq/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java
trunk/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java
trunk/tests/src/org/hornetq/tests/integration/jms/connection/ExceptionListenerTest.java
trunk/tests/src/org/hornetq/tests/integration/jms/consumer/ConsumerTest.java
trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java
trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.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
trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java
trunk/tests/src/org/hornetq/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java
trunk/tests/src/org/hornetq/tests/util/JMSClusteredTestBase.java
trunk/tests/src/org/hornetq/tests/util/JMSTestBase.java
Log:
Making deployers to not store configs on journals + adding tests and a few tweaks on configuration storage
Modified: trunk/src/main/org/hornetq/core/settings/impl/AddressSettings.java
===================================================================
--- trunk/src/main/org/hornetq/core/settings/impl/AddressSettings.java 2010-03-29 15:51:54 UTC (rev 9003)
+++ trunk/src/main/org/hornetq/core/settings/impl/AddressSettings.java 2010-03-30 03:58:50 UTC (rev 9004)
@@ -278,7 +278,7 @@
lastValueQueue = BufferHelper.readNullableBoolean(buffer);
- redeliveryDelay = BufferHelper.readNullableLong(buffer);
+ redistributionDelay = BufferHelper.readNullableLong(buffer);
sendToDLAOnNoRoute = BufferHelper.readNullableBoolean(buffer);
}
Modified: trunk/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java 2010-03-29 15:51:54 UTC (rev 9003)
+++ trunk/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java 2010-03-30 03:58:50 UTC (rev 9004)
@@ -292,7 +292,7 @@
try
{
- boolean created = server.createQueue(name, selector, true, JMSServerControlImpl.toArray(jndiBindings));
+ boolean created = server.createQueue(true, name, selector, true, JMSServerControlImpl.toArray(jndiBindings));
if (created)
{
sendNotification(NotificationType.QUEUE_CREATED, name);
@@ -339,7 +339,7 @@
try
{
- boolean created = server.createTopic(topicName, JMSServerControlImpl.toArray(jndiBindings));
+ boolean created = server.createTopic(true, topicName, JMSServerControlImpl.toArray(jndiBindings));
if (created)
{
sendNotification(NotificationType.TOPIC_CREATED, topicName);
Modified: trunk/src/main/org/hornetq/jms/persistence/JMSStorageManager.java
===================================================================
--- trunk/src/main/org/hornetq/jms/persistence/JMSStorageManager.java 2010-03-29 15:51:54 UTC (rev 9003)
+++ trunk/src/main/org/hornetq/jms/persistence/JMSStorageManager.java 2010-03-30 03:58:50 UTC (rev 9004)
@@ -64,7 +64,7 @@
// Inner classes -------------------------------------------------
- void addJNDI(PersistedType type, String name, String address) throws Exception;
+ void addJNDI(PersistedType type, String name, String ... address) throws Exception;
List<PersistedJNDI> recoverPersistedJNDI() throws Exception;
Modified: trunk/src/main/org/hornetq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java 2010-03-29 15:51:54 UTC (rev 9003)
+++ trunk/src/main/org/hornetq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java 2010-03-30 03:58:50 UTC (rev 9004)
@@ -185,7 +185,7 @@
return list;
}
- public void addJNDI(PersistedType type, String name, String address) throws Exception
+ public void addJNDI(PersistedType type, String name, String ... address) throws Exception
{
Pair<PersistedType, String> key = new Pair<PersistedType, String>(type, name);
@@ -203,7 +203,11 @@
mapJNDI.put(key, currentJNDI);
- currentJNDI.addJNDI(address);
+ for (String adItem : address)
+ {
+ currentJNDI.addJNDI(adItem);
+ }
+
long newId = idGenerator.generateID();
Modified: trunk/src/main/org/hornetq/jms/persistence/impl/nullpm/NullJMSStorageManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/persistence/impl/nullpm/NullJMSStorageManagerImpl.java 2010-03-29 15:51:54 UTC (rev 9003)
+++ trunk/src/main/org/hornetq/jms/persistence/impl/nullpm/NullJMSStorageManagerImpl.java 2010-03-30 03:58:50 UTC (rev 9004)
@@ -104,7 +104,7 @@
/* (non-Javadoc)
* @see org.hornetq.jms.persistence.JMSStorageManager#addJNDI(org.hornetq.jms.persistence.PersistedType, java.lang.String, java.lang.String)
*/
- public void addJNDI(PersistedType type, String name, String address) throws Exception
+ public void addJNDI(PersistedType type, String name, String ... address) throws Exception
{
}
Modified: trunk/src/main/org/hornetq/jms/server/JMSServerManager.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/JMSServerManager.java 2010-03-29 15:51:54 UTC (rev 9003)
+++ trunk/src/main/org/hornetq/jms/server/JMSServerManager.java 2010-03-30 03:58:50 UTC (rev 9004)
@@ -56,7 +56,7 @@
* @throws Exception
* if problems were encountered creating the queue.
*/
- boolean createQueue(String queueName, String selectorString, boolean durable, String ...jndi) throws Exception;
+ boolean createQueue(boolean storeConfig, String queueName, String selectorString, boolean durable, String ...jndi) throws Exception;
boolean addTopicToJndi(final String topicName, final String jndiBinding) throws Exception;
@@ -76,7 +76,7 @@
* @throws Exception
* if a problem occurred creating the topic
*/
- boolean createTopic(String topicName, String ... jndi) throws Exception;
+ boolean createTopic(boolean storeConfig, String topicName, String ... jndi) throws Exception;
/**
* Remove the topic from JNDI.
@@ -257,7 +257,7 @@
String groupId,
String ... jndiBindings) throws Exception;
- void createConnectionFactory(ConnectionFactoryConfiguration cfConfig, String... jndiBindings) throws Exception;
+ void createConnectionFactory(boolean storeConfig, ConnectionFactoryConfiguration cfConfig, String... jndiBindings) throws Exception;
/**
* destroys a connection factory.
Modified: trunk/src/main/org/hornetq/jms/server/impl/JMSServerDeployer.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/impl/JMSServerDeployer.java 2010-03-29 15:51:54 UTC (rev 9003)
+++ trunk/src/main/org/hornetq/jms/server/impl/JMSServerDeployer.java 2010-03-30 03:58:50 UTC (rev 9004)
@@ -169,7 +169,7 @@
TopicConfiguration topicConfig = parser.parseTopicConfiguration(node);
for (String jndi : topicConfig.getBindings())
{
- jmsServerManager.createTopic(topicConfig.getName(), jndi);
+ jmsServerManager.createTopic(false, topicConfig.getName(), jndi);
}
}
@@ -180,7 +180,7 @@
private void deployQueue(final Node node) throws Exception
{
JMSQueueConfiguration queueconfig = parser.parseQueueConfiguration(node);
- jmsServerManager.createQueue(queueconfig.getName(), queueconfig.getSelector(), queueconfig.isDurable(), queueconfig.getBindings());
+ jmsServerManager.createQueue(false, queueconfig.getName(), queueconfig.getSelector(), queueconfig.isDurable(), queueconfig.getBindings());
}
/**
@@ -190,7 +190,7 @@
private void deployConnectionFactory(final Node node) throws Exception
{
ConnectionFactoryConfiguration cfConfig = parser.parseConnectionFactoryConfiguration(node);
- jmsServerManager.createConnectionFactory(cfConfig, cfConfig.getBindings());
+ jmsServerManager.createConnectionFactory(false, cfConfig, cfConfig.getBindings());
}
Modified: trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2010-03-29 15:51:54 UTC (rev 9003)
+++ trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2010-03-30 03:58:50 UTC (rev 9004)
@@ -264,15 +264,21 @@
unbindJNDI(topicJNDI);
unbindJNDI(connectionFactoryJNDI);
+
for (String connectionFactory : new HashSet<String>(connectionFactories.keySet()))
{
destroyConnectionFactory(connectionFactory);
}
- // destinationBindings.clear();
connectionFactories.clear();
connectionFactoryJNDI.clear();
+
+ queueJNDI.clear();
+ queues.clear();
+
+ topicJNDI.clear();
+ topics.clear();
if (context != null)
{
@@ -338,7 +344,8 @@
return server.getVersion().getFullVersion();
}
- public synchronized boolean createQueue(final String queueName,
+ public synchronized boolean createQueue(final boolean storeConfig,
+ final String queueName,
final String selectorString,
final boolean durable,
final String... jndi) throws Exception
@@ -347,30 +354,81 @@
boolean added = internalCreateQueue(queueName, selectorString, durable);
- storage.storeDestination(new PersistedDestination(PersistedType.Queue, queueName, selectorString, durable));
+ if (!added)
+ {
+ return false;
+ }
+ HornetQDestination destination = queues.get(queueName);
+ if (destination == null)
+ {
+ // sanity check. internalCreateQueue should already have done this check
+ throw new IllegalArgumentException("Queue does not exist");
+ }
+
+ ArrayList<String> bindings = new ArrayList<String>();
+
for (String jndiItem : jndi)
{
- addQueueToJndi(queueName, jndiItem);
+ if (bindToJndi(jndiItem, destination))
+ {
+ bindings.add(jndiItem);
+ }
}
+ String[] usedJNDI = bindings.toArray(new String[bindings.size()]);
+ addToBindings(queueJNDI, queueName, usedJNDI);
+
+ if (storeConfig && durable)
+ {
+ storage.storeDestination(new PersistedDestination(PersistedType.Queue, queueName, selectorString, durable));
+ storage.addJNDI(PersistedType.Queue, queueName, usedJNDI);
+ }
+
return added;
}
- public synchronized boolean createTopic(final String topicName, final String... jndi) throws Exception
+ public synchronized boolean createTopic(final boolean storeConfig, final String topicName, final String... jndi) throws Exception
{
checkInitialised();
boolean added = internalCreateTopic(topicName);
- storage.storeDestination(new PersistedDestination(PersistedType.Topic, topicName));
-
- for (String jndiItem : jndi)
+ if (!added)
{
- addTopicToJndi(topicName, jndiItem);
+ return false;
}
+ else
+ {
+ HornetQDestination destination = topics.get(topicName);
- return added;
+ if (destination == null)
+ {
+ // sanity check. internalCreateQueue should already have done this check
+ throw new IllegalArgumentException("Queue does not exist");
+ }
+
+ ArrayList<String> bindings = new ArrayList<String>();
+
+ for (String jndiItem : jndi)
+ {
+ if (bindToJndi(jndiItem, destination))
+ {
+ bindings.add(jndiItem);
+ }
+ }
+
+ String[] usedJNDI = bindings.toArray(new String[bindings.size()]);
+ addToBindings(topicJNDI, topicName, usedJNDI);
+
+ if (storeConfig)
+ {
+ storage.storeDestination(new PersistedDestination(PersistedType.Topic, topicName));
+ storage.addJNDI(PersistedType.Topic, topicName, usedJNDI);
+ }
+
+ return true;
+ }
}
public boolean addTopicToJndi(final String topicName, final String jndiBinding) throws Exception
@@ -459,11 +517,14 @@
{
checkInitialised();
- removeFromJNDI(queueJNDI, name, jndi);
+ boolean removed = removeFromJNDI(queueJNDI, name, jndi);
- storage.deleteJNDI(PersistedType.Queue, name, jndi);
+ if (removed)
+ {
+ storage.deleteJNDI(PersistedType.Queue, name, jndi);
+ }
- return true;
+ return removed;
}
/* (non-Javadoc)
@@ -474,11 +535,15 @@
{
checkInitialised();
- removeFromJNDI(queueJNDI, name);
-
- storage.deleteJNDI(PersistedType.Queue, name);
-
- return true;
+ if (removeFromJNDI(queueJNDI, name))
+ {
+ storage.deleteJNDI(PersistedType.Queue, name);
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}
/* (non-Javadoc)
@@ -489,11 +554,15 @@
{
checkInitialised();
- removeFromJNDI(topicJNDI, name, jndi);
-
- storage.deleteJNDI(PersistedType.Topic, name, jndi);
-
- return true;
+ if (removeFromJNDI(topicJNDI, name, jndi))
+ {
+ storage.deleteJNDI(PersistedType.Topic, name, jndi);
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}
/* (non-Javadoc)
@@ -504,11 +573,14 @@
{
checkInitialised();
- removeFromJNDI(topicJNDI, name);
+ boolean removed = removeFromJNDI(topicJNDI, name);
- storage.deleteJNDI(PersistedType.Topic, name);
+ if (removed)
+ {
+ storage.deleteJNDI(PersistedType.Topic, name);
+ }
- return true;
+ return removed;
}
/* (non-Javadoc)
@@ -606,7 +678,7 @@
if (cf == null)
{
ConnectionFactoryConfiguration configuration = new ConnectionFactoryConfigurationImpl(name, connectorConfigs);
- createConnectionFactory(configuration, jndiBindings);
+ createConnectionFactory(true, configuration, jndiBindings);
}
}
@@ -621,7 +693,7 @@
{
ConnectionFactoryConfiguration configuration = new ConnectionFactoryConfigurationImpl(name, connectorConfigs);
configuration.setClientID(clientID);
- createConnectionFactory(configuration, jndiBindings);
+ createConnectionFactory(true, configuration, jndiBindings);
}
}
@@ -690,7 +762,7 @@
configuration.setReconnectAttempts(reconnectAttempts);
configuration.setFailoverOnServerShutdown(failoverOnServerShutdown);
configuration.setGroupID(groupId);
- createConnectionFactory(configuration, jndiBindings);
+ createConnectionFactory(true, configuration, jndiBindings);
}
}
@@ -765,7 +837,7 @@
configuration.setMaxRetryInterval(maxRetryInterval);
configuration.setReconnectAttempts(reconnectAttempts);
configuration.setFailoverOnServerShutdown(failoverOnServerShutdown);
- createConnectionFactory(configuration, jndiBindings);
+ createConnectionFactory(true, configuration, jndiBindings);
}
}
@@ -781,7 +853,7 @@
ConnectionFactoryConfiguration configuration = new ConnectionFactoryConfigurationImpl(name,
discoveryAddress,
discoveryPort);
- createConnectionFactory(configuration, jndiBindings);
+ createConnectionFactory(true, configuration, jndiBindings);
}
}
@@ -800,20 +872,34 @@
discoveryAddress,
discoveryPort);
configuration.setClientID(clientID);
- createConnectionFactory(configuration, jndiBindings);
+ createConnectionFactory(true, configuration, jndiBindings);
}
}
- public synchronized void createConnectionFactory(final ConnectionFactoryConfiguration cfConfig,
- String... jndiBindings) throws Exception
+ public synchronized void createConnectionFactory(final boolean storeConfig,
+ final ConnectionFactoryConfiguration cfConfig,
+ String... jndi) throws Exception
{
- internalCreateCF(cfConfig);
- storage.storeConnectionFactory(new PersistedConnectionFactory(cfConfig));
- for (String jndiBinding : jndiBindings)
+ HornetQConnectionFactory cf = internalCreateCF(cfConfig);
+
+ ArrayList<String> bindings = new ArrayList<String>();
+
+ for (String jndiItem : jndi)
{
- addConnectionFactoryToJNDI(cfConfig.getName(), jndiBinding);
+ if (bindToJndi(jndiItem, cf))
+ {
+ bindings.add(jndiItem);
+ }
}
+ String[] usedJNDI = bindings.toArray(new String[bindings.size()]);
+ addToBindings(connectionFactoryJNDI, cfConfig.getName(), usedJNDI);
+
+ if (storeConfig)
+ {
+ storage.storeConnectionFactory(new PersistedConnectionFactory(cfConfig));
+ storage.addJNDI(PersistedType.ConnectionFactory, cfConfig.getName(), usedJNDI);
+ }
}
private HornetQConnectionFactory internalCreateConnectionFactory(final String name,
@@ -974,26 +1060,33 @@
private boolean internalCreateQueue(final String queueName, final String selectorString, final boolean durable) throws Exception
{
- HornetQDestination hqQueue = HornetQDestination.createQueue(queueName);
-
- // Convert from JMS selector to core filter
- String coreFilterString = null;
-
- if (selectorString != null)
+ if (queues.get(queueName) != null)
{
- coreFilterString = SelectorTranslator.convertToHornetQFilterString(selectorString);
+ return false;
}
+ else
+ {
+ HornetQDestination hqQueue = HornetQDestination.createQueue(queueName);
- server.getHornetQServerControl().deployQueue(hqQueue.getAddress(),
- hqQueue.getAddress(),
- coreFilterString,
- durable);
+ // Convert from JMS selector to core filter
+ String coreFilterString = null;
- queues.put(queueName, hqQueue);
+ if (selectorString != null)
+ {
+ coreFilterString = SelectorTranslator.convertToHornetQFilterString(selectorString);
+ }
- jmsManagementService.registerQueue(hqQueue);
+ server.getHornetQServerControl().deployQueue(hqQueue.getAddress(),
+ hqQueue.getAddress(),
+ coreFilterString,
+ durable);
- return true;
+ queues.put(queueName, hqQueue);
+
+ jmsManagementService.registerQueue(hqQueue);
+
+ return true;
+ }
}
/**
@@ -1006,21 +1099,29 @@
*/
private boolean internalCreateTopic(final String topicName) throws Exception
{
- HornetQDestination hqTopic = HornetQDestination.createTopic(topicName);
- // We create a dummy subscription on the topic, that never receives messages - this is so we can perform JMS
- // checks when routing messages to a topic that
- // does not exist - otherwise we would not be able to distinguish from a non existent topic and one with no
- // subscriptions - core has no notion of a topic
- server.getHornetQServerControl().deployQueue(hqTopic.getAddress(),
- hqTopic.getAddress(),
- JMSServerManagerImpl.REJECT_FILTER,
- true);
- topics.put(topicName, hqTopic);
+ if (topics.get(topicName) != null)
+ {
+ return false;
+ }
+ else
+ {
+ HornetQDestination hqTopic = HornetQDestination.createTopic(topicName);
+ // We create a dummy subscription on the topic, that never receives messages - this is so we can perform JMS
+ // checks when routing messages to a topic that
+ // does not exist - otherwise we would not be able to distinguish from a non existent topic and one with no
+ // subscriptions - core has no notion of a topic
+ server.getHornetQServerControl().deployQueue(hqTopic.getAddress(),
+ hqTopic.getAddress(),
+ JMSServerManagerImpl.REJECT_FILTER,
+ true);
- jmsManagementService.registerTopic(hqTopic);
+ topics.put(topicName, hqTopic);
- return true;
+ jmsManagementService.registerTopic(hqTopic);
+
+ return true;
+ }
}
/**
@@ -1121,7 +1222,7 @@
if (cf == null)
{
ConnectionFactoryConfiguration configuration = new ConnectionFactoryConfigurationImpl(name, liveTC);
- createConnectionFactory(configuration, jndiBindings);
+ createConnectionFactory(true, configuration, jndiBindings);
}
}
@@ -1136,7 +1237,7 @@
{
ConnectionFactoryConfiguration configuration = new ConnectionFactoryConfigurationImpl(name, liveTC);
configuration.setClientID(clientID);
- createConnectionFactory(configuration, jndiBindings);
+ createConnectionFactory(true, configuration, jndiBindings);
}
}
@@ -1150,7 +1251,7 @@
if (cf == null)
{
ConnectionFactoryConfiguration configuration = new ConnectionFactoryConfigurationImpl(name, liveTC, backupTC);
- createConnectionFactory(configuration, jndiBindings);
+ createConnectionFactory(true, configuration, jndiBindings);
}
}
@@ -1166,7 +1267,7 @@
{
ConnectionFactoryConfiguration configuration = new ConnectionFactoryConfigurationImpl(name, liveTC, backupTC);
configuration.setClientID(clientID);
- createConnectionFactory(configuration, jndiBindings);
+ createConnectionFactory(true, configuration, jndiBindings);
}
}
@@ -1241,8 +1342,7 @@
}
}
-
- private void addToBindings(Map<String, List<String>> map, String name, String jndi)
+ private void addToBindings(Map<String, List<String>> map, String name, String... jndi)
{
List<String> list = map.get(name);
if (list == null)
@@ -1250,7 +1350,10 @@
list = new ArrayList<String>();
map.put(name, list);
}
- list.add(jndi);
+ for (String jndiItem : jndi)
+ {
+ list.add(jndiItem);
+ }
}
private boolean bindToJndi(final String jndiName, final Object objectToBind) throws NamingException
@@ -1333,30 +1436,21 @@
List<ConnectionFactoryConfiguration> connectionFactoryConfigurations = config.getConnectionFactoryConfigurations();
for (ConnectionFactoryConfiguration config : connectionFactoryConfigurations)
{
- createConnectionFactory(config, config.getBindings());
+ createConnectionFactory(false, config, config.getBindings());
}
List<JMSQueueConfiguration> queueConfigs = config.getQueueConfigurations();
for (JMSQueueConfiguration config : queueConfigs)
{
String[] bindings = config.getBindings();
- createQueue(config.getName(), config.getSelector(), config.isDurable());
- for (String binding : bindings)
- {
- addQueueToJndi(config.getName(), binding);
- }
+ createQueue(false, config.getName(), config.getSelector(), config.isDurable(), bindings);
}
List<TopicConfiguration> topicConfigs = config.getTopicConfigurations();
for (TopicConfiguration config : topicConfigs)
{
String[] bindings = config.getBindings();
- createTopic(config.getName());
-
- for (String binding : bindings)
- {
- addTopicToJndi(config.getName(), binding);
- }
+ createTopic(false, config.getName(), bindings);
}
}
@@ -1518,14 +1612,16 @@
{
return false;
}
- if (context != null)
+
+ if (jndiBindings.remove(jndi))
{
- if (jndiBindings.remove(jndi))
- {
- context.unbind(jndi);
- }
+ context.unbind(jndi);
+ return true;
}
- return true;
+ else
+ {
+ return false;
+ }
}
/**
Modified: trunk/tests/jms-tests/src/org/hornetq/jms/tests/tools/container/LocalTestServer.java
===================================================================
--- trunk/tests/jms-tests/src/org/hornetq/jms/tests/tools/container/LocalTestServer.java 2010-03-29 15:51:54 UTC (rev 9003)
+++ trunk/tests/jms-tests/src/org/hornetq/jms/tests/tools/container/LocalTestServer.java 2010-03-30 03:58:50 UTC (rev 9004)
@@ -210,12 +210,12 @@
public void createQueue(final String name, final String jndiName) throws Exception
{
- getJMSServerManager().createQueue(name, null, true, "/queue/" + (jndiName != null ? jndiName : name));
+ getJMSServerManager().createQueue(true, name, null, true, "/queue/" + (jndiName != null ? jndiName : name));
}
public void createTopic(final String name, final String jndiName) throws Exception
{
- getJMSServerManager().createTopic(name, "/topic/" + (jndiName != null ? jndiName : name));
+ getJMSServerManager().createTopic(true, name, "/topic/" + (jndiName != null ? jndiName : name));
}
public void deployConnectionFactory(final String clientId, final String objectName, final String ... jndiBindings) throws Exception
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/FloodServerTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/FloodServerTest.java 2010-03-29 15:51:54 UTC (rev 9003)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/FloodServerTest.java 2010-03-30 03:58:50 UTC (rev 9004)
@@ -93,7 +93,7 @@
serverManager.start();
serverManager.activated();
- serverManager.createTopic(topicName, topicName);
+ serverManager.createTopic(false, topicName, topicName);
registerConnectionFactory();
}
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/bridge/BridgeTestBase.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/bridge/BridgeTestBase.java 2010-03-29 15:51:54 UTC (rev 9003)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/bridge/BridgeTestBase.java 2010-03-30 03:58:50 UTC (rev 9004)
@@ -129,7 +129,7 @@
createQueue("sourceQueue", 0);
- jmsServer0.createTopic("sourceTopic", "/topic/sourceTopic");
+ jmsServer0.createTopic(false, "sourceTopic", "/topic/sourceTopic");
createQueue("localTargetQueue", 0);
@@ -150,7 +150,7 @@
{
server = jmsServer1;
}
- server.createQueue(queueName, null, true, "/queue/" + queueName);
+ server.createQueue(false, queueName, null, true, "/queue/" + queueName);
}
@Override
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java 2010-03-29 15:51:54 UTC (rev 9003)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java 2010-03-30 03:58:50 UTC (rev 9004)
@@ -199,7 +199,7 @@
JMSBridgeReconnectionTest.log.info("Restarting server");
jmsServer1.start();
- jmsServer1.createQueue("targetQueue", null, true, "queue/targetQueue");
+ jmsServer1.createQueue(false, "targetQueue", null, true, "queue/targetQueue");
createQueue("targetQueue", 1);
Deleted: trunk/tests/src/org/hornetq/tests/integration/jms/client/CreateCFTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/client/CreateCFTest.java 2010-03-29 15:51:54 UTC (rev 9003)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/client/CreateCFTest.java 2010-03-30 03:58:50 UTC (rev 9004)
@@ -1,105 +0,0 @@
-/*
- * Copyright 2010 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-package org.hornetq.tests.integration.jms.client;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.JMSException;
-import javax.jms.Session;
-import javax.naming.NamingException;
-
-import org.hornetq.api.core.Pair;
-import org.hornetq.api.core.TransportConfiguration;
-import org.hornetq.jms.server.config.impl.ConnectionFactoryConfigurationImpl;
-import org.hornetq.tests.util.JMSTestBase;
-
-/**
- * A CreateCFTest
- *
- * @author <mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
- *
- *
- */
-public class CreateCFTest extends JMSTestBase
-{
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- protected boolean usePersistence()
- {
- return true;
- }
-
- public void testCreateCF() throws Exception
- {
- ConnectionFactoryConfigurationImpl factCFG = new ConnectionFactoryConfigurationImpl("tst");
-
- ArrayList<Pair<String, String>> listStr = new ArrayList<Pair<String, String>>();
- listStr.add(new Pair<String, String>("netty", null));
-
- factCFG.setConnectorNames(listStr);
-
- jmsServer.createConnectionFactory(factCFG, "/someCF", "/someCF2" );
-
- openCon("/someCF");
- openCon("/someCF2");
-
- jmsServer.stop();
-
- jmsServer.start();
-
- openCon("/someCF");
- openCon("/someCF2");
-
-
-
- jmsServer.stop();
-
- }
-
- /**
- * @throws NamingException
- * @throws JMSException
- */
- private void openCon(String name) throws NamingException, JMSException
- {
- ConnectionFactory cf = (ConnectionFactory)context.lookup(name);
-
- Connection conn = cf.createConnection();
-
- conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- conn.close();
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Copied: trunk/tests/src/org/hornetq/tests/integration/jms/client/StoreConfigTest.java (from rev 9003, trunk/tests/src/org/hornetq/tests/integration/jms/client/CreateCFTest.java)
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/client/StoreConfigTest.java (rev 0)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/client/StoreConfigTest.java 2010-03-30 03:58:50 UTC (rev 9004)
@@ -0,0 +1,328 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.tests.integration.jms.client;
+
+import java.util.ArrayList;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.naming.NamingException;
+
+import org.hornetq.api.core.Pair;
+import org.hornetq.jms.server.config.impl.ConnectionFactoryConfigurationImpl;
+import org.hornetq.tests.util.JMSTestBase;
+
+/**
+ * A CreateCFTest
+ *
+ * @author <mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class StoreConfigTest extends JMSTestBase
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ protected boolean usePersistence()
+ {
+ return true;
+ }
+
+ public void testCreateCF() throws Exception
+ {
+ ConnectionFactoryConfigurationImpl factCFG = new ConnectionFactoryConfigurationImpl("tst");
+
+ ArrayList<Pair<String, String>> listStr = new ArrayList<Pair<String, String>>();
+ listStr.add(new Pair<String, String>("netty", null));
+
+ factCFG.setConnectorNames(listStr);
+
+ jmsServer.createConnectionFactory(true, factCFG, "/someCF", "/someCF2" );
+
+
+ ConnectionFactoryConfigurationImpl nonPersisted = new ConnectionFactoryConfigurationImpl("np");
+
+ listStr = new ArrayList<Pair<String, String>>();
+ listStr.add(new Pair<String, String>("netty", null));
+
+ nonPersisted.setConnectorNames(listStr);
+
+ jmsServer.createConnectionFactory(false, nonPersisted, "/nonPersisted" );
+
+ openCon("/someCF");
+ openCon("/someCF2");
+ openCon("/nonPersisted");
+
+ jmsServer.stop();
+
+ jmsServer.start();
+
+ openCon("/someCF");
+ openCon("/someCF2");
+ assertNullJNDI("/nonPersisted");
+
+ jmsServer.stop();
+
+ jmsServer.start();
+
+ jmsServer.addConnectionFactoryToJNDI("tst", "/newJNDI");
+ openCon("/someCF");
+ openCon("/someCF2");
+ openCon("/newJNDI");
+ assertNullJNDI("/nonPersisted");
+
+
+ jmsServer.stop();
+
+ assertNullJNDI("/newJNDI");
+
+ jmsServer.start();
+
+ openCon("/someCF");
+ openCon("/someCF2");
+ openCon("/newJNDI");
+ }
+
+ public void testCreateTopic() throws Exception
+ {
+ ConnectionFactoryConfigurationImpl factCFG = new ConnectionFactoryConfigurationImpl("tst");
+
+ ArrayList<Pair<String, String>> listStr = new ArrayList<Pair<String, String>>();
+ listStr.add(new Pair<String, String>("netty", null));
+
+ factCFG.setConnectorNames(listStr);
+
+ jmsServer.createConnectionFactory(true, factCFG, "/someCF");
+
+ assertTrue(jmsServer.createTopic(true, "topicOne", "/t1", "/t.1"));
+
+ assertTrue(jmsServer.createTopic(false, "topicTwo", "/t2", "/t.2"));
+
+ assertFalse(jmsServer.createTopic(false, "topicOne", "/z1", "z2"));
+
+ assertNullJNDI("/z1");
+ assertNullJNDI("/z2");
+
+ checkDestination("/t1");
+ checkDestination("/t.1");
+
+ checkDestination("/t2");
+ checkDestination("/t.2");
+
+ jmsServer.stop();
+
+ assertNullJNDI("/t1");
+ assertNullJNDI("/t.1");
+
+ assertNullJNDI("/t2");
+ assertNullJNDI("/t.2");
+
+
+ jmsServer.start();
+
+
+ checkDestination("/t1");
+ checkDestination("/t.1");
+
+ assertNullJNDI("/t2");
+ assertNullJNDI("/t.2");
+
+ jmsServer.addTopicToJndi("topicOne", "/tI");
+
+ jmsServer.stop();
+ jmsServer.start();
+
+ checkDestination("/tI");
+ checkDestination("/t1");
+ checkDestination("/t.1");
+
+ assertNullJNDI("/t2");
+ assertNullJNDI("/t.2");
+
+
+ assertTrue(jmsServer.removeTopicFromJNDI("topicOne", "/tI"));
+
+ assertFalse(jmsServer.removeTopicFromJNDI("topicOne","nothing"));
+ assertFalse(jmsServer.removeTopicFromJNDI("nothing","nothing"));
+ assertFalse(jmsServer.removeTopicFromJNDI("nothing"));
+
+ assertNullJNDI("/tI");
+ checkDestination("/t1");
+ checkDestination("/t.1");
+
+ jmsServer.stop();
+
+ jmsServer.start();
+
+ assertNullJNDI("/tI");
+ checkDestination("/t1");
+ checkDestination("/t.1");
+
+
+ jmsServer.stop();
+ }
+
+
+
+ private void checkDestination(String name) throws Exception
+ {
+ ConnectionFactory cf = (ConnectionFactory) context.lookup("/someCF");
+ Connection conn = cf.createConnection();
+ Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ Destination dest = (Destination)context.lookup(name);
+
+ conn.start();
+ MessageConsumer cons = sess.createConsumer(dest);
+
+ MessageProducer prod = sess.createProducer(dest);
+ prod.send(sess.createMessage());
+ assertNotNull(cons.receiveNoWait());
+ conn.close();
+
+ }
+
+
+
+
+ public void testCreateQueue() throws Exception
+ {
+ ConnectionFactoryConfigurationImpl factCFG = new ConnectionFactoryConfigurationImpl("tst");
+
+ ArrayList<Pair<String, String>> listStr = new ArrayList<Pair<String, String>>();
+ listStr.add(new Pair<String, String>("netty", null));
+
+ factCFG.setConnectorNames(listStr);
+
+ jmsServer.createConnectionFactory(true, factCFG, "/someCF");
+
+ assertTrue(jmsServer.createQueue(true, "queue1", null, true, "/q1", "/q.1"));
+
+ assertFalse(jmsServer.createQueue(true, "queue1", "someWeirdThing", true, "/qx", "/qz"));
+
+ assertNullJNDI("/qx");
+
+ assertNullJNDI("/qz");
+
+ assertTrue(jmsServer.createQueue(false, "queue2", null, true, "/q2", "/q.2"));
+
+ checkDestination("/q1");
+ checkDestination("/q.1");
+
+ checkDestination("/q2");
+ checkDestination("/q.2");
+
+ jmsServer.stop();
+
+ assertNullJNDI("/q1");
+ assertNullJNDI("/q1.1");
+ assertNullJNDI("/qI");
+ assertNullJNDI("/q2");
+ assertNullJNDI("/q.2");
+
+
+ jmsServer.start();
+
+
+ checkDestination("/q1");
+ checkDestination("/q.1");
+
+ assertNullJNDI("/q2");
+ assertNullJNDI("/q.2");
+
+ jmsServer.addQueueToJndi("queue1", "/qI");
+
+ jmsServer.stop();
+ jmsServer.start();
+
+ checkDestination("/qI");
+ checkDestination("/q1");
+ checkDestination("/q.1");
+
+ assertNullJNDI("/q2");
+ assertNullJNDI("/q.2");
+
+
+ assertTrue(jmsServer.removeQueueFromJNDI("queue1", "/q1"));
+
+ assertFalse(jmsServer.removeQueueFromJNDI("queue1","nothing"));
+
+ assertNullJNDI("/q1");
+ checkDestination("/q.1");
+ checkDestination("/qI");
+
+ jmsServer.stop();
+
+ jmsServer.start();
+
+ assertNullJNDI("/q1");
+ checkDestination("/q.1");
+ checkDestination("/qI");
+
+ jmsServer.stop();
+ }
+
+ /**
+ *
+ */
+ private void assertNullJNDI(String name)
+ {
+ Object obj = null;
+ try
+ {
+ obj = context.lookup(name);
+ }
+ catch (Exception expected)
+ {
+ }
+
+ assertNull(obj);
+ }
+ /**
+ * @throws NamingException
+ * @throws JMSException
+ */
+ private void openCon(String name) throws NamingException, JMSException
+ {
+ ConnectionFactory cf = (ConnectionFactory)context.lookup(name);
+
+ Connection conn = cf.createConnection();
+
+ conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ conn.close();
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java 2010-03-29 15:51:54 UTC (rev 9003)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java 2010-03-30 03:58:50 UTC (rev 9004)
@@ -100,7 +100,7 @@
public void testCreateQueue() throws Exception
{
- liveJMSService.createQueue("queue1", null, true, "/queue/queue1");
+ liveJMSService.createQueue(true, "queue1", null, true, "/queue/queue1");
assertNotNull(ctx1.lookup("/queue/queue1"));
liveJMSService.stop();
@@ -129,7 +129,7 @@
public void testCreateTopic() throws Exception
{
- liveJMSService.createTopic("topic", "/topic/t1");
+ liveJMSService.createTopic(true, "topic", "/topic/t1");
assertNotNull(ctx1.lookup("//topic/t1"));
liveJMSService.stop();
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/connection/ExceptionListenerTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/connection/ExceptionListenerTest.java 2010-03-29 15:51:54 UTC (rev 9003)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/connection/ExceptionListenerTest.java 2010-03-30 03:58:50 UTC (rev 9004)
@@ -69,7 +69,7 @@
jmsServer = new JMSServerManagerImpl(server);
jmsServer.setContext(new NullInitialContext());
jmsServer.start();
- jmsServer.createQueue(ExceptionListenerTest.Q_NAME, null, true, ExceptionListenerTest.Q_NAME);
+ jmsServer.createQueue(false, ExceptionListenerTest.Q_NAME, null, true, ExceptionListenerTest.Q_NAME);
cf = (HornetQConnectionFactory) HornetQJMSClient.createConnectionFactory(new TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMConnectorFactory"));
cf.setBlockOnDurableSend(true);
cf.setPreAcknowledge(true);
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/consumer/ConsumerTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/consumer/ConsumerTest.java 2010-03-29 15:51:54 UTC (rev 9003)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/consumer/ConsumerTest.java 2010-03-30 03:58:50 UTC (rev 9004)
@@ -49,7 +49,7 @@
{
super.setUp();
- jmsServer.createQueue(ConsumerTest.Q_NAME, null, true, ConsumerTest.Q_NAME);
+ jmsServer.createQueue(false, ConsumerTest.Q_NAME, null, true, ConsumerTest.Q_NAME);
cf = HornetQJMSClient.createConnectionFactory(new TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMConnectorFactory"));
}
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java 2010-03-29 15:51:54 UTC (rev 9003)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java 2010-03-30 03:58:50 UTC (rev 9004)
@@ -417,7 +417,7 @@
JMSQueueControl queueControl = createManagementControl();
String expiryQueueName = RandomUtil.randomString();
HornetQDestination expiryQueue = (HornetQDestination)HornetQJMSClient.createQueue(expiryQueueName);
- serverManager.createQueue(expiryQueueName, null, true, expiryQueueName);
+ serverManager.createQueue(false, expiryQueueName, null, true, expiryQueueName);
queueControl.setExpiryAddress(expiryQueue.getAddress());
JMSQueueControl expiryQueueControl = ManagementControlHelper.createJMSQueueControl(expiryQueue, mbeanServer);
@@ -544,7 +544,7 @@
public void testSendMessageToDeadLetterAddress() throws Exception
{
String deadLetterQueue = RandomUtil.randomString();
- serverManager.createQueue(deadLetterQueue, null, true, deadLetterQueue);
+ serverManager.createQueue(false, deadLetterQueue, null, true, deadLetterQueue);
HornetQDestination dlq = (HornetQDestination)HornetQJMSClient.createQueue(deadLetterQueue);
Connection conn = createConnection();
@@ -605,7 +605,7 @@
String filter = "key = " + matchingValue;
String deadLetterQueue = RandomUtil.randomString();
- serverManager.createQueue(deadLetterQueue, null, true, deadLetterQueue);
+ serverManager.createQueue(false, deadLetterQueue, null, true, deadLetterQueue);
HornetQDestination dlq = (HornetQDestination)HornetQJMSClient.createQueue(deadLetterQueue);
Connection conn = createConnection();
@@ -647,7 +647,7 @@
{
String otherQueueName = RandomUtil.randomString();
- serverManager.createQueue(otherQueueName, null, true, otherQueueName);
+ serverManager.createQueue(false, otherQueueName, null, true, otherQueueName);
HornetQDestination otherQueue = (HornetQDestination)HornetQJMSClient.createQueue(otherQueueName);
// send on queue
@@ -694,7 +694,7 @@
String filter = "key = " + matchingValue;
String otherQueueName = RandomUtil.randomString();
- serverManager.createQueue(otherQueueName, null, true, otherQueueName);
+ serverManager.createQueue(false, otherQueueName, null, true, otherQueueName);
HornetQDestination otherQueue = (HornetQDestination)HornetQJMSClient.createQueue(otherQueueName);
Connection connection = JMSUtil.createConnection(InVMConnectorFactory.class.getName());
@@ -729,7 +729,7 @@
{
String otherQueueName = RandomUtil.randomString();
- serverManager.createQueue(otherQueueName, null, true, otherQueueName);
+ serverManager.createQueue(false, otherQueueName, null, true, otherQueueName);
HornetQDestination otherQueue = (HornetQDestination)HornetQJMSClient.createQueue(otherQueueName);
String[] messageIDs = JMSUtil.sendMessages(queue, 1);
@@ -752,7 +752,7 @@
String unknownMessageID = RandomUtil.randomString();
String otherQueueName = RandomUtil.randomString();
- serverManager.createQueue(otherQueueName, null, true, otherQueueName);
+ serverManager.createQueue(false, otherQueueName, null, true, otherQueueName);
JMSQueueControl queueControl = createManagementControl();
Assert.assertEquals(0, queueControl.getMessageCount());
@@ -834,7 +834,7 @@
serverManager.activated();
String queueName = RandomUtil.randomString();
- serverManager.createQueue(queueName, null, true, queueName);
+ serverManager.createQueue(false, queueName, null, true, queueName);
queue = (HornetQDestination)HornetQJMSClient.createQueue(queueName);
}
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.java 2010-03-29 15:51:54 UTC (rev 9003)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.java 2010-03-30 03:58:50 UTC (rev 9004)
@@ -565,10 +565,13 @@
return Collections.EMPTY_LIST;
}
- public void addJNDI(PersistedType type, String name, String address) throws Exception
+ public void addJNDI(PersistedType type, String name, String ... address) throws Exception
{
persistedJNDIMap.putIfAbsent(name, new ArrayList<String>());
- persistedJNDIMap.get(name).add(address);
+ for (String ad: address)
+ {
+ persistedJNDIMap.get(name).add(ad);
+ }
}
public List<PersistedJNDI> recoverPersistedJNDI() 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 15:51:54 UTC (rev 9003)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/server/management/TopicControlTest.java 2010-03-30 03:58:50 UTC (rev 9004)
@@ -432,7 +432,7 @@
subscriptionName = RandomUtil.randomString();
String topicName = RandomUtil.randomString();
- serverManager.createTopic(topicName, topicBinding);
+ serverManager.createTopic(false, 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 15:51:54 UTC (rev 9003)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/server/management/TopicControlUsingJMSTest.java 2010-03-30 03:58:50 UTC (rev 9004)
@@ -357,7 +357,7 @@
subscriptionName = RandomUtil.randomString();
String topicName = RandomUtil.randomString();
- serverManager.createTopic(topicName, topicBinding );
+ serverManager.createTopic(false, topicName, topicBinding );
topic = (HornetQDestination)HornetQJMSClient.createTopic(topicName);
HornetQConnectionFactory cf = (HornetQConnectionFactory)HornetQJMSClient.createConnectionFactory(new TransportConfiguration(InVMConnectorFactory.class.getName()));
Modified: trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java 2010-03-29 15:51:54 UTC (rev 9003)
+++ trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java 2010-03-30 03:58:50 UTC (rev 9004)
@@ -22,15 +22,16 @@
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.management.HornetQServerControl;
import org.hornetq.api.core.management.ObjectNameBuilder;
+import org.hornetq.api.core.management.Parameter;
import org.hornetq.api.core.management.QueueControl;
import org.hornetq.api.core.management.RoleInfo;
import org.hornetq.core.config.Configuration;
-import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.messagecounter.impl.MessageCounterManagerImpl;
import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.HornetQServers;
+import org.hornetq.core.settings.impl.AddressSettings;
import org.hornetq.tests.util.RandomUtil;
import org.hornetq.utils.json.JSONArray;
import org.hornetq.utils.json.JSONObject;
@@ -391,16 +392,23 @@
Assert.assertEquals(newSample, serverControl.getMessageCounterSamplePeriod());
}
-
+
public void testSecuritySettings() throws Exception
{
HornetQServerControl serverControl = createManagementControl();
String addressMatch = "test.#";
String exactAddress = "test.whatever";
-
+
assertEquals(0, serverControl.getRoles(addressMatch).length);
serverControl.addSecuritySettings(addressMatch, "foo", "foo, bar", "foo", "bar", "foo, bar", "", "");
-
+
+ // Restart the server. Those settings should be persisted
+
+ server.stop();
+ server.start();
+
+ serverControl = createManagementControl();
+
String rolesAsJSON = serverControl.getRolesAsJSON(exactAddress);
RoleInfo[] roleInfos = RoleInfo.from(rolesAsJSON);
assertEquals(2, roleInfos.length);
@@ -423,7 +431,7 @@
assertTrue(fooRole.isCreateNonDurableQueue());
assertFalse(fooRole.isDeleteNonDurableQueue());
assertFalse(fooRole.isManage());
-
+
assertFalse(barRole.isSend());
assertTrue(barRole.isConsume());
assertFalse(barRole.isCreateDurableQueue());
@@ -431,11 +439,58 @@
assertTrue(barRole.isCreateNonDurableQueue());
assertFalse(barRole.isDeleteNonDurableQueue());
assertFalse(barRole.isManage());
-
+
serverControl.removeSecuritySettings(addressMatch);
assertEquals(0, serverControl.getRoles(exactAddress).length);
}
+ public void testAddressSettings() throws Exception
+ {
+ HornetQServerControl serverControl = createManagementControl();
+ String addressMatch = "test.#";
+ String exactAddress = "test.whatever";
+
+ String DLA = "someDLA";
+ String expiryAddress = "someExpiry";
+ boolean lastValueQueue = true;
+ int deliveryAttempts = 1;
+ long maxSizeBytes = 2;
+ int pageSizeBytes = 3;
+ long redeliveryDelay = 4;
+ long redistributionDelay = 5;
+ boolean sendToDLAOnNoRoute = true;
+ String addressFullMessagePolicy = "PAGE";
+
+ serverControl.addAddressSettings(addressMatch,
+ DLA,
+ expiryAddress,
+ lastValueQueue,
+ deliveryAttempts,
+ maxSizeBytes,
+ pageSizeBytes,
+ redeliveryDelay,
+ redistributionDelay,
+ sendToDLAOnNoRoute,
+ addressFullMessagePolicy);
+
+ server.stop();
+ server.start();
+ serverControl = createManagementControl();
+
+ AddressSettings settings = serverControl.getAddressSettings(exactAddress);
+
+ assertEquals(DLA, settings.getDeadLetterAddress().toString());
+ assertEquals(expiryAddress, settings.getExpiryAddress().toString());
+ assertEquals(lastValueQueue, settings.isLastValueQueue());
+ assertEquals(deliveryAttempts, settings.getMaxDeliveryAttempts());
+ assertEquals(maxSizeBytes, settings.getMaxSizeBytes());
+ assertEquals(pageSizeBytes, settings.getPageSizeBytes());
+ assertEquals(redeliveryDelay, settings.getRedeliveryDelay());
+ assertEquals(redistributionDelay, settings.getRedistributionDelay());
+ assertEquals(sendToDLAOnNoRoute, settings.isSendToDLAOnNoRoute());
+ assertEquals(addressFullMessagePolicy, settings.getAddressFullMessagePolicy().toString());
+ }
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
@@ -451,12 +506,13 @@
params,
RandomUtil.randomString());
- conf = new ConfigurationImpl();
+ conf = createDefaultConfig(false);
conf.setSecurityEnabled(false);
conf.setJMXManagementEnabled(true);
+ conf.getAcceptorConfigurations().clear();
conf.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
- server = HornetQServers.newHornetQServer(conf, mbeanServer, false);
+ server = HornetQServers.newHornetQServer(conf, mbeanServer, true);
conf.getConnectorConfigurations().put(connectorConfig.getName(), connectorConfig);
server.start();
}
Modified: trunk/tests/src/org/hornetq/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java 2010-03-29 15:51:54 UTC (rev 9003)
+++ trunk/tests/src/org/hornetq/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java 2010-03-30 03:58:50 UTC (rev 9004)
@@ -533,8 +533,8 @@
jmsServer.setContext(context);
jmsServer.start();
- jmsServer.createQueue(JMSBridgeImplTest.SOURCE, null, true, "/queue/" + JMSBridgeImplTest.SOURCE);
- jmsServer.createQueue(JMSBridgeImplTest.TARGET, null, true, "/queue/" + JMSBridgeImplTest.TARGET);
+ jmsServer.createQueue(false, JMSBridgeImplTest.SOURCE, null, true, "/queue/" + JMSBridgeImplTest.SOURCE);
+ jmsServer.createQueue(false, JMSBridgeImplTest.TARGET, null, true, "/queue/" + JMSBridgeImplTest.TARGET);
}
Modified: trunk/tests/src/org/hornetq/tests/util/JMSClusteredTestBase.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/util/JMSClusteredTestBase.java 2010-03-29 15:51:54 UTC (rev 9003)
+++ trunk/tests/src/org/hornetq/tests/util/JMSClusteredTestBase.java 2010-03-30 03:58:50 UTC (rev 9004)
@@ -90,16 +90,16 @@
*/
protected Queue createQueue(final String name) throws Exception, NamingException
{
- jmsServer2.createQueue(name, null, true, "/queue/" + name);
- jmsServer1.createQueue(name, null, true, "/queue/" + name);
+ jmsServer2.createQueue(false, name, null, true, "/queue/" + name);
+ jmsServer1.createQueue(false, name, null, true, "/queue/" + name);
return (Queue)context1.lookup("/queue/" + name);
}
protected Topic createTopic(final String name) throws Exception, NamingException
{
- jmsServer2.createTopic(name, "/topic/" + name);
- jmsServer1.createTopic(name, "/topic/" + name);
+ jmsServer2.createTopic(false, name, "/topic/" + name);
+ jmsServer1.createTopic(false, name, "/topic/" + name);
return (Topic)context1.lookup("/topic/" + name);
}
Modified: trunk/tests/src/org/hornetq/tests/util/JMSTestBase.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/util/JMSTestBase.java 2010-03-29 15:51:54 UTC (rev 9003)
+++ trunk/tests/src/org/hornetq/tests/util/JMSTestBase.java 2010-03-30 03:58:50 UTC (rev 9004)
@@ -85,14 +85,14 @@
*/
protected Queue createQueue(final String name) throws Exception, NamingException
{
- jmsServer.createQueue(name, null, true, "/jms/" + name);
+ jmsServer.createQueue(false, name, null, true, "/jms/" + name);
return (Queue)context.lookup("/jms/" + name);
}
protected Topic createTopic(final String name) throws Exception, NamingException
{
- jmsServer.createTopic(name, "/jms/" + name);
+ jmsServer.createTopic(false, name, "/jms/" + name);
return (Topic)context.lookup("/jms/" + name);
}
More information about the hornetq-commits
mailing list