activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r465266 - in /incubator/activemq/trunk/activemq-core/src/test: java/org/apache/activemq/test/retroactive/ java/org/apache/activemq/util/ resources/org/apache/activemq/test/retroactive/
Date Wed, 18 Oct 2006 14:50:55 GMT
Author: jstrachan
Date: Wed Oct 18 07:50:53 2006
New Revision: 465266

URL: http://svn.apache.org/viewvc?view=rev&rev=465266
Log:
added a test case to test out AMQ-980 and from the looks of things, things are actually working
fine for last image policy with wildcards

Added:
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/test/retroactive/RetroactiveConsumerTestWithLastImagePolicyWithWildcardTest.java
  (with props)
    incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/test/retroactive/activemq-lastimage-policy.xml
  (with props)
Modified:
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/test/retroactive/RetroactiveConsumerTestWithSimpleMessageListTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/util/MessageIdList.java

Added: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/test/retroactive/RetroactiveConsumerTestWithLastImagePolicyWithWildcardTest.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/test/retroactive/RetroactiveConsumerTestWithLastImagePolicyWithWildcardTest.java?view=auto&rev=465266
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/test/retroactive/RetroactiveConsumerTestWithLastImagePolicyWithWildcardTest.java
(added)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/test/retroactive/RetroactiveConsumerTestWithLastImagePolicyWithWildcardTest.java
Wed Oct 18 07:50:53 2006
@@ -0,0 +1,51 @@
+/**
+ *
+ * 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.test.retroactive;
+
+import org.apache.activemq.command.ActiveMQTopic;
+
+import javax.jms.MessageProducer;
+import javax.jms.TextMessage;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+
+/**
+ *
+ * @version $Revision$
+ */
+public class RetroactiveConsumerTestWithLastImagePolicyWithWildcardTest extends RetroactiveConsumerTestWithSimpleMessageListTest
{
+    private int counter = 1;
+    
+    protected void sendMessage(MessageProducer producer, TextMessage message) throws JMSException
{
+        ActiveMQTopic topic = new ActiveMQTopic(destination.toString() + "." + (counter++));
+        System.out.println("Sending to destination: " + topic);
+        producer.send(topic, message);
+    }
+
+    protected MessageProducer createProducer() throws JMSException {
+        return session.createProducer(null);
+    }
+
+    protected MessageConsumer createConsumer() throws JMSException {
+        return session.createConsumer( new ActiveMQTopic(destination.toString() + ".>"));
+    }
+
+    protected String getBrokerXml() {
+        return "org/apache/activemq/test/retroactive/activemq-lastimage-policy.xml";
+    }
+}

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

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

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

Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/test/retroactive/RetroactiveConsumerTestWithSimpleMessageListTest.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/test/retroactive/RetroactiveConsumerTestWithSimpleMessageListTest.java?view=diff&rev=465266&r1=465265&r2=465266
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/test/retroactive/RetroactiveConsumerTestWithSimpleMessageListTest.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/test/retroactive/RetroactiveConsumerTestWithSimpleMessageListTest.java
Wed Oct 18 07:50:53 2006
@@ -26,6 +26,7 @@
 import javax.jms.MessageProducer;
 import javax.jms.Session;
 import javax.jms.TextMessage;
+import javax.jms.JMSException;
 
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.EmbeddedBrokerTestSupport;
@@ -47,10 +48,10 @@
         // lets some messages
         connection = createConnection();
         session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-        MessageProducer producer = session.createProducer(destination);
+        MessageProducer producer = createProducer();
         for (int i = 0; i < messageCount; i++) {
             TextMessage message = session.createTextMessage("Message: " + i + " sent at:
" + new Date());
-            producer.send(message);
+            sendMessage(producer, message);
         }
         producer.close();
         session.close();
@@ -60,7 +61,7 @@
         connection.start();
         session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
 
-        MessageConsumer consumer = session.createConsumer(destination);
+        MessageConsumer consumer = createConsumer();
         MessageIdList listener = new MessageIdList();
         consumer.setMessageListener(listener);
         listener.waitForMessagesToArrive(messageCount);
@@ -105,4 +106,16 @@
         return "org/apache/activemq/test/retroactive/activemq-fixed-buffer.xml";
     }
 
+
+    protected MessageProducer createProducer() throws JMSException {
+        return session.createProducer(destination);
+    }
+
+    protected void sendMessage(MessageProducer producer, TextMessage message) throws JMSException
{
+        producer.send(message);
+    }
+
+    protected MessageConsumer createConsumer() throws JMSException {
+        return session.createConsumer(destination);
+    }
 }

Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/util/MessageIdList.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/util/MessageIdList.java?view=diff&rev=465266&r1=465265&r2=465266
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/util/MessageIdList.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/util/MessageIdList.java
Wed Oct 18 07:50:53 2006
@@ -104,8 +104,8 @@
                 messageIds.add(id);
                 semaphore.notifyAll();
             }
-            if (verbose) {
-                log.info("Received message: " + message);
+            if (log.isDebugEnabled()) {
+                log.debug("Received message: " + message);
             }
         } catch (JMSException e) {
             e.printStackTrace();

Added: incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/test/retroactive/activemq-lastimage-policy.xml
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/test/retroactive/activemq-lastimage-policy.xml?view=auto&rev=465266
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/test/retroactive/activemq-lastimage-policy.xml
(added)
+++ incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/test/retroactive/activemq-lastimage-policy.xml
Wed Oct 18 07:50:53 2006
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+
+<!-- this file can only be parsed using the xbean-spring library -->
+<!-- START SNIPPET: xbean -->
+<beans>
+
+  <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+
+  <broker persistent="false" xmlns="http://activemq.org/config/1.0">
+
+    <destinationPolicy>
+      <policyMap>
+        <policyEntries>
+          <policyEntry topic="org.apache.activemq.test.>">
+            <subscriptionRecoveryPolicy>
+              <lastImageSubscriptionRecoveryPolicy/>
+            </subscriptionRecoveryPolicy>
+          </policyEntry>
+        </policyEntries>
+      </policyMap>
+    </destinationPolicy>
+
+  </broker>
+
+</beans>
+<!-- END SNIPPET: xbean -->

Propchange: incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/test/retroactive/activemq-lastimage-policy.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/test/retroactive/activemq-lastimage-policy.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/test/retroactive/activemq-lastimage-policy.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message