You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by pm...@apache.org on 2014/02/03 13:59:37 UTC

svn commit: r1563866 - in /qpid/trunk/qpid: cpp/design_docs/broker-acl-work.txt cpp/src/qpid/broker/AclModule.h cpp/src/tests/acl.py doc/book/src/cpp-broker/Security.xml

Author: pmoravec
Date: Mon Feb  3 12:59:37 2014
New Revision: 1563866

URL: http://svn.apache.org/r1563866
Log:
QPID-5519: ACL property/properties for paged queues - fixed typo, added tests and documentation

Modified:
    qpid/trunk/qpid/cpp/design_docs/broker-acl-work.txt
    qpid/trunk/qpid/cpp/src/qpid/broker/AclModule.h
    qpid/trunk/qpid/cpp/src/tests/acl.py
    qpid/trunk/qpid/doc/book/src/cpp-broker/Security.xml

Modified: qpid/trunk/qpid/cpp/design_docs/broker-acl-work.txt
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/design_docs/broker-acl-work.txt?rev=1563866&r1=1563865&r2=1563866&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/design_docs/broker-acl-work.txt (original)
+++ qpid/trunk/qpid/cpp/design_docs/broker-acl-work.txt Mon Feb  3 12:59:37 2014
@@ -28,16 +28,20 @@ in memory and on disk.
 
 * Add property limit settings to CREATE QUEUE Acl rules.
 
-User Option     Acl Limit Property      Units
---------------- ----------------------  ---------------
-qpid.max_size   queuemaxsizelowerlimit  bytes
-                queuemaxsizeupperlimit  bytes
-qpid.max_count  queuemaxcountlowerlimit messages
-                queuemaxcountupperlimit messages
-qpid.file_size  filemaxsizelowerlimit   pages (64Kb per page)
-                filemaxsizeupperlimit   pages (64Kb per page)
-qpid.file_count filemaxcountlowerlimit  files
-                filemaxcountupperlimit  files
+User Option     	Acl Limit Property      Units
+--------------- 	----------------------  ---------------
+qpid.max_size   	queuemaxsizelowerlimit  bytes
+                	queuemaxsizeupperlimit  bytes
+qpid.max_count  	queuemaxcountlowerlimit messages
+                	queuemaxcountupperlimit messages
+qpid.file_size  	filemaxsizelowerlimit   pages (64Kb per page)
+                	filemaxsizeupperlimit   pages (64Kb per page)
+qpid.file_count 	filemaxcountlowerlimit  files
+                	filemaxcountupperlimit  files
+qpid.max_pages_loaded	pageslowerlimit		pages
+			pagesupperlimit		pages
+qpid.page_factor	pagefactorlowerlimit	integer (multiple of the platform-defined page size)
+			pagefactorlowerlimit	integer (multiple of the platform-defined page size)
 
 
 * Change rule match behavior to accomodate limit settings

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/AclModule.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/AclModule.h?rev=1563866&r1=1563865&r2=1563866&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/AclModule.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/AclModule.h Mon Feb  3 12:59:37 2014
@@ -326,9 +326,9 @@ namespace acl {
                 case SPECPROP_MAXFILECOUNTLOWERLIMIT:  return "filemaxcountlowerlimit";
                 case SPECPROP_MAXFILECOUNTUPPERLIMIT:  return "filemaxcountupperlimit";
                 case SPECPROP_MAXPAGESLOWERLIMIT:      return "pageslowerlimit";
-                case SPECPROP_MAXPAGESUPPERLIMIT:      return "pageslowerlimit";
+                case SPECPROP_MAXPAGESUPPERLIMIT:      return "pagesupperlimit";
                 case SPECPROP_MAXPAGEFACTORLOWERLIMIT: return "pagefactorlowerlimit";
-                case SPECPROP_MAXPAGEFACTORUPPERLIMIT: return "pagefactorlowerlimit";
+                case SPECPROP_MAXPAGEFACTORUPPERLIMIT: return "pagefactorupperlimit";
                 default: assert(false); // should never get here
             }
             return "";

Modified: qpid/trunk/qpid/cpp/src/tests/acl.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/acl.py?rev=1563866&r1=1563865&r2=1563866&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/acl.py (original)
+++ qpid/trunk/qpid/cpp/src/tests/acl.py Mon Feb  3 12:59:37 2014
@@ -671,6 +671,118 @@ class ACLTests(TestBase010):
             self.fail(result)
 
 
