use of org.apache.openejb.test.object.ObjectGraph in project tomee by apache.
the class StatelessRmiIiopTests method test59_returnClassObjectGraph.
public void test59_returnClassObjectGraph() {
try {
final Class[] primitives = { boolean.class, byte.class, char.class, short.class, int.class, long.class, float.class, double.class };
final ObjectGraph expectedGraph = new ObjectGraph(primitives);
final ObjectGraph actualGraph = ejbObject.returnObjectGraph(expectedGraph);
final Class[] expected = (Class[]) expectedGraph.getObject();
final Class[] actual = (Class[]) actualGraph.getObject();
assertEquals(expected.length, actual.length);
for (int i = 0; i < expected.length; i++) {
assertEquals(expected[i], actual[i]);
}
} catch (final RemoteException e) {
fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
use of org.apache.openejb.test.object.ObjectGraph in project tomee by apache.
the class StatelessRmiIiopTests method test47_returnNestedEJBMetaData.
public void test47_returnNestedEJBMetaData() {
try {
final Object obj = initialContext.lookup("client/tests/stateless/EncBean");
final EncStatelessHome home = (EncStatelessHome) obj;
assertNotNull("The EJBHome returned from JNDI is null", home);
final EJBMetaData expected = home.getEJBMetaData();
assertNotNull("The EJBMetaData returned is null", expected);
final ObjectGraph graph = ejbObject.returnObjectGraph(new ObjectGraph(expected));
assertNotNull("The ObjectGraph is null", graph);
final EJBMetaData actual = (EJBMetaData) graph.getObject();
assertNotNull("The EJBMetaData returned is null", actual);
assertEquals(expected.getHomeInterfaceClass(), actual.getHomeInterfaceClass());
assertEquals(expected.getRemoteInterfaceClass(), actual.getRemoteInterfaceClass());
} catch (final Exception e) {
fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
use of org.apache.openejb.test.object.ObjectGraph in project tomee by apache.
the class StatelessRmiIiopTests method test52_returnNestedHandle.
public void test52_returnNestedHandle() {
try {
final Object obj = initialContext.lookup("client/tests/stateless/EncBean");
final EncStatelessHome home = (EncStatelessHome) obj;
assertNotNull("The EJBHome returned from JNDI is null", home);
final EncStatelessObject object = home.create();
assertNotNull("The EJBObject created is null", object);
final Handle expected = object.getHandle();
assertNotNull("The EJBObject Handle returned is null", expected);
assertNotNull("The EJBObject in the Handle is null", expected.getEJBObject());
final ObjectGraph graph = ejbObject.returnObjectGraph(new ObjectGraph(expected));
assertNotNull("The ObjectGraph is null", graph);
final Handle actual = (Handle) graph.getObject();
assertNotNull("The EJBObject Handle returned is null", actual);
assertNotNull("The EJBObject in the Handle is null", actual.getEJBObject());
final EJBObject exp = expected.getEJBObject();
final EJBObject act = actual.getEJBObject();
assertTrue("The EJBObjects in the Handles are not identical", exp.isIdentical(act));
} catch (final Exception e) {
fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
use of org.apache.openejb.test.object.ObjectGraph in project tomee by apache.
the class RmiIiopSingletonBean method returnNestedEJBMetaData.
public ObjectGraph returnNestedEJBMetaData() throws javax.ejb.EJBException {
ObjectGraph data = null;
try {
final InitialContext ctx = new InitialContext();
final EncSingletonHome home = (EncSingletonHome) ctx.lookup("java:comp/env/singleton/rmi-iiop/home");
final EJBMetaData object = home.getEJBMetaData();
data = new ObjectGraph(object);
} catch (final Exception e) {
throw new javax.ejb.EJBException(e);
}
return data;
}
use of org.apache.openejb.test.object.ObjectGraph in project tomee by apache.
the class Cmp2RmiIiopTests method test37_returnNestedEJBHome.
public void test37_returnNestedEJBHome() {
try {
final Object obj = initialContext.lookup("client/tests/entity/cmp/EncBean");
final EncCmpHome expected = (EncCmpHome) obj;
assertNotNull("The EJBHome returned from JNDI is null", expected);
final ObjectGraph graph = ejbObject.returnObjectGraph(new ObjectGraph(expected));
assertNotNull("The ObjectGraph is null", graph);
final EncCmpHome actual = (EncCmpHome) graph.getObject();
assertNotNull("The EJBHome returned is null", actual);
} catch (final Exception e) {
fail("Received Exception " + e.getClass() + " : " + e.getMessage());
}
}
Aggregations