weaver      2004/10/29 07:12:28

  Modified:    components/security/src/test/org/apache/jetspeed/security/spi
                        TestRoleSecurityHandler.java
                        TestGroupSecurityHandler.java
                        TestUserSecurityHandler.java
                        TestCredentialHandler.java
                        TestSecurityMappingHandler.java
               components/security/src/test/org/apache/jetspeed/security
                        TestSecurityHelper.java
                        TestGeneralizationHierarchy.java
                        TestRdbmsPolicyFolder.java TestRoleManager.java
                        TestLoginModule.java TestAggregationHierarchy.java
                        TestRdbmsPolicy.java TestUserManager.java
                        TestGroupManager.java TestPermissionManager.java
                        TestAuthenticationProviderProxy.java
  Added:       components/security/src/java/org/apache/jetspeed/security/util/test
                        AbstractSecurityTestcase.java
  Removed:     components/security/src/test/org/apache/jetspeed/security
                        AbstractSecurityTestcase.java
  Log:
  see: http://nagoya.apache.org/jira/browse/JS2-144
  - security refactor
  
  Revision  Changes    Path
  1.6       +1 -12     
jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/spi/TestRoleSecurityHandler.java
  
  Index: TestRoleSecurityHandler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/spi/TestRoleSecurityHandler.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestRoleSecurityHandler.java      4 Oct 2004 00:15:22 -0000       1.5
  +++ TestRoleSecurityHandler.java      29 Oct 2004 14:12:27 -0000      1.6
  @@ -18,9 +18,9 @@
   import java.security.Permissions;
   import java.security.Principal;
   
  -import org.apache.jetspeed.security.AbstractSecurityTestcase;
   import org.apache.jetspeed.security.PortletPermission;
   import org.apache.jetspeed.security.impl.RolePrincipalImpl;
  +import org.apache.jetspeed.security.util.test.AbstractSecurityTestcase;
   
   import junit.framework.Test;
   import junit.framework.TestSuite;
  @@ -35,17 +35,6 @@
   public class TestRoleSecurityHandler extends AbstractSecurityTestcase
   {
   
  -    /**
  -     * <p>
  -     * Defines the test case name for junit.
  -     * </p>
  -     * 
  -     * @param testName The test case name.
  -     */
  -    public TestRoleSecurityHandler(String testName)
  -    {
  -        super(testName);
  -    }
   
       /**
        * @see junit.framework.TestCase#setUp()
  
  
  
  1.3       +2 -12     
jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/spi/TestGroupSecurityHandler.java
  
  Index: TestGroupSecurityHandler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/spi/TestGroupSecurityHandler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestGroupSecurityHandler.java     19 Sep 2004 19:04:11 -0000      1.2
  +++ TestGroupSecurityHandler.java     29 Oct 2004 14:12:27 -0000      1.3
  @@ -16,7 +16,7 @@
   
   import java.security.Principal;
   
  -import org.apache.jetspeed.security.AbstractSecurityTestcase;
  +import org.apache.jetspeed.security.util.test.AbstractSecurityTestcase;
   
   import junit.framework.Test;
   import junit.framework.TestSuite;
  @@ -31,17 +31,7 @@
   public class TestGroupSecurityHandler extends AbstractSecurityTestcase
   {
   
  -    /**
  -     * <p>
  -     * Defines the test case name for junit.
  -     * </p>
  -     * 
  -     * @param testName The test case name.
  -     */
  -    public TestGroupSecurityHandler(String testName)
  -    {
  -        super(testName);
  -    }
  +   
   
       /**
        * @see junit.framework.TestCase#setUp()
  
  
  
  1.5       +2 -13     
jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/spi/TestUserSecurityHandler.java
  
  Index: TestUserSecurityHandler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/spi/TestUserSecurityHandler.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestUserSecurityHandler.java      12 Oct 2004 20:20:36 -0000      1.4
  +++ TestUserSecurityHandler.java      29 Oct 2004 14:12:27 -0000      1.5
  @@ -17,7 +17,7 @@
   import java.security.Principal;
   import java.util.Iterator;
   
  -import org.apache.jetspeed.security.AbstractSecurityTestcase;
  +import org.apache.jetspeed.security.util.test.AbstractSecurityTestcase;
   
   import junit.framework.Test;
   import junit.framework.TestSuite;
  @@ -32,18 +32,7 @@
   public class TestUserSecurityHandler extends AbstractSecurityTestcase
   {
   
  -    /**
  -     * <p>
  -     * Defines the test case name for junit.
  -     * </p>
  -     * 
  -     * @param testName The test case name.
  -     */
  -    public TestUserSecurityHandler(String testName)
  -    {
  -        super(testName);
  -    }
  -
  +    
       /**
        * @see junit.framework.TestCase#setUp()
        */
  
  
  
  1.4       +1 -13     
jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/spi/TestCredentialHandler.java
  
  Index: TestCredentialHandler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/spi/TestCredentialHandler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestCredentialHandler.java        27 Oct 2004 22:09:28 -0000      1.3
  +++ TestCredentialHandler.java        29 Oct 2004 14:12:27 -0000      1.4
  @@ -16,8 +16,8 @@
   
   import java.util.Set;
   
  -import org.apache.jetspeed.security.AbstractSecurityTestcase;
   import org.apache.jetspeed.security.PasswordCredential;
  +import org.apache.jetspeed.security.util.test.AbstractSecurityTestcase;
   
   import junit.framework.Test;
   import junit.framework.TestSuite;
  @@ -32,18 +32,6 @@
   public class TestCredentialHandler extends AbstractSecurityTestcase
   {
   
  -    /**
  -     * <p>
  -     * Defines the test case name for junit.
  -     * </p>
  -     * 
  -     * @param testName The test case name.
  -     */
  -    public TestCredentialHandler(String testName)
  -    {
  -        super(testName);
  -    }
  -    
       /**
        * @see junit.framework.TestCase#setUp()
        */
  
  
  
  1.3       +2 -12     
jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/spi/TestSecurityMappingHandler.java
  
  Index: TestSecurityMappingHandler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/spi/TestSecurityMappingHandler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestSecurityMappingHandler.java   20 Sep 2004 16:30:03 -0000      1.2
  +++ TestSecurityMappingHandler.java   29 Oct 2004 14:12:27 -0000      1.3
  @@ -16,7 +16,7 @@
   
   import java.util.Set;
   
  -import org.apache.jetspeed.security.AbstractSecurityTestcase;
  +import org.apache.jetspeed.security.util.test.AbstractSecurityTestcase;
   
   import junit.framework.Test;
   import junit.framework.TestSuite;
  @@ -31,17 +31,7 @@
   public class TestSecurityMappingHandler extends AbstractSecurityTestcase
   {
   
  -    /**
  -     * <p>
  -     * Defines the test case name for junit.
  -     * </p>
  -     * 
  -     * @param testName The test case name.
  -     */
  -    public TestSecurityMappingHandler(String testName)
  -    {
  -        super(testName);
  -    }
  +   
   
       /**
        * @see junit.framework.TestCase#setUp()
  
  
  
  1.4       +2 -12     
jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/TestSecurityHelper.java
  
  Index: TestSecurityHelper.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/TestSecurityHelper.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestSecurityHelper.java   27 May 2004 19:45:32 -0000      1.3
  +++ TestSecurityHelper.java   29 Oct 2004 14:12:28 -0000      1.4
  @@ -24,6 +24,7 @@
   import junit.framework.TestSuite;
   
   import org.apache.jetspeed.security.impl.UserPrincipalImpl;
  +import org.apache.jetspeed.security.util.test.AbstractSecurityTestcase;
   
   /**
    * TestSecurityHelper
  @@ -33,17 +34,6 @@
    */
   public class TestSecurityHelper extends AbstractSecurityTestcase
   {
  -    /**
  -     * Defines the testcase name for JUnit.
  -     *
  -     * @param name the testcase's name.
  -     */
  -    public TestSecurityHelper(String name)
  -    {
  -        super(name);
  -    }
  -
  - 
       public static Test suite()
       {
           // All methods starting with "test" will be executed in the test suite.
  
  
  
  1.3       +2 -10     
jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/TestGeneralizationHierarchy.java
  
  Index: TestGeneralizationHierarchy.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/TestGeneralizationHierarchy.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestGeneralizationHierarchy.java  18 Sep 2004 19:34:52 -0000      1.2
  +++ TestGeneralizationHierarchy.java  29 Oct 2004 14:12:28 -0000      1.3
  @@ -24,6 +24,7 @@
   import org.apache.jetspeed.security.impl.GeneralizationHierarchyResolver;
   import org.apache.jetspeed.security.impl.RolePrincipalImpl;
   import org.apache.jetspeed.security.impl.UserManagerImpl;
  +import org.apache.jetspeed.security.util.test.AbstractSecurityTestcase;
   
   /**
    * <p>Unit testing for [EMAIL PROTECTED] GeneralizationHierarchyResolver}.</p>
  @@ -34,15 +35,6 @@
   public class TestGeneralizationHierarchy extends AbstractSecurityTestcase
   {
   
  -    /**
  -     * <p>Defines the test case name for junit.</p>
  -     * @param testName The test case name.
  -     */
  -    public TestGeneralizationHierarchy(String testName)
  -    {
  -        super(testName);
  -    }
  -    
       /**
        * @see junit.framework.TestCase#setUp()
        */
  
  
  
  1.3       +2 -10     
jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/TestRdbmsPolicyFolder.java
  
  Index: TestRdbmsPolicyFolder.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/TestRdbmsPolicyFolder.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestRdbmsPolicyFolder.java        28 Sep 2004 04:23:52 -0000      1.2
  +++ TestRdbmsPolicyFolder.java        29 Oct 2004 14:12:28 -0000      1.3
  @@ -30,6 +30,7 @@
   import org.apache.jetspeed.security.UserPrincipal;
   import org.apache.jetspeed.security.impl.PassiveCallbackHandler;
   import org.apache.jetspeed.security.impl.UserPrincipalImpl;
  +import org.apache.jetspeed.security.util.test.AbstractSecurityTestcase;
   
   /**
    * @author <a href="mailto:[EMAIL PROTECTED]">Christophe Lombart</a>
  @@ -39,15 +40,6 @@
   {
       /** <p>The JAAS login context.</p> */
       private LoginContext loginContext = null;
  -
  -    /**
  -     * <p>Defines the test case name for junit.</p>
  -     * @param testName The test case name.
  -     */
  -    public TestRdbmsPolicyFolder(String testName)
  -    {
  -        super(testName);
  -    }
   
       /**
        * @see junit.framework.TestCase#setUp()
  
  
  
  1.12      +2 -13     
jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/TestRoleManager.java
  
  Index: TestRoleManager.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/TestRoleManager.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- TestRoleManager.java      12 Oct 2004 20:19:24 -0000      1.11
  +++ TestRoleManager.java      29 Oct 2004 14:12:28 -0000      1.12
  @@ -22,6 +22,7 @@
   import junit.framework.TestSuite;
   
   import org.apache.jetspeed.security.impl.RolePrincipalImpl;
  +import org.apache.jetspeed.security.util.test.AbstractSecurityTestcase;
   
   /**
    * <p>
  @@ -33,18 +34,6 @@
    */
   public class TestRoleManager extends AbstractSecurityTestcase
   {
  -
  -    /**
  -     * <p>
  -     * Defines the test case name for junit.
  -     * </p>
  -     * 
  -     * @param testName The test case name.
  -     */
  -    public TestRoleManager(String testName)
  -    {
  -        super(testName);
  -    }
   
       /**
        * @see junit.framework.TestCase#setUp()
  
  
  
  1.6       +1 -9      
jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/TestLoginModule.java
  
  Index: TestLoginModule.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/TestLoginModule.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestLoginModule.java      18 Sep 2004 19:34:52 -0000      1.5
  +++ TestLoginModule.java      29 Oct 2004 14:12:28 -0000      1.6
  @@ -24,6 +24,7 @@
   
   import org.apache.jetspeed.security.impl.PassiveCallbackHandler;
   import org.apache.jetspeed.security.impl.UserPrincipalImpl;
  +import org.apache.jetspeed.security.util.test.AbstractSecurityTestcase;
   
   /**
    * @author <a href="mailto:[EMAIL PROTECTED]">David Le Strat</a>
  @@ -32,15 +33,6 @@
   {
       /** <p>The JAAS login context.</p> */
       private LoginContext loginContext = null;
  -
  -    /**
  -     * <p>Defines the test case name for junit.</p>
  -     * @param testName The test case name.
  -     */
  -    public TestLoginModule(String testName)
  -    {
  -        super(testName);
  -    }
   
       /**
        * @see junit.framework.TestCase#setUp()
  
  
  
  1.3       +2 -13     
jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/TestAggregationHierarchy.java
  
  Index: TestAggregationHierarchy.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/TestAggregationHierarchy.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestAggregationHierarchy.java     18 Sep 2004 19:34:52 -0000      1.2
  +++ TestAggregationHierarchy.java     29 Oct 2004 14:12:28 -0000      1.3
  @@ -24,6 +24,7 @@
   import org.apache.jetspeed.security.impl.AggregationHierarchyResolver;
   import org.apache.jetspeed.security.impl.RolePrincipalImpl;
   import org.apache.jetspeed.security.impl.UserManagerImpl;
  +import org.apache.jetspeed.security.util.test.AbstractSecurityTestcase;
   
   /**
    * <p>
  @@ -35,18 +36,6 @@
    */
   public class TestAggregationHierarchy extends AbstractSecurityTestcase
   {
  -
  -    /**
  -     * <p>
  -     * Defines the test case name for junit.
  -     * </p>
  -     * 
  -     * @param testName The test case name.
  -     */
  -    public TestAggregationHierarchy(String testName)
  -    {
  -        super(testName);
  -    }
   
       /**
        * @see junit.framework.TestCase#setUp()
  
  
  
  1.8       +1 -9      
jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/TestRdbmsPolicy.java
  
  Index: TestRdbmsPolicy.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/TestRdbmsPolicy.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TestRdbmsPolicy.java      28 Sep 2004 04:23:52 -0000      1.7
  +++ TestRdbmsPolicy.java      29 Oct 2004 14:12:28 -0000      1.8
  @@ -27,6 +27,7 @@
   
   import org.apache.jetspeed.security.impl.PassiveCallbackHandler;
   import org.apache.jetspeed.security.impl.UserPrincipalImpl;
  +import org.apache.jetspeed.security.util.test.AbstractSecurityTestcase;
   
   /**
    * @author <a href="mailto:[EMAIL PROTECTED]">David Le Strat</a>
  @@ -35,15 +36,6 @@
   {
       /** <p>The JAAS login context.</p> */
       private LoginContext loginContext = null;
  -
  -    /**
  -     * <p>Defines the test case name for junit.</p>
  -     * @param testName The test case name.
  -     */
  -    public TestRdbmsPolicy(String testName)
  -    {
  -        super(testName);
  -    }
   
       /**
        * @see junit.framework.TestCase#setUp()
  
  
  
  1.12      +1 -12     
jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/TestUserManager.java
  
  Index: TestUserManager.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/TestUserManager.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- TestUserManager.java      27 Oct 2004 22:09:28 -0000      1.11
  +++ TestUserManager.java      29 Oct 2004 14:12:28 -0000      1.12
  @@ -27,6 +27,7 @@
   import junit.framework.TestSuite;
   
   import org.apache.jetspeed.security.impl.PassiveCallbackHandler;
  +import org.apache.jetspeed.security.util.test.AbstractSecurityTestcase;
   
   /**
    * <p>
  @@ -37,18 +38,6 @@
    */
   public class TestUserManager extends AbstractSecurityTestcase
   {
  -
  -    /**
  -     * <p>
  -     * Defines the test case name for junit.
  -     * </p>
  -     * 
  -     * @param testName The test case name.
  -     */
  -    public TestUserManager(String testName)
  -    {
  -        super(testName);
  -    }
   
       /**
        * @see junit.framework.TestCase#setUp()
  
  
  
  1.10      +2 -13     
jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/TestGroupManager.java
  
  Index: TestGroupManager.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/TestGroupManager.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- TestGroupManager.java     2 Oct 2004 23:05:48 -0000       1.9
  +++ TestGroupManager.java     29 Oct 2004 14:12:28 -0000      1.10
  @@ -22,6 +22,7 @@
   import junit.framework.TestSuite;
   
   import org.apache.jetspeed.security.impl.GroupPrincipalImpl;
  +import org.apache.jetspeed.security.util.test.AbstractSecurityTestcase;
   
   /**
    * <p>
  @@ -33,18 +34,6 @@
    */
   public class TestGroupManager extends AbstractSecurityTestcase
   {
  -
  -    /**
  -     * <p>
  -     * Defines the test case name for junit.
  -     * </p>
  -     * 
  -     * @param testName The test case name.
  -     */
  -    public TestGroupManager(String testName)
  -    {
  -        super(testName);
  -    }
   
       /**
        * @see junit.framework.TestCase#setUp()
  
  
  
  1.6       +1 -9      
jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/TestPermissionManager.java
  
  Index: TestPermissionManager.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/TestPermissionManager.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestPermissionManager.java        28 Sep 2004 04:23:52 -0000      1.5
  +++ TestPermissionManager.java        29 Oct 2004 14:12:28 -0000      1.6
  @@ -26,6 +26,7 @@
   import org.apache.jetspeed.security.impl.GroupPrincipalImpl;
   import org.apache.jetspeed.security.impl.RolePrincipalImpl;
   import org.apache.jetspeed.security.impl.UserPrincipalImpl;
  +import org.apache.jetspeed.security.util.test.AbstractSecurityTestcase;
   
   /**
    * <p>Unit testing for [EMAIL PROTECTED] PermissionManager}.</p>
  @@ -34,15 +35,6 @@
    */
   public class TestPermissionManager extends AbstractSecurityTestcase
   {
  -
  -    /**
  -     * <p>Defines the test case name for junit.</p>
  -     * @param testName The test case name.
  -     */
  -    public TestPermissionManager(String testName)
  -    {
  -        super(testName);
  -    }
   
       /**
        * @see junit.framework.TestCase#setUp()
  
  
  
  1.2       +3 -11     
jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/TestAuthenticationProviderProxy.java
  
  Index: TestAuthenticationProviderProxy.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/components/security/src/test/org/apache/jetspeed/security/TestAuthenticationProviderProxy.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestAuthenticationProviderProxy.java      11 Oct 2004 23:25:29 -0000      1.1
  +++ TestAuthenticationProviderProxy.java      29 Oct 2004 14:12:28 -0000      1.2
  @@ -34,6 +34,7 @@
   import org.apache.jetspeed.security.spi.UserSecurityHandler;
   import org.apache.jetspeed.security.spi.impl.LdapCredentialHandler;
   import org.apache.jetspeed.security.spi.impl.LdapUserSecurityHandler;
  +import org.apache.jetspeed.security.util.test.AbstractSecurityTestcase;
   
   /**
    * <p>Unit testing for [EMAIL PROTECTED] TestAuthenticationProviderProxy}.</p>
  @@ -44,15 +45,6 @@
   {
   
       /**
  -     * <p>Defines the test case name for junit.</p>
  -     * @param testName The test case name.
  -     */
  -    public TestAuthenticationProviderProxy(String testName)
  -    {
  -        super(testName);
  -    }
  -    
  -    /**
        * @see junit.framework.TestCase#setUp()
        */
       protected void setUp() throws Exception
  @@ -181,7 +173,7 @@
               assertEquals("should not contain any role", 0, roles.size());
               
               // The mapping entry should be gone.
  -            assertNull(cq.getInternalUserPrincipal("ldap1", true));
  +            assertNull(securityAccess.getInternalUserPrincipal("ldap1", true));
               
               // Is user in roles?
               assertFalse(rms.isUserInRole("ldap1", "testrole1"));
  @@ -227,7 +219,7 @@
               assertEquals("should not contain any group", 0, groups.size());
               
               // The mapping entry should be gone.
  -            assertNull(cq.getInternalUserPrincipal("ldap1", true));
  +            assertNull(securityAccess.getInternalUserPrincipal("ldap1", true));
               
               // Is user in groups?
               assertFalse(gms.isUserInGroup("ldap1", "testgroup1"));
  
  
  
  1.1                  
jakarta-jetspeed-2/components/security/src/java/org/apache/jetspeed/security/util/test/AbstractSecurityTestcase.java
  
  Index: AbstractSecurityTestcase.java
  ===================================================================
  /*
   * Copyright 2000-2001,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.jetspeed.security.util.test;
  
  import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.Collection;
  import java.util.Iterator;
  import java.util.List;
  
  import javax.security.auth.Subject;
  
  import org.apache.jetspeed.prefs.util.test.AbstractPrefsSupportedTestCase;
  import org.apache.jetspeed.security.AuthenticationProvider;
  import org.apache.jetspeed.security.AuthenticationProviderProxy;
  import org.apache.jetspeed.security.GroupManager;
  import org.apache.jetspeed.security.PermissionManager;
  import org.apache.jetspeed.security.RoleManager;
  import org.apache.jetspeed.security.SecurityProvider;
  import org.apache.jetspeed.security.UserManager;
  import org.apache.jetspeed.security.impl.SecurityProviderImpl;
  import org.apache.jetspeed.security.spi.CredentialHandler;
  import org.apache.jetspeed.security.spi.GroupSecurityHandler;
  import org.apache.jetspeed.security.spi.RoleSecurityHandler;
  import org.apache.jetspeed.security.spi.SecurityAccess;
  import org.apache.jetspeed.security.spi.SecurityMappingHandler;
  import org.apache.jetspeed.security.spi.UserSecurityHandler;
  
  /**
   * @author <a href="mailto:[EMAIL PROTECTED]">Scott T. Weaver </a>
   * @version $Id: AbstractSecurityTestcase.java,v 1.1 2004/10/29 14:12:28 weaver Exp $
   *  
   */
  public class AbstractSecurityTestcase extends AbstractPrefsSupportedTestCase
  {
      /** SPI Common Queries. */
      protected SecurityAccess securityAccess;
      
      /** SPI Default Credential Handler. */
      protected CredentialHandler ch;
      
      /** SPI Default User Security Handler. */
      protected UserSecurityHandler ush;
      
      /** SPI Default Role Security Handler. */
      protected RoleSecurityHandler rsh;
      
      /** SPI Default Group Security Handler. */
      protected GroupSecurityHandler gsh;
      
      /** SPI Default Security Mapping Handler. */
      protected SecurityMappingHandler smh;
      
      /** The security provider. */
      protected SecurityProvider securityProvider;
      
      /** The user manager. */
      protected UserManager ums;
  
      /** The group manager. */
      protected GroupManager gms;
  
      /** The role manager. */
      protected RoleManager rms;
  
      /** The permission manager. */
      protected PermissionManager pms;
  
      /**
       * @see junit.framework.TestCase#setUp()
       */
      protected void setUp() throws Exception
      {
  
          super.setUp();
          
          
          
          
          // SPI Security handlers.
          securityAccess = (SecurityAccess) 
ctx.getBean("org.apache.jetspeed.security.spi.SecurityAccess");
          ch =  (CredentialHandler) 
ctx.getBean("org.apache.jetspeed.security.spi.CredentialHandler");
          ush = (UserSecurityHandler) 
ctx.getBean("org.apache.jetspeed.security.spi.UserSecurityHandler");
          rsh = (RoleSecurityHandler) 
ctx.getBean("org.apache.jetspeed.security.spi.RoleSecurityHandler");
          gsh = (GroupSecurityHandler) 
ctx.getBean("org.apache.jetspeed.security.spi.GroupSecurityHandler");
          smh = (SecurityMappingHandler) 
ctx.getBean("org.apache.jetspeed.security.spi.SecurityMappingHandler");
          
          // Security Providers.        
          AuthenticationProvider atnProvider = (AuthenticationProvider) 
ctx.getBean("org.apache.jetspeed.security.AuthenticationProvider");
          List atnProviders = new ArrayList();
          atnProviders.add(atnProvider);
          
         
          AuthenticationProviderProxy atnProviderProxy = (AuthenticationProviderProxy) 
ctx.getBean("org.apache.jetspeed.security.AuthenticationProviderProxy");
          securityProvider = new SecurityProviderImpl(atnProviderProxy, rsh, gsh, smh);
          
          securityProvider = (SecurityProvider) 
ctx.getBean("org.apache.jetspeed.security.SecurityProvider");
          
          ums = (UserManager) ctx.getBean("org.apache.jetspeed.security.UserManager");
          gms = (GroupManager) 
ctx.getBean("org.apache.jetspeed.security.GroupManager");
          rms = (RoleManager) ctx.getBean("org.apache.jetspeed.security.RoleManager");
          
          // Login module.
          //new LoginModuleProxyImpl(ums);
  
          
          // Authorization.
          pms = (PermissionManager) 
ctx.getBean("org.apache.jetspeed.security.PermissionManager");
          //Policy policy = new RdbmsPolicy(pms);
          //new AuthorizationProviderImpl(policy);
      }
  
      /**
       * Returns subject's principals of type claz
       * 
       * @param subject
       * @param claz
       * @return Returns subject's principals of type claz
       */
      protected Collection getPrincipals(Subject subject, Class claz)
      {
          List principals = new ArrayList();
          for (Iterator iter = subject.getPrincipals().iterator(); iter.hasNext();)
          {
              Object element = iter.next();
              if (claz.isInstance(element))
                  principals.add(element);
  
          }
          return principals;
      }
  
      protected String[] getConfigurations()
      {
          String[] confs = super.getConfigurations();
          List confList = new ArrayList(Arrays.asList(confs));
          confList.add("META-INF/security.xml");
          return (String[]) confList.toArray(new String[1]);
      }
  
  }
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to