harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r1004908 - in /harmony/enhanced/java/trunk/classlib/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging: HandlerTest.java LoggerTest.java
Date Wed, 06 Oct 2010 07:10:19 GMT
Author: hindessm
Date: Wed Oct  6 07:10:19 2010
New Revision: 1004908

URL: http://svn.apache.org/viewvc?rev=1004908&view=rev
Log:
Reverting:

  r1004471 | jessewilson | 2010-10-04 23:59:23 +0100 (Mon, 04 Oct 2010) | 2 lines

  Isolate logging behavior tests from logging+security tests. Necessary to
  run the tests in a VM where installing an alternate security manager is
  not allowed.

as this breaks the build[0] and now fails on the RI.

[0] https://hudson.apache.org/hudson/view/Harmony/job/Harmony-1.5-head-linux-x86_64-full-tests/345/testReport/


Modified:
    harmony/enhanced/java/trunk/classlib/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/HandlerTest.java
    harmony/enhanced/java/trunk/classlib/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LoggerTest.java

Modified: harmony/enhanced/java/trunk/classlib/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/HandlerTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/HandlerTest.java?rev=1004908&r1=1004907&r2=1004908&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/HandlerTest.java
(original)
+++ harmony/enhanced/java/trunk/classlib/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/HandlerTest.java
Wed Oct  6 07:10:19 2010
@@ -497,25 +497,23 @@ public class HandlerTest extends TestCas
 	public void testReportError() {
 		MockHandler h = new MockHandler();
 		h.setErrorManager(new MockErrorManager());
-
-        Exception ex = new Exception("test exception");
-        // with non-null parameters
-        h.reportError("test msg", ex, -1);
-        assertEquals(-1, CallVerificationStack.getInstance().popInt());
-        assertSame(ex, CallVerificationStack.getInstance().pop());
-        assertEquals("test msg", CallVerificationStack.getInstance().pop());
-        // with null parameters
-        h.reportError(null, null, 0);
-        assertEquals(0, CallVerificationStack.getInstance().popInt());
-        assertSame(null, CallVerificationStack.getInstance().pop());
-        assertNull(CallVerificationStack.getInstance().pop());
-	}
-
-	public void testReportErrorWithSecurityManager() {
-        SecurityManager oldMan = System.getSecurityManager();
+		SecurityManager oldMan = System.getSecurityManager();
 		System.setSecurityManager(new MockSecurityManager());
+
 		try {
-            testReportError();
+			Exception ex = new Exception("test exception");
+			// with non-null parameters
+			h.reportError("test msg", ex, -1);
+			assertEquals(-1, CallVerificationStack.getInstance().popInt());
+			assertSame(ex, CallVerificationStack.getInstance().pop());
+			assertEquals("test msg", CallVerificationStack.getInstance().pop());
+			// with null parameters
+			h.reportError(null, null, 0);
+			assertEquals(0, CallVerificationStack.getInstance().popInt());
+			assertSame(null, CallVerificationStack.getInstance().pop());
+			assertNull(CallVerificationStack.getInstance().pop());
+		} catch (SecurityException e) {
+			fail("Should not throw SecurityException!");
 		} finally {
 			System.setSecurityManager(oldMan);
 		}

Modified: harmony/enhanced/java/trunk/classlib/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LoggerTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LoggerTest.java?rev=1004908&r1=1004907&r2=1004908&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LoggerTest.java
(original)
+++ harmony/enhanced/java/trunk/classlib/modules/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LoggerTest.java
Wed Oct  6 07:10:19 2010
@@ -182,23 +182,22 @@ public class LoggerTest extends TestCase
 	 * Test getAnonymousLogger()
 	 */
 	public void testGetAnonymousLogger() {
-        Logger alog = Logger.getAnonymousLogger();
-        assertNotSame(alog, Logger.getAnonymousLogger());
-        assertNull(alog.getFilter());
-        assertEquals(0, alog.getHandlers().length);
-        assertNull(alog.getLevel());
-        assertNull(alog.getName());
-        assertNull(alog.getParent().getParent());
-        assertNull(alog.getResourceBundle());
-        assertNull(alog.getResourceBundleName());
-        assertTrue(alog.getUseParentHandlers());
-	}
-
-	public void testGetAnonymousLoggerWithSecurityManager() {
 		SecurityManager oldMan = System.getSecurityManager();
 		System.setSecurityManager(new MockSecurityManager());
+
 		try {
-            testGetAnonymousLogger();
+			Logger alog = Logger.getAnonymousLogger();
+			assertNotSame(alog, Logger.getAnonymousLogger());
+			assertNull(alog.getFilter());
+			assertEquals(0, alog.getHandlers().length);
+			assertNull(alog.getLevel());
+			assertNull(alog.getName());
+			assertNull(alog.getParent().getParent());
+			assertNull(alog.getResourceBundle());
+			assertNull(alog.getResourceBundleName());
+			assertTrue(alog.getUseParentHandlers());
+			// fail("Should throw SecurityException!");
+			// } catch (SecurityException e) {
 		} finally {
 			System.setSecurityManager(oldMan);
 		}
@@ -3400,16 +3399,17 @@ public class LoggerTest extends TestCase
 	/*
 	 * Test whether privileged code is used to load resource bundles.
 	 */
-	public void testLoadResourceBundleWithSecurityManager() {
+	public void testLoadResourceBundle() {
+        // 
 		SecurityManager oldMan = System.getSecurityManager();
 		System.setSecurityManager(new MockNoLoadingClassSecurityManager());
 		try {
-            Logger.getAnonymousLogger(VALID_RESOURCE_BUNDLE);
+			Logger.getAnonymousLogger(VALID_RESOURCE_BUNDLE);
 		} finally {
 			System.setSecurityManager(oldMan);
 		}
 	}
-
+    
     public void testLoadResourceBundleNonExistent() {
         try {
             // Try a load a non-existent resource bundle.
@@ -3425,35 +3425,38 @@ public class LoggerTest extends TestCase
      * @tests java.util.logging.Logger#logrb(Level, String, String, String,
      *        String, Object)
      */
-    public void test_init_logger() throws Exception {
+    public void test_init_logger()
+            throws Exception {
         Properties p = new Properties();
         p.put("testGetLogger_Normal_ANewLogger2.level", "ALL");
         LogManager.getLogManager().readConfiguration(
                 EnvironmentHelper.PropertiesToInputStream(p));
+
         assertNull(LogManager.getLogManager().getLogger(
                 "testGetLogger_Normal_ANewLogger2"));
-    }
-    
-    public void test_init_loggerWithSecurityManager() throws Exception {
         SecurityManager originalSecurityManager = System.getSecurityManager();
-        System.setSecurityManager(new SecurityManager());
         try {
+            System.setSecurityManager(new SecurityManager());
+            // should not throw expection
             Logger logger = Logger.getLogger("testGetLogger_Normal_ANewLogger2");
+            // should thrpw exception
             try{
                 logger.setLevel(Level.ALL);
                 fail("should throw SecurityException");
-            } catch (SecurityException expected) {
+            } catch (SecurityException e){
+                // expected
             }
             try{
                 logger.setParent(Logger.getLogger("root"));
                 fail("should throw SecurityException");
-            } catch (SecurityException expected) {
+            } catch (SecurityException e){
+                // expected
             }
         } finally {
             System.setSecurityManager(originalSecurityManager);
         }
     }
-
+    
     /*
      * test initHandler
      */



Mime
View raw message