You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by js...@apache.org on 2006/07/07 10:57:11 UTC

svn commit: r419843 - in /incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq: config/ transport/ usecases/

Author: jstrachan
Date: Fri Jul  7 01:57:09 2006
New Revision: 419843

URL: http://svn.apache.org/viewvc?rev=419843&view=rev
Log:
moved the tests across from the assembly module that can be run inside the activemq-core module

Added:
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/config/
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/config/BrokerXmlConfigFromJNDITest.java   (with props)
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/config/BrokerXmlConfigTest.java   (with props)
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/config/ConfigTest.java   (with props)
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/QueueClusterTest.java   (with props)
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/TopicClusterTest.java   (with props)
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/
      - copied from r419046, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ChangeSentMessageTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/ChangeSentMessageTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ChangeSessionDeliveryModeTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/ChangeSessionDeliveryModeTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/CompositeConsumeTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/CompositeConsumeTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/CompositePublishTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/CompositePublishTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ConsumeQueuePrefetchTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/ConsumeQueuePrefetchTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ConsumeTopicPrefetchTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/ConsumeTopicPrefetchTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/CreateLotsOfTemporaryQueuesTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/CreateLotsOfTemporaryQueuesTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/CreateTemporaryQueueBeforeStartTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/CreateTemporaryQueueBeforeStartTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableConsumerCloseAndReconnectTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/DurableConsumerCloseAndReconnectTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionTestSupport.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/DurableSubscriptionTestSupport.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ExceptionListenerTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/ExceptionListenerTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/JDBCDurableSubscriptionTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/JDBCDurableSubscriptionTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/JournalDurableSubscriptionTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/JournalDurableSubscriptionTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/MultiBrokersMultiClientsTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/MultiBrokersMultiClientsTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/MultiBrokersMultiClientsUsingTcpTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/MultiBrokersMultiClientsUsingTcpTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ProducerConsumerTestSupport.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/ProducerConsumerTestSupport.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/PublishOnDurableTopicConsumedMessageTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/PublishOnDurableTopicConsumedMessageTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/PublishOnQueueConsumedMessageInTransactionTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/PublishOnQueueConsumedMessageInTransactionTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/PublishOnQueueConsumedMessageTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/PublishOnQueueConsumedMessageTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/PublishOnQueueConsumedMessageUsingActivemqXMLTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/PublishOnQueueConsumedMessageUsingActivemqXMLTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/PublishOnTemporaryQueueConsumedMessageTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/PublishOnTemporaryQueueConsumedMessageTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/PublishOnTopicConsumedMessageTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/PublishOnTopicConsumedMessageTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/PublishOnTopicConsumerMessageUsingActivemqXMLTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/PublishOnTopicConsumerMessageUsingActivemqXMLTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/QueueConsumerCloseAndReconnectTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/QueueConsumerCloseAndReconnectTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/QueueDuplicatesTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/QueueDuplicatesTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/QueueRedeliverTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/QueueRedeliverTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ReliableReconnectTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/ReliableReconnectTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/StartAndStopBrokerTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/StartAndStopBrokerTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/SubscribeClosePublishThenConsumeTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/SubscribeClosePublishThenConsumeTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/TestSupport.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/TestSupport.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ThreeBrokerQueueNetworkTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/ThreeBrokerQueueNetworkTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ThreeBrokerQueueNetworkUsingTcpTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/ThreeBrokerQueueNetworkUsingTcpTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ThreeBrokerTempQueueNetworkTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/ThreeBrokerTempQueueNetworkTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ThreeBrokerTopicNetworkTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/ThreeBrokerTopicNetworkTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ThreeBrokerTopicNetworkUsingTcpTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/ThreeBrokerTopicNetworkUsingTcpTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/TopicRedeliverTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/TopicRedeliverTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/TransactionRollbackOrderTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/TransactionRollbackOrderTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/TransactionTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/TransactionTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/TransientQueueRedeliverTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/TransientQueueRedeliverTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/TwoBrokerMessageNotSentToRemoteWhenNoConsumerTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/TwoBrokerMessageNotSentToRemoteWhenNoConsumerTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/TwoBrokerMulticastQueueTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/TwoBrokerMulticastQueueTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/TwoBrokerQueueClientsReconnectTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/TwoBrokerQueueClientsReconnectTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/TwoBrokerQueueSendReceiveTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/TwoBrokerQueueSendReceiveTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/TwoBrokerTopicSendReceiveLotsOfMessagesUsingTcpTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/TwoBrokerTopicSendReceiveLotsOfMessagesUsingTcpTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/TwoBrokerTopicSendReceiveTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/TwoBrokerTopicSendReceiveTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/TwoBrokerTopicSendReceiveUsingHttpTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/TwoBrokerTopicSendReceiveUsingHttpTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/TwoBrokerTopicSendReceiveUsingJavaConfigurationTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/TwoBrokerTopicSendReceiveUsingJavaConfigurationTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/TwoBrokerTopicSendReceiveUsingTcpTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/TwoBrokerTopicSendReceiveUsingTcpTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/TwoMulticastDiscoveryBrokerTopicSendReceiveTest.java
      - copied unchanged from r419827, incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/TwoMulticastDiscoveryBrokerTopicSendReceiveTest.java

