Ejemplo n.º 1
0
  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());
    }
  }
Ejemplo n.º 2
0
  public void test52_returnNestedHandle() {
    try {
      final Object obj = initialContext.lookup("client/tests/entity/bmp/EncBean");
      final EncBmpHome home =
          (EncBmpHome) javax.rmi.PortableRemoteObject.narrow(obj, EncBmpHome.class);
      assertNotNull("The EJBHome returned from JNDI is null", home);

      final EncBmpObject object = home.create("test_52 BmpBean");
      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());
    }
  }
Ejemplo n.º 3
0
  public void test53_returnNestedHandle2() {
    try {
      final ObjectGraph graph = ejbObject.returnNestedHandle();
      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());
    } catch (final Exception e) {
      fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
  }
Ejemplo n.º 4
0
  public void test38_returnNestedEJBHome2() {
    try {
      final ObjectGraph graph = ejbObject.returnNestedEJBHome();
      assertNotNull("The ObjectGraph is null", graph);

      final EncBmpHome actual =
          (EncBmpHome) javax.rmi.PortableRemoteObject.narrow(graph.getObject(), EncBmpHome.class);
      assertNotNull("The EJBHome returned is null", actual);
    } catch (final Exception e) {
      fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
  }
Ejemplo n.º 5
0
  public void test48_returnNestedEJBMetaData2() {
    try {
      final ObjectGraph graph = ejbObject.returnNestedEJBMetaData();
      assertNotNull("The ObjectGraph is null", graph);

      final EJBMetaData actual = (EJBMetaData) graph.getObject();
      assertNotNull("The EJBMetaData returned is null", actual);
      assertNotNull(
          "The home interface class of the EJBMetaData is null", actual.getHomeInterfaceClass());
      assertNotNull(
          "The remote interface class of the EJBMetaData is null",
          actual.getRemoteInterfaceClass());
    } catch (final Exception e) {
      fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
  }
Ejemplo n.º 6
0
  public void test37_returnNestedEJBHome() {
    try {
      final Object obj = initialContext.lookup("client/tests/entity/bmp/EncBean");
      final EncBmpHome expected =
          (EncBmpHome) javax.rmi.PortableRemoteObject.narrow(obj, EncBmpHome.class);
      assertNotNull("The EJBHome returned from JNDI is null", expected);

      final ObjectGraph graph = ejbObject.returnObjectGraph(new ObjectGraph(expected));
      assertNotNull("The ObjectGraph is null", graph);

      final EncBmpHome actual =
          (EncBmpHome) javax.rmi.PortableRemoteObject.narrow(graph.getObject(), EncBmpHome.class);
      assertNotNull("The EJBHome returned is null", actual);
    } catch (final Exception e) {
      fail("Received Exception " + e.getClass() + " : " + e.getMessage());
    }
  }