harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r396860 - in /incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common: javax/security/auth/ javax/security/auth/login/ org/apache/harmony/auth/internal/
Date Tue, 25 Apr 2006 12:23:38 GMT
Author: smishura
Date: Tue Apr 25 05:23:04 2006
New Revision: 396860

URL: http://svn.apache.org/viewcvs?rev=396860&view=rev
Log:
Apply patch for HARMONY-353 (improvements to junit test method usage) for auth module. All
auth tests passed on Windows.

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/PrivateCredentialPermissionTest.java
  (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/SubjectTest.java
  (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/login/LoginContextTest.java
  (contents, props changed)
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/login/LoginContextTest_1.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/internal/SecurityTest.java
  (contents, props changed)

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/PrivateCredentialPermissionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/PrivateCredentialPermissionTest.java?rev=396860&r1=396859&r2=396860&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/PrivateCredentialPermissionTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/PrivateCredentialPermissionTest.java
Tue Apr 25 05:23:04 2006
@@ -708,7 +708,7 @@
         PrivateCredentialPermission p = new PrivateCredentialPermission(
                 "a b \"c c\"", "read");
 
-        assertTrue("Principal name:", "c c".equals(p.getPrincipals()[0][1]));
+        assertEquals("Principal name:", "c c", p.getPrincipals()[0][1]);
     }
 
     public final void testSerialization_Wildcard() throws Exception {
@@ -747,12 +747,12 @@
         PrivateCredentialPermission p = (PrivateCredentialPermission) sIn
                 .readObject();
 
-        assertTrue("CredentialClass ", "a".equals(p.getCredentialClass()));
+        assertEquals("CredentialClass ", "a", p.getCredentialClass());
 
         String[][] principals = p.getPrincipals();
-        assertTrue("Size:", principals.length == 1);
-        assertTrue("PrincipalClass:", "b".equals(principals[0][0]));
-        assertTrue("PrincipalName:", "c".equals(principals[0][1]));
+        assertEquals("Size:", 1, principals.length);
+        assertEquals("PrincipalClass:", "b", principals[0][0]);
+        assertEquals("PrincipalName:", "c", principals[0][1]);
     }
 
     public final void testSerialization_Self() throws Exception {
@@ -763,12 +763,12 @@
         PrivateCredentialPermission p = (PrivateCredentialPermission) sIn
                 .readObject();
 
-        assertTrue("CredentialClass ", "a".equals(p.getCredentialClass()));
+        assertEquals("CredentialClass ", "a", p.getCredentialClass());
 
         String[][] principals = p.getPrincipals();
-        assertTrue("Size:", principals.length == 1);
-        assertTrue("PrincipalClass:", "b".equals(principals[0][0]));
-        assertTrue("PrincipalName:", "c".equals(principals[0][1]));
+        assertEquals("Size:", 1, principals.length);
+        assertEquals("PrincipalClass:", "b", principals[0][0]);
+        assertEquals("PrincipalName:", "c", principals[0][1]);
     }
 
     // Golden: PrivateCredentialPermission("a b \"c\"","read");

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/PrivateCredentialPermissionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/SubjectTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/SubjectTest.java?rev=396860&r1=396859&r2=396860&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/SubjectTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/SubjectTest.java
Tue Apr 25 05:23:04 2006
@@ -878,10 +878,10 @@
         Subject ss = (Subject) sIn.readObject();
 
         assertTrue(ss.isReadOnly());
-        assertTrue(ss.getPrincipals().size() == 1);
+        assertEquals(1, ss.getPrincipals().size());
         assertTrue(ss.getPrincipals().iterator().next() instanceof MyClass1);
-        assertTrue(ss.getPublicCredentials().size() == 0);
-        assertTrue(ss.getPrivateCredentials().size() == 0);
+        assertEquals(0, ss.getPublicCredentials().size());
+        assertEquals(0, ss.getPrivateCredentials().size());
 
         try {
             ss.getPrincipals().add(new MyClass1());

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/SubjectTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/login/LoginContextTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/login/LoginContextTest.java?rev=396860&r1=396859&r2=396860&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/login/LoginContextTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/login/LoginContextTest.java
Tue Apr 25 05:23:04 2006
@@ -106,8 +106,7 @@
             new LoginContext(moduleName);
             fail("No expected LoginException");
         } catch (LoginException e) {
-            assertTrue("Default module", MyConfig.getLastAppName().equals(
-                    "other"));
+            assertEquals("Default module", "other", MyConfig.getLastAppName());
         }
     }
 
@@ -210,7 +209,7 @@
         context.login();
 
         // only one module must be created
