User: salborini
Date: 00/09/25 19:35:35
Modified: src/java/org/jboss/zol/testbean/client EjbossClient.java
Log:
New tests for bean managed transaction demarcation.
Won't work for now, but I have to commit for Marc to finish testing.
Revision Changes Path
1.21 +69 -6 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.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- EjbossClient.java 2000/09/13 22:23:14 1.20
+++ EjbossClient.java 2000/09/26 02:35:34 1.21
@@ -29,6 +29,10 @@
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.testbean.interfaces.BMTStatefulHome;
+import org.jboss.zol.testbean.interfaces.BMTStateful;
+import org.jboss.zol.testbean.interfaces.BMTStatelessHome;
+import org.jboss.zol.testbean.interfaces.BMTStateless;
import org.jboss.zol.testbean2.interfaces.AllTypes;
import org.jboss.zol.testbean2.interfaces.AllTypesHome;
import org.jboss.zol.testbean2.interfaces.MyObject;
@@ -38,7 +42,7 @@
* Sample client for the jboss container.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
-* @version $Id: EjbossClient.java,v 1.20 2000/09/13 22:23:14 salborini Exp $
+* @version $Id: EjbossClient.java,v 1.21 2000/09/26 02:35:34 salborini Exp $
*/
public class EjbossClient {
@@ -53,7 +57,7 @@
System.out.println("Copyright (C), The jBoss Organization, 2000");
System.out.println("_____________________________________________");
System.out.println();
- System.out.println("Welcome to the test Suite v1.2");
+ System.out.println("Welcome to the test Suite v1.4");
System.out.println("_____________________________________________");
System.out.println();
@@ -414,7 +418,8 @@
}
System.out.println("ok");
//*/
- ///*
+
+ ///*
System.out.println();
System.out.println();
System.out.println("Test Entity Bean PK");
@@ -732,14 +737,72 @@
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("Test Bean Managed Transaction Demarcation");
+ System.out.println("=========================================");
+ System.out.println();
+ System.out.print(++test+"- "+"Looking up the home BMTStateful...");
+ BMTStatefulHome bmtSFHome = (BMTStatefulHome) ctx.lookup("BMTStateful");
+ if (bmtSFHome != null ) System.out.println("ok");
+ System.out.print(++test+"- "+"Calling create on BMTStatefulHome...");
+ BMTStateful bmtSF = bmtSFHome.create();
+ System.out.println("OK");
+ System.out.println(++test+"- "+"Can the bean access its
UserTransaction");
+ System.out.println(bmtSF.txExists());
+ System.out.println(++test+"- "+"Testing commit on
UserTransaction");
+ System.out.println(bmtSF.txCommit());
+ System.out.println(++test+"- "+"Testing rollback on
UserTransaction");
+ System.out.println(bmtSF.txRollback());
+ System.out.print(++test+"- "+"Beginning a transaction...");
+ System.out.println(bmtSF.txBegin());
+ System.out.print(++test+"- "+"Committing the transaction in
another call...");
+ System.out.println(bmtSF.txEnd());
+ System.out.print(++test+"- "+"Creating a table for real db w/
tx test...");
+ bmtSF.createTable();
+ System.out.println("OK, field value is:");
+ System.out.println(bmtSF.getDbField());
+ System.out.print(++test+"- "+"Updating the field in a
transaction, commit...");
+ bmtSF.dbCommit();
+ System.out.println("OK, field value is:");
+ System.out.println(bmtSF.getDbField());
+ System.out.print(++test+"- "+"Updating the field in a
transaction, rollback...");
+ bmtSF.dbRollback();
+ System.out.println("OK, field value is:");
+ System.out.println(bmtSF.getDbField());
+ System.out.print(++test+"- "+"Now dropping the table...");
+ bmtSF.dropTable();
+ System.out.println("OK");
+ System.out.print(++test+"- "+"Looking up the home BMTStateful...");
+ BMTStatelessHome bmtSLHome = (BMTStatelessHome)
ctx.lookup("BMTStateless");
+ if (bmtSLHome != null ) System.out.println("ok");
+ System.out.print(++test+"- "+"Calling create on BMTStatelessHome...");
+ BMTStateless bmtSL = bmtSLHome.create();
+ System.out.println("OK");
+ System.out.println(++test+"- "+"Can the bean access its
UserTransaction");
+ System.out.println(bmtSL.txExists());
+ System.out.println(++test+"- "+"Testing commit on
UserTransaction");
+ System.out.println(bmtSL.txCommit());
+ System.out.println(++test+"- "+"Testing rollback on
UserTransaction");
+ System.out.println(bmtSL.txRollback());
+ System.out.print(++test+"- "+"Beginning a transaction
(container should throw an exception)...");
+ try {
+ System.out.print(bmtSL.txBegin());
+ System.out.println(" ... FAILED");
+ } catch (RemoteException e) {
+ System.out.println(" ... OK, exception message: "+
e.getMessage());
+ }
+
+
+
+ //*/
System.out.println();
System.out.println();
System.out.println();
System.out.println("Test OK, "+test+" tests run, congratulations");
- //*/
Date finishDate = new Date();