1 22 package org.jboss.test.cts.test; 23 24 import java.rmi.RemoteException ; 25 26 import javax.management.ObjectName ; 27 import javax.naming.InitialContext ; 28 import javax.rmi.PortableRemoteObject ; 29 30 import junit.framework.Test; 31 32 import org.jboss.test.JBossTestCase; 33 import org.jboss.test.cts.interfaces.StatelessSession; 34 import org.jboss.test.cts.interfaces.StatelessSessionHome; 35 36 46 public class StatelessSessionBrokenCreateUnitTestCase extends JBossTestCase 47 { 48 public StatelessSessionBrokenCreateUnitTestCase(String name) 49 { 50 super(name); 51 } 52 53 public void testCreateExceptionFromRemoteInterface() throws Exception 54 { 55 getLog().debug("+++ testCreateExceptionFromInterface()"); 56 InitialContext ctx = new InitialContext (); 57 Object ref = ctx.lookup("ejbcts/StatelessSessionHome"); 58 StatelessSessionHome home = (StatelessSessionHome) PortableRemoteObject.narrow(ref, StatelessSessionHome.class); 59 StatelessSession sessionBean = home.create(); 60 sessionBean.breakCreate(); 61 ObjectName pool = new ObjectName ("jboss.j2ee:jndiName=ejbcts/StatelessSessionHome,plugin=pool,service=EJB"); 62 getServer().invoke(pool, "clear", null, null); 63 try 64 { 65 sessionBean.method1("This should cause a CreateException"); 66 fail("Should not be here"); 67 } 68 catch (RemoteException expected) 69 { 70 log.debug("Expected", expected); 71 } 72 } 73 74 public static Test suite() throws Exception 75 { 76 return getDeploySetup(StatelessSessionBrokenCreateUnitTestCase.class, "cts.jar"); 77 } 78 } 79 | Popular Tags |