1 22 package org.jboss.test.cts.test; 23 24 import javax.naming.InitialContext ; 25 import javax.rmi.PortableRemoteObject ; 26 27 import junit.framework.Test; 28 29 import org.jboss.test.JBossTestCase; 30 import org.jboss.test.cts.interfaces.CallerSession; 31 import org.jboss.test.cts.interfaces.CallerSessionHome; 32 import org.jboss.test.cts.interfaces.CalleeException; 33 34 39 public class IndependentJarsUnitTestCase 40 extends JBossTestCase 41 { 42 CallerSession sessionBean; 43 44 public IndependentJarsUnitTestCase(String name) 45 { 46 super(name); 47 } 48 49 protected void setUp() throws Exception 50 { 51 InitialContext ctx = new InitialContext (); 52 Object ref = ctx.lookup("ejbcts/CallerSessionHome"); 53 CallerSessionHome home = (CallerSessionHome) 54 PortableRemoteObject.narrow(ref, CallerSessionHome.class); 55 sessionBean = home.create(); 56 } 57 58 protected void tearDown() throws Exception 59 { 60 if (sessionBean != null) 61 sessionBean.remove(); 62 } 63 64 65 70 public void testInterJarCall() throws Exception 71 { 72 deploy("cts2.jar"); 74 sessionBean.simpleCall(true); 75 sessionBean.simpleCall2(true); 76 try 77 { 78 sessionBean.callAppEx(); 79 } 80 catch(CalleeException e) 81 { 82 log.info("Saw excpected exception", e); 83 } 84 undeploy("cts2.jar"); 85 deploy("cts2.jar"); 86 sessionBean.simpleCall(true); 87 sessionBean.simpleCall2(true); 88 try 89 { 90 sessionBean.callAppEx(); 91 } 92 catch(CalleeException e) 93 { 94 log.info("Saw excpected exception", e); 95 } 96 undeploy("cts2.jar"); 97 } 98 99 104 public void testCallByValueInSameJar() throws Exception 105 { 106 sessionBean.callByValueInSameJar(); 107 } 108 109 public static Test suite() throws Exception 110 { 111 return getDeploySetup(IndependentJarsUnitTestCase.class, "cts.jar"); 112 } 113 114 } 115 | Popular Tags |