activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r951067 - in /activemq/trunk/activemq-core/src/test: java/org/apache/activemq/usecases/ resources/org/apache/activemq/usecases/
Date Thu, 03 Jun 2010 16:51:41 GMT
Author: dejanb
Date: Thu Jun  3 16:51:40 2010
New Revision: 951067

URL: http://svn.apache.org/viewvc?rev=951067&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQ-2753 - additional test

Added:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/MessageReroutingTest.java
    activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/usecases/rerouting-activemq-A.xml
    activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/usecases/rerouting-activemq-B.xml
    activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/usecases/rerouting-activemq-C.xml
    activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/usecases/rerouting-activemq-D.xml

Added: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/MessageReroutingTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/MessageReroutingTest.java?rev=951067&view=auto
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/MessageReroutingTest.java
(added)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/MessageReroutingTest.java
Thu Jun  3 16:51:40 2010
@@ -0,0 +1,87 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.apache.activemq.usecases;
+
+import javax.jms.Destination;
+import javax.jms.MessageConsumer;
+
+import junit.framework.Test;
+
+import org.apache.activemq.JmsMultipleBrokersTestSupport;
+import org.apache.activemq.command.ActiveMQQueue;
+import org.apache.activemq.command.ActiveMQTopic;
+import org.apache.activemq.util.MessageIdList;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.core.io.ClassPathResource;
+
+public class MessageReroutingTest extends JmsMultipleBrokersTestSupport {
+    private static final transient Log LOG = LogFactory.getLog(MessageReroutingTest.class);
+    
+    
+    public Destination dest;
+    public static final int MESSAGE_COUNT = 50;
+
+    protected void setUp() throws Exception {
+        super.setAutoFail(true);
+        super.setUp();
+        
+        createBroker(new ClassPathResource("org/apache/activemq/usecases/rerouting-activemq-D.xml"));
+        createBroker(new ClassPathResource("org/apache/activemq/usecases/rerouting-activemq-C.xml"));
+        createBroker(new ClassPathResource("org/apache/activemq/usecases/rerouting-activemq-B.xml"));
+        createBroker(new ClassPathResource("org/apache/activemq/usecases/rerouting-activemq-A.xml"));
+        
+        brokers.get("broker-A").broker.waitUntilStarted();
+    }
+    
+    public void initCombos() {
+        addCombinationValues("dest", new Object[] {new ActiveMQQueue("TEST"), new ActiveMQTopic("TEST")});
+    }
+    
+    public void testMessageRerouting() throws Exception {
+        MessageConsumer consumer = createConsumer("broker-D", dest);
+        
+        MessageIdList received = getConsumerMessages("broker-D", consumer);
+        
+        Thread.sleep(2000); //wait for subs to propagate
+
+        // send/receive messages
+        sendMessages("broker-A", dest, MESSAGE_COUNT);
+        received.waitForMessagesToArrive(MESSAGE_COUNT);
+        LOG.info("received " +  received.getMessageCount() + " messages");
+        assertEquals(MESSAGE_COUNT, received.getMessageCount());
+        
+        brokers.get("broker-B").broker.stop();
+        brokers.get("broker-B").broker.waitUntilStopped();
+        Thread.sleep(2000);
+        
+        // ensure send/receive still works
+        sendMessages("broker-A", dest, MESSAGE_COUNT);
+        received.waitForMessagesToArrive(MESSAGE_COUNT);
+        LOG.info("received " +  received.getMessageCount() + " messages");
+        assertTrue("Didn't receive any more messages " + received.getMessageCount(), received.getMessageCount()
> MESSAGE_COUNT);
+        
+        
+    }
+
+    
+    public static Test suite() {
+        return suite(MessageReroutingTest.class);
+    }
+    
+    
+}

