Author: chirino
Date: Mon Aug 29 12:46:23 2011
New Revision: 1162770

URL: http://svn.apache.org/viewvc?rev=1162770&view=rev
Log:
Added test to verify the regex based id matching in rules work.

Modified:
    
activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-secure.xml
    
activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/users.properties
    
activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/StompTest.scala

Modified: 
activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-secure.xml
URL: 
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-secure.xml?rev=1162770&r1=1162769&r2=1162770&view=diff
==============================================================================
--- 
activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-secure.xml
 (original)
+++ 
activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-secure.xml
 Mon Aug 29 12:46:23 2011
@@ -30,6 +30,9 @@
   <access_rule allow="can_consume_ds"        kind="dsub"  action="consume"/>
   <access_rule allow="can_recieve_topic"     kind="dsub"  action="receive"/>
 
+  <access_rule allow="guest" action="connect"/>
+  <access_rule allow="guest" action="create destroy send receive consume" 
kind="topic queue dsub" id_regex="test.*"/>
+
   <virtual_host id="default" purge_on_startup="true">
     <host_name>localhost</host_name>
   </virtual_host>

Modified: 
activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/users.properties
URL: 
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/users.properties?rev=1162770&r1=1162769&r2=1162770&view=diff
==============================================================================
--- 
activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/users.properties 
(original)
+++ 
activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/users.properties 
Mon Aug 29 12:46:23 2011
@@ -17,6 +17,7 @@
 
 
connect_group=CN=ssl_user|can_only_connect|can_send_create_queue|can_send_queue|can_receive_queue|can_consume_queue|can_send_create_topic|can_send_topic|can_recieve_topic|can_consume_create_ds|can_consume_ds
 
+guest=guest
 can_not_connect=can_not_connect
 can_only_connect=can_only_connect
 

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=1162770&r1=1162769&r2=1162770&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
 Mon Aug 29 12:46:23 2011
@@ -1386,6 +1386,32 @@ class StompSecurityTest extends StompTes
 
   }
 
+  test("Send and create authorized via id_regex") {
+    connect("1.1", client,
+      "login:guest\n" +
+      "passcode:guest\n")
+
+    client.write(
+      "SEND\n" +
+      "destination:/queue/testblah\n" +
+      "receipt:0\n" +
+      "\n" +
+      "Hello Wolrd\n")
+
+    wait_for_receipt("0")
+
+    client.write(
+      "SEND\n" +
+      "destination:/queue/notmatch\n" +
+      "receipt:1\n" +
+      "\n" +
+      "Hello Wolrd\n")
+
+    val frame = client.receive()
+    frame should startWith("ERROR\n")
+    frame should include("message:Not authorized to create the queue")
+  }
+
   test("Can send and once created") {
 
     // Now try sending with the lower access id.


Reply via email to