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 cl...@apache.org on 2006/04/05 17:16:54 UTC

svn commit: r391636 - in /db/jdo: branches/2.0/tck20/src/java/org/apache/jdo/tck/lifecycle/ trunk/tck20/src/java/org/apache/jdo/tck/lifecycle/

Author: clr
Date: Wed Apr  5 08:16:18 2006
New Revision: 391636

URL: http://svn.apache.org/viewcvs?rev=391636&view=rev
Log:
JDO-362 Fixed omitted makePersistent call in NontransactionalWrite

Modified:
    db/jdo/branches/2.0/tck20/src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteOptimisticCommitConflict.java
    db/jdo/branches/2.0/tck20/src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteTest.java
    db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteOptimisticCommitConflict.java
    db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteTest.java

Modified: db/jdo/branches/2.0/tck20/src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteOptimisticCommitConflict.java
URL: http://svn.apache.org/viewcvs/db/jdo/branches/2.0/tck20/src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteOptimisticCommitConflict.java?rev=391636&r1=391635&r2=391636&view=diff
==============================================================================
--- db/jdo/branches/2.0/tck20/src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteOptimisticCommitConflict.java (original)
+++ db/jdo/branches/2.0/tck20/src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteOptimisticCommitConflict.java Wed Apr  5 08:16:18 2006
@@ -82,11 +82,12 @@
     public void testOptimisticCommitConflict() {
         if (!checkNontransactionalFeaturesSupported(true)) 
             return;
+        String location = 
+                ASSERTION_FAILED + "after optimistic commit with conflict";
         createAndModifyVersionedPCPoint();
         conflictingUpdate();
-        beginAndCommitTransactionFails(true);
-        checkXValue(ASSERTION_FAILED + "after optimistic commit with conflict",
-                conflictXValue);
+        beginAndCommitTransactionFails(location, true);
+        checkXValue(location, conflictXValue);
         failOnError();
     }
 

Modified: db/jdo/branches/2.0/tck20/src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteTest.java
URL: http://svn.apache.org/viewcvs/db/jdo/branches/2.0/tck20/src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteTest.java?rev=391636&r1=391635&r2=391636&view=diff
==============================================================================
--- db/jdo/branches/2.0/tck20/src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteTest.java (original)
+++ db/jdo/branches/2.0/tck20/src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteTest.java Wed Apr  5 08:16:18 2006
@@ -28,49 +28,16 @@
 import org.apache.jdo.tck.util.BatchTestRunner;
 
 /**
- *<B>Title:</B> Test NontransactionalWrite
+ *<B>Title:</B> Test NontransactionalWrite abstract base class
  *<BR>
  *<B>Keywords:</B> NontransactionalWrite
  *<BR>
- *<B>Assertion ID:</B> A5.6.2-4, A5.6.2-6, A5.6.2-8, A5.6.2-10.
+ *<B>Assertion ID:</B>
  *<BR>
  *<B>Assertion Description: </B>
-A5.6.2-4 [If a datastore transaction is begun, commit will write 
-the changes to the datastore with no checking as to 
-the current state of the instances in the datastore. 
-That is, the changes made outside the transaction 
-together with any changes made inside the transaction 
-will overwrite the current state of the datastore.] 
-
-A5.6.2-6 [If a datastore transaction is begun, rollback will not write 
-any changes to the datastore.] 
-
-A5.6.2-8 [If an optimistic transaction is begun, commit will write 
-the changes to the datastore after checking as to the current state 
-of the instances in the datastore. The changes made outside 
-the transaction together with any changes made inside the transaction 
-will update the current state of the datastore if the version 
-checking is successful.] 
-
-A5.6.2-10 [If an optimistic transaction is begun, rollback will not write 
-any changes to the datastore. The persistent-nontransactional-dirty 
-instances will transition according to the RestoreValues flag. ] 
  */
 
