Author: eevans
Date: Wed Oct  6 15:19:19 2010
New Revision: 1005081

URL: http://svn.apache.org/viewvc?rev=1005081&view=rev
Log:
CF access test for SimpleAuthority

Patch by eevans; reviewed by Stu Hood for CASSANDRA-1554

Modified:
    cassandra/trunk/test/conf/access.properties
    cassandra/trunk/test/unit/org/apache/cassandra/auth/SimpleAuthorityTest.java

Modified: cassandra/trunk/test/conf/access.properties
URL: 
http://svn.apache.org/viewvc/cassandra/trunk/test/conf/access.properties?rev=1005081&r1=1005080&r2=1005081&view=diff
==============================================================================
--- cassandra/trunk/test/conf/access.properties (original)
+++ cassandra/trunk/test/conf/access.properties Wed Oct  6 15:19:19 2010
@@ -24,5 +24,6 @@
 # list of keyspaces: all users will be able to view the list of keyspaces.
 <modify-keyspaces>=user1
 
-Keyspace1.<read>=user1,user2
-Keyspace1.<write>=user1,user2
+Keyspace1.<rw>=user1,user2
+Keyspace1.Standard1.<ro>=user2
+Keyspace1.Standard1.<rw>=user1

Modified: 
cassandra/trunk/test/unit/org/apache/cassandra/auth/SimpleAuthorityTest.java
URL: 
http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/auth/SimpleAuthorityTest.java?rev=1005081&r1=1005080&r2=1005081&view=diff
==============================================================================
--- 
cassandra/trunk/test/unit/org/apache/cassandra/auth/SimpleAuthorityTest.java 
(original)
+++ 
cassandra/trunk/test/unit/org/apache/cassandra/auth/SimpleAuthorityTest.java 
Wed Oct  6 15:19:19 2010
@@ -23,7 +23,6 @@ import java.util.Arrays;
 import java.util.EnumSet;
 import java.util.List;
 
-import org.junit.Before;
 import org.junit.Test;
 import static org.junit.Assert.assertEquals;
 
@@ -38,6 +37,10 @@ public class SimpleAuthorityTest
     private final List<Object> KEYSPACES_RESOURCE = 
Arrays.<Object>asList(Resources.ROOT, Resources.KEYSPACES);
     private final List<Object> KEYSPACE1_RESOURCE = 
Arrays.<Object>asList(Resources.ROOT, Resources.KEYSPACES, "Keyspace1");
     private final List<Object> KEYSPACE2_RESOURCE = 
Arrays.<Object>asList(Resources.ROOT, Resources.KEYSPACES, "Keyspace2");
+    private final List<Object> STANDARD1_RESOURCE = 
Arrays.<Object>asList(Resources.ROOT,
+                                                                          
Resources.KEYSPACES,
+                                                                          
"Keyspace1",
+                                                                          
"Standard1");
 
     @Test
     public void testValidateConfiguration() throws Exception
@@ -70,4 +73,12 @@ public class SimpleAuthorityTest
                      EnumSet.of(Permission.READ),
                      authority.authorize(USER3, KEYSPACES_RESOURCE));
     }
+    
+    @Test
+    public void testAuthorizeColumnFamily() throws Exception
+    {
+        assertEquals(Permission.ALL, authority.authorize(USER1, 
STANDARD1_RESOURCE));
+        assertEquals(EnumSet.of(Permission.READ), authority.authorize(USER2, 
STANDARD1_RESOURCE));
+        assertEquals(Permission.NONE, authority.authorize(USER3, 
STANDARD1_RESOURCE));
+    }
 }


Reply via email to