activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1490032 - in /activemq/trunk: activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/ activemq-client/src/test/java/org/apache/activemq/ activemq-unit-tests/src/test/java/org/apache/activemq/
Date Wed, 05 Jun 2013 21:06:39 GMT
Author: tabish
Date: Wed Jun  5 21:06:39 2013
New Revision: 1490032

URL: http://svn.apache.org/r1490032
Log:
fix for: https://issues.apache.org/jira/browse/AMQ-4487 and https://issues.apache.org/jira/browse/AMQ-4372

Additional testing and updates. 

Added:
    activemq/trunk/activemq-client/src/test/java/org/apache/activemq/ActiveMQMessageAuditNotSyncTest.java
  (with props)
Modified:
    activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/PolicyEntry.java
    activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java

Modified: activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/PolicyEntry.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/PolicyEntry.java?rev=1490032&r1=1490031&r2=1490032&view=diff
==============================================================================
--- activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/PolicyEntry.java
(original)
+++ activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/PolicyEntry.java
Wed Jun  5 21:06:39 2013
@@ -244,6 +244,7 @@ public class PolicyEntry extends Destina
         // is done.  We should refactor the browsers to better handle message dispatch so
         // we can remove this and perform a more efficient dispatch.
         sub.setMaxProducersToAudit(Integer.MAX_VALUE);
+        sub.setMaxAuditDepth(Short.MAX_VALUE);
     }
 
     public void configure(Broker broker, SystemUsage memoryManager, QueueSubscription sub)
{

Added: activemq/trunk/activemq-client/src/test/java/org/apache/activemq/ActiveMQMessageAuditNotSyncTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-client/src/test/java/org/apache/activemq/ActiveMQMessageAuditNotSyncTest.java?rev=1490032&view=auto
==============================================================================
--- activemq/trunk/activemq-client/src/test/java/org/apache/activemq/ActiveMQMessageAuditNotSyncTest.java
(added)
+++ activemq/trunk/activemq-client/src/test/java/org/apache/activemq/ActiveMQMessageAuditNotSyncTest.java
Wed Jun  5 21:06:39 2013
@@ -0,0 +1,70 @@
+/**
+ * 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;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.activemq.command.ConnectionId;
+import org.apache.activemq.command.MessageId;
+import org.apache.activemq.command.ProducerId;
+import org.apache.activemq.command.SessionId;
+import org.apache.activemq.util.IdGenerator;
+import org.apache.activemq.util.LongSequenceGenerator;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ActiveMQMessageAuditNotSyncTest {
+
+    private final IdGenerator connectionIdGenerator = new IdGenerator();
+    private final LongSequenceGenerator sessionIdGenerator = new LongSequenceGenerator();
+    private final LongSequenceGenerator producerIdGenerator = new LongSequenceGenerator();
+    private final LongSequenceGenerator sequenceIdGenerator = new LongSequenceGenerator();
+
+    @Before
+    public void setUp() throws Exception {
+    }
+
+    @After
+    public void tearDown() throws Exception {
+    }
+
+    @Test
+    public void testAuditDepth() {
+
+        int maxAuditDepth = Integer.MAX_VALUE;
+
+        ConnectionId connectionId = new ConnectionId(connectionIdGenerator.generateId());
+        SessionId sessionId = new SessionId(connectionId, sessionIdGenerator.getNextSequenceId());
+        ProducerId producerId = new ProducerId(sessionId, producerIdGenerator.getNextSequenceId());
+
+        ActiveMQMessageAuditNoSync audit = new ActiveMQMessageAuditNoSync();
+        audit.setAuditDepth(maxAuditDepth);
+
+        MessageId msgId = new MessageId(producerId, 0);
+        for (int i = 0; i < maxAuditDepth; i++) {
+            msgId.setProducerSequenceId(sequenceIdGenerator.getNextSequenceId());
+            assertFalse(audit.isDuplicate(msgId));
+        }
+
+        for (int i = 0; i < maxAuditDepth; i++) {
+            assertTrue(audit.isDuplicate(msgId));
+        }
+    }
+}

Propchange: activemq/trunk/activemq-client/src/test/java/org/apache/activemq/ActiveMQMessageAuditNotSyncTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java?rev=1490032&r1=1490031&r2=1490032&view=diff
==============================================================================
--- activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java
(original)
+++ activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java
Wed Jun  5 21:06:39 2013
@@ -307,7 +307,9 @@ public class JmsQueueBrowserTest extends
 
         MessageProducer producer = session.createProducer(destination);
 
-        for (int i = 0; i < 1000; i++) {
+        int numberOfMessages = 4096;
+
+        for (int i = 0; i < numberOfMessages; i++) {
             producer.send(session.createTextMessage("Message: "  + i));
         }
 
@@ -329,7 +331,7 @@ public class JmsQueueBrowserTest extends
         }
 
         System.out.println("Number browsed:  " + numberBrowsed);
-        assertEquals(1000, numberBrowsed);
+        assertEquals(numberOfMessages, numberBrowsed);
         browser.close();
         producer.close();
     }



Mime
View raw message