Author: vtence
Date: Fri Dec  3 05:26:55 2004
New Revision: 109674

URL: http://svn.apache.org/viewcvs?view=rev&rev=109674
Log:
Started work on XML Policy builder
Added:
   
incubator/directory/janus/trunk/script/src/test/org/apache/janus/script/xml/Dom4JPolicyBuilderTest.java
   
incubator/directory/janus/trunk/script/src/test/org/apache/janus/script/xml/policy.xml

Added: 
incubator/directory/janus/trunk/script/src/test/org/apache/janus/script/xml/Dom4JPolicyBuilderTest.java
Url: 
http://svn.apache.org/viewcvs/incubator/directory/janus/trunk/script/src/test/org/apache/janus/script/xml/Dom4JPolicyBuilderTest.java?view=auto&rev=109674
==============================================================================
--- (empty file)
+++ 
incubator/directory/janus/trunk/script/src/test/org/apache/janus/script/xml/Dom4JPolicyBuilderTest.java
     Fri Dec  3 05:26:55 2004
@@ -0,0 +1,55 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.janus.script.xml;
+
+import org.jmock.Mock;
+import org.jmock.MockObjectTestCase;
+import org.apache.janus.authentication.attribute.MutableInformationProvider;
+
+import java.io.StringReader;
+
+public class Dom4JPolicyBuilderTest extends MockObjectTestCase
+{
+    public void testSupportsDenyOverridesPolicyAlgorithm() throws Exception
+    {
+//        Dom4JRoleBuilder builder = Dom4JRoleBuilder.fromReader( new 
StringReader( emptyDenyOverridesPolicy() ) );
+//
+//        Mock mockProvider = new Mock( MutableInformationProvider.class );
+//        mockProvider.expects( once() ).method( "addAttribute" ).with( eq( 
Usernames.joe() ), eq( Roles.user() ) ).will( returnValue( true ) );
+//        mockProvider.expects( once() ).method( "addAttribute" ).with( eq( 
Usernames.joe() ), eq( Roles.developer() ) ).will( returnValue( true ) );
+//
+//        builder.buildProvider( ( MutableInformationProvider ) 
mockProvider.proxy() );
+//
+//        mockProvider.verify();
+    }
+
+    private String emptyDenyOverridesPolicy()
+    {
+        String content =
+                "<policy>\n" +
+                "    <rule effect=\"deny\">\n" +
+                "        <subject>\n" +
+                "            <any/>\n" +
+                "        </subject>\n" +
+                "        <permission>\n" +
+                "            <any/>\n" +
+                "        </permission>\n" +
+                "    </rule>\n" +
+                "</policy>";
+        return content;
+    }
+}

Added: 
incubator/directory/janus/trunk/script/src/test/org/apache/janus/script/xml/policy.xml
Url: 
http://svn.apache.org/viewcvs/incubator/directory/janus/trunk/script/src/test/org/apache/janus/script/xml/policy.xml?view=auto&rev=109674
==============================================================================
--- (empty file)
+++ 
incubator/directory/janus/trunk/script/src/test/org/apache/janus/script/xml/policy.xml
      Fri Dec  3 05:26:55 2004
@@ -0,0 +1,23 @@
+<policy>
+    <rule effect="grant">
+        <subject>
+            <or>
+                <role>admin</role>
+                <group>developer</group>
+                <username>joeblow</username>
+            </or>
+        </subject>
+        <permission>
+            <file path="/protected/*" action="read, write"/>
+            <file path="/private/*" action="read"/>
+        </permission>
+    </rule>
+    <rule effect="deny">
+        <subject>
+            <any/>
+        </subject>
+        <permission>
+            <any/>
+        </permission>
+    </rule>
+</policy>
\ No newline at end of file

Reply via email to