+    def test_illegal_pages_lower_limit_spec(self):
+        """
+        Test illegal paged queue policy
+        """
+
+        aclf = self.get_acl_file()
+        aclf.write('acl deny bob@QPID create queue name=q2 pageslowerlimit=-1\n')
+        aclf.write('acl allow all all')
+        aclf.close()
+
+        result = self.reload_acl()
+        expected = "-1 is not a valid value for 'pageslowerlimit', " \
+                   "values should be between 0 and 9223372036854775807";
+        if (result.find(expected) == -1):
+            self.fail(result)
+
+        aclf = self.get_acl_file()
+        aclf.write('acl deny bob@QPID create queue name=q2 pageslowerlimit=9223372036854775808\n')
+        aclf.write('acl allow all all')
+        aclf.close()
+
+        result = self.reload_acl()
+        expected = "9223372036854775808 is not a valid value for 'pageslowerlimit', " \
+                   "values should be between 0 and 9223372036854775807";
+        if (result.find(expected) == -1):
+            self.fail(result)
+
+
+    def test_illegal_pages_upper_limit_spec(self):
+        """
+        Test illegal paged queue policy
+        """
+
+        aclf = self.get_acl_file()
+        aclf.write('acl deny bob@QPID create queue name=q2 pagesupperlimit=-1\n')
+        aclf.write('acl allow all all')
+        aclf.close()
+
+        result = self.reload_acl()
+        expected = "-1 is not a valid value for 'pagesupperlimit', " \
+                   "values should be between 0 and 9223372036854775807";
+        if (result.find(expected) == -1):
+            self.fail(result)
+
+        aclf = self.get_acl_file()
+        aclf.write('acl deny bob@QPID create queue name=q2 pagesupperlimit=9223372036854775808\n')
+        aclf.write('acl allow all all')
+        aclf.close()
+
+        result = self.reload_acl()
+        expected = "9223372036854775808 is not a valid value for 'pagesupperlimit', " \
+                   "values should be between 0 and 9223372036854775807";
+        if (result.find(expected) == -1):
+            self.fail(result)
+
+
+    def test_illegal_pagefactor_lower_limit_spec(self):
+        """
+        Test illegal paged queue policy
+        """
+
+        aclf = self.get_acl_file()
+        aclf.write('acl deny bob@QPID create queue name=q2 pagefactorlowerlimit=-1\n')
+        aclf.write('acl allow all all')
+        aclf.close()
+
+        result = self.reload_acl()
+        expected = "-1 is not a valid value for 'pagefactorlowerlimit', " \
+                   "values should be between 0 and 9223372036854775807";
+        if (result.find(expected) == -1):
+            self.fail(result)
+
+        aclf = self.get_acl_file()
+        aclf.write('acl deny bob@QPID create queue name=q2 pagefactorlowerlimit=9223372036854775808\n')
+        aclf.write('acl allow all all')
+        aclf.close()
+
+        result = self.reload_acl()
+        expected = "9223372036854775808 is not a valid value for 'pagefactorlowerlimit', " \
+                   "values should be between 0 and 9223372036854775807";
+        if (result.find(expected) == -1):
+            self.fail(result)
+
+
+    def test_illegal_pagefactor_upper_limit_spec(self):
+        """
+        Test illegal paged queue policy
+        """
+
+        aclf = self.get_acl_file()
+        aclf.write('acl deny bob@QPID create queue name=q2 pagefactorupperlimit=-1\n')
+        aclf.write('acl allow all all')
+        aclf.close()
+
+        result = self.reload_acl()
+        expected = "-1 is not a valid value for 'pagefactorupperlimit', " \
+                   "values should be between 0 and 9223372036854775807";
+        if (result.find(expected) == -1):
+            self.fail(result)
+
+        aclf = self.get_acl_file()
+        aclf.write('acl deny bob@QPID create queue name=q2 pagefactorupperlimit=9223372036854775808\n')
+        aclf.write('acl allow all all')
+        aclf.close()
+
+        result = self.reload_acl()
+        expected = "9223372036854775808 is not a valid value for 'pagefactorupperlimit', " \
+                   "values should be between 0 and 9223372036854775807";
+        if (result.find(expected) == -1):
+            self.fail(result)
+
+
    #=====================================
    # ACL queue tests
    #=====================================
@@ -687,6 +799,7 @@ class ACLTests(TestBase010):
         aclf.write('acl deny bob@QPID purge queue name=q3\n')
         aclf.write('acl deny bob@QPID delete queue name=q4\n')
         aclf.write('acl deny bob@QPID create queue name=q5 maxqueuesize=1000 maxqueuecount=100\n')
+        aclf.write('acl deny bob@QPID create queue name=q6 paging=true\n')
         aclf.write('acl allow all all')
         aclf.close()
 
