use of javax.ejb.EJBMetaData in project wildfly by wildfly.
the class ClientEjb method getRemoteMessageViaEjbMetadata.
public String getRemoteMessageViaEjbMetadata() throws RemoteException {
final EJBMetaData metadata = home.getEJBMetaData();
final IIOPBasicHome newHome = (IIOPBasicHome) PortableRemoteObject.narrow(metadata.getEJBHome(), IIOPBasicHome.class);
final IIOPBasicRemote object = newHome.create();
Assert.assertEquals(IIOPBasicHome.class, metadata.getHomeInterfaceClass());
Assert.assertEquals(IIOPBasicRemote.class, metadata.getRemoteInterfaceClass());
return object.hello();
}
use of javax.ejb.EJBMetaData in project wildfly by wildfly.
the class ReferenceAnnotationDescriptorTestCase method testStateful21Interfaces.
@Test
public void testStateful21Interfaces() throws Exception {
InitialContext jndiContext = new InitialContext();
StatefulSession30Home home = (StatefulSession30Home) jndiContext.lookup("java:module/StatefulSession30!" + StatefulSession30Home.class.getName());
Assert.assertNotNull(home);
EJBMetaData metadata = home.getEJBMetaData();
Assert.assertNotNull(metadata);
Assert.assertEquals(StatefulSession30.class, metadata.getRemoteInterfaceClass());
HomeHandle homeHandle = home.getHomeHandle();
Assert.assertNotNull(homeHandle);
EJBHome ejbHome = homeHandle.getEJBHome();
Assert.assertNotNull(ejbHome);
metadata = ejbHome.getEJBMetaData();
Assert.assertNotNull(metadata);
Assert.assertEquals(StatefulSession30.class, metadata.getRemoteInterfaceClass());
StatefulSession30 session = home.create();
Assert.assertNotNull(session);
ejbHome = session.getEJBHome();
Assert.assertNotNull(ejbHome);
Handle handle = session.getHandle();
Assert.assertNotNull(handle);
EJBObject ejbObject = handle.getEJBObject();
Assert.assertNotNull(ejbObject);
ejbHome = ejbObject.getEJBHome();
Assert.assertNotNull(ejbHome);
Handle handle1 = ejbObject.getHandle();
Assert.assertNotNull(handle1);
StatefulSession30 session1 = home.create();
Assert.assertFalse(session.isIdentical(session1));
Assert.assertTrue(session.isIdentical(session));
}
use of javax.ejb.EJBMetaData in project wildfly by wildfly.
the class ReferenceAnnotationDescriptorTestCase method testStateless21Interfaces.
@Test
public void testStateless21Interfaces() throws Exception {
InitialContext jndiContext = new InitialContext();
Session30Home home = (Session30Home) jndiContext.lookup("java:module/Session30!" + Session30Home.class.getName());
Assert.assertNotNull(home);
EJBMetaData metadata = home.getEJBMetaData();
Assert.assertNotNull(metadata);
Assert.assertEquals(Session30.class.getName(), metadata.getRemoteInterfaceClass().getName());
HomeHandle homeHandle = home.getHomeHandle();
Assert.assertNotNull(homeHandle);
EJBHome ejbHome = homeHandle.getEJBHome();
Assert.assertNotNull(ejbHome);
metadata = ejbHome.getEJBMetaData();
Assert.assertNotNull(metadata);
Assert.assertEquals(Session30.class.getName(), metadata.getRemoteInterfaceClass().getName());
Session30 session = home.create();
Assert.assertNotNull(session);
ejbHome = session.getEJBHome();
Assert.assertNotNull(ejbHome);
Handle handle = session.getHandle();
Assert.assertNotNull(handle);
EJBObject ejbObject = handle.getEJBObject();
Assert.assertNotNull(ejbObject);
ejbHome = ejbObject.getEJBHome();
Assert.assertNotNull(ejbHome);
Handle handle1 = ejbObject.getHandle();
Assert.assertNotNull(handle1);
Session30 session1 = home.create();
Assert.assertTrue(session.isIdentical(session1));
}
use of javax.ejb.EJBMetaData in project tomee by apache.
the class CmpRmiIiopTests method test46_returnEJBMetaData.
public void test46_returnEJBMetaData() {
try {
final EJBMetaData actual = ejbObject.returnEJBMetaData();
assertNotNull("The EJBMetaData returned is null", actual);
assertEquals(actual.getHomeInterfaceClass(), actual.getHomeInterfaceClass());
assertEquals(actual.getRemoteInterfaceClass(), actual.getRemoteInterfaceClass());
} catch (final Exception e) {
fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
use of javax.ejb.EJBMetaData in project tomee by apache.
the class CmpRmiIiopTests method test49_returnEJBMetaDataArray.
public void test49_returnEJBMetaDataArray() {
try {
final Object obj = initialContext.lookup("client/tests/entity/cmp/EncBean");
final EncCmpHome home = (EncCmpHome) obj;
assertNotNull("The EJBHome returned from JNDI is null", home);
final EJBMetaData[] expected = new EJBMetaData[3];
for (int i = 0; i < expected.length; i++) {
expected[i] = home.getEJBMetaData();
assertNotNull("The EJBMetaData returned is null", expected[i]);
}
final EJBMetaData[] actual = (EJBMetaData[]) ejbObject.returnEJBMetaDataArray(expected);
assertNotNull("The EJBMetaData array returned is null", actual);
assertEquals(expected.length, actual.length);
for (int i = 0; i < actual.length; i++) {
assertNotNull("The EJBMetaData returned is null", actual[i]);
assertEquals(expected[i].getHomeInterfaceClass(), actual[i].getHomeInterfaceClass());
assertEquals(expected[i].getRemoteInterfaceClass(), actual[i].getRemoteInterfaceClass());
}
} catch (final Exception e) {
fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
Aggregations