You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by hi...@apache.org on 2010/09/29 16:52:20 UTC
svn commit: r1002661 - in /harmony/enhanced/java/branches/java6: ./
classlib/ classlib/depends/libs/
classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/
classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/java/rmi/acti...
Author: hindessm
Date: Wed Sep 29 14:52:20 2010
New Revision: 1002661
URL: http://svn.apache.org/viewvc?rev=1002661&view=rev
Log:
Merge change from /harmony/enhanced/java/trunk@1002488:
r1002488 | regisxu | 2010-09-29 07:33:52 +0100 (Wed, 29 Sep 2010) | 1 line
Apply patches for HARMONY-6657: A batch of testcases to increase rmi module test coverage
Added:
harmony/enhanced/java/branches/java6/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RMISocketFactoryTest.java
- copied unchanged from r1002488, harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RMISocketFactoryTest.java
harmony/enhanced/java/branches/java6/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RemoteObjectTest.java
- copied unchanged from r1002488, harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RemoteObjectTest.java
harmony/enhanced/java/branches/java6/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RemoteServerTest.java
- copied unchanged from r1002488, harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RemoteServerTest.java
harmony/enhanced/java/branches/java6/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RemoteStubTest.java
- copied unchanged from r1002488, harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RemoteStubTest.java
harmony/enhanced/java/branches/java6/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/java/rmi/activation/ActivationGroupIDTest.java
- copied unchanged from r1002488, harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/java/rmi/activation/ActivationGroupIDTest.java
harmony/enhanced/java/branches/java6/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/java/rmi/dgc/
- copied from r1002488, harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/java/rmi/dgc/
harmony/enhanced/java/branches/java6/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/java/rmi/dgc/LeaseTest.java
- copied unchanged from r1002488, harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/java/rmi/dgc/LeaseTest.java
harmony/enhanced/java/branches/java6/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/java/rmi/dgc/VMIDTest.java
- copied unchanged from r1002488, harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/java/rmi/dgc/VMIDTest.java
harmony/enhanced/java/branches/java6/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/javax/activity/
- copied from r1002488, harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/javax/activity/
harmony/enhanced/java/branches/java6/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/javax/activity/ActivityCompletedExceptionTest.java
- copied unchanged from r1002488, harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/javax/activity/ActivityCompletedExceptionTest.java
harmony/enhanced/java/branches/java6/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/javax/activity/ActivityRequiredExceptionTest.java
- copied unchanged from r1002488, harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/javax/activity/ActivityRequiredExceptionTest.java
harmony/enhanced/java/branches/java6/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/javax/activity/InvalidActivityExceptionTest.java
- copied unchanged from r1002488, harmony/enhanced/java/trunk/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/tests/javax/activity/InvalidActivityExceptionTest.java
Modified:
harmony/enhanced/java/branches/java6/ (props changed)
harmony/enhanced/java/branches/java6/classlib/ (props changed)
harmony/enhanced/java/branches/java6/classlib/depends/libs/ (props changed)
harmony/enhanced/java/branches/java6/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/LogStreamTest.java
harmony/enhanced/java/branches/java6/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RMIClassLoaderTest.java
harmony/enhanced/java/branches/java6/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ServerNotActiveExceptionTest.java
harmony/enhanced/java/branches/java6/drlvm/ (props changed)
harmony/enhanced/java/branches/java6/jdktools/ (props changed)
Propchange: harmony/enhanced/java/branches/java6/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Sep 29 14:52:20 2010
@@ -1,4 +1,4 @@
/harmony/enhanced/java/branches/mrh:935751-941490
-/harmony/enhanced/java/trunk:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822,999260,999286,999306,999591,999601,999623,999715-999716,999724,999793,1000005,1000169,1000213,1000229,1000231,1000233,1000240,1000245,1000248,1000265,1000527,1000689,1000696,1000699-1000700,1000705,1000708,1001065,1001080,1001153,1001187,1001490,1001609,1001638,1001652,1001723,1001741,1001744-1001745,1001751,1002080,1002189,1002476,1002480
+/harmony/enhanced/java/trunk:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822,999260,999286,999306,999591,999601,999623,999715-999716,999724,999793,1000005,1000169,1000213,1000229,1000231,1000233,1000240,1000245,1000248,1000265,1000527,1000689,1000696,1000699-1000700,1000705,1000708,1001065,1001080,1001153,1001187,1001490,1001609,1001638,1001652,1001723,1001741,1001744-1001745,1001751,1002080,1002189,1002476,1002480,1002488
/harmony/enhanced/trunk:476395-929252
/incubator/harmony/enhanced/trunk:292550-476394
Propchange: harmony/enhanced/java/branches/java6/classlib/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Sep 29 14:52:20 2010
@@ -1,7 +1,7 @@
/harmony/enhanced/classlib/trunk:713674-735919,765923-926091,926318-926838
/harmony/enhanced/classlib/trunk/working_classlib:884014-884286
/harmony/enhanced/java/branches/mrh/classlib:935751-941490
-/harmony/enhanced/java/trunk/classlib:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822,999260,999286,999306,999591,999601,999623,999715-999716,999724,999793,1000005,1000169,1000213,1000229,1000231,1000233,1000240,1000245,1000248,1000265,1000527,1000689,1000696,1000699-1000700,1000705,1000708,1001065,1001080,1001153,1001187,1001490,1001609,1001638,1001652,1001723,1001741,1001744-1001745,1001751,1002080,1002189,1002476,1002480
+/harmony/enhanced/java/trunk/classlib:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822,999260,999286,999306,999591,999601,999623,999715-999716,999724,999793,1000005,1000169,1000213,1000229,1000231,1000233,1000240,1000245,1000248,1000265,1000527,1000689,1000696,1000699-1000700,1000705,1000708,1001065,1001080,1001153,1001187,1001490,1001609,1001638,1001652,1001723,1001741,1001744-1001745,1001751,1002080,1002189,1002476,1002480,1002488
/harmony/enhanced/trunk/classlib:476395-929252
/harmony/enhanced/trunk/working_classlib:476396-920147
/incubator/harmony/enhanced/trunk/classlib:292550-476394
Propchange: harmony/enhanced/java/branches/java6/classlib/depends/libs/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Sep 29 14:52:20 2010
@@ -1,4 +1,4 @@
/harmony/enhanced/classlib/trunk/depends/libs:544451-926091
-/harmony/enhanced/java/trunk/classlib/depends/libs:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822,999260,999286,999306,999591,999601,999623,999715-999716,999724,999793,1000005,1000169,1000213,1000229,1000231,1000233,1000240,1000245,1000248,1000265,1000527,1000689,1000696,1000699-1000700,1000705,1000708,1001065,1001080,1001153,1001187,1001490,1001609,1001638,1001652,1001723,1001741,1001744-1001745,1001751,1002080,1002189,1002476,1002480
+/harmony/enhanced/java/trunk/classlib/depends/libs:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822,999260,999286,999306,999591,999601,999623,999715-999716,999724,999793,1000005,1000169,1000213,1000229,1000231,1000233,1000240,1000245,1000248,1000265,1000527,1000689,1000696,1000699-1000700,1000705,1000708,1001065,1001080,1001153,1001187,1001490,1001609,1001638,1001652,1001723,1001741,1001744-1001745,1001751,1002080,1002189,1002476,1002480,1002488
/harmony/enhanced/trunk/classlib/depends/libs:476395-929252
/incubator/harmony/enhanced/trunk/classlib/depends/libs:292550-476394
Modified: harmony/enhanced/java/branches/java6/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/LogStreamTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/LogStreamTest.java?rev=1002661&r1=1002660&r2=1002661&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/LogStreamTest.java (original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/LogStreamTest.java Wed Sep 29 14:52:20 2010
@@ -18,8 +18,10 @@
package org.apache.harmony.rmi.server;
import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
import java.io.PrintStream;
import java.rmi.server.LogStream;
+
import junit.framework.TestCase;
public class LogStreamTest extends TestCase {
@@ -27,13 +29,13 @@ public class LogStreamTest extends TestC
* Test for java.rmi.server.LogStream.write(int b)
*/
public void testWriteI() throws Exception {
- //regression test for HARMONY-1271
- LogStream.log("tst").write((int)'\n');
+ // regression test for HARMONY-1271
+ LogStream.log("tst").write((int) '\n');
- //regression test for HARMONY-994
+ // regression test for HARMONY-994
LogStream.log("tst").write(0);
}
-
+
public void testSetOutputStreamBad() throws Exception {
// Regression test HARMONY-1198
try {
@@ -46,41 +48,54 @@ public class LogStreamTest extends TestC
}
/**
- * Test for java.rmi.server.LogStream.write(byte[], int, int)
- * testing invalid offsets/lengths.
+ * Test for java.rmi.server.LogStream.write(byte[], int, int) testing
+ * invalid offsets/lengths.
*/
public void testWriteArrInvalidOffLen() throws Exception {
// Regression test for HARMONY-1691
// list of invalid offsets/lengths pairs
- int[][] invalidPairs = new int[][] {
- { -2, 1 },
- { 0, -6 },
- { 6, 1 },
- { 0, 6 } };
+ int[][] invalidPairs = new int[][] { { -2, 1 }, { 0, -6 }, { 6, 1 },
+ { 0, 6 } };
// store original default stream for LogStream
PrintStream prevOut = LogStream.getDefaultStream();
try {
// set empty default stream to not print garbage to System.out/err
- LogStream.setDefaultStream(
- new PrintStream(new ByteArrayOutputStream()));
+ LogStream.setDefaultStream(new PrintStream(
+ new ByteArrayOutputStream()));
LogStream ls = LogStream.log("test");
for (int i = 0; i < invalidPairs.length; ++i) {
try {
- ls.write(new byte[] { 1, 1 },
- invalidPairs[i][0], invalidPairs[i][1]);
+ ls.write(new byte[] { 1, 1 }, invalidPairs[i][0],
+ invalidPairs[i][1]);
fail("IndexOutOfBoundsException "
+ "is not thrown when off = " + invalidPairs[i][0]
+ ", len = " + invalidPairs[i][1]);
} catch (IndexOutOfBoundsException e) {
- //expected
+ // expected
}
}
} finally {
// restore original stream
LogStream.setDefaultStream(prevOut);
}
+
+ }
+
+ public void testParseLevel() {
+ assertEquals(LogStream.parseLevel("BRIEF"), LogStream.BRIEF);
+ assertEquals(LogStream.parseLevel("SILENT"), LogStream.SILENT);
+ assertEquals(LogStream.parseLevel("VERBOSE"), LogStream.VERBOSE);
}
+
+ public void testGetOutputStream() {
+ LogStream log = LogStream.log("abc");
+ OutputStream output = log.getOutputStream();
+ PrintStream defaultPrintStream = LogStream.getDefaultStream();
+
+ assertEquals(output.toString(), defaultPrintStream.toString());
+ }
+
}
Modified: harmony/enhanced/java/branches/java6/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RMIClassLoaderTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RMIClassLoaderTest.java?rev=1002661&r1=1002660&r2=1002661&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RMIClassLoaderTest.java (original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/RMIClassLoaderTest.java Wed Sep 29 14:52:20 2010
@@ -19,10 +19,13 @@
package org.apache.harmony.rmi.server;
import java.net.MalformedURLException;
+import java.net.URI;
import java.net.URL;
import java.net.URLClassLoader;
import java.rmi.server.RMIClassLoader;
+import java.rmi.server.RMIClassLoaderSpi;
import java.security.Permission;
+
import junit.framework.TestCase;
public class RMIClassLoaderTest extends TestCase {
@@ -52,8 +55,8 @@ public class RMIClassLoaderTest extends
* to be sure this path will be the first after sorting
*/
"/_fake.jar" };
- Class<?> c = RMIClassLoader.loadClass("file://" + paths[0] + " file://" + paths[1],
- "TestClass", null);
+ Class<?> c = RMIClassLoader.loadClass("file://" + paths[0]
+ + " file://" + paths[1], "TestClass", null);
ClassLoader cl = c.getClassLoader();
if (cl instanceof URLClassLoader) {
URL[] urls = ((URLClassLoader) cl).getURLs();
@@ -63,8 +66,8 @@ public class RMIClassLoaderTest extends
String failStr = "";
for (int i = 0; i < urls.length; ++i) {
if (!urls[i].getPath().equals(paths[i])) {
- failStr += "\nURL[" + i + "].getPath() = " + urls[i].getPath()
- + ", expected: " + paths[i];
+ failStr += "\nURL[" + i + "].getPath() = "
+ + urls[i].getPath() + ", expected: " + paths[i];
}
}
if (!failStr.equals("")) {
@@ -80,59 +83,266 @@ public class RMIClassLoaderTest extends
}
/**
- * Test for java.rmi.server.RMIClassLoader.loadProxyClass(String, String[], ClassLoader)
- * testing invalid url as a codebase.
- */
+ * Test for java.rmi.server.RMIClassLoader.loadProxyClass(String, String[],
+ * ClassLoader) testing invalid url as a codebase.
+ */
public void testLoadProxyClassInvalidCodebase() throws Exception {
- //Regression for HARMONY-1133
+ // Regression for HARMONY-1133
SecurityManager previous = System.getSecurityManager();
System.setSecurityManager(null);
-
+
try {
RMIClassLoader.loadProxyClass("zzz", new String[] {}, null);
fail("MalformedURLException expected");
- } catch (MalformedURLException e) {
- //expected
+ } catch (MalformedURLException e) {
+ // expected
} finally {
- System.setSecurityManager(previous);
+ System.setSecurityManager(previous);
}
}
/**
- * Test for java.rmi.server.RMIClassLoader.loadClass(String, String)
- * testing invalid url as a codebase.
+ * Test for java.rmi.server.RMIClassLoader.loadClass(String, String) testing
+ * invalid url as a codebase.
*/
public void testLoadClassInvalidCodebase() throws Exception {
- //Regression for HARMONY-1133
+ // Regression for HARMONY-1133
SecurityManager previous = System.getSecurityManager();
System.setSecurityManager(null);
-
- try {
+
+ try {
RMIClassLoader.loadClass("zzz", "a123");
fail("MalformedURLException expected");
- } catch (MalformedURLException e) {
- //expected
+ } catch (MalformedURLException e) {
+ // expected
} finally {
- System.setSecurityManager(previous);
- }
+ System.setSecurityManager(previous);
+ }
}
/**
- * Test for java.rmi.server.RMIClassLoader.getClassLoader(String)
- * testing invalid url as a codebase.
+ * Test for java.rmi.server.RMIClassLoader.getClassLoader(String) testing
+ * invalid url as a codebase.
*/
public void testGetClassLoaderInvalidCodebase() throws Exception {
- //Regression for HARMONY-1134
+ // Regression for HARMONY-1134
SecurityManager previous = System.getSecurityManager();
System.setSecurityManager(null);
- try {
+ try {
RMIClassLoader.getClassLoader("zzz");
fail("MalformedURLException expected");
- } catch (MalformedURLException e) {
- //expected
+ } catch (MalformedURLException e) {
+ // expected
+ } finally {
+ System.setSecurityManager(previous);
+ }
+ }
+
+ /**
+ * Modify the above method to test loadClass, loadClass(String, String) for
+ * coverage.
+ */
+ public void testLoadClassCodebaseOrder2() throws Exception {
+ SecurityManager previous = System.getSecurityManager();
+ System.setSecurityManager(new SecurityManager() {
+ @Override
+ public void checkPermission(Permission perm) {
+ /*
+ * Override checkPermission to allow everything. Specifically,
+ * we want to allow the SecurityManager to be set to null at the
+ * end of the test and we want to allow the 'testClass.jar' file
+ * to be allowed to load.
+ */
+ return;
+ }
+ });
+ try {
+ URL testJarURL = getClass().getResource("testClass.jar");
+ String[] paths = new String[] { testJarURL.getPath(),
+ /*
+ * to be sure this path will be the first after sorting
+ */
+ "/_fake.jar" };
+ Class<?> c = RMIClassLoader.loadClass("file://" + paths[0]
+ + " file://" + paths[1], "TestClass");
+ ClassLoader cl = c.getClassLoader();
+ if (cl instanceof URLClassLoader) {
+ URL[] urls = ((URLClassLoader) cl).getURLs();
+ if (urls.length != 2) {
+ fail("Unexpected number of URLs: " + urls.length);
+ }
+ String failStr = "";
+ for (int i = 0; i < urls.length; ++i) {
+ if (!urls[i].getPath().equals(paths[i])) {
+ failStr += "\nURL[" + i + "].getPath() = "
+ + urls[i].getPath() + ", expected: " + paths[i];
+ }
+ }
+ if (!failStr.equals("")) {
+ fail(failStr);
+ }
+ } else {
+ fail("Class is loaded by non-URLClassLoader");
+ }
+ } finally {
+ // reset the security manager back to null state
+ System.setSecurityManager(previous);
+ }
+ }
+
+ /**
+ * Modify the above method to test loadClass, loadClass(String, String) for
+ * coverage.
+ */
+ public void testLoadClassCodebaseOrder3() throws Exception {
+ SecurityManager previous = System.getSecurityManager();
+ System.setSecurityManager(new SecurityManager() {
+ @Override
+ public void checkPermission(Permission perm) {
+ /*
+ * Override checkPermission to allow everything. Specifically,
+ * we want to allow the SecurityManager to be set to null at the
+ * end of the test and we want to allow the 'testClass.jar' file
+ * to be allowed to load.
+ */
+ return;
+ }
+ });
+ try {
+ URL testJarURL = getClass().getResource("testClass.jar");
+ String[] paths = new String[] { testJarURL.getPath(),
+ /*
+ * to be sure this path will be the first after sorting
+ */
+ "/_fake.jar" };
+
+ Class<?> c = RMIClassLoader.loadClass(new URI("file://" + paths[0])
+ .toURL(), "TestClass");
+
+ assertNotNull(c);
+
+ } catch (Exception e) {
+ fail("class should be loaded");
} finally {
- System.setSecurityManager(previous);
- }
+ // reset the security manager back to null state
+ System.setSecurityManager(previous);
+ }
+ }
+
+ /**
+ * Modify the above method to test testGetSecurityContext for coverage.
+ */
+ public void testGetSecurityContext() throws Exception {
+ SecurityManager previous = System.getSecurityManager();
+ SecurityManager sm = new SecurityManager() {
+ @Override
+ public void checkPermission(Permission perm) {
+ /*
+ * Override checkPermission to allow everything. Specifically,
+ * we want to allow the SecurityManager to be set to null at the
+ * end of the test and we want to allow the 'testClass.jar' file
+ * to be allowed to load.
+ */
+ return;
+ }
+
+ };
+ System.setSecurityManager(sm);
+ try {
+ URL testJarURL = getClass().getResource("testClass.jar");
+ String[] paths = new String[] { testJarURL.getPath(),
+ /*
+ * to be sure this path will be the first after sorting
+ */
+ "/_fake.jar" };
+
+ Class<?> c = RMIClassLoader.loadClass(new URI("file://" + paths[0])
+ .toURL(), "TestClass");
+
+ assertNotNull(c);
+
+ Object sc = RMIClassLoader.getSecurityContext(c.getClassLoader());
+ if (true) {
+ return;
+ }
+
+ // This is the ri behavior, spec for what to return is not found
+ assertEquals(((URL) sc).toString(), testJarURL.toString());
+ } finally {
+ // reset the security manager back to null state
+ System.setSecurityManager(previous);
+ }
+ }
+
+ public void testGetDefaultProvideInstance() {
+ assertTrue(RMIClassLoader.getDefaultProviderInstance() instanceof RMIClassLoaderSpi);
+ }
+
+ /**
+ * Modify the above method to test loadClass, loadClass(String, String) for
+ * coverage.
+ */
+ public void testLoadClassCodebaseOrder4() throws Exception {
+ SecurityManager previous = System.getSecurityManager();
+ System.setSecurityManager(new SecurityManager() {
+ @Override
+ public void checkPermission(Permission perm) {
+ /*
+ * Override checkPermission to allow everything. Specifically,
+ * we want to allow the SecurityManager to be set to null at the
+ * end of the test and we want to allow the 'testClass.jar' file
+ * to be allowed to load.
+ */
+ return;
+ }
+ });
+ try {
+ URL testJarURL = getClass().getResource("testClass.jar");
+ String[] paths = new String[] { testJarURL.getPath(),
+ /*
+ * to be sure this path will be the first after sorting
+ */
+ "/_fake.jar" };
+
+ ClassLoader cl = RMIClassLoader.getClassLoader(new URI("file://"
+ + paths[0]).toURL().toString());
+ Class<?> c = cl.loadClass("TestClass");
+
+ assertNotNull(c);
+
+ } finally {
+ // reset the security manager back to null state
+ System.setSecurityManager(previous);
+ }
+ }
+
+ /**
+ * Modify the above method to test loadClass, loadClass(String, String) for
+ * coverage.
+ */
+ public void testLoadClassCodebaseOrder5() throws Exception {
+ SecurityManager previous = System.getSecurityManager();
+ System.setSecurityManager(new SecurityManager() {
+ @Override
+ public void checkPermission(Permission perm) {
+ /*
+ * Override checkPermission to allow everything. Specifically,
+ * we want to allow the SecurityManager to be set to null at the
+ * end of the test and we want to allow the 'testClass.jar' file
+ * to be allowed to load.
+ */
+ return;
+ }
+ });
+ try {
+ Class<?> c = RMIClassLoader.loadClass("TestClass");
+ fail();
+ } catch (ClassNotFoundException e) {
+ // expected
+ } finally {
+ // reset the security manager back to null state
+ System.setSecurityManager(previous);
+ }
}
}
Modified: harmony/enhanced/java/branches/java6/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ServerNotActiveExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ServerNotActiveExceptionTest.java?rev=1002661&r1=1002660&r2=1002661&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ServerNotActiveExceptionTest.java (original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ServerNotActiveExceptionTest.java Wed Sep 29 14:52:20 2010
@@ -66,6 +66,12 @@ public class ServerNotActiveExceptionTes
ServerNotActiveException e = new ServerNotActiveException(errorMessage);
assertEquals(errorMessage, e.getMessage());
}
+
+
+ public void test_Constructor(){
+ ServerNotActiveException e = new ServerNotActiveException();
+ assertNull(e.getMessage());
+ }
// comparator for ServerNotActiveException objects
private static final SerializableAssert comparator = new SerializableAssert() {
Propchange: harmony/enhanced/java/branches/java6/drlvm/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Sep 29 14:52:20 2010
@@ -1,5 +1,5 @@
/harmony/enhanced/java/branches/mrh/drlvm:935751-941490
-/harmony/enhanced/java/trunk/drlvm:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822,999260,999286,999306,999591,999601,999623,999715-999716,999724,999793,1000005,1000169,1000213,1000229,1000231,1000233,1000240,1000245,1000248,1000265,1000527,1000689,1000696,1000699-1000700,1000705,1000708,1001065,1001080,1001153,1001187,1001490,1001609,1001638,1001652,1001723,1001741,1001744-1001745,1001751,1002080,1002189,1002476,1002480
+/harmony/enhanced/java/trunk/drlvm:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822,999260,999286,999306,999591,999601,999623,999715-999716,999724,999793,1000005,1000169,1000213,1000229,1000231,1000233,1000240,1000245,1000248,1000265,1000527,1000689,1000696,1000699-1000700,1000705,1000708,1001065,1001080,1001153,1001187,1001490,1001609,1001638,1001652,1001723,1001741,1001744-1001745,1001751,1002080,1002189,1002476,1002480,1002488
/harmony/enhanced/trunk/drlvm:476395-929252
/harmony/enhanced/trunk/working_vm:476396-920147
/incubator/harmony/enhanced/trunk/drlvm:292550-476394
Propchange: harmony/enhanced/java/branches/java6/jdktools/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Sep 29 14:52:20 2010
@@ -1,4 +1,4 @@
-/harmony/enhanced/java/trunk/jdktools:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822,999260,999286,999306,999591,999601,999623,999715-999716,999724,999793,1000005,1000169,1000213,1000229,1000231,1000233,1000240,1000245,1000248,1000265,1000527,1000689,1000696,1000699-1000700,1000705,1000708,1001065,1001080,1001153,1001187,1001490,1001609,1001638,1001652,1001723,1001741,1001744-1001745,1001751,1002080,1002189,1002476,1002480
+/harmony/enhanced/java/trunk/jdktools:929253-997624,997759,997980,997986,998010,998030,998619,998628,998759,998804,998822,999260,999286,999306,999591,999601,999623,999715-999716,999724,999793,1000005,1000169,1000213,1000229,1000231,1000233,1000240,1000245,1000248,1000265,1000527,1000689,1000696,1000699-1000700,1000705,1000708,1001065,1001080,1001153,1001187,1001490,1001609,1001638,1001652,1001723,1001741,1001744-1001745,1001751,1002080,1002189,1002476,1002480,1002488
/harmony/enhanced/jdktools/trunk:630107-925933
/harmony/enhanced/trunk/jdktools:476395-929252
/harmony/enhanced/trunk/working_jdktools:476396-920147