1 19 20 package org.netbeans.modules.j2ee.oc4j; 21 22 import java.net.URL ; 23 import org.netbeans.junit.NbTestCase; 24 25 29 public class OC4JClassLoaderTest extends NbTestCase { 30 31 static final String OC4J_HOME = "/home/pblaha/servers/oc4j"; 32 33 public OC4JClassLoaderTest(String testName) { 34 super(testName); 35 } 36 37 protected void setUp() throws Exception { 38 } 39 40 protected void tearDown() throws Exception { 41 } 42 43 public void testGetInstance() { 44 System.out.println("getInstance"); 45 OC4JClassLoader instance1 = OC4JClassLoader.getInstance(OC4J_HOME); 46 assertNotNull(instance1); 47 OC4JClassLoader instance2 = OC4JClassLoader.getInstance(OC4J_HOME); 48 assertSame(instance2, instance1); 49 } 50 51 public void testUpdateLoader() throws Exception { 52 System.out.println("updateLoader"); 53 OC4JClassLoader loader = OC4JClassLoader.getInstance(OC4J_HOME); 54 URL [] urls = loader.getURLs(); 55 for (int i = 0; i < urls.length; i++) { 56 System.out.println(urls[i]); 57 } 58 59 Class c = loader.loadClass("oracle.oc4j.admin.deploy.api.J2EEDeploymentManager"); 61 assertNotNull(c); 62 ClassLoader old = Thread.currentThread().getContextClassLoader(); 63 loader.updateLoader(); 64 ClassLoader n = Thread.currentThread().getContextClassLoader(); 65 assertNotSame(old, n); 66 67 } 68 69 } 70 | Popular Tags |