1 17 18 19 20 package org.apache.lenya.ac.impl; 21 22 import junit.textui.TestRunner; 23 24 import org.apache.lenya.ac.AccessControlException; 25 import org.apache.lenya.ac.Policy; 26 import org.apache.lenya.ac.PolicyManager; 27 import org.apache.lenya.cms.PublicationHelper; 28 29 public class PolicyManagerTest extends AccessControlTest { 30 31 36 public PolicyManagerTest(String test) { 37 super(test); 38 } 39 40 44 public static void main(String [] args) { 45 PublicationHelper.extractPublicationArguments(args); 46 TestRunner.run(AccessControllerTest.class); 47 } 48 49 private static String [] URLS = { "/test/authoring/index.html" }; 50 51 55 public void testAccessController() throws AccessControlException { 56 57 DefaultAccessController controller = getAccessController(); 58 PolicyManager policyManager = controller.getPolicyManager(); 59 assertNotNull(policyManager); 60 61 for (int i = 0; i < URLS.length; i++) { 62 Policy policy = policyManager.getPolicy(controller.getAccreditableManager(), URLS[i]); 63 assertNotNull(policy); 64 assertTrue(policy.getRoles(getIdentity()).length > 0); 65 } 66 } 67 68 } 69 | Popular Tags |