activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1242180 - in /activemq/activemq-apollo/trunk/apollo-stomp/src: main/scala/org/apache/activemq/apollo/stomp/StompProtocolHandler.scala test/scala/org/apache/activemq/apollo/stomp/StompTest.scala
Date Wed, 08 Feb 2012 23:47:50 GMT
Author: chirino
Date: Wed Feb  8 23:47:50 2012
New Revision: 1242180

URL: http://svn.apache.org/viewvc?rev=1242180&view=rev
Log:
Fixes APLO-156 - AssertionError on queue browser creation

Modified:
    activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocolHandler.scala
    activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/StompTest.scala

Modified: activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocolHandler.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocolHandler.scala?rev=1242180&r1=1242179&r2=1242180&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocolHandler.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocolHandler.scala
Wed Feb  8 23:47:50 2012
@@ -490,9 +490,6 @@ class StompProtocolHandler extends Proto
             // Then send the end of browse message.
             val headers:HeaderMap = List(DESTINATION->EMPTY, MESSAGE_ID->EMPTY, BROWSER->END)
             var frame = StompFrame(MESSAGE, headers, BufferContent(EMPTY_BUFFER))
-            if( subscription_id != None ) {
-              frame = frame.append_headers((SUBSCRIPTION, subscription_id.get)::Nil)
-            }
 
             val delivery = new Delivery()
             delivery.message = StompFrameMessage(frame)
@@ -502,8 +499,13 @@ class StompProtocolHandler extends Proto
               // session is full so use an overflow sink so to hold the message,
               // and then trigger closing the session once it empties out.
               val sink = new OverflowSink(downstream)
+              var disposed = false
               sink.refiller = ^{
-                dispose
+                // refiller could get triggered multiple times. only care about the first
one.
+                if( !disposed ) {
+                  disposed = true
+                  dispose
+                }
               }
               sink.offer(delivery)
             } else {

Modified: activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/StompTest.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/StompTest.scala?rev=1242180&r1=1242179&r2=1242180&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/StompTest.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/StompTest.scala
Wed Feb  8 23:47:50 2012
@@ -111,7 +111,7 @@ class StompTestSupport extends FunSuiteS
       body)
   }
 
-  def subscribe(id:String, dest:String, mode:String="auto", persistent:Boolean=false, c:
StompClient = client) = {
+  def subscribe(id:String, dest:String, mode:String="auto", persistent:Boolean=false, headers:String="",
c: StompClient = client) = {
     val rid = receipt_counter.incrementAndGet()
     c.write(
       "SUBSCRIBE\n" +
@@ -120,6 +120,7 @@ class StompTestSupport extends FunSuiteS
       (if(persistent) "persistent:true\n" else "")+
       "ack:"+mode+"\n"+
       "receipt:"+rid+"\n" +
+      headers+
       "\n")
     wait_for_receipt(""+rid, c)
   }
@@ -498,6 +499,23 @@ class Stomp11HeartBeatTest extends Stomp
 }
 class StompDestinationTest extends StompTestSupport {
 
+  test("Browsing queues does not cause AssertionError.  Reported in APLO-156") {
+    connect("1.1")
+    subscribe("0", "/queue/TOOL.DEFAULT")
+    async_send("/queue/TOOL.DEFAULT", "1")
+    async_send("/queue/TOOL.DEFAULT", "2")
+    assert_received("1", "0")
+    assert_received("2", "0")
+    subscribe("1", "/queue/TOOL.DEFAULT", "auto", false, "browser:true\n")
+    val frame = client.receive()
+    frame should startWith(
+      "MESSAGE\n" +
+      "subscription:1\n" +
+      "destination:\n" +
+      "message-id:\n" +
+      "browser:end")
+  }
+
   test("retain:set makes a topic remeber the message") {
     connect("1.1")
     async_send("/topic/retained-example", 1)



Mime
View raw message