Author: chirino
Date: Wed Apr 3 14:16:31 2013
New Revision: 1464035
URL: http://svn.apache.org/r1464035
Log:
Enhancing the wait_for_receipt test function.
Modified:
activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/StompTestSupport.scala
Modified:
activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/StompTestSupport.scala
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/StompTestSupport.scala?rev=1464035&r1=1464034&r2=1464035&view=diff
==============================================================================
---
activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/StompTestSupport.scala
(original)
+++
activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/StompTestSupport.scala
Wed Apr 3 14:16:31 2013
@@ -206,18 +206,31 @@ class StompTestSupport extends BrokerFun
})
}
- def wait_for_receipt(id: String, c: StompClient = client, discard_others:
Boolean = false, timeout:Int=10000): Unit = {
+ def wait_for_receipt(id: String=null, c: StompClient = client,
discard_others: Boolean = false, timeout:Int=10000): String = {
if (!discard_others) {
val frame = c.receive(timeout)
frame should startWith("RECEIPT\n")
- frame should include("receipt-id:" + id + "\n")
+ if( id !=null ) {
+ frame should include("receipt-id:" + id + "\n")
+ return id;
+ } else {
+ var pos = frame.indexOf("receipt-id:");
+ if ( pos >= 0) {
+ pos += "receipt-id:".length;
+ val pos2 = frame.indexOf("\n", pos);
+ if ( pos2 >= 0) {
+ return frame.substring(pos, pos2);
+ }
+ }
+ }
} else {
while (true) {
val frame = c.receive(timeout)
if (frame.startsWith("RECEIPT\n") && frame.indexOf("receipt-id:" + id
+ "\n") >= 0) {
- return
+ return id;
}
}
}
+ return null;
}
}