You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-commits@db.apache.org by mb...@apache.org on 2005/09/20 23:29:28 UTC

svn commit: r290570 - in /incubator/jdo/trunk/tck20: assertions/ test/conf/ test/java/org/apache/jdo/tck/transactions/

Author: mbo
Date: Tue Sep 20 14:29:12 2005
New Revision: 290570

URL: http://svn.apache.org/viewcvs?rev=290570&view=rev
Log:
JDO-139: Issues with tck20 test case transaction.GetOptimistic

Removed:
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/transactions/GetOptimistic.java
Modified:
    incubator/jdo/trunk/tck20/assertions/JdoTckAssertionsTable.sxc
    incubator/jdo/trunk/tck20/test/conf/JDOTCKTestCases.list
    incubator/jdo/trunk/tck20/test/conf/alltests.conf
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/transactions/Rollback.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/transactions/SetOptimistic.java

Modified: incubator/jdo/trunk/tck20/assertions/JdoTckAssertionsTable.sxc
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/assertions/JdoTckAssertionsTable.sxc?rev=290570&r1=290569&r2=290570&view=diff
==============================================================================
Binary files - no diff available.

Modified: incubator/jdo/trunk/tck20/test/conf/JDOTCKTestCases.list
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/conf/JDOTCKTestCases.list?rev=290570&r1=290569&r2=290570&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/conf/JDOTCKTestCases.list (original)
+++ incubator/jdo/trunk/tck20/test/conf/JDOTCKTestCases.list Tue Sep 20 14:29:12 2005
@@ -364,7 +364,6 @@
 org.apache.jdo.tck.transactions.BeforeCompletionMethodCalled
 org.apache.jdo.tck.transactions.BeforeCompletionMethodNotCalledBeforeRollback
 org.apache.jdo.tck.transactions.Commit
-org.apache.jdo.tck.transactions.GetOptimistic
 org.apache.jdo.tck.transactions.GetPersistenceManager
 org.apache.jdo.tck.transactions.GetRetainValues
 org.apache.jdo.tck.transactions.GetSynchronization

Modified: incubator/jdo/trunk/tck20/test/conf/alltests.conf
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/conf/alltests.conf?rev=290570&r1=290569&r2=290570&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/conf/alltests.conf (original)
+++ incubator/jdo/trunk/tck20/test/conf/alltests.conf Tue Sep 20 14:29:12 2005
@@ -336,7 +336,6 @@
 org.apache.jdo.tck.transactions.BeforeCompletionMethodCalled \
 org.apache.jdo.tck.transactions.BeforeCompletionMethodNotCalledBeforeRollback \
 org.apache.jdo.tck.transactions.Commit \
-org.apache.jdo.tck.transactions.GetOptimistic \
 org.apache.jdo.tck.transactions.GetPersistenceManager \
 org.apache.jdo.tck.transactions.GetRetainValues \
 org.apache.jdo.tck.transactions.GetSynchronization \

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/transactions/Rollback.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/transactions/Rollback.java?rev=290570&r1=290569&r2=290570&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/transactions/Rollback.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/transactions/Rollback.java Tue Sep 20 14:29:12 2005
@@ -25,7 +25,6 @@
 
 import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.mylib.PCPoint;
-import org.apache.jdo.tck.query.BoundParameterCheck;
 import org.apache.jdo.tck.util.BatchTestRunner;
 
 
@@ -37,16 +36,15 @@
  *<B>Assertion ID:</B> A13.4.4-2.
  *<BR>
  *<B>Assertion Description: </B>
- The <code>commit</code> method performs the following operations:
+ The <code>rollback</code> method performs the following operations:
  <UL>
+ <LI>rolls back changes made in this transaction from the data store;</LI>
  <LI>transitions persistent instances
  according to the life cycle specification;</LI>
- <LI>rolls back changes made in this transaction from the data store;</LI>
  <LI>calls the <code>afterCompletion</code> method of the
  <code>Synchronization</code> instance registered with the
  <code>Transaction</code>.</LI>
  </UL>
-
  */
 
 
@@ -65,7 +63,7 @@
     
     /** */
     private static final String ASSERTION_FAILED = 
-        "Assertion A13.4.4-2 (BoundParameterCheck) failed: ";
+        "Assertion A13.4.4-2 (Rollback) failed: ";
     
     /**
      * The <code>main</code> is called when the class
@@ -73,7 +71,7 @@
      * @param args The arguments passed to the program.
      */
     public static void main(String[] args) {
-        BatchTestRunner.run(BoundParameterCheck.class);
+        BatchTestRunner.run(Rollback.class);
     }
    
     /**

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/transactions/SetOptimistic.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/transactions/SetOptimistic.java?rev=290570&r1=290569&r2=290570&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/transactions/SetOptimistic.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/transactions/SetOptimistic.java Tue Sep 20 14:29:12 2005
@@ -62,14 +62,51 @@
     public void test() {
         pm = getPM();
           
-        runTestSetOptimistic(pm);   
+        runTestSetOptimistic(pm);
+        runTestSetOptimisticToInverse(pm);   
 
         pm.close(); 
         pm = null;
     }
 
     /** */
-    void runTestSetOptimistic(PersistenceManager pm) {
+    public void runTestSetOptimistic(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            if (isOptimisticSupported()) {
+                tx.setOptimistic(true);
+                tx.begin();
+                if (!tx.getOptimistic()) {
+                    fail(ASSERTION_FAILED,
+                         "tx.getOptimistic() returns false after setting the flag to true.");
+                }
+                tx.commit();
+                if (!tx.getOptimistic()) {
+                    fail(ASSERTION_FAILED,
+                         "tx.getOptimistic() returns false after setting the flag to true.");
+                }
+            }
+            
+            tx.setOptimistic(false);
+            tx.begin();
+            if (tx.getOptimistic()) {
+                fail(ASSERTION_FAILED,
+                     "tx.getOptimistic() returns true after setting the flag to false.");
+            }
+            tx.commit();
+            if (tx.getOptimistic()) {
+                fail(ASSERTION_FAILED,
+                     "tx.getOptimistic() returns true after setting the flag to false.");
+            }
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    void runTestSetOptimisticToInverse(PersistenceManager pm) {
         if (!isOptimisticSupported()) {
             if (debug) logger.debug("Optimistic not supported.");
             return;