1 45 package org.openejb.test.entity.cmp; 46 47 import javax.ejb.EJBHome ; 48 49 55 public class CmpEjbMetaDataTests extends BasicCmpTestClient{ 56 57 public CmpEjbMetaDataTests(){ 58 super("EJBMetaData."); 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 ejbMetaData = ejbHome.getEJBMetaData(); 66 } 67 68 public void test01_getEJBHome(){ 72 try{ 73 EJBHome home = ejbMetaData.getEJBHome(); 74 assertNotNull( "The EJBHome is null", home ); 75 } catch (Exception e){ 76 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 77 } 78 } 79 80 public void test02_getHomeInterfaceClass(){ 81 try{ 82 Class clazz = ejbMetaData.getHomeInterfaceClass(); 83 assertNotNull( "The Home Interface class is null", clazz ); 84 assertEquals(clazz , BasicCmpHome.class); 85 } catch (Exception e){ 86 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 87 } 88 } 89 90 public void test03_getPrimaryKeyClass(){ 91 try{ 92 Class clazz = ejbMetaData.getPrimaryKeyClass(); 93 assertNotNull( "The EJBMetaData is null", clazz ); 94 assertEquals(clazz , Integer .class); 95 } catch (Exception e){ 96 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 97 } 98 } 99 100 public void test04_getRemoteInterfaceClass(){ 101 try{ 102 Class clazz = ejbMetaData.getRemoteInterfaceClass(); 103 assertNotNull( "The Remote Interface class is null", clazz ); 104 assertEquals(clazz , BasicCmpObject.class); 105 } catch (Exception e){ 106 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 107 } 108 } 109 110 public void test05_isSession(){ 111 try{ 112 assertTrue( "EJBMetaData says this is a session bean", !ejbMetaData.isSession() ); 113 } catch (Exception e){ 114 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 115 } 116 } 117 118 public void test06_isStatelessSession(){ 119 try{ 120 assertTrue( "EJBMetaData says this is a stateless session bean", !ejbMetaData.isStatelessSession() ); 121 } catch (Exception e){ 122 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 123 } 124 } 125 } 129 | Popular Tags |