@@ -739,6 +852,15 @@ class ACLTests(TestBase010):
 
         try:
             queue_options = {}
+            queue_options["qpid.paging"] = True
+            session.queue_declare(queue="q6", arguments=queue_options)
+            self.fail("ACL should deny queue create request with name=q6, qpid.paging=True");
+        except qpid.session.SessionException, e:
+            self.assertEqual(403,e.args[0].error_code)
+            session = self.get_session('bob','bob')
+
+        try:
+            queue_options = {}
             queue_options["qpid.max_count"] = 200
             queue_options["qpid.max_size"] = 100
             session.queue_declare(queue="q2", exclusive=True, arguments=queue_options)
@@ -972,6 +1094,107 @@ class ACLTests(TestBase010):
                 self.fail("ACL should allow queue delete request for q4");
 
    #=====================================
+   # ACL paged tests
+   #=====================================
+
+    def test_paged_allow_mode(self):
+        """
+        Test cases for paged acl in allow mode
+        """
+        aclf = self.get_acl_file()
+        aclf.write('acl deny bob@QPID create queue name=qf1 pageslowerlimit=1000\n')
+        aclf.write('acl deny bob@QPID create queue name=qf2 pagesupperlimit=100\n')
+        aclf.write('acl deny bob@QPID create queue name=qf3 pagefactorlowerlimit=10\n')
+        aclf.write('acl deny bob@QPID create queue name=qf4 pagefactorupperlimit=1\n')
+        aclf.write('acl allow all all')
+        aclf.close()
+
+        result = self.reload_acl()
+        if (result):
+            self.fail(result)
+
+        session = self.get_session('bob','bob')
+
+        try:
+            queue_options = {}
+            queue_options["qpid.paging"] = True
+            queue_options["qpid.max_pages_loaded"] = 500
+            session.queue_declare(queue="qf1", arguments=queue_options)
+            self.fail("ACL should deny queue create request with name=qf1, qpid.paging=True, qpid.max_pages_loaded=500");
+        except qpid.session.SessionException, e:
+            self.assertEqual(403,e.args[0].error_code)
+            session = self.get_session('bob','bob')
+
+        try:
+            queue_options = {}
+            queue_options["qpid.paging"] = True
+            queue_options["qpid.max_pages_loaded"] = 500
+            session.queue_declare(queue="qf2", arguments=queue_options)
+            self.fail("ACL should deny queue create request with name=qf2, qpid.paging=True, qpid.max_pages_loaded=500");
+        except qpid.session.SessionException, e:
+            self.assertEqual(403,e.args[0].error_code)
+            session = self.get_session('bob','bob')
+
+        try:
+            queue_options = {}
+            queue_options["qpid.paging"] = True
+            queue_options["qpid.page_factor"] = 5
+            session.queue_declare(queue="qf3", arguments=queue_options)
+            self.fail("ACL should deny queue create request with name=qf3, qpid.paging=True, qpid.page_factor=5");
+        except qpid.session.SessionException, e:
+            self.assertEqual(403,e.args[0].error_code)
+            session = self.get_session('bob','bob')
+
+        try:
+            queue_options = {}
+            queue_options["qpid.paging"] = True
+            queue_options["qpid.page_factor"] = 5
+            session.queue_declare(queue="qf4", arguments=queue_options)
+            self.fail("ACL should deny queue create request with name=qf4, qpid.paging=True, qpid.page_factor=5");
+        except qpid.session.SessionException, e:
+            self.assertEqual(403,e.args[0].error_code)
+            session = self.get_session('bob','bob')
+
+
+    def test_paged_deny_mode(self):
+        """
+        Test cases for paged acl in deny mode
+        """
+        aclf = self.get_acl_file()
+        aclf.write('acl allow bob@QPID create queue name=qf1 pageslowerlimit=100 pagesupperlimit=1000\n')
+        aclf.write('acl allow bob@QPID create queue name=qf2 pagefactorlowerlimit=1 pagefactorupperlimit=10\n')
+        aclf.write('acl allow anonymous all all\n')
+        aclf.write('acl deny all all')
+        aclf.close()
+
+        result = self.reload_acl()
+        if (result):
+            self.fail(result)
+
+        session = self.get_session('bob','bob')
+
+        try:
+            queue_options = {}
+            queue_options["qpid.paging"] = True
+            queue_options["qpid.max_pages_loaded"] = 500
+            session.queue_declare(queue="qf1", arguments=queue_options)
+        except qpid.session.SessionException, e:
+            if (403 == e.args[0].error_code):
+                self.fail("ACL should allow queue create request with name=qf1, qpid.paging=True, qpid.max_pages_loaded=500");
+            session = self.get_session('bob','bob')
+
+        try:
+            queue_options = {}
+            queue_options["qpid.paging"] = True
+            queue_options["qpid.page_factor"] = 5
+            session.queue_declare(queue="qf2", arguments=queue_options)
+        except qpid.session.SessionException, e:
+            if (403 == e.args[0].error_code):
+                self.fail("ACL should allow queue create request with name=qf2, qpid.paging=True, qpid.page_factor=5");
+            session = self.get_session('bob','bob')
+
+
+   #=====================================
    # ACL file tests
    #=====================================
 