-public class NontransactionalWriteTest extends JDO_Test {
-
-    /** */
-    protected static final String ASSERTION_FAILED = 
-        "Assertion A5.6.2-4 (NontransactionalWriteTest) failed: ";
-    
-    /**
-     * The <code>main</code> is called when the class
-     * is directly executed from the command line.
-     * @param args The arguments passed to the program.
-     */
-    public static void main(String[] args) {
-        BatchTestRunner.run(NontransactionalWriteTest.class);
-    }
+abstract public class NontransactionalWriteTest extends JDO_Test {
 
     /** 
      * The ObjectId of the pc instance, set by method
@@ -102,6 +69,7 @@
         pm.currentTransaction().setNontransactionalRead(true);
         pm.currentTransaction().setRetainValues(true);
         VersionedPCPoint instance =  new VersionedPCPoint(originalXValue, 200);
+        pm.makePersistent(instance);
         oid = pm.getObjectId(instance);
         pm.currentTransaction().commit();
         instance.setX(newXValue);
@@ -136,7 +104,8 @@
      * transaction must fail due to a conflicting update.
      * @param optimistic use optimistic transaction
      */
-    protected void beginAndCommitTransactionFails(boolean optimistic) {
+    protected void beginAndCommitTransactionFails(String location, 
+            boolean optimistic) {
         getPM().currentTransaction().setOptimistic(optimistic);
         pm.currentTransaction().begin();
         try {
@@ -145,7 +114,7 @@
             // good catch; return
             return;
         }
-        appendMessage(ASSERTION_FAILED + "transaction succeeded but" +
+        appendMessage(location + "transaction succeeded but" +
                 " should not succeed.");
     }
 
@@ -261,4 +230,4 @@
         return true;
     }
 
-}
\ No newline at end of file
+}

Modified: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteOptimisticCommitConflict.java
URL: http://svn.apache.org/viewcvs/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteOptimisticCommitConflict.java?rev=391636&r1=391635&r2=391636&view=diff
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteOptimisticCommitConflict.java (original)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteOptimisticCommitConflict.java Wed Apr  5 08:16:18 2006
@@ -82,11 +82,12 @@
     public void testOptimisticCommitConflict() {
         if (!checkNontransactionalFeaturesSupported(true)) 
             return;
+        String location = 
+                ASSERTION_FAILED + "after optimistic commit with conflict";
         createAndModifyVersionedPCPoint();
         conflictingUpdate();
-        beginAndCommitTransactionFails(true);
-        checkXValue(ASSERTION_FAILED + "after optimistic commit with conflict",
-                conflictXValue);
+        beginAndCommitTransactionFails(location, true);
+        checkXValue(location, conflictXValue);
         failOnError();
     }
 

Modified: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteTest.java
URL: http://svn.apache.org/viewcvs/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteTest.java?rev=391636&r1=391635&r2=391636&view=diff
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteTest.java (original)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteTest.java Wed Apr  5 08:16:18 2006
@@ -28,49 +28,16 @@
 import org.apache.jdo.tck.util.BatchTestRunner;
 
 /**
- *<B>Title:</B> Test NontransactionalWrite
+ *<B>Title:</B> Test NontransactionalWrite abstract base class
  *<BR>
  *<B>Keywords:</B> NontransactionalWrite
  *<BR>
- *<B>Assertion ID:</B> A5.6.2-4, A5.6.2-6, A5.6.2-8, A5.6.2-10.
+ *<B>Assertion ID:</B>
  *<BR>
  *<B>Assertion Description: </B>
-A5.6.2-4 [If a datastore transaction is begun, commit will write 
-the changes to the datastore with no checking as to 
-the current state of the instances in the datastore. 
-That is, the changes made outside the transaction 
-together with any changes made inside the transaction 
-will overwrite the current state of the datastore.] 
-
-A5.6.2-6 [If a datastore transaction is begun, rollback will not write 
-any changes to the datastore.] 
-
-A5.6.2-8 [If an optimistic transaction is begun, commit will write 
-the changes to the datastore after checking as to the current state 
-of the instances in the datastore. The changes made outside 
-the transaction together with any changes made inside the transaction 
-will update the current state of the datastore if the version 
-checking is successful.] 
-
-A5.6.2-10 [If an optimistic transaction is begun, rollback will not write 
-any changes to the datastore. The persistent-nontransactional-dirty 
-instances will transition according to the RestoreValues flag. ] 
  */
 
-public class NontransactionalWriteTest extends JDO_Test {
-
-    /** */
-    protected static final String ASSERTION_FAILED = 
-        "Assertion A5.6.2-4 (NontransactionalWriteTest) failed: ";
-    
-    /**
-     * The <code>main</code> is called when the class
-     * is directly executed from the command line.
-     * @param args The arguments passed to the program.
-     */
-    public static void main(String[] args) {
-        BatchTestRunner.run(NontransactionalWriteTest.class);
-    }
+abstract public class NontransactionalWriteTest extends JDO_Test {
 
     /** 
      * The ObjectId of the pc instance, set by method
@@ -102,6 +69,7 @@
         pm.currentTransaction().setNontransactionalRead(true);
         pm.currentTransaction().setRetainValues(true);
         VersionedPCPoint instance =  new VersionedPCPoint(originalXValue, 200);
+        pm.makePersistent(instance);
         oid = pm.getObjectId(instance);
         pm.currentTransaction().commit();
         instance.setX(newXValue);
@@ -136,7 +104,8 @@
      * transaction must fail due to a conflicting update.
      * @param optimistic use optimistic transaction
      */
-    protected void beginAndCommitTransactionFails(boolean optimistic) {
+    protected void beginAndCommitTransactionFails(String location, 
+            boolean optimistic) {
         getPM().currentTransaction().setOptimistic(optimistic);
         pm.currentTransaction().begin();
         try {
@@ -145,7 +114,7 @@
             // good catch; return
             return;
         }
-        appendMessage(ASSERTION_FAILED + "transaction succeeded but" +
+        appendMessage(location + "transaction succeeded but" +
                 " should not succeed.");
     }
 
@@ -261,4 +230,4 @@
         return true;
     }
 
-}
\ No newline at end of file
+}