コード例 #1
0
  public void lookupStatefulBusinessRemote() throws TestFailureException {
    try {
      try {
        final InitialContext ctx = new InitialContext();
        Assert.assertNotNull("The InitialContext is null", ctx);

        final BasicStatefulBusinessRemote object =
            (BasicStatefulBusinessRemote)
                javax.rmi.PortableRemoteObject.narrow(
                    ctx.lookup("java:comp/env/stateless/beanReferences/stateful-business-remote"),
                    BasicStatefulBusinessRemote.class);
        Assert.assertNotNull("The EJB BusinessRemote is null", object);
      } catch (final Exception e) {
        Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
      }
    } catch (final AssertionFailedError afe) {
      throw new TestFailureException(afe);
    }
  }
コード例 #2
0
  public void lookupStatefulBean() throws TestFailureException {
    try {
      try {
        final InitialContext ctx = new InitialContext();
        Assert.assertNotNull("The InitialContext is null", ctx);

        final BasicStatefulHome home =
            (BasicStatefulHome)
                javax.rmi.PortableRemoteObject.narrow(
                    ctx.lookup("java:comp/env/stateless/beanReferences/stateful"),
                    BasicStatefulHome.class);
        Assert.assertNotNull("The EJBHome looked up is null", home);

        final BasicStatefulObject object = home.createObject("Enc Bean");
        Assert.assertNotNull("The EJBObject is null", object);
      } catch (final Exception e) {
        Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
      }
    } catch (final AssertionFailedError afe) {
      throw new TestFailureException(afe);
    }
  }