-        assertTrue("Number of modules", MyLoginModule.list.size() == 1);
+        assertEquals("Number of modules", 1, MyLoginModule.list.size());
 
         MyLoginModule module = (MyLoginModule) MyLoginModule.list.get(0);
 
@@ -315,8 +314,7 @@
             new LoginContext(moduleName, handler);
             fail("No expected LoginException");
         } catch (LoginException e) {
-            assertTrue("Default module", MyConfig.getLastAppName().equals(
-                    "other"));
+            assertEquals("Default module", "other", MyConfig.getLastAppName());
         }
     }
 
@@ -371,7 +369,7 @@
         context.login();
 
         // only one module must be created
-        assertTrue("Number of modules", MyLoginModule.list.size() == 1);
+        assertEquals("Number of modules", 1, MyLoginModule.list.size());
 
         MyLoginModule module = (MyLoginModule) MyLoginModule.list.get(0);
 
@@ -454,8 +452,7 @@
             new LoginContext(moduleName, subject);
             fail("No expected LoginException");
         } catch (LoginException e) {
-            assertTrue("Default module", MyConfig.getLastAppName().equals(
-                    "other"));
+            assertEquals("Default module", "other", MyConfig.getLastAppName());
         }
     }
 
@@ -535,7 +532,7 @@
         context.login();
 
         // only one module must be created
-        assertTrue("Number of modules", MyLoginModule.list.size() == 1);
+        assertEquals("Number of modules", 1, MyLoginModule.list.size());
 
         MyLoginModule module = (MyLoginModule) MyLoginModule.list.get(0);
 
@@ -651,8 +648,7 @@
             new LoginContext(moduleName, subject, handler);
             fail("No expected LoginException");
         } catch (LoginException e) {
-            assertTrue("Default module", MyConfig.getLastAppName().equals(
-                    "other"));
+            assertEquals("Default module", "other", MyConfig.getLastAppName());
         }
     }
 
@@ -682,7 +678,7 @@
         context.login();
 
         // only one module must be created
-        assertTrue("Number of modules", MyLoginModule.list.size() == 1);
+        assertEquals("Number of modules", 1, MyLoginModule.list.size());
 
         MyLoginModule module = (MyLoginModule) MyLoginModule.list.get(0);
 
@@ -934,4 +930,4 @@
             return false;
         }
     }
-}
\ No newline at end of file
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/login/LoginContextTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/login/LoginContextTest_1.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/login/LoginContextTest_1.java?rev=396860&r1=396859&r2=396860&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/login/LoginContextTest_1.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/login/LoginContextTest_1.java
Tue Apr 25 05:23:04 2006
@@ -709,7 +709,7 @@
         Security.setProperty(DEFAULT_CBHANDLER_PROPERTY, klassName);
         // This also shows that the cbHandler is instantiated at the ctor
         new LoginContext(CONFIG_NAME);
-        assertTrue(TestCallbackHandler.size() == 1);
+        assertEquals(1, TestCallbackHandler.size());
         // ugh... cant set 'null' here... 
         Security.setProperty(DEFAULT_CBHANDLER_PROPERTY, "");
         // additional cleanup to make it PerfTests compatible
@@ -887,7 +887,7 @@
         TestConfig.addInstalledSufficient("TestLoginModule_Success");
         LoginContext lc = new LoginContext(CONFIG_NAME);
         lc.login();
-        assertTrue(TestLoginModule.size() == 1);
+        assertEquals(1, TestLoginModule.size());
         assertTrue(TestLoginModule.get(0).initCalled);
         assertTrue(TestLoginModule.get(0).loginCalled);
 
@@ -899,7 +899,7 @@
 
         lc.login();
 
-        assertTrue(TestLoginModule.size() == 1);
+        assertEquals(1, TestLoginModule.size());
         assertTrue(TestLoginModule.get(0).loginCalled);
         assertFalse(TestLoginModule.get(0).initCalled);
         // additional cleanup to make it PerfTests compatible
@@ -922,7 +922,7 @@
             //ok
         }
 
-        assertTrue(TestLoginModule.size() == 1);
+        assertEquals(1, TestLoginModule.size());
         assertTrue(TestLoginModule.get(0).initCalled);
         assertFalse(TestLoginModule.get(0).loginCalled);
         assertFalse(TestLoginModule.get(0).commitCalled);
@@ -940,7 +940,7 @@
         TestLoginModule.staticMask = 0;
         lc.login();
 
