1 45 package org.openejb.test.entity.cmp; 46 47 import javax.ejb.EJBMetaData ; 48 49 55 public class CmpEjbHomeTests extends BasicCmpTestClient{ 56 57 public CmpEjbHomeTests(){ 58 super("EJBHome."); 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("Second Bean"); 66 ejbPrimaryKey = ejbObject.getPrimaryKey(); 67 } 68 69 public void test01_getEJBMetaData(){ 73 try{ 74 EJBMetaData ejbMetaData = ejbHome.getEJBMetaData(); 75 assertNotNull( "The EJBMetaData is null", ejbMetaData ); 76 } catch (Exception e){ 77 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 78 } 79 } 80 81 public void test02_getHomeHandle(){ 82 try{ 83 ejbHomeHandle = ejbHome.getHomeHandle(); 84 assertNotNull( "The HomeHandle is null", ejbHomeHandle ); 85 } catch (Exception e){ 86 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 87 } 88 } 89 90 public void test03_remove(){ 91 try{ 92 ejbHome.remove(ejbPrimaryKey); 93 try{ 94 ejbObject.businessMethod("Should throw an exception"); 95 assertTrue( "Calling business method after removing the EJBObject does not throw an exception", false ); 96 } catch (Exception e){ 97 assertTrue( true ); 98 return; 99 } 100 } catch (Exception e){ 101 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 102 } 103 } 104 } 108 | Popular Tags |