Index: src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteTest.java =================================================================== --- src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteTest.java (revision 389951) +++ src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteTest.java (working copy) @@ -35,43 +35,10 @@ *Assertion ID: A5.6.2-4, A5.6.2-6, A5.6.2-8, A5.6.2-10. *
*Assertion Description: -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 main 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); - } - /** * The ObjectId of the pc instance, set by method * createAndModifyInstance. @@ -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."); } Index: src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteOptimisticCommitConflict.java =================================================================== --- src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteOptimisticCommitConflict.java (revision 389951) +++ src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteOptimisticCommitConflict.java (working copy) @@ -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(); }