1 45 package org.openejb.test.stateless; 46 47 import javax.ejb.EJBObject ; 48 49 55 public class StatelessHandleTests extends BasicStatelessTestClient{ 56 57 public StatelessHandleTests(){ 58 super("Handle."); 59 } 60 61 protected void setUp() throws Exception { 62 super.setUp(); 63 Object obj = initialContext.lookup("client/tests/stateless/BasicStatelessHome"); 64 ejbHome = (BasicStatelessHome)javax.rmi.PortableRemoteObject.narrow( obj, BasicStatelessHome.class); 65 ejbObject = ejbHome.create(); 66 ejbHandle = ejbObject.getHandle(); 67 } 68 69 protected void tearDown() throws Exception { 70 try { 71 } catch (Exception e){ 73 throw e; 74 } finally { 75 super.tearDown(); 76 } 77 } 78 79 public void test01_getEJBObject(){ 83 84 try{ 85 EJBObject object = ejbHandle.getEJBObject(); 86 assertNotNull( "The EJBObject is null", object ); 87 } catch (Exception e){ 90 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 91 } 92 } 93 94 108 public void test02_EJBHome_remove(){ 109 try{ 110 ejbHome.remove(ejbHandle); 111 try{ 112 ejbObject.businessMethod("Should throw an exception"); 113 assertTrue( "Calling business method after removing the EJBObject does not throw an exception", false ); 114 } catch (Exception e){ 115 assertTrue( true ); 116 return; 117 } 118 } catch (Exception e){ 119 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 120 } 121 } 122 126 } 127 | Popular Tags |