Modified: qpid/trunk/qpid/doc/book/src/cpp-broker/Security.xml
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/doc/book/src/cpp-broker/Security.xml?rev=1563866&r1=1563865&r2=1563866&view=diff
==============================================================================
--- qpid/trunk/qpid/doc/book/src/cpp-broker/Security.xml (original)
+++ qpid/trunk/qpid/doc/book/src/cpp-broker/Security.xml Mon Feb  3 12:59:37 2014
@@ -421,7 +421,11 @@ com.sun.security.jgss.initiate {
                 filemaxsizelowerlimit   | 
 		filemaxsizeupperlimit   |
                 filemaxcountlowerlimit  | 
-		filemaxcountupperlimit ]
+		filemaxcountupperlimit  |
+                pageslowerlimit         |
+                pagesupperlimit         |
+                pagefactorlowerlimit    |
+                pagefactorupperlimit ]
     
     acl permission {<group-name>|<user-name>|"all"} {action|"all"} [object|"all" 
                 [property=<property-value> ...]]
@@ -728,6 +732,12 @@ com.sun.security.jgss.initiate {
 				       <entry>Indicates the presence of an <parameter>exclusive</parameter> flag</entry>
 				       <entry>CREATE QUEUE, ACCESS QUEUE</entry>
 				     </row>
+                                     <row>
+                                       <entry> <command>paging</command> </entry>
+                                       <entry>Boolean</entry>
+                                       <entry>Indicates if the queue is paging queue</entry>
+                                       <entry>CREATE QUEUE, ACCESS QUEUE</entry>
+                                     </row>
 				     <row>
 				       <entry> <command>type</command> </entry>
 				       <entry>String</entry>
@@ -806,6 +816,30 @@ com.sun.security.jgss.initiate {
 				       <entry>Maximum value for file.max_count (files)</entry>
 				       <entry>CREATE QUEUE, ACCESS QUEUE</entry>
 				     </row>
+                                     <row>
+                                       <entry> <command>pageslowerlimit</command> </entry>
+                                       <entry>Integer</entry>
+                                       <entry>Minimum value for number of pages in memory of paged queue</entry>
+                                       <entry>CREATE QUEUE</entry>
+                                     </row>
+                                     <row>
+                                       <entry> <command>pagesupperlimit</command> </entry>
+                                       <entry>Integer</entry>
+                                       <entry>Maximum value for number of pages in memory of paged queue</entry>
+                                       <entry>CREATE QUEUE</entry>
+                                     </row>
+                                     <row>
+                                       <entry> <command>pagefactorlowerlimit</command> </entry>
+                                       <entry>Integer</entry>
+                                       <entry>Minimum value for size of one page in paged queue</entry>
+                                       <entry>CREATE QUEUE</entry>
+                                     </row>
+                                     <row>
+                                       <entry> <command>pagefactorupperlimit</command> </entry>
+                                       <entry>Integer</entry>
+                                       <entry>Maximum value for size of one page in paged queue</entry>
+                                       <entry>CREATE QUEUE</entry>
+                                     </row>
 				   </tbody>
 				</tgroup>
 			</table>
@@ -910,7 +944,7 @@ com.sun.security.jgss.initiate {
 				<row>
 				  <entry>create</entry>
 				  <entry>queue</entry>
-				  <entry>name alternate durable exclusive autodelete policy queuemaxsizelowerlimit queuemaxsizeupperlimit queuemaxcountlowerlimit queuemaxcountupperlimit filemaxsizelowerlimit filemaxsizeupperlimit filemaxcountlowerlimit filemaxcountupperlimit</entry>
+				  <entry>name alternate durable exclusive autodelete policy queuemaxsizelowerlimit queuemaxsizeupperlimit queuemaxcountlowerlimit queuemaxcountupperlimit filemaxsizelowerlimit filemaxsizeupperlimit filemaxcountlowerlimit filemaxcountupperlimit paging pageslowerlimit pagesupperlimit pagefactorlowerlimit pagefactorupperlimit</entry>
 				  <entry></entry>
 				</row>
 				<row>



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org