User: fleury
Date: 00/08/14 12:09:38
Modified: src/java/org/jboss/zol/testbean/client EjbossClient.java
Log:
new test
Revision Changes Path
1.16 +55 -14 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.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- EjbossClient.java 2000/08/14 15:13:23 1.15
+++ EjbossClient.java 2000/08/14 19:09:37 1.16
@@ -33,7 +33,7 @@
* Sample client for the jboss container.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
-* @version $Id: EjbossClient.java,v 1.15 2000/08/14 15:13:23 fleury Exp $
+* @version $Id: EjbossClient.java,v 1.16 2000/08/14 19:09:37 fleury Exp $
*/
public class EjbossClient {
@@ -59,7 +59,7 @@
Context ctx = new InitialContext();
System.out.println("OK");
- /*
+ ///*
System.out.println();
System.out.println("Test Stateless Bean");
System.out.println("===================");
@@ -145,7 +145,7 @@
System.out.print(++test+"- "+"Calling StatelessSession.remove()...");
statelessSession.remove();
System.out.println("ok");
- */
+ //*/
///*
System.out.println();
System.out.println("Test Stateful Bean");
@@ -176,8 +176,8 @@
System.out.println(statefulSession.hashCode());
System.out.print(++test+"- "+"equals (same object) ... ");
System.out.println(statefulSession.equals(statefulSession));
- //System.out.print(++test+"- "+"equals (another object) (false under
same home)... ");
-
//System.out.println(statefulSession.equals(statefulSessionHome.create()));
+ System.out.print(++test+"- "+"equals (another object) (false under same
home)... ");
+
System.out.println(statefulSession.equals(statefulSessionHome.create("marc4")));
System.out.println("***Testing the various local EJBObject class
calls");
System.out.print(++test+"- "+"Get Primary Key ... ");
System.out.println(statefulSession.getPrimaryKey());
@@ -276,19 +276,60 @@
System.out.println(++test+"- "+"Calling Business Method B (EJBObject
from entity) on enterpriseEntity...");
System.out.println(enterpriseEntity.callBusinessMethodB());
+
+ System.out.println("***Testing the various local Object class calls");
+ System.out.print(++test+"- "+"toString ... ");
+ System.out.println(enterpriseEntity.toString());
+ System.out.print(++test+"- "+"hashCode ... ");
+ System.out.println(enterpriseEntity.hashCode());
+ System.out.print(++test+"- "+"equals (same object) ... ");
+ System.out.println(enterpriseEntity.equals(enterpriseEntity));
+ System.out.print(++test+"- "+"equals (another object) (true for this
case)... ");
+ System.out.println(enterpriseEntity.equals(enterpriseEntity2));
+ System.out.println("***Testing the various local EJBObject class
calls");
+ System.out.print(++test+"- "+"Get Primary Key ... ");
+ System.out.println(enterpriseEntity.getPrimaryKey());
+ System.out.print(++test+"- "+"Get Handle ... ");
+ Handle entityHandle = enterpriseEntity.getHandle();
+ if (entityHandle != null) System.out.println("OK");
+ System.out.print(++test+"- "+"Serialize handle and deserialize....");
+ MarshalledObject mo3 = new MarshalledObject(entityHandle);
+ Handle entityHandle3 = (Handle) mo3.get();
+ EnterpriseEntity enterpriseEntity3 = (EnterpriseEntity)
entityHandle3.getEJBObject();
+ if (enterpriseEntity3 != null) System.out.println("OK");
+ System.out.println(++test+"- "+"Calling businessMethodA on it...");
+ System.out.println(enterpriseEntity3.callBusinessMethodB());
+ System.out.println(++test+"- "+"They should be
identical..."+enterpriseEntity.isIdentical(enterpriseEntity3));
+ System.out.print(++test+"- "+"Calling entityHome.remove(Handle)...");
+ enterpriseEntityHome.remove(enterpriseEntity3.getHandle());
+ System.out.println("OK");
- System.out.print(++test+"- "+"Calling method createEntity on
enterpriseEntity... ");
- EnterpriseEntity marc2 = enterpriseEntity.createEntity("marc2");
- System.out.println("OK");
+ System.out.print(++test+"- "+"Calling
enterpriseEntity.remove() (should fail)...");
+ try {
+ enterpriseEntity.remove();
+ System.out.println("NOT OK");
+ }
+ catch (Exception e) {
+ System.out.println("OK");
+ }
- System.out.print(++test+"- "+"Calling EnterpriseEntity.remove() for
marc2...");
- marc2.remove();
+ System.out.print(++test+"- "+"Calling
EnterpriseEntity.create() for marc6...");
+ EnterpriseEntity marc6 = enterpriseEntityHome.create("marc6");
System.out.println("ok");
+ System.out.print(++test+"- "+"Calling method createEntity on
enterpriseEntity... ");
+ EnterpriseEntity marc2 = marc6.createEntity("marc2");
+ System.out.println("OK");
- System.out.print(++test+"- "+"Calling EnterpriseEntity.remove() for
marc...");
- enterpriseEntity.remove();
+
+ System.out.print(++test+"- "+"removing by PK on home (marc2)...");
+ enterpriseEntityHome.remove(marc2.getPrimaryKey());
+ System.out.println("ok");
+
+ System.out.print(++test+"- "+"Calling
enterpriseEntity.remove() (marc6)...");
+ marc6.remove();
System.out.println("ok");
+
System.out.println();
@@ -319,8 +360,8 @@
if (bmpBean.getEJBHome() != null) System.out.println("ok");
else throw new Exception("Null Home");
- System.out.print(++test+"- "+"Calling business methodA on BMP bean...");
- bmpBean.callBusinessMethodA();
+ System.out.println(++test+"- "+"Calling business methodA on BMP
bean...");
+ System.out.println(bmpBean.callBusinessMethodA());
System.out.println(++test+"- "+"Calling business methodB (B2B) on BMP
bean and it says ");
System.out.println(bmpBean.callBusinessMethodB());