Package org.jboss.test.testbean2.bean

Examples of org.jboss.test.testbean2.bean.AllTypesBean


      aHome = aMetaData.getEJBHome();
      getLog().debug("OK");

      getLog().debug(++test+"- "+"Calling findByPrimaryKey on AllTypesHome with name seb...");

      AllTypes allTypes = null;
      try {
         allTypes = allTypesHome.findByPrimaryKey("seb");
      }
      catch (Exception e) {getLog().debug(e.getMessage());}
      if (allTypes == null) {

         getLog().debug("not found OK");
         getLog().debug(++test+"- "+"Calling create on AllTypesHome with name seb...");
         allTypes = allTypesHome.create("seb");
      }

      if (allTypes != null) getLog().debug("ok");

      getLog().debug(++test+"- "+"Calling business method A an AllTypes (B2B with external ejb-ref)...");
      getLog().debug("OK, result is" + allTypes.callBusinessMethodA());

      getLog().debug("Getting all the fields");
      getLog().debug(++test+"- "+"boolean " + allTypes.getBoolean() + " Ok");
      getLog().debug(++test+"- "+"byte " + allTypes.getByte() + " Ok");
      getLog().debug(++test+"- "+"short " + allTypes.getShort() + " Ok");
      getLog().debug(++test+"- "+"int " + allTypes.getInt() + " Ok");
      getLog().debug(++test+"- "+"long " + allTypes.getLong() + " Ok");
      getLog().debug(++test+"- "+"float " + allTypes.getFloat() + " Ok");
      getLog().debug(++test+"- "+"double " + allTypes.getDouble() + " Ok");
      getLog().debug("No char test yet, bug in jdk");
      getLog().debug(++test+"- "+"String " + allTypes.getString() + " Ok");
      getLog().debug(++test+"- "+"Date " + allTypes.getDate() + " Ok");
      getLog().debug(++test+"- "+"Timestamp " + allTypes.getTimestamp() + " Ok");

      getLog().debug(++test+"- "+"MyObject ");
      MyObject obj = allTypes.getObject();
      getLog().debug("OK");

      getLog().debug(++test+"- "+"getting handle of stateful...");
      Handle sfHandle = allTypes.getStateful();
      getLog().debug("OK");

      getLog().debug(++test+"- "+"getting the bean back from the handle...");
      StatefulSession sfBean = (StatefulSession)sfHandle.getEJBObject();
      getLog().debug("OK");

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

      getLog().debug(++test+"- "+"calling business method A on stateful: ");
      getLog().debug("OK, result is " + sfBean.callBusinessMethodA());

      getLog().debug(++test+"- "+"adding the stateful bean as an object in AllTypes..");
      allTypes.addObjectToList(sfBean);
      getLog().debug("OK");

      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");

      getLog().debug(++test+"- "+"getting handle of entity...");
      Handle eeHandle = allTypes.getEntity();
      getLog().debug("OK");

      getLog().debug(++test+"- "+"getting the bean back from the handle...");
      EnterpriseEntity eeBean = (EnterpriseEntity)eeHandle.getEJBObject();
      getLog().debug("OK");

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

      getLog().debug(++test+"- "+"calling business method A on stateless: ");
      getLog().debug("OK, result is" + eeBean.callBusinessMethodA());

      getLog().debug(++test+"- "+"adding the entity bean as an object in AllTypes..");
      allTypes.addObjectToList(eeBean);
      getLog().debug("OK");

      getLog().debug(++test+"- "+"Getting the list of objects back (should contain the 3 beans)...");
      Collection coll = allTypes.getObjectList();
      assertEquals(coll.size(), 3);
      getLog().debug("OK");
      getLog().debug(++test+"- "+"stateful bean ");
      assertTrue(coll.contains(sfBean));
      getLog().debug("OK");
      getLog().debug(++test+"- "+"stateless bean ");
      assertTrue(coll.contains(slBean));
      getLog().debug("OK");
      getLog().debug(++test+"- "+"entity bean ");
      assertTrue(coll.contains(eeBean));
      getLog().debug("OK");

      getLog().debug("Testing automatically generated finders");

      getLog().debug(++test+"- "+"findAll()..");
      coll = allTypesHome.findAll();
      assertTrue(coll.contains(allTypes));
      getLog().debug("OK");

      getLog().debug(++test+"- "+"findByPrimaryKey()...");
      AllTypes result = allTypesHome.findByPrimaryKey("seb");
      assertTrue(result.equals(allTypes));
      getLog().debug("OK");

      getLog().debug(++test+"- "+"findByABoolean()..");
      coll = allTypesHome.findByABoolean(allTypes.getBoolean());
      assertTrue(coll.contains(allTypes));
