User: salborini
  Date: 00/09/13 15:23:15

  Modified:    src/java/org/jboss/zol/testbean/client EjbossClient.java
  Log:
  New test for:
  - external ejb references.
  - storage of (nearly) all possible types of data.
  
  Revision  Changes    Path
  1.20      +189 -4    zola/src/java/org/jboss/zol/testbean/client/EjbossClient.java
  
  Index: EjbossClient.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/zola/src/java/org/jboss/zol/testbean/client/EjbossClient.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- EjbossClient.java 2000/09/08 05:16:33     1.19
  +++ EjbossClient.java 2000/09/13 22:23:14     1.20
  @@ -29,13 +29,16 @@
   import org.jboss.zol.testbean.interfaces.AComplexPK;
   import org.jboss.zol.testbean.interfaces.TxSessionHome;
   import org.jboss.zol.testbean.interfaces.TxSession;
  +import org.jboss.zol.testbean2.interfaces.AllTypes;
  +import org.jboss.zol.testbean2.interfaces.AllTypesHome;
  +import org.jboss.zol.testbean2.interfaces.MyObject;
   
   
   /**
   * Sample client for the jboss container.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
  -* @version $Id: EjbossClient.java,v 1.19 2000/09/08 05:16:33 fleury Exp $
  +* @version $Id: EjbossClient.java,v 1.20 2000/09/13 22:23:14 salborini Exp $
   */
   public class EjbossClient {
       
  @@ -360,7 +363,7 @@
               System.out.println();
               System.out.println();
               
  -           // */
  +            //*/
               ///*
               System.out.println();
               System.out.println();
  @@ -410,7 +413,7 @@
                   System.out.println((String)currentBean.getPrimaryKey());
               }
               System.out.println("ok");
  -           // */
  +            //*/
               ///*
               System.out.println();
               System.out.println();
  @@ -494,7 +497,8 @@
               
               
               
  -             ///*
  +            //*/
  +                     ///*
               System.out.println();
               System.out.println();
               System.out.println("Test TxSession");
  @@ -548,8 +552,189 @@
               System.out.print(++test+"- "+"calling requiredToRequiresNew... ");
               System.out.println(txBean.requiredToRequiresNew());
               
  +            //*/
  +                     
  +                     
  +                     ///*
  +            System.out.println();
  +            System.out.println();
  +            System.out.println("Test AllTypesBean");
  +            System.out.println("=================");
  +            System.out.println();
  +            System.out.print(++test+"- "+"Looking up the home AllTypes...");
  +            AllTypesHome allTypesHome = (AllTypesHome) ctx.lookup("AllTypes");
  +            if (allTypesHome!= null ) System.out.println("ok");
  +            System.out.print(++test+"- "+"Calling findByPrimaryKey on AllTypesHome 
with name seb...");
               
  +            AllTypes allTypes = null;
  +            try {
  +                allTypes = allTypesHome.findByPrimaryKey("seb");
  +            }
  +            catch (Exception e) {System.out.println(e.getMessage());}
  +            if (allTypes == null) {
  +                
  +                System.out.println("not found OK");
  +                System.out.print(++test+"- "+"Calling create on AllTypesHome with 
name seb...");
  +                allTypes = allTypesHome.create("seb");
  +            }
  +            
  +            if (allTypes != null) System.out.println("ok");
               
  +                     System.out.print(++test+"- "+"Calling business method A an 
AllTypes (B2B with external ejb-ref)...");
  +                     System.out.println("OK, result is" + 
allTypes.callBusinessMethodA());
  +                     
  +            System.out.println("Getting all the fields");
  +            System.out.println(++test+"- "+"boolean " + allTypes.getBoolean());
  +            System.out.println(++test+"- "+"byte " + allTypes.getByte());
  +            System.out.println(++test+"- "+"short " + allTypes.getShort());
  +            System.out.println(++test+"- "+"int " + allTypes.getInt());
  +            System.out.println(++test+"- "+"long " + allTypes.getLong());
  +            System.out.println(++test+"- "+"float " + allTypes.getFloat());
  +            System.out.println(++test+"- "+"double " + allTypes.getDouble());
  +            System.out.println("No char test yet, bug in jdk");
  +            System.out.println(++test+"- "+"String " + allTypes.getString());
  +            System.out.println(++test+"- "+"Date " + allTypes.getDate());
  +            System.out.println(++test+"- "+"Timestamp " + allTypes.getTimestamp());
  +                
  +                     System.out.print(++test+"- "+"MyObject ");
  +                 MyObject obj = allTypes.getObject();
  +                     System.out.println("OK");
  +                     
  +                     System.out.print(++test+"- "+"getting handle of stateful...");
  +                     Handle sfHandle = allTypes.getStateful();
  +             System.out.println("OK");
  +                             
  +                     System.out.print(++test+"- "+"getting the bean back from the 
handle...");
  +                     StatefulSession sfBean = 
(StatefulSession)sfHandle.getEJBObject();
  +                     System.out.println("OK");
  +                             
  +                     System.out.print(++test+"- "+"calling business method A on 
stateful: ");
  +                     System.out.println("OK, result is " + 
sfBean.callBusinessMethodA());
  +                     
  +                     System.out.print(++test+"- "+"adding the stateful bean as an 
object in AllTypes..");
  +                     allTypes.addObjectToList(sfBean);
  +                     System.out.println("OK");
  +                         
  +                     System.out.print(++test+"- "+"getting handle of stateless...");
  +                     Handle slHandle = allTypes.getStateless();
  +             System.out.println("OK");
  +                             
  +                     System.out.print(++test+"- "+"getting the bean back from the 
handle...");
  +                     StatelessSession slBean = 
(StatelessSession)slHandle.getEJBObject();
  +                     System.out.println("OK");
  +                             
  +                     System.out.print(++test+"- "+"calling business method B on 
stateless: ");
  +                     System.out.println("OK, result is " + 
slBean.callBusinessMethodB());
  +                         
  +                     System.out.print(++test+"- "+"adding the stateless bean as an 
object in AllTypes..");
  +                     allTypes.addObjectToList(slBean);
  +                     System.out.println("OK");
  +                         
  +                     System.out.print(++test+"- "+"getting handle of entity...");
  +                     Handle eeHandle = allTypes.getEntity();
  +             System.out.println("OK");
  +                             
  +                     System.out.print(++test+"- "+"getting the bean back from the 
handle...");
  +                     EnterpriseEntity eeBean = 
(EnterpriseEntity)eeHandle.getEJBObject();
  +                     System.out.println("OK");
  +                             
  +                     System.out.print(++test+"- "+"calling business method A on 
stateless: ");
  +                     System.out.println("OK, result is" + 
eeBean.callBusinessMethodA());
  +                         
  +                     System.out.print(++test+"- "+"adding the entity bean as an 
object in AllTypes..");
  +                     allTypes.addObjectToList(eeBean);
  +                     System.out.println("OK");
  +                         
  +                     System.out.print(++test+"- "+"Getting the list of objects back 
(should contain the 3 beans)...");
  +                     Collection coll = allTypes.getObjectList();
  +                     System.out.println("OK");
  +                     System.out.print(++test+"- "+"stateful bean ");
  +                     if (coll.contains(sfBean)) System.out.println("OK"); else 
System.out.println("FAILED");
  +                     System.out.print(++test+"- "+"stateless bean ");
  +                     if (coll.contains(slBean)) System.out.println("OK"); else 
System.out.println("FAILED");
  +                     System.out.print(++test+"- "+"entity bean ");
  +                     if (coll.contains(eeBean)) System.out.println("OK"); else 
System.out.println("FAILED");
  +                             
  +                     System.out.println("Testing automatically generated finders");
  +                     
  +                     System.out.print(++test+"- "+"findAll()..");
  +                     coll = allTypesHome.findAll();
  +                     if (coll.contains(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  +                     
  +                     System.out.print(++test+"- "+"findByPrimaryKey()...");
  +                     AllTypes result = allTypesHome.findByPrimaryKey("seb");
  +                     if (result.equals(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  +                     
  +                     System.out.print(++test+"- "+"findByABoolean()..");
  +                     coll = allTypesHome.findByABoolean(allTypes.getBoolean());
  +                     if (coll.contains(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  +                     
  +                     System.out.print(++test+"- "+"findByAByte()..");
  +                     coll = allTypesHome.findByAByte(allTypes.getByte());
  +                     if (coll.contains(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  +                     
  +                     System.out.print(++test+"- "+"findByAShort()..");
  +                     coll = allTypesHome.findByAShort(allTypes.getShort());
  +                     if (coll.contains(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  +                     
  +                     System.out.print(++test+"- "+"findByAnInt()..");
  +                     coll = allTypesHome.findByAnInt(allTypes.getInt());
  +                     if (coll.contains(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  +                     
  +                     System.out.print(++test+"- "+"findByALong()..");
  +                     coll = allTypesHome.findByALong(allTypes.getLong());
  +                     if (coll.contains(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  +                     
  +                     System.out.print(++test+"- "+"findByAFloat()..");
  +                     coll = allTypesHome.findByAFloat(allTypes.getFloat());
  +                     if (coll.contains(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  +                     
  +                     System.out.print(++test+"- "+"findByADouble()..");
  +                     coll = allTypesHome.findByADouble(allTypes.getDouble());
  +                     if (coll.contains(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  +
  +                     System.out.println("No Char test yet, bug in jdk");
  +                 
  +                     System.out.print(++test+"- "+"findByAString()..");
  +                     coll = allTypesHome.findByAString(allTypes.getString());
  +                     if (coll.contains(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  +                     
  +                     System.out.print(++test+"- "+"findByADate()..");
  +                     coll = allTypesHome.findByADate(allTypes.getDate());
  +                     if (coll.contains(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  +                     
  +                     System.out.print(++test+"- "+"findByATimestamp()..");
  +                     coll = allTypesHome.findByATimestamp(allTypes.getTimestamp());
  +                     if (coll.contains(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  +                     
  +                     System.out.print(++test+"- "+"findByAnObject()..");
  +                     coll = allTypesHome.findByAnObject(allTypes.getObject());
  +                     if (coll.contains(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  +                     
  +                     System.out.print(++test+"- "+"findByStatefulSession()..");
  +                     coll = 
allTypesHome.findByStatefulSession((StatefulSession)allTypes.getStateful().getEJBObject());
  +                     if (coll.contains(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  +                     
  +                     System.out.print(++test+"- "+"findByStatelessSession()..");
  +                     coll = 
allTypesHome.findByStatelessSession((StatelessSession)allTypes.getStateless().getEJBObject());
  +                     if (coll.contains(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  +                     
  +                     System.out.print(++test+"- "+"findByEnterpriseEntity()..");
  +                     coll = 
allTypesHome.findByEnterpriseEntity((EnterpriseEntity)allTypes.getEntity().getEJBObject());
  +                     if (coll.contains(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  +                     
  +                     System.out.println("Testing finders defined in jaws.xml");
  +                     
  +                     System.out.print(++test+"- "+"findByMinInt()..");
  +                     coll = allTypesHome.findByMinInt(0);
  +                     if (coll.contains(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  +                     
  +                     System.out.print(++test+"- "+"findByIntAndDouble()..");
  +                     coll = allTypesHome.findByIntAndDouble(allTypes.getInt(), 
allTypes.getDouble());
  +                     if (coll.contains(allTypes)) System.out.println("OK"); else 
System.out.println("FAILED");
  +                     
  +                     
  +     
               System.out.println();
               System.out.println();
               System.out.println();
  
  
  

Reply via email to