1 45 package org.openejb.test.stateful; 46 47 import javax.ejb.EJBObject ; 48 49 55 public class StatefulHandleTests extends BasicStatefulTestClient{ 56 57 public StatefulHandleTests(){ 58 super("Handle."); 59 } 60 61 protected void setUp() throws Exception { 62 super.setUp(); 63 Object obj = initialContext.lookup("client/tests/stateful/BasicStatefulHome"); 64 ejbHome = (BasicStatefulHome)javax.rmi.PortableRemoteObject.narrow( obj, BasicStatefulHome.class); 65 ejbObject = ejbHome.create("Fourth Bean"); 66 ejbHandle = ejbObject.getHandle(); 67 } 68 69 public void test01_getEJBObject(){ 73 74 try{ 75 EJBObject object = ejbHandle.getEJBObject(); 76 assertNotNull( "The EJBObject is null", object ); 77 } catch (Exception e){ 80 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 81 } 82 } 83 88 public void test02_EJBHome_remove(){ 89 try{ 90 ejbHome.remove(ejbHandle); 91 try{ 92 ejbObject.businessMethod("Should throw an exception"); 93 assertTrue( "Calling business method after removing the EJBObject does not throw an exception", false ); 94 } catch (Exception e){ 95 assertTrue( true ); 96 return; 97 } 98 } catch (Exception e){ 99 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 100 } 101 } 102 106 } 107 | Popular Tags |