1 45 package org.openejb.test.stateless; 46 47 import javax.ejb.EJBHome ; 48 49 55 public class StatelessEjbMetaDataTests extends BasicStatelessTestClient{ 56 57 public StatelessEjbMetaDataTests(){ 58 super("EJBMetaData."); 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 ejbMetaData = ejbHome.getEJBMetaData(); 66 } 67 68 public void test01_getEJBHome(){ 72 try{ 73 74 EJBHome home = ejbMetaData.getEJBHome(); 75 assertNotNull( "The EJBHome is null", home ); 76 } catch (Exception e){ 77 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 78 } 79 } 80 81 public void test02_getHomeInterfaceClass(){ 82 try{ 83 Class clazz = ejbMetaData.getHomeInterfaceClass(); 84 assertNotNull( "The Home Interface class is null", clazz ); 85 assertEquals(clazz , BasicStatelessHome.class); 86 } catch (Exception e){ 87 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 88 } 89 } 90 103 public void test03_getPrimaryKeyClass(){ 104 try{ 105 Class clazz = ejbMetaData.getPrimaryKeyClass(); 106 assertNull("Should not return a primary key. Method should throw an java.lang.RuntimeException", clazz ); 107 } catch (UnsupportedOperationException e){ 108 assertTrue( true ); 109 return; 110 } catch (Exception e){ 111 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 112 } 113 assertTrue( "Method should throw an java.lang.RuntimeException", false ); 114 } 115 116 public void test04_getRemoteInterfaceClass(){ 117 try{ 118 Class clazz = ejbMetaData.getRemoteInterfaceClass(); 119 assertNotNull( "The Remote Interface class is null", clazz ); 120 assertEquals(clazz , BasicStatelessObject.class); 121 } catch (Exception e){ 122 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 123 } 124 } 125 126 public void test05_isSession(){ 127 try{ 128 assertTrue( "EJBMetaData says this is not a session bean", ejbMetaData.isSession() ); 129 } catch (Exception e){ 130 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 131 } 132 } 133 134 public void test06_isStatelessSession(){ 135 try{ 136 assertTrue( "EJBMetaData says this is not a stateless session bean", ejbMetaData.isStatelessSession() ); 137 } catch (Exception e){ 138 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 139 } 140 } 141 } 145 | Popular Tags |