-        assertTrue(TestLoginModule.size() == 1);
+        assertEquals(1, TestLoginModule.size());
         assertFalse(TestLoginModule.get(0).initCalled);
         assertTrue(TestLoginModule.get(0).loginCalled);
         assertTrue(TestLoginModule.get(0).commitCalled);
@@ -1096,7 +1096,7 @@
      */
     public void testLogin_04() throws Exception {
         TestConfig.addInstalledRequired("TestLoginModule");
-        assertTrue(TestLoginModule.size() == 0);
+        assertEquals(0, TestLoginModule.size());
         LoginContext lc = new LoginContext(CONFIG_NAME);
         TestLoginModule.staticMask = TestLoginModule.FAIL_AT_CTOR;
         try {
@@ -1105,11 +1105,11 @@
         } catch (LoginException ex) {
             // ok
         }
-        assertTrue(TestLoginModule.size() == 0);
+        assertEquals(0, TestLoginModule.size());
         // fail nowhere
         TestLoginModule.staticMask = 0;
         lc.login(); // must be successful now
-        assertTrue(TestLoginModule.size() == 1);
+        assertEquals(1, TestLoginModule.size());
         assertTrue(TestLoginModule.get(0).initCalled);
         assertTrue(TestLoginModule.get(0).loginCalled);
         assertTrue(TestLoginModule.get(0).commitCalled);
@@ -1154,14 +1154,14 @@
         } catch (LoginException ex) {
             // ok
         }
-        assertTrue(TestLoginModule.size() == 1);
+        assertEquals(1, TestLoginModule.size());
         assertFalse(TestLoginModule.get(0).loginCalled);
         assertFalse(TestLoginModule.get(0).commitCalled); // self check
         // fail nowhere
         TestLoginModule.staticMask = 0;
         lc.login(); // must be successful now
         // no new module must be created
-        assertTrue(TestLoginModule.size() == 1);
+        assertEquals(1, TestLoginModule.size());
         assertTrue(TestLoginModule.get(0).loginCalled);
         assertTrue(TestLoginModule.get(0).commitCalled);
         // additional cleanup to make it PerfTests compatible
@@ -1183,7 +1183,7 @@
         } catch (LoginException ex) {
             //ok
         }
-        assertTrue(TestLoginModule.size() == 1);
+        assertEquals(1, TestLoginModule.size());
         assertTrue(TestLoginModule.get(0).loginCalled);
         assertTrue(TestLoginModule.get(0).abortCalled);
         assertFalse(TestLoginModule.get(0).commitCalled);
@@ -1360,7 +1360,7 @@
 
         lc.login();
 
-        assertTrue(TestLoginModule.size() == 2);
+        assertEquals(2, TestLoginModule.size());
         //
         assertTrue(TestLoginModule.get(0).loginCalled);
         assertTrue(TestLoginModule.get(0).commitCalled);
@@ -1390,7 +1390,7 @@
             assertSame(TestLoginModule.staticLE, le);
         }
 
-        assertTrue(TestLoginModule.size() == 2);
+        assertEquals(2, TestLoginModule.size());
         //
         assertTrue(TestLoginModule.get(0).loginCalled);
         assertTrue(TestLoginModule.get(0).commitCalled);
@@ -1421,7 +1421,7 @@
             // gut
         }
 
-        assertTrue(TestLoginModule.size() == 3);
+        assertEquals(3, TestLoginModule.size());
         //
         assertTrue(TestLoginModule.get(0).loginCalled);
         assertTrue(TestLoginModule.get(0).commitCalled);
@@ -1454,7 +1454,7 @@
             // gut
         }
 
-        assertTrue(TestLoginModule.size() == 3);
+        assertEquals(3, TestLoginModule.size());
         //
         assertTrue(TestLoginModule.get(0).loginCalled);
         assertTrue(TestLoginModule.get(0).commitCalled);
@@ -1483,7 +1483,7 @@
 
         lc.login();
 
-        assertTrue(TestLoginModule.size() == 2);
+        assertEquals(2, TestLoginModule.size());
         //
         assertTrue(TestLoginModule.get(0).loginCalled);
         assertTrue(TestLoginModule.get(0).commitCalled);
@@ -1510,7 +1510,7 @@
 
         lc.login();
 
-        assertTrue(TestLoginModule.size() == 2);
+        assertEquals(2, TestLoginModule.size());
         //
         assertTrue(TestLoginModule.get(0).initCalled);
         assertTrue(TestLoginModule.get(0).loginCalled);
@@ -1539,7 +1539,7 @@
 
         lc.login();
 