Added: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/config/BrokerXmlConfigFromJNDITest.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/config/BrokerXmlConfigFromJNDITest.java?rev=419843&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/config/BrokerXmlConfigFromJNDITest.java (added)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/config/BrokerXmlConfigFromJNDITest.java Fri Jul  7 01:57:09 2006
@@ -0,0 +1,59 @@
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed 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.apache.activemq.config;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.test.JmsTopicSendReceiveWithTwoConnectionsTest;
+
+import javax.naming.InitialContext;
+import javax.naming.Context;
+
+import java.io.File;
+import java.util.Hashtable;
+
+/**
+ * @version $Revision$
+ */
+public class BrokerXmlConfigFromJNDITest extends JmsTopicSendReceiveWithTwoConnectionsTest {
+    protected ActiveMQConnectionFactory createConnectionFactory() throws Exception {
+        // START SNIPPET: example
+
+        
+        System.err.print(System.getProperties());
+        
+        // we could put these properties into a jndi.properties
+        // on the classpath instead
+        Hashtable properties = new Hashtable();
+        properties.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
+
+        // configure the embedded broker using an XML config file
+        // which is either a URL or a resource on the classpath
+        
+        File f = new File(System.getProperty("basedir", "."));
+        f = new File(f, "src/sample-conf/default.xml");
+        
+        properties.put("brokerXmlConfig", "file:"+f.getPath());
+        properties.put(Context.PROVIDER_URL, "vm://localhost");
+
+        InitialContext context = new InitialContext(properties);
+        ActiveMQConnectionFactory connectionFactory = (ActiveMQConnectionFactory) context.lookup("ConnectionFactory");
+
+        // END SNIPPET: example
+        return connectionFactory;
+    }
+
+}

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/config/BrokerXmlConfigFromJNDITest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/config/BrokerXmlConfigFromJNDITest.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/config/BrokerXmlConfigFromJNDITest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/config/BrokerXmlConfigFromJNDITest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/config/BrokerXmlConfigTest.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/config/BrokerXmlConfigTest.java?rev=419843&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/config/BrokerXmlConfigTest.java (added)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/config/BrokerXmlConfigTest.java Fri Jul  7 01:57:09 2006
@@ -0,0 +1,50 @@
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed 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.apache.activemq.config;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.test.JmsTopicSendReceiveWithTwoConnectionsTest;
+
+import java.net.URI;
+
+/**
+ * @version $Revision$
+ */
+public class BrokerXmlConfigTest extends JmsTopicSendReceiveWithTwoConnectionsTest {
+    protected ActiveMQConnectionFactory createConnectionFactory() throws Exception {
+        // START SNIPPET: bean
+
+        // configure the connection factory using
+        // normal Java Bean property methods
+        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();
+
+        // configure the embedded broker using an XML config file
+        // which is either a URL or a resource on the classpath
+
+        // TODO ...
+
+        //connectionFactory.setBrokerXmlConfig("file:src/sample-conf/default.xml");
+
+        // you only need to configure the broker URL if you wish to change the
+        // default connection mechanism, which in this test case we do
+        connectionFactory.setBrokerURL("vm://localhost");
+
+        // END SNIPPET: bean
+        return connectionFactory;
+    }
+
+}

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/config/BrokerXmlConfigTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/config/BrokerXmlConfigTest.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/config/BrokerXmlConfigTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/config/BrokerXmlConfigTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/config/ConfigTest.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/config/ConfigTest.java?rev=419843&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/config/ConfigTest.java (added)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/config/ConfigTest.java Fri Jul  7 01:57:09 2006
@@ -0,0 +1,380 @@
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed 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.apache.activemq.config;
+
+import java.io.File;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.activeio.command.DefaultWireFormat;
+import org.apache.activeio.command.WireFormat;
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.broker.TransportConnector;
+import org.apache.activemq.broker.region.policy.FixedSizedSubscriptionRecoveryPolicy;
+import org.apache.activemq.broker.region.policy.LastImageSubscriptionRecoveryPolicy;
+import org.apache.activemq.broker.region.policy.NoSubscriptionRecoveryPolicy;
+import org.apache.activemq.broker.region.policy.RoundRobinDispatchPolicy;
+import org.apache.activemq.broker.region.policy.SimpleDispatchPolicy;
+import org.apache.activemq.broker.region.policy.StrictOrderDispatchPolicy;
+import org.apache.activemq.broker.region.policy.SubscriptionRecoveryPolicy;
+import org.apache.activemq.broker.region.policy.TimedSubscriptionRecoveryPolicy;
+import org.apache.activemq.command.ActiveMQTopic;
+import org.apache.activemq.memory.UsageManager;
+import org.apache.activemq.openwire.OpenWireFormat;
+import org.apache.activemq.store.PersistenceAdapter;
+import org.apache.activemq.store.jdbc.JDBCPersistenceAdapter;
+import org.apache.activemq.store.journal.JournalPersistenceAdapter;
+import org.apache.activemq.store.memory.MemoryPersistenceAdapter;
+import org.apache.activemq.transport.activeio.ActiveIOTransportServer;
+import org.apache.activemq.transport.tcp.TcpTransportServer;
+import org.apache.activemq.xbean.BrokerFactoryBean;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.derby.jdbc.EmbeddedDataSource;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.core.io.Resource;
+
+/**
+ * @version $Revision$
+ */
+public class ConfigTest extends TestCase {
+    
+    private static final Log log = LogFactory.getLog(ConfigTest.class);
+    
+    protected static final String JOURNAL_ROOT = "target/test-data/";
+    protected static final String DERBY_ROOT = "target/test-data/";
+    protected static final String CONF_ROOT = "src/test/resources/org/apache/activemq/config/sample-conf/";
+
+    static {
+        System.setProperty("javax.net.ssl.trustStore", "src/test/resources/client.keystore");
+        System.setProperty("javax.net.ssl.trustStorePassword", "password");
+        System.setProperty("javax.net.ssl.trustStoreType", "jks");
+        System.setProperty("javax.net.ssl.keyStore", "src/test/resources/server.keystore");
+        System.setProperty("javax.net.ssl.keyStorePassword", "password");
+        System.setProperty("javax.net.ssl.keyStoreType", "jks");
+    }
+
+    /*
+     * IMPORTANT NOTE: Assertions checking for the existence of the derby directory will fail if the first derby
+     *                 directory is not created under target/test-data/. The test in unable to change the derby
+     *                 root directory for succeeding creation. It uses the first created directory as the root.
+     */
+
+    /*
+     * This tests creating a journal persistence adapter using the persistence adapter factory bean
+     */
+    public void testJournaledJDBCConfig() throws Exception {
+        System.out.print("Checking journaled JDBC persistence adapter configuration... ");
+
+        File journalFile = new File(JOURNAL_ROOT + "testJournaledJDBCConfig/journal");
+        recursiveDelete(journalFile);
+
+        File derbyFile = new File(DERBY_ROOT + "testJournaledJDBCConfig/derbydb"); // Default derby name
+        recursiveDelete(derbyFile);
+
+        BrokerService broker;
+        broker = createBroker(new FileSystemResource(CONF_ROOT + "journaledjdbc-example.xml"));
+        try {
+            assertEquals("Broker Config Error (brokerName)", "brokerJournaledJDBCConfigTest", broker.getBrokerName());
+
+            PersistenceAdapter adapter = broker.getPersistenceAdapter();
+
+            assertTrue("Should have created a journal persistence adapter", adapter instanceof JournalPersistenceAdapter);
+            assertTrue("Should have created a derby directory at " + derbyFile.getAbsolutePath(), derbyFile.exists());
+            assertTrue("Should have created a journal directory at " + journalFile.getAbsolutePath(), journalFile.exists());
+
+            
+            // Check persistence factory configurations
+            System.out.print("Checking persistence adapter factory settings... ");
+            JournalPersistenceAdapter pa = (JournalPersistenceAdapter) broker.getPersistenceAdapter();
+            
+            log.info("Success");
+        } finally {
+            if (broker != null) {
+                broker.stop();
+            }
+        }
+    }
+
+    /*
+     * This tests creating a jdbc persistence adapter using xbeans-spring
+     */
+    public void testJdbcConfig() throws Exception {
+        System.out.print("Checking jdbc persistence adapter configuration... ");
+
+        BrokerService broker;
+        broker = createBroker(new FileSystemResource(CONF_ROOT + "jdbc-example.xml"));
+        try {
+            assertEquals("Broker Config Error (brokerName)", "brokerJdbcConfigTest", broker.getBrokerName());
+
+            PersistenceAdapter adapter = broker.getPersistenceAdapter();
+
+            assertTrue("Should have created a jdbc persistence adapter", adapter instanceof JDBCPersistenceAdapter);
+            assertEquals("JDBC Adapter Config Error (cleanupPeriod)", 60000,
+                    ((JDBCPersistenceAdapter)adapter).getCleanupPeriod());
+            assertTrue("Should have created an EmbeddedDataSource",
+                    ((JDBCPersistenceAdapter)adapter).getDataSource() instanceof EmbeddedDataSource);
+            assertTrue("Should have created a DefaultWireFormat",
+                    ((JDBCPersistenceAdapter)adapter).getWireFormat() instanceof DefaultWireFormat);
+
+            log.info("Success");
+        } finally {
+            if (broker != null) {
+                broker.stop();
+            }
+        }
+    }
+
+    /*
+     * This tests configuring the different broker properties using xbeans-spring
+     */
+    public void testBrokerConfig() throws Exception {
+        ActiveMQTopic dest;
+        BrokerService broker;
+
+        File journalFile = new File(JOURNAL_ROOT);
+        recursiveDelete(journalFile);
+
+        // Create broker from resource
+        System.out.print("Creating broker... ");
+        broker = createBroker("org/apache/activemq/config/example.xml");
+        log.info("Success");
+
+        try {
+            // Check broker configuration
+            System.out.print("Checking broker configurations... ");
+            assertEquals("Broker Config Error (brokerName)", "brokerConfigTest", broker.getBrokerName());
+            assertEquals("Broker Config Error (populateJMSXUserID)", false, broker.isPopulateJMSXUserID());
+            assertEquals("Broker Config Error (useLoggingForShutdownErrors)", true, broker.isUseLoggingForShutdownErrors());
+            assertEquals("Broker Config Error (useJmx)", true, broker.isUseJmx());
+            assertEquals("Broker Config Error (persistent)", false, broker.isPersistent());
+            assertEquals("Broker Config Error (useShutdownHook)", false, broker.isUseShutdownHook());
+            assertEquals("Broker Config Error (deleteAllMessagesOnStartup)", true, broker.isDeleteAllMessagesOnStartup());
+            log.info("Success");
+
+            // Check specific vm transport
+            System.out.print("Checking vm connector... ");
+            assertEquals("Should have a specific VM Connector", "vm://javacoola", broker.getVmConnectorURI().toString());
+            log.info("Success");
+
+            // Check transport connectors list
+            System.out.print("Checking transport connectors... ");
+            List connectors = broker.getTransportConnectors();
+            assertTrue("Should have created at least 4 connectors", (connectors.size() >= 4));
+            assertTrue ("1st connector should be TcpTransportServer", ((TransportConnector)connectors.get(0)).getServer() instanceof TcpTransportServer);
+            assertTrue ("2nd connector should be TcpTransportServer", ((TransportConnector)connectors.get(1)).getServer() instanceof TcpTransportServer);
+            assertTrue ("3rd connector should be TcpTransportServer", ((TransportConnector)connectors.get(2)).getServer() instanceof TcpTransportServer);
+            assertTrue ("4th connector should be ActiveIOTransportServer", ((TransportConnector)connectors.get(3)).getServer() instanceof ActiveIOTransportServer);
+
+            // Check spring configured transport server (last transport connector only)
+            ActiveIOTransportServer myTransportServer = (ActiveIOTransportServer)((TransportConnector)connectors.get(3)).getServer();
+            assertEquals("URI should be ssl", "ssl://localhost:61634", myTransportServer.getConnectURI().toString());
+            assertEquals("Error transport server config (stopTimeout)", 5000, myTransportServer.getStopTimeout());
+
+            // Check spring configured wire format factory
+            WireFormat myWireFormat = myTransportServer.getWireFormatFactory().createWireFormat();
+            assertTrue("WireFormat should be OpenWireFormat", myWireFormat instanceof OpenWireFormat);
+            assertEquals("WireFormat Config Error (stackTraceEnabled)", false, ((OpenWireFormat)myWireFormat).getPreferedWireFormatInfo().isStackTraceEnabled());
+            assertEquals("WireFormat Config Error (tcpNoDelayEnabled)", true, ((OpenWireFormat)myWireFormat).getPreferedWireFormatInfo().isTcpNoDelayEnabled());
+            assertEquals("WireFormat Config Error (cacheEnabled)", false, ((OpenWireFormat)myWireFormat).getPreferedWireFormatInfo().isCacheEnabled());
+            log.info("Success");
+
+            // Check network connectors
+            System.out.print("Checking network connectors... ");
+            List networkConnectors = broker.getNetworkConnectors();
+            assertEquals("Should have a single network connector", 1, networkConnectors.size());
+            log.info("Success");
+
+            // Check dispatch policy configuration
+            System.out.print("Checking dispatch policies... ");
+
+            dest = new ActiveMQTopic("Topic.SimpleDispatch");
+            assertTrue("Should have a simple dispatch policy for " + dest.getTopicName(),
+                    broker.getDestinationPolicy().getEntryFor(dest).getDispatchPolicy() instanceof SimpleDispatchPolicy);
+
+            dest = new ActiveMQTopic("Topic.RoundRobinDispatch");
+            assertTrue("Should have a round robin dispatch policy for " + dest.getTopicName(),
+                    broker.getDestinationPolicy().getEntryFor(dest).getDispatchPolicy() instanceof RoundRobinDispatchPolicy);
+
+            dest = new ActiveMQTopic("Topic.StrictOrderDispatch");
+            assertTrue("Should have a strict order dispatch policy for " + dest.getTopicName(),
+                    broker.getDestinationPolicy().getEntryFor(dest).getDispatchPolicy() instanceof StrictOrderDispatchPolicy);
+            log.info("Success");
+
+            // Check subscription policy configuration
+            System.out.print("Checking subscription recovery policies... ");
+            SubscriptionRecoveryPolicy subsPolicy;
+
+            dest = new ActiveMQTopic("Topic.FixedSizedSubs");
+            subsPolicy = broker.getDestinationPolicy().getEntryFor(dest).getSubscriptionRecoveryPolicy();
+            assertTrue("Should have a fixed sized subscription recovery policy for " + dest.getTopicName(),
+                  subsPolicy instanceof FixedSizedSubscriptionRecoveryPolicy);
+            assertEquals("FixedSizedSubsPolicy Config Error (maximumSize)", 2000000,
+                  ((FixedSizedSubscriptionRecoveryPolicy)subsPolicy).getMaximumSize());
+            assertEquals("FixedSizedSubsPolicy Config Error (useSharedBuffer)", false,
+                  ((FixedSizedSubscriptionRecoveryPolicy)subsPolicy).isUseSharedBuffer());
+
+            dest = new ActiveMQTopic("Topic.LastImageSubs");
+            subsPolicy = broker.getDestinationPolicy().getEntryFor(dest).getSubscriptionRecoveryPolicy();
+            assertTrue("Should have a last image subscription recovery policy for " + dest.getTopicName(),
+                    subsPolicy instanceof LastImageSubscriptionRecoveryPolicy);
+
+            dest = new ActiveMQTopic("Topic.NoSubs");
+            subsPolicy = broker.getDestinationPolicy().getEntryFor(dest).getSubscriptionRecoveryPolicy();
+            assertTrue("Should have no subscription recovery policy for " + dest.getTopicName(),
+                    subsPolicy instanceof NoSubscriptionRecoveryPolicy);
+
+            dest = new ActiveMQTopic("Topic.TimedSubs");
+            subsPolicy = broker.getDestinationPolicy().getEntryFor(dest).getSubscriptionRecoveryPolicy();
+            assertTrue("Should have a timed subscription recovery policy for " + dest.getTopicName(),
+                    subsPolicy instanceof TimedSubscriptionRecoveryPolicy);
+            assertEquals("TimedSubsPolicy Config Error (recoverDuration)", 25000,
+                    ((TimedSubscriptionRecoveryPolicy)subsPolicy).getRecoverDuration());
+            log.info("Success");
+
+            // Check usage manager
+            System.out.print("Checking memory manager configurations... ");
+            UsageManager memMgr = broker.getMemoryManager();
+            assertTrue("Should have a memory manager", memMgr != null);
+            assertEquals("UsageManager Config Error (limit)", 200000, memMgr.getLimit());
+            assertEquals("UsageManager Config Error (percentUsageMinDelta)", 20, memMgr.getPercentUsageMinDelta());
+            log.info("Success");
+
+            log.info("Success");
+        } finally {
+            if (broker != null) {
+                broker.stop();
+            }
+        }
+    }
+
+    /*
+     * This tests creating a journal persistence adapter using xbeans-spring
+     */
+    public void testJournalConfig() throws Exception {
+        System.out.print("Checking journal persistence adapter configuration... ");
+
+        File journalFile = new File(JOURNAL_ROOT + "testJournalConfig/journal");
+        recursiveDelete(journalFile);
+
+        BrokerService broker;
+        broker = createBroker(new FileSystemResource(CONF_ROOT + "journal-example.xml"));
+        try {
+            assertEquals("Broker Config Error (brokerName)", "brokerJournalConfigTest", broker.getBrokerName());
+
+            PersistenceAdapter adapter = broker.getPersistenceAdapter();
+
+            assertTrue("Should have created a journal persistence adapter", adapter instanceof JournalPersistenceAdapter);
+            assertTrue("Should have created a journal directory at " + journalFile.getAbsolutePath(), journalFile.exists());
+
+            log.info("Success");
+        } finally {
+            if (broker != null) {
+                broker.stop();
+            }
+        }
+    }
+
+    /*
+     * This tests creating a memory persistence adapter using xbeans-spring
+     */
+    public void testMemoryConfig() throws Exception {
+        System.out.print("Checking memory persistence adapter configuration... ");
+
+        File journalFile = new File(JOURNAL_ROOT + "testMemoryConfig");
+        recursiveDelete(journalFile);
+
+        File derbyFile = new File(DERBY_ROOT + "testMemoryConfig");
+        recursiveDelete(derbyFile);
+
+        BrokerService broker;
+        broker = createBroker(new FileSystemResource(CONF_ROOT + "memory-example.xml"));
+
+        try {
+            assertEquals("Broker Config Error (brokerName)", "brokerMemoryConfigTest", broker.getBrokerName());
+
+            PersistenceAdapter adapter = broker.getPersistenceAdapter();
+
+            assertTrue("Should have created a memory persistence adapter", adapter instanceof MemoryPersistenceAdapter);
+            assertTrue("Should have not created a derby directory at " + derbyFile.getAbsolutePath(), !derbyFile.exists());
+            assertTrue("Should have not created a journal directory at " + journalFile.getAbsolutePath(), !journalFile.exists());
+
+            log.info("Success");
+        } finally {
+            if (broker != null) {
+                broker.stop();
+            }
+        }
+
+    }
+
+    public void testXmlConfigHelper() throws Exception {
+        BrokerService broker;
+
+        broker = createBroker(new FileSystemResource(CONF_ROOT + "memory-example.xml"));
+        try {
+            assertEquals("Broker Config Error (brokerName)", "brokerMemoryConfigTest", broker.getBrokerName());
+        } finally {
+            if (broker != null) {
+                broker.stop();
+            }
+        }
+
+        broker = createBroker("org/apache/activemq/config/config.xml");
+        try {
+            assertEquals("Broker Config Error (brokerName)", "brokerXmlConfigHelper", broker.getBrokerName());
+        } finally {
+            if (broker != null) {
+                broker.stop();
+            }
+        }
+    }
+
+    /*
+     * TODO: Create additional tests for forwarding bridges
+     */
+
+    protected static void recursiveDelete(File file) {
+        if( file.isDirectory() ) {
+            File[] files = file.listFiles();
+            for (int i = 0; i < files.length; i++) {
+                recursiveDelete(files[i]);
+            }
+        }
+        file.delete();
+    }
+
+    protected BrokerService createBroker(String resource) throws Exception {
+        return createBroker(new ClassPathResource(resource));
+    }
+
+    protected BrokerService createBroker(Resource resource) throws Exception {
+        BrokerFactoryBean factory = new BrokerFactoryBean(resource);
+        factory.afterPropertiesSet();
+
+        BrokerService broker = factory.getBroker();
+
+        assertTrue("Should have a broker!", broker != null);
+
+        //Broker is already started by default when using the XML file
+       // broker.start();
+
+        return broker;
+    }
+}

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/config/ConfigTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/config/ConfigTest.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/config/ConfigTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/config/ConfigTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/QueueClusterTest.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/QueueClusterTest.java?rev=419843&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/QueueClusterTest.java (added)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/QueueClusterTest.java Fri Jul  7 01:57:09 2006
@@ -0,0 +1,36 @@
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed 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.apache.activemq.transport;
+
+
+
+/**
+ * @version $Revision$
+ */
+public class QueueClusterTest extends TopicClusterTest {
+    
+    
+    protected void setUp() throws Exception{
+       topic = false;
+       super.setUp();
+    }
+    
+    protected int expectedReceiveCount(){
+        return MESSAGE_COUNT * NUMBER_IN_CLUSTER;
+    }
+    
+}

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/QueueClusterTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/QueueClusterTest.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/QueueClusterTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/QueueClusterTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/TopicClusterTest.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/TopicClusterTest.java?rev=419843&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/TopicClusterTest.java (added)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/TopicClusterTest.java Fri Jul  7 01:57:09 2006
@@ -0,0 +1,179 @@
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed 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.apache.activemq.transport;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jms.Connection;
+import javax.jms.DeliveryMode;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+
+import junit.framework.TestCase;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.broker.TransportConnector;
+import org.apache.activemq.command.ActiveMQQueue;
+import org.apache.activemq.command.ActiveMQTextMessage;
+import org.apache.activemq.command.ActiveMQTopic;
+import org.apache.activemq.util.ServiceStopper;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * @version $Revision$
+ */
+public class TopicClusterTest extends TestCase implements MessageListener {
+    protected final static Log log = LogFactory.getLog(TopicClusterTest.class);
+    protected Destination destination;
+    protected boolean topic = true;
+    protected AtomicInteger receivedMessageCount = new AtomicInteger(0);
+    protected static int MESSAGE_COUNT = 50;
+    protected static int NUMBER_IN_CLUSTER = 3;
+    protected int deliveryMode = DeliveryMode.NON_PERSISTENT;
+    protected MessageProducer[] producers;
+    protected Connection[] connections;
+    protected List services = new ArrayList();
+
+    protected void setUp() throws Exception {
+        connections = new Connection[NUMBER_IN_CLUSTER];
+        producers = new MessageProducer[NUMBER_IN_CLUSTER];
+        Destination destination = createDestination();
+        int portStart = 50000;
+        String root = System.getProperty("activemq.store.dir");
+        if (root == null) {
+            root = "target/store";
+        }
+        try {
+            for (int i = 0;i < NUMBER_IN_CLUSTER;i++) {
+
+                System.setProperty("activemq.store.dir", root + "_broker_" + i);
+                connections[i] = createConnection("broker-" + i);
+                connections[i].setClientID("ClusterTest" + i);
+                connections[i].start();
+                Session session = connections[i].createSession(false, Session.AUTO_ACKNOWLEDGE);
+                producers[i] = session.createProducer(destination);
+                producers[i].setDeliveryMode(deliveryMode);
+                MessageConsumer consumer = createMessageConsumer(session,destination);
+                consumer.setMessageListener(this);
+
+            }
+            log.info("Sleeping to ensure cluster is fully connected");
+            Thread.sleep(5000);
+        } finally {
+            System.setProperty("activemq.store.dir", root);
+        }
+    }
+
+    protected void tearDown() throws Exception {
+        if (connections != null) {
+            for (int i = 0;i < connections.length;i++) {
+                connections[i].close();
+            }
+        }
+        ServiceStopper stopper = new ServiceStopper();
+        stopper.stopServices(services);
+    }
+    
+    protected MessageConsumer createMessageConsumer(Session session, Destination destination) throws JMSException{
+        return session.createConsumer(destination);
+    }
+
+    protected ActiveMQConnectionFactory createGenericClusterFactory(String brokerName) throws Exception {
+        BrokerService container = new BrokerService();
+        container.setBrokerName(brokerName);
+      
+        String url = "tcp://localhost:0";
+        TransportConnector connector = container.addConnector(url);
+        connector.setDiscoveryUri(new URI("multicast://default"));        
+        container.addNetworkConnector("multicast://default");
+        container.start();
+        
+        services.add(container);
+        
+        return new ActiveMQConnectionFactory("vm://"+brokerName);
+    }
+
+    protected int expectedReceiveCount() {
+        return MESSAGE_COUNT * NUMBER_IN_CLUSTER * NUMBER_IN_CLUSTER;
+    }
+
+    protected Connection createConnection(String name) throws Exception {
+        return createGenericClusterFactory(name).createConnection();
+    }
+
+    protected Destination createDestination() {
+        return createDestination(getClass().getName());
+    }
+
+    protected Destination createDestination(String name) {
+        if (topic) {
+            return new ActiveMQTopic(name);
+        }
+        else {
+            return new ActiveMQQueue(name);
+        }
+    }
+
+
+    /**
+     * @param msg
+     */
+    public void onMessage(Message msg) {
+        //log.info("GOT: " + msg);
+        receivedMessageCount.incrementAndGet();
+        synchronized (receivedMessageCount) {
+            if (receivedMessageCount.get() >= expectedReceiveCount()) {
+                receivedMessageCount.notify();
+            }
+        }
+    }
+
+    /**
+     * @throws Exception
+     */
+    public void testSendReceive() throws Exception {
+        for (int i = 0;i < MESSAGE_COUNT;i++) {
+            TextMessage textMessage = new ActiveMQTextMessage();
+            textMessage.setText("MSG-NO:" + i);
+            for (int x = 0;x < producers.length;x++) {
+                producers[x].send(textMessage);
+            }
+        }
+        synchronized (receivedMessageCount) {
+            if (receivedMessageCount.get() < expectedReceiveCount()) {
+                receivedMessageCount.wait(20000);
+            }
+        }
+        //sleep a little - to check we don't get too many messages
+        Thread.sleep(2000);
+        System.err.println("GOT: " + receivedMessageCount.get());
+        assertEquals("Expected message count not correct", expectedReceiveCount(), receivedMessageCount.get());
+    }
+
+}
\ No newline at end of file

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/TopicClusterTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/TopicClusterTest.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/TopicClusterTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/TopicClusterTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain