1 45 package org.openejb.test.entity.cmp; 46 47 import javax.ejb.EJBObject ; 48 49 55 public class CmpHandleTests extends BasicCmpTestClient{ 56 57 public CmpHandleTests(){ 58 super("Handle."); 59 } 60 61 protected void setUp() throws Exception { 62 super.setUp(); 63 Object obj = initialContext.lookup("client/tests/entity/cmp/BasicCmpHome"); 64 ejbHome = (BasicCmpHome)javax.rmi.PortableRemoteObject.narrow( obj, BasicCmpHome.class); 65 ejbObject = ejbHome.create("Fifth Bean"); 66 ejbHandle = ejbObject.getHandle(); 67 } 68 69 protected void tearDown() throws Exception { 70 if(ejbObject !=null) 71 ejbObject.remove(); 72 super.tearDown(); 73 } 74 75 public void test01_getEJBObject(){ 79 80 try{ 81 EJBObject object = ejbHandle.getEJBObject(); 82 assertNotNull( "The EJBObject is null", object ); 83 } catch (Exception e){ 86 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 87 } 88 } 89 90 95 public void test02_EJBHome_remove(){ 96 try{ 97 ejbHome.remove(ejbHandle); 98 try{ 99 ejbObject.businessMethod("Should throw an exception"); 100 assertTrue( "Calling business method after removing the EJBObject does not throw an exception", false ); 101 } catch (Exception e){ 102 assertTrue( true ); 103 return; 104 } 105 } catch (Exception e){ 106 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 107 } finally{ 108 ejbObject = null; 109 } 110 } 111 115 } 116 | Popular Tags |