View Full Code Here


      getLog().debug("");
      getLog().debug("Test AllTypesBean");
      getLog().debug("=================");
      getLog().debug("");
      getLog().debug(++test+"- "+"Looking up the home AllTypes...");
      AllTypesHome allTypesHome = (AllTypesHome) ctx.lookup("AllTypes");
      if (allTypesHome!= null ) getLog().debug("ok");

      getLog().debug(++test+"- "+"Getting the home handle...");
      HomeHandle homeHandle = allTypesHome.getHomeHandle();
      getLog().debug("OK");

      getLog().debug(++test+"- "+"Getting the home back from the handle...");
      EJBHome aHome = homeHandle.getEJBHome();
      getLog().debug("OK");

      getLog().debug(++test+"- "+"Getting metadata from home...");
      EJBMetaData aMetaData = aHome.getEJBMetaData();
      getLog().debug("OK");

      getLog().debug(++test+"- "+"Getting home from metadata...");
      aHome = aMetaData.getEJBHome();
      getLog().debug("OK");

      getLog().debug(++test+"- "+"Calling findByPrimaryKey on AllTypesHome with name seb...");

      AllTypes allTypes = null;
      try {
         allTypes = allTypesHome.findByPrimaryKey("seb");
      }
      catch (Exception e) {getLog().debug(e.getMessage());}
      if (allTypes == null) {

         getLog().debug("not found OK");
         getLog().debug(++test+"- "+"Calling create on AllTypesHome with name seb...");
         allTypes = allTypesHome.create("seb");
      }

      if (allTypes != null) getLog().debug("ok");

      getLog().debug(++test+"- "+"Calling business method A an AllTypes (B2B with external ejb-ref)...");
      getLog().debug("OK, result is" + allTypes.callBusinessMethodA());

      getLog().debug("Getting all the fields");
      getLog().debug(++test+"- "+"boolean " + allTypes.getBoolean() + " Ok");
      getLog().debug(++test+"- "+"byte " + allTypes.getByte() + " Ok");
      getLog().debug(++test+"- "+"short " + allTypes.getShort() + " Ok");
      getLog().debug(++test+"- "+"int " + allTypes.getInt() + " Ok");
      getLog().debug(++test+"- "+"long " + allTypes.getLong() + " Ok");
      getLog().debug(++test+"- "+"float " + allTypes.getFloat() + " Ok");
      getLog().debug(++test+"- "+"double " + allTypes.getDouble() + " Ok");
      getLog().debug("No char test yet, bug in jdk");
      getLog().debug(++test+"- "+"String " + allTypes.getString() + " Ok");
      getLog().debug(++test+"- "+"Date " + allTypes.getDate() + " Ok");
      getLog().debug(++test+"- "+"Timestamp " + allTypes.getTimestamp() + " Ok");

      getLog().debug(++test+"- "+"MyObject ");
      MyObject obj = allTypes.getObject();
      getLog().debug("OK");

      getLog().debug(++test+"- "+"getting handle of stateful...");
      Handle sfHandle = allTypes.getStateful();
      getLog().debug("OK");

      getLog().debug(++test+"- "+"getting the bean back from the handle...");
      StatefulSession sfBean = (StatefulSession)sfHandle.getEJBObject();
      getLog().debug("OK");

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

      getLog().debug(++test+"- "+"calling business method A on stateful: ");
      getLog().debug("OK, result is " + sfBean.callBusinessMethodA());

      getLog().debug(++test+"- "+"adding the stateful bean as an object in AllTypes..");
      allTypes.addObjectToList(sfBean);
      getLog().debug("OK");

      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");

      getLog().debug(++test+"- "+"getting handle of entity...");
      Handle eeHandle = allTypes.getEntity();
      getLog().debug("OK");

      getLog().debug(++test+"- "+"getting the bean back from the handle...");
      EnterpriseEntity eeBean = (EnterpriseEntity)eeHandle.getEJBObject();
      getLog().debug("OK");

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

      getLog().debug(++test+"- "+"calling business method A on stateless: ");
      getLog().debug("OK, result is" + eeBean.callBusinessMethodA());

      getLog().debug(++test+"- "+"adding the entity bean as an object in AllTypes..");
      allTypes.addObjectToList(eeBean);
      getLog().debug("OK");

      getLog().debug(++test+"- "+"Getting the list of objects back (should contain the 3 beans)...");
      Collection coll = allTypes.getObjectList();
      assertEquals(coll.size(), 3);
      getLog().debug("OK");
      getLog().debug(++test+"- "+"stateful bean ");
      assertTrue(coll.contains(sfBean));
      getLog().debug("OK");
      getLog().debug(++test+"- "+"stateless bean ");
      assertTrue(coll.contains(slBean));
      getLog().debug("OK");
      getLog().debug(++test+"- "+"entity bean ");
      assertTrue(coll.contains(eeBean));
      getLog().debug("OK");

      getLog().debug("Testing automatically generated finders");

      getLog().debug(++test+"- "+"findAll()..");
      coll = allTypesHome.findAll();
      assertTrue(coll.contains(allTypes));
      getLog().debug("OK");

      getLog().debug(++test+"- "+"findByPrimaryKey()...");
      AllTypes result = allTypesHome.findByPrimaryKey("seb");
      assertTrue(result.equals(allTypes));
      getLog().debug("OK");

      getLog().debug(++test+"- "+"findByABoolean()..");
      coll = allTypesHome.findByABoolean(allTypes.getBoolean());
      assertTrue(coll.contains(allTypes));
      getLog().debug("OK");

      getLog().debug(++test+"- "+"findByAByte()..");
      coll = allTypesHome.findByAByte(allTypes.getByte());
      assertTrue(coll.contains(allTypes));getLog().debug("OK");

      getLog().debug(++test+"- "+"findByAShort()..");
      coll = allTypesHome.findByAShort(allTypes.getShort());
      assertTrue(coll.contains(allTypes));getLog().debug("OK");

      getLog().debug(++test+"- "+"findByAnInt()..");
      coll = allTypesHome.findByAnInt(allTypes.getInt());
      assertTrue(coll.contains(allTypes));getLog().debug("OK");

      getLog().debug(++test+"- "+"findByALong()..");
      coll = allTypesHome.findByALong(allTypes.getLong());
      assertTrue(coll.contains(allTypes));getLog().debug("OK");

      getLog().debug(++test+"- "+"findByAFloat()..");
      coll = allTypesHome.findByAFloat(allTypes.getFloat());
      assertTrue(coll.contains(allTypes));getLog().debug("OK");

      getLog().debug(++test+"- "+"findByADouble()..");
      coll = allTypesHome.findByADouble(allTypes.getDouble());
      assertTrue(coll.contains(allTypes));getLog().debug("OK");

      getLog().debug("No Char test yet, bug in jdk");

      getLog().debug(++test+"- "+"findByAString()..");
      coll = allTypesHome.findByAString(allTypes.getString());
      assertTrue(coll.contains(allTypes));getLog().debug("OK");

      getLog().debug(++test+"- "+"findByADate()..");
      coll = allTypesHome.findByADate(allTypes.getDate());
      assertTrue(coll.contains(allTypes));getLog().debug("OK");

      getLog().debug(++test+"- "+"findByATimestamp()..");
      coll = allTypesHome.findByATimestamp(allTypes.getTimestamp());
      assertTrue(coll.contains(allTypes));getLog().debug("OK");

      getLog().debug(++test+"- "+"findByAnObject()..");
      coll = allTypesHome.findByAnObject(allTypes.getObject());
      assertTrue(coll.contains(allTypes));getLog().debug("OK");

      getLog().debug(++test+"- "+"findByStatefulSession()..");
      coll = allTypesHome.findByStatefulSession((StatefulSession)allTypes.getStateful().getEJBObject());
      getLog().debug("size="+coll.size());
      for (Iterator i = coll.iterator(); i.hasNext();) {
      Object o = i.next();
      getLog().debug("o="+o);
    }
      assertTrue(coll.contains(allTypes));getLog().debug("OK");

      getLog().debug(++test+"- "+"findByStatelessSession()..");
      coll = allTypesHome.findByStatelessSession((StatelessSession)allTypes.getStateless().getEJBObject());
      assertTrue(coll.contains(allTypes));getLog().debug("OK");

      getLog().debug(++test+"- "+"findByEnterpriseEntity()..");
      coll = allTypesHome.findByEnterpriseEntity((EnterpriseEntity)allTypes.getEntity().getEJBObject());
      assertTrue(coll.contains(allTypes));getLog().debug("OK");

      getLog().debug("Testing finders defined in jaws.xml");

      getLog().debug(++test+"- "+"findByMinInt()..");
      coll = allTypesHome.findByMinInt(0);
      assertTrue(coll.contains(allTypes));getLog().debug("OK");

      getLog().debug(++test+"- "+"findByIntAndDouble()..");
      coll = allTypesHome.findByIntAndDouble(allTypes.getInt(), allTypes.getDouble());
      assertTrue(coll.contains(allTypes));getLog().debug("OK");

      }
      catch (Exception e) {getLog().debug("Exception: ", e); throw e;}
   }
View Full Code Here

  
  
   public String ejbCreate(String pk) throws RemoteException, CreateException {
      return ejbCreate(true, (byte)1, (short)2, (int)3, (long)4, (float)5.6,
         (double)7.8, /*'9',*/ pk, new Date(System.currentTimeMillis()),
         new Timestamp(System.currentTimeMillis()), new MyObject());
   }
View Full Code Here

      getLog().debug(++test+"- "+"String " + allTypes.getString() + " Ok");
      getLog().debug(++test+"- "+"Date " + allTypes.getDate() + " Ok");
      getLog().debug(++test+"- "+"Timestamp " + allTypes.getTimestamp() + " Ok");

      getLog().debug(++test+"- "+"MyObject ");
      MyObject obj = allTypes.getObject();
      getLog().debug("OK");

      getLog().debug(++test+"- "+"getting handle of stateful...");
      Handle sfHandle = allTypes.getStateful();
      getLog().debug("OK");
View Full Code Here

TOP

Related Classes of org.jboss.test.testbean2.bean.AllTypesBean

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.