Package org.jboss.test.testbean.interfaces

Examples of org.jboss.test.testbean.interfaces.StatelessSession


            p.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
            InitialContext ctx = new InitialContext(p);
           
            StatelessSessionHome  statelessSessionHome =  (StatelessSessionHome) ctx.lookup("nextgen.StatelessSession");
            EnterpriseEntityHome  cmpHome =  (EnterpriseEntityHome)ctx.lookup("nextgen.EnterpriseEntity");
            StatelessSession statelessSession = statelessSessionHome.create();
            EnterpriseEntity cmp = null;
            try
            {
               cmp = cmpHome.findByPrimaryKey("bill");
            }
            catch (Exception ex)
            {
               cmp = cmpHome.create("bill");
            }
            int count = 0;
            while (true)
            {
               System.out.println(statelessSession.callBusinessMethodB());
               try
               {
                  cmp.setOtherField(count++);
               }
               catch (Exception ex)
View Full Code Here


      getLog().debug(++test+"- "+"Looking up the home nextgen.StatelessSession...");
      StatelessSessionHome  statelessSessionHome =
      (StatelessSessionHome) ctx.lookup("nextgen.StatelessSession");
      if (statelessSessionHome!= null ) getLog().debug("ok");
         getLog().debug(++test+"- "+"Calling create on StatelessSessionHome...");
      StatelessSession statelessSession =
      statelessSessionHome.create();
      assertTrue("statelessSessionHome.create() != null", statelessSession != null);
      getLog().debug("ok");

      getLog().debug(++test+"- "+"Calling getEJBHome() on StatelessSession...");
      assertTrue("statelessSession.getEJBHome() != null", statelessSession.getEJBHome() != null);
      getLog().debug("ok");

      getLog().debug(++test+"- "+"Calling Business Method A on StatelessSession... ");
      statelessSession.callBusinessMethodA();
      getLog().debug("ok");
      getLog().debug(++test+"- "+"Calling Business Method B on StatelessSession... ");
      getLog().debug(statelessSession.callBusinessMethodB());
      getLog().debug(++test+"- "+"Calling Business Method B(String) on StatelessSession... ");
      getLog().debug(statelessSession.callBusinessMethodB("of wisdom"));
      getLog().debug(++test+"- "+"Calling Business Method C on StatelessSession... ");
      getLog().debug(statelessSession.callBusinessMethodC());
      getLog().debug(++test+"- "+"Calling Business Method D on StatelessSession... ");
      try
      {
         statelessSession.callBusinessMethodD();
         fail("callBusinessMethodD, no exception was thrown");
      }
      catch (BusinessMethodException e)
      {
         getLog().debug("Caught BusinessMethodException OK");
      }
      getLog().debug(++test+"- "+"Calling Business Method E (getEJBObject) on StatelessSession... ");
      getLog().debug(statelessSession.callBusinessMethodE());

      getLog().debug(++test+"- "+"Calling testClassLoading on StatelessSession... ");
      statelessSession.testClassLoading();
      getLog().debug("OK");

      getLog().debug("***Testing the various local Object class calls");
      getLog().debug(++test+"- "+"toString ... " + statelessSession.toString());

      getLog().debug(++test+"- "+"hashCode ... " + statelessSession.hashCode());

      getLog().debug(++test+"- "+"equals (same object) ... " + statelessSession.equals(statelessSession));

      getLog().debug(++test+"- "+"equals (another object) (true under same home)... " + statelessSession.equals(statelessSessionHome.create()));

      getLog().debug("***Testing the various local EJBObject class calls");

      getLog().debug(++test+"- "+"Get Handle ... ");
      Handle statelessHandle = statelessSession.getHandle();
      assertTrue("statelessHandle != null", statelessHandle != null);
      getLog().debug("OK");
      getLog().debug(++test+"- "+"Serialize handle and deserialize..");
      MarshalledObject mo = new MarshalledObject(statelessHandle);
      Handle handle2 = (Handle) mo.get();
      StatelessSession statelessSession2 = (StatelessSession) handle2.getEJBObject();
      assertTrue("statelessSession2 != null", statelessSession2 != null);
      getLog().debug("OK");
      getLog().debug(++test+"- "+"Calling businessMethodB on it...");
      getLog().debug(statelessSession2.callBusinessMethodB());
      getLog().debug(++test+"- "+"They should be identical..."+statelessSession.isIdentical(statelessSession2));
      getLog().debug("***Testing the various local EJBHome class calls");
      getLog().debug(++test+"- "+"Getting the metaData...");
      EJBMetaData statelessMetaData = statelessSessionHome.getEJBMetaData();
      assertTrue("statelessMetaData != null", statelessMetaData != null);
View Full Code Here

      getLog().debug(++test+"- "+"getting handle of stateless...");
      Handle slHandle = allTypes.getStateless();
      getLog().debug("OK");

      getLog().debug(++test+"- "+"getting the bean back from the handle...");
      StatelessSession slBean = (StatelessSession)slHandle.getEJBObject();
      getLog().debug("OK");

      getLog().debug(++test+"- "+"comparing serialized handles...");
      assertTrue(Arrays.equals(new MarshalledValue(slHandle).toByteArray(), new MarshalledValue(slBean.getHandle()).toByteArray()));
      getLog().debug("OK");

      getLog().debug(++test+"- "+"calling business method B on stateless: ");
      getLog().debug("OK, result is " + slBean.callBusinessMethodB());

      getLog().debug(++test+"- "+"adding the stateless bean as an object in AllTypes..");
      allTypes.addObjectToList(slBean);
      getLog().debug("OK");
View Full Code Here

TOP

Related Classes of org.jboss.test.testbean.interfaces.StatelessSession

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.