-        assertTrue(TestLoginModule.size() == 2);
+        assertEquals(2, TestLoginModule.size());
         //
         assertTrue(TestLoginModule.get(0).initCalled);
         assertTrue(TestLoginModule.get(0).loginCalled);
@@ -1572,7 +1572,7 @@
             // gut
         }
 
-        assertTrue(TestLoginModule.size() == 2);
+        assertEquals(2, TestLoginModule.size());
         //
         assertTrue(TestLoginModule.get(0).initCalled);
         assertTrue(TestLoginModule.get(0).loginCalled);
@@ -1609,7 +1609,7 @@
             // assertSame( ex, TestLoginModule.staticLE);
         }
 
-        assertTrue(TestLoginModule.size() == 1);
+        assertEquals(1, TestLoginModule.size());
         //
         assertTrue(TestLoginModule.get(0).initCalled);
         assertTrue(TestLoginModule.get(0).loginCalled);
@@ -1676,7 +1676,7 @@
         } catch (LoginException _) {
             // gut
         }
-        assertTrue(TestLoginModule.size() == 0);
+        assertEquals(0, TestLoginModule.size());
         // additional cleanup to make it PerfTests compatible
         clear();
     }
@@ -1698,7 +1698,7 @@
         } catch (LoginException _) {
             // gut
         }
-        assertTrue(TestLoginModule.size() == 2);
+        assertEquals(2, TestLoginModule.size());
         assertTrue(TestLoginModule.get(0).logoutCalled);
         assertTrue(TestLoginModule.get(1).logoutCalled);
         // additional cleanup to make it PerfTests compatible
@@ -2030,7 +2030,7 @@
         lc.login();
         lc.logout();
         //
-        assertTrue(TestCallbackHandler.size() == 1);
+        assertEquals(1, TestCallbackHandler.size());
 
         // now, get abort() called
         TestLoginModule.staticMask = TestLoginModule.FAIL_AT_LOGIN;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/internal/SecurityTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/internal/SecurityTest.java?rev=396860&r1=396859&r2=396860&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/internal/SecurityTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/internal/SecurityTest.java
Tue Apr 25 05:23:04 2006
@@ -210,7 +210,7 @@
             assertTrue("IteratorTest: suite MUST be initialized", set != null
                     && element != null);
 
-            assertTrue("IteratorTest: set MUST be empty", set.size() == 0);
+            assertEquals("IteratorTest: set MUST be empty", 0, set.size());
         }
 
         /**
@@ -656,7 +656,7 @@
             assertTrue("SetTest: suite MUST be initialized", set != null
                     && element != null);
 
-            assertTrue("SetTest: set MUST be empty", set.size() == 0);
+            assertEquals("SetTest: set MUST be empty", 0, set.size());
 
             hash.add(element);
         }
@@ -708,13 +708,13 @@
         //
         public void testClear_EmptySet() {
             set.clear();
-            assertTrue("Set MUST be empty", set.size() == 0);
+            assertEquals("Set MUST be empty", 0, set.size());
         }
 
         public void testClear_NotEmptySet() {
             set.add(element);
             set.clear();
-            assertTrue("Set MUST be empty", set.size() == 0);
+            assertEquals("Set MUST be empty", 0, set.size());
         }
 
         //
@@ -933,8 +933,8 @@
             assertTrue("UnsupportedNullTest: suite MUST be initialized",
                     set != null && element != null);
 
-            assertTrue("UnsupportedNullTest: set MUST be empty",
-                    set.size() == 0);
+            assertEquals("UnsupportedNullTest: set MUST be empty",
+                    0, set.size());
 
             hash.add(null);
         }
@@ -1010,7 +1010,7 @@
                 assertTrue("Retaining NULL element", set.retainAll(hash));
             } catch (NullPointerException npe) {
             }
-            assertTrue("Set is empty", set.size() == 0);
+            assertEquals("Set is empty", 0, set.size());
         }
     }
 
@@ -1047,8 +1047,8 @@
             assertTrue("IneligibleElementTest: suite MUST be initialized",
                     set != null && element != null && iElement != null);
 
-            assertTrue("IneligibleElementTest: set MUST be empty",
-                    set.size() == 0);
+            assertEquals("IneligibleElementTest: set MUST be empty",
+                    0, set.size());
 
             hash.add(null);
 
@@ -1161,7 +1161,7 @@
             } catch (ClassCastException e) {
             } catch (IllegalArgumentException e) {
             }
-            assertTrue("Now set is empty", set.size() == 0);
+            assertEquals("Now set is empty", 0, set.size());
         }
     }
 

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/internal/SecurityTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message