Added: activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/usecases/rerouting-activemq-A.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/usecases/rerouting-activemq-A.xml?rev=951067&view=auto
==============================================================================
--- activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/usecases/rerouting-activemq-A.xml
(added)
+++ activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/usecases/rerouting-activemq-A.xml
Thu Jun  3 16:51:40 2010
@@ -0,0 +1,54 @@
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF 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.
+-->
+<beans
+  xmlns="http://www.springframework.org/schema/beans"
+  xmlns:amq="http://activemq.apache.org/schema/core"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+  http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
+
+	<!--
+		The <broker> element is used to configure the ActiveMQ broker.
+	-->
+	<broker xmlns="http://activemq.apache.org/schema/core"
+		brokerName="broker-A" dataDirectory="target/durable-data-A" persistent="false" useJmx="false">
+
+        <destinationPolicy>
+            <policyMap>
+                <policyEntries>
+                    <policyEntry topic=">" enableAudit="true">
+                        <dispatchPolicy>
+                            <priorityNetworkDispatchPolicy/>
+                        </dispatchPolicy>
+                    </policyEntry>
+                </policyEntries>
+            </policyMap>
+        </destinationPolicy>
+		
+		<!--  connect to B and C-->
+        <networkConnectors>
+            <networkConnector uri="static:(tcp://localhost:61617)" name="A-B" networkTTL="2"
suppressDuplicateTopicSubscriptions="false" />
+            <networkConnector uri="static:(tcp://localhost:61618)" name="A-C" networkTTL="2"
suppressDuplicateTopicSubscriptions="false" />
+        </networkConnectors>
+
+		<transportConnectors>
+			<transportConnector name="openwire" uri="tcp://0.0.0.0:61616" />
+		</transportConnectors>
+		
+	</broker>
+    
+</beans>

Added: activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/usecases/rerouting-activemq-B.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/usecases/rerouting-activemq-B.xml?rev=951067&view=auto
==============================================================================
--- activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/usecases/rerouting-activemq-B.xml
(added)
+++ activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/usecases/rerouting-activemq-B.xml
Thu Jun  3 16:51:40 2010
@@ -0,0 +1,41 @@
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF 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.
+-->
+<beans
+  xmlns="http://www.springframework.org/schema/beans"
+  xmlns:amq="http://activemq.apache.org/schema/core"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+  http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
+
+    <!--
+        The <broker> element is used to configure the ActiveMQ broker.
+    -->
+    <broker xmlns="http://activemq.apache.org/schema/core"
+        brokerName="broker-B" dataDirectory="target/durable-data-B" persistent="false" useJmx="false">
+        
+        <!--  connect to D -->
+        <networkConnectors>
+            <networkConnector uri="static:(tcp://localhost:61619)" name="B-D" networkTTL="2"
/>
+        </networkConnectors>
+
+        <transportConnectors>
+            <transportConnector name="openwire" uri="tcp://0.0.0.0:61617" />
+        </transportConnectors>
+
+    </broker>
+    
+</beans>

Added: activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/usecases/rerouting-activemq-C.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/usecases/rerouting-activemq-C.xml?rev=951067&view=auto
==============================================================================
--- activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/usecases/rerouting-activemq-C.xml
(added)
+++ activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/usecases/rerouting-activemq-C.xml
Thu Jun  3 16:51:40 2010
@@ -0,0 +1,42 @@
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF 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.
+-->
+<beans
+  xmlns="http://www.springframework.org/schema/beans"
+  xmlns:amq="http://activemq.apache.org/schema/core"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+  http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
+
+    <!--
+        The <broker> element is used to configure the ActiveMQ broker.
+    -->
+    <broker xmlns="http://activemq.apache.org/schema/core"
+        brokerName="broker-C" dataDirectory="target/durable-data-C" persistent="false" useJmx="false">
+
+        
+        <!--  connect to D -->
+        <networkConnectors>
+            <networkConnector uri="static:(tcp://localhost:61619)" name="C-D" networkTTL="2"
/>
+        </networkConnectors>                
+
+        <transportConnectors>
+            <transportConnector name="openwire" uri="tcp://0.0.0.0:61618" />
+        </transportConnectors>
+
+    </broker>
+    
+</beans>
\ No newline at end of file

Added: activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/usecases/rerouting-activemq-D.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/usecases/rerouting-activemq-D.xml?rev=951067&view=auto
==============================================================================
--- activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/usecases/rerouting-activemq-D.xml
(added)
+++ activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/usecases/rerouting-activemq-D.xml
Thu Jun  3 16:51:40 2010
@@ -0,0 +1,45 @@
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF 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.
+-->
+<beans
+  xmlns="http://www.springframework.org/schema/beans"
+  xmlns:amq="http://activemq.apache.org/schema/core"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+  http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
+
+    <!--
+        The <broker> element is used to configure the ActiveMQ broker.
+    -->
+    <broker xmlns="http://activemq.apache.org/schema/core"
+        brokerName="broker-D" dataDirectory="target/durable-data-D" persistent="false" useJmx="false">
+
+
+        <destinationPolicy>
+            <policyMap>
+                <policyEntries>
+                    <policyEntry topic=">" enableAudit="true"/>
+                </policyEntries>
+            </policyMap>
+        </destinationPolicy>
+
+        <transportConnectors>
+            <transportConnector name="openwire" uri="tcp://0.0.0.0:61619" />
+        </transportConnectors>
+
+    </broker>
+    
+</beans>
\ No newline at end of file



Mime
View raw message