You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by ep...@apache.org on 2004/11/04 21:49:57 UTC

cvs commit: jakarta-turbine-fulcrum/security/nt/src/test/org/apache/fulcrum/security/nt/dynamic NTBasicModelManagerTest.java NTUserManagerTest.java NTDynamicModelManagerTest.java

epugh       2004/11/04 12:49:57

  Modified:    security/nt/src/test/org/apache/fulcrum/security/nt/dynamic
                        NTBasicModelManagerTest.java NTUserManagerTest.java
                        NTDynamicModelManagerTest.java
  Log:
  Catch and ignroe test errors when ntsystem doesn't exist.
  
  Revision  Changes    Path
  1.6       +16 -10    jakarta-turbine-fulcrum/security/nt/src/test/org/apache/fulcrum/security/nt/dynamic/NTBasicModelManagerTest.java
  
  Index: NTBasicModelManagerTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-fulcrum/security/nt/src/test/org/apache/fulcrum/security/nt/dynamic/NTBasicModelManagerTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- NTBasicModelManagerTest.java	1 Nov 2004 13:29:21 -0000	1.5
  +++ NTBasicModelManagerTest.java	4 Nov 2004 20:49:56 -0000	1.6
  @@ -26,10 +26,10 @@
   import org.apache.fulcrum.security.util.UnknownEntityException;
   import org.apache.fulcrum.testcontainer.BaseUnitTest;
   /**
  - * 
  + *
    * Test the NT implementation of the user manager. This test traps some exceptions that can be
    * thrown if there is NO nt dll.
  - * 
  + *
    * @author <a href="mailto:epugh@upstate.com">Eric Pugh</a>
    * @version $Id$
    */
  @@ -40,12 +40,12 @@
       private static final String USERNAME = "Eric Pugh";
       private static final String DOMAIN = "IQUITOS";
       private static final String PASSWORD = "";
  -	private static final String GUESTUSER = DOMAIN + "/" + "Guest";
  -	private static final String TESTUSER = DOMAIN + "/" + USERNAME;
  +    private static final String GUESTUSER = DOMAIN + "/" + "Guest";
  +    private static final String TESTUSER = DOMAIN + "/" + USERNAME;
       private BasicModelManager modelManager;
  -	private SecurityService securityService;
  -	private UserManager userManager;
  -	private User user;
  +    private SecurityService securityService;
  +    private UserManager userManager;
  +    private User user;
   
       public void setUp() throws Exception
       {
  @@ -63,7 +63,7 @@
       }
       /**
        * Constructor for MemoryPermissionManagerTest.
  -     * 
  +     *
        * @param arg0
        */
       public NTBasicModelManagerTest(String arg0)
  @@ -112,6 +112,9 @@
           {
               log.info("Unit test not being run due to missing NT DLL");
           }
  +        catch (java.lang.NoClassDefFoundError ncdfe){
  +            log.info("Unit test not being run due to missing NT DLL");
  +        }
       }
       public void testRevokeUserGroup() throws Exception
       {
  @@ -133,6 +136,9 @@
           {
               log.info("Unit test not being run due to missing NT DLL");
           }
  +        catch (java.lang.NoClassDefFoundError ncdfe){
  +            log.info("Unit test not being run due to missing NT DLL");
  +        }
       }
  -  
  +
   }
  
  
  
  1.9       +50 -36    jakarta-turbine-fulcrum/security/nt/src/test/org/apache/fulcrum/security/nt/dynamic/NTUserManagerTest.java
  
  Index: NTUserManagerTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-fulcrum/security/nt/src/test/org/apache/fulcrum/security/nt/dynamic/NTUserManagerTest.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- NTUserManagerTest.java	1 Nov 2004 13:29:21 -0000	1.8
  +++ NTUserManagerTest.java	4 Nov 2004 20:49:56 -0000	1.9
  @@ -25,10 +25,10 @@
   
   import com.tagish.auth.win32.NTSystem;
   /**
  - * 
  + *
    * Test the NT implementation of the user manager. This test traps some exceptions that can be
    * thrown if there is NO nt dll.
  - * 
  + *
    * @author <a href="mailto:epugh@upstate.com">Eric Pugh</a>
    * @version $Id$
    */
  @@ -39,8 +39,8 @@
       private static final String USERNAME = "Eric Pugh";
       private static final String DOMAIN = "IQUITOS";
       private static final String PASSWORD = "";
  -	private static final String GUESTUSER = DOMAIN + "/" + "Guest";
  -	private static final String TESTUSER = DOMAIN + "/" + USERNAME;
  +    private static final String GUESTUSER = DOMAIN + "/" + "Guest";
  +    private static final String TESTUSER = DOMAIN + "/" + USERNAME;
   
       public void setUp() throws Exception
       {
  @@ -57,7 +57,7 @@
       }
       /**
        * Constructor for MemoryPermissionManagerTest.
  -     * 
  +     *
        * @param arg0
        */
       public NTUserManagerTest(String arg0)
  @@ -68,7 +68,7 @@
       {
           try
           {
  -			user = userManager.getUser(GUESTUSER, "");
  +            user = userManager.getUser(GUESTUSER, "");
               user.setPassword("");
               assertTrue(userManager.checkExists(user));
           }
  @@ -202,21 +202,21 @@
           }
       }
       /** ******* ALL BELOW HERE THROW RUNTIME EXCEPTIONS ******** */
  -	/*
  -	 * Class to test for User retrieve(String, String)
  -	 */
  -	public void testGetAllUsers() throws Exception
  -	{
  -		try
  -	   {
  -		   userManager.getAllUsers();
  -		   fail("Should throw runtime exception");
  -	   }
  -	   catch (RuntimeException re)
  -	   {
  -		   assertTrue(re.getMessage().equals(ERROR_MSG));
  -	   }
  -	}    
  +    /*
  +     * Class to test for User retrieve(String, String)
  +     */
  +    public void testGetAllUsers() throws Exception
  +    {
  +        try
  +       {
  +           userManager.getAllUsers();
  +           fail("Should throw runtime exception");
  +       }
  +       catch (RuntimeException re)
  +       {
  +           assertTrue(re.getMessage().equals(ERROR_MSG));
  +       }
  +    }
       /*
        * Class to test for User retrieve(String)
        */
  @@ -232,7 +232,7 @@
               assertTrue(re.getMessage().equals(ERROR_MSG));
           }
       }
  -    
  +
       public void testGetUserById() throws Exception
       {
           try
  @@ -244,13 +244,14 @@
           {
               assertTrue(re.getMessage().equals(ERROR_MSG));
           }
  -    }    
  +    }
       public void testChangePassword() throws Exception
       {
  -		user = userManager.getUser(GUESTUSER, "");
  -		user.setPassword("");
           try
           {
  +            user = userManager.getUser(GUESTUSER, "");
  +            user.setPassword("");
  +
               userManager.changePassword(user, "", "newPassword");
               fail("Should throw runtime exception");
           }
  @@ -258,6 +259,7 @@
           {
               log.info("Unit test not being run due to missing NT DLL");
           }
  +
           catch (RuntimeException re)
           {
               assertTrue(re.getMessage().equals(ERROR_MSG));
  @@ -265,8 +267,8 @@
       }
       public void testForcePassword() throws Exception
       {
  -		user = userManager.getUser(GUESTUSER, "");
  -		user.setPassword("");
  +        user = userManager.getUser(GUESTUSER, "");
  +        user.setPassword("");
           try
           {
               userManager.forcePassword(user, "JC_SUBSET");
  @@ -281,7 +283,7 @@
               assertTrue(re.getMessage().equals(ERROR_MSG));
           }
       }
  -   
  +
       public void testSaveUser() throws Exception
       {
           try
  @@ -294,7 +296,7 @@
               assertTrue(re.getMessage().equals(ERROR_MSG));
           }
       }
  -   
  +
       public void testRemoveUser() throws Exception
       {
           try
  @@ -331,16 +333,28 @@
               assertTrue(re.getMessage().equals(ERROR_MSG));
           }
       }
  +
  +    /*
  +     * Override parent class, doesn't make sense..
  +     */
       public void testCheckExistsWithString() throws Exception
       {
  -       
  -    }  
  -    
  +
  +    }
  +
       /*
  -     * Class to test for boolean checkExists(string)
  +     * Override parent class, doesn't make sense..
        */
       public void testAddUserTwiceFails() throws Exception
       {
  -      
  -    }  
  +
  +    }
  +    /*
  +     * Override parent class, doesn't make sense..
  +     */
  +    public void testCheckUserCaseSensitiveExists() throws Exception
  +    {
  +
  +    }
  +
   }
  
  
  
  1.6       +16 -10    jakarta-turbine-fulcrum/security/nt/src/test/org/apache/fulcrum/security/nt/dynamic/NTDynamicModelManagerTest.java
  
  Index: NTDynamicModelManagerTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-fulcrum/security/nt/src/test/org/apache/fulcrum/security/nt/dynamic/NTDynamicModelManagerTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- NTDynamicModelManagerTest.java	1 Nov 2004 13:29:21 -0000	1.5
  +++ NTDynamicModelManagerTest.java	4 Nov 2004 20:49:56 -0000	1.6
  @@ -26,10 +26,10 @@
   import org.apache.fulcrum.security.util.UnknownEntityException;
   import org.apache.fulcrum.testcontainer.BaseUnitTest;
   /**
  - * 
  + *
    * Test the NT implementation of the user manager. This test traps some exceptions that can be
    * thrown if there is NO nt dll.
  - * 
  + *
    * @author <a href="mailto:epugh@upstate.com">Eric Pugh</a>
    * @version $Id$
    */
  @@ -40,12 +40,12 @@
       private static final String USERNAME = "Eric Pugh";
       private static final String DOMAIN = "IQUITOS";
       private static final String PASSWORD = "";
  -	private static final String GUESTUSER = DOMAIN + "/" + "Guest";
  -	private static final String TESTUSER = DOMAIN + "/" + USERNAME;
  +    private static final String GUESTUSER = DOMAIN + "/" + "Guest";
  +    private static final String TESTUSER = DOMAIN + "/" + USERNAME;
       private DynamicModelManager modelManager;
  -	private SecurityService securityService;
  -	private UserManager userManager;
  -	private User user;
  +    private SecurityService securityService;
  +    private UserManager userManager;
  +    private User user;
   
       public void setUp() throws Exception
       {
  @@ -63,7 +63,7 @@
       }
       /**
        * Constructor for MemoryPermissionManagerTest.
  -     * 
  +     *
        * @param arg0
        */
       public NTDynamicModelManagerTest(String arg0)
  @@ -112,6 +112,9 @@
           {
               log.info("Unit test not being run due to missing NT DLL");
           }
  +        catch (java.lang.NoClassDefFoundError ncdfe){
  +            log.info("Unit test not being run due to missing NT DLL");
  +        }
       }
       public void testRevokeUserGroup() throws Exception
       {
  @@ -133,6 +136,9 @@
           {
               log.info("Unit test not being run due to missing NT DLL");
           }
  +        catch (java.lang.NoClassDefFoundError ncdfe){
  +            log.info("Unit test not being run due to missing NT DLL");
  +        }
       }
  -  
  +
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org