1 22 package org.jboss.test.jrmp.test; 23 24 import java.io.File ; 25 import java.net.URL ; 26 import java.security.CodeSource ; 27 28 import javax.naming.InitialContext ; 29 30 import org.jboss.test.JBossTestCase; 31 import org.jboss.test.jrmp.interfaces.IString; 32 33 39 public class DynLoadingFromSARUnitTestCase extends JBossTestCase 40 { 41 public DynLoadingFromSARUnitTestCase(String name) 42 { 43 super(name); 44 } 45 46 51 public void testAccess() throws Exception 52 { 53 InitialContext jndiContext = new InitialContext (); 54 getLog().debug("Lookup IString"); 55 Object obj = jndiContext.lookup("test/jrmp/IString"); 56 IString echo = (IString) obj; 57 getLog().debug("found = " + echo); 58 Class clazz = echo.getClass(); 59 CodeSource cs = clazz.getProtectionDomain().getCodeSource(); 60 URL location = cs.getLocation(); 61 getLog().debug("IString.class = " + clazz); 62 getLog().debug("IString.class location = " + location); 63 assertTrue("CodeSource URL.protocol != file", location.getProtocol().equals("file") == false); 64 } 65 66 71 protected void setUp() throws Exception 72 { 73 super.setUp(); 74 URL istringImpl = getClass().getResource("/org/jboss/test/jrmp/ejb/AString.class"); 75 if (istringImpl != null) 76 { 77 getLog().debug("Found IString impl at: " + istringImpl); 78 File implFile = new File (istringImpl.getFile()); 79 getLog().debug("Removed: " + implFile.delete()); 80 } 81 deploy("jrmp-dl.sar"); 82 } 83 84 89 protected void tearDown() throws Exception 90 { 91 undeploy("jrmp-dl.sar"); 92 super.tearDown(); 93 } 94 95 } 96 | Popular Tags |