1 22 package org.jboss.test.naming.test; 23 24 import java.io.IOException ; 25 import java.rmi.RemoteException ; 26 import javax.ejb.CreateException ; 27 import javax.ejb.EJBObject ; 28 import javax.naming.InitialContext ; 29 import javax.naming.NamingException ; 30 import javax.rmi.PortableRemoteObject ; 31 32 import junit.framework.Test; 33 import junit.framework.TestCase; 34 import junit.framework.TestSuite; 35 36 import org.jboss.test.JBossTestCase; 37 import org.jboss.test.naming.interfaces.TestENCHome; 38 import org.jboss.test.naming.interfaces.TestENCHome2; 39 import org.jboss.test.naming.interfaces.TestENC; 40 41 48 public class ENCUnitTestCase extends JBossTestCase 49 { 50 55 public ENCUnitTestCase(String name) 56 { 57 super(name); 58 } 59 60 64 public void testENC() throws Exception 65 { 66 Object obj = getInitialContext().lookup("ENCBean"); 67 obj = PortableRemoteObject.narrow(obj, TestENCHome.class); 68 TestENCHome home = (TestENCHome)obj; 69 getLog().debug("Found TestENCHome"); 70 71 TestENC bean = home.create(); 72 getLog().debug("Created ENCBean"); 73 bean.accessENC(); 74 bean.remove(); 75 } 76 77 82 public void testENC2() throws Exception 83 { 84 Object obj = getInitialContext().lookup("ENCBean0"); 85 obj = PortableRemoteObject.narrow(obj, TestENCHome2.class); 86 TestENCHome2 home = (TestENCHome2)obj; 87 getLog().debug("Found TestENCHome2"); 88 89 TestENC bean = home.create(); 90 getLog().debug("Created ENCBean0"); 91 bean.accessENC(); 92 bean.remove(); 93 } 94 95 public static Test suite() throws Exception 96 { 97 return getDeploySetup(ENCUnitTestCase.class, "naming.jar"); 98 } 99 100 } 101 | Popular Tags |