org.apache.jdo.tck.lifecycle
Class NontransactionalWriteTest

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.apache.jdo.tck.JDO_Test
              extended byorg.apache.jdo.tck.lifecycle.NontransactionalWriteTest
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
NontransactionalWriteDatastoreCommit, NontransactionalWriteDatastoreCommitConflict, NontransactionalWriteDatastoreRollback, NontransactionalWriteOptimisticCommit, NontransactionalWriteOptimisticCommitConflict, NontransactionalWriteOptimisticRollback, NontransactionalWriteThrows

public abstract class NontransactionalWriteTest
extends JDO_Test

Title: Test NontransactionalWrite abstract base class
Keywords: NontransactionalWrite
Assertion ID:
Assertion Description:


Field Summary
protected  int conflictXValue
           
protected  int newXValue
           
protected  java.lang.Object oid
          The ObjectId of the pc instance, set by method createAndModifyInstance.
protected  int originalXValue
          The original value of the X field of the pc instance, set by method createAndModifyInstance.
 
Fields inherited from class org.apache.jdo.tck.JDO_Test
APPLICATION_IDENTITY, cleanupData, closePMFAfterEachTest, DATASTORE_IDENTITY, debug, DETACHED_CLEAN, DETACHED_DIRTY, HOLLOW, identitytype, ILLEGAL_STATE, logger, messages, NL, NUM_STATES, PERSISTENT_CLEAN, PERSISTENT_DELETED, PERSISTENT_DIRTY, PERSISTENT_NEW, PERSISTENT_NEW_DELETED, PERSISTENT_NONTRANSACTIONAL, PERSISTENT_NONTRANSACTIONAL_DIRTY, pm, pmf, PMFProperties, PMFPropertiesObject, states, testSucceeded, TRANSIENT, TRANSIENT_CLEAN, TRANSIENT_DIRTY
 
Constructor Summary
NontransactionalWriteTest()
           
 
Method Summary
protected  void beginAndCommitTransaction(boolean optimistic)
          Begin and commit a transaction using the persistence manager that manages the nontransactional dirty instance.
protected  void beginAndCommitTransactionFails(java.lang.String location, boolean optimistic)
          Begin and commit a transaction using the persistence manager that manages the nontransactional dirty instance.
protected  void beginAndRollbackTransaction(boolean optimistic)
          Begin and rollback a transaction using the persistence manager that manages the nontransactional dirty instance.
protected  boolean checkNontransactionalFeaturesSupported(boolean optimistic)
          Check that all Nontransactional features are supported.
protected  boolean checkNontransactionalReadSupported()
          Check if NontransactionalRead is supported, and log a debug message if it is not.
protected  boolean checkNontransactionalWriteSupported()
          Check if NontransactionalWrite is supported, and log a debug message if it is not.
protected  boolean checkOptimisticSupported()
          Check if Optimistic is supported, and log a debug message if it is not.
protected  boolean checkRetainValuesSupported()
          Check if RetainValues is supported, and log a debug message if it is not.
protected  void checkXValue(java.lang.String location, int expectedXValue)
          Check the x value of the persistent instance referenced by the oid.
protected  void conflictingUpdate()
          Perform a conflicting transaction that updates the same field as the nontransactional dirty instance.
protected  VersionedPCPoint createAndModifyVersionedPCPoint()
          Create a new VersionedPCPoint instance,modify its X value, and store its oid in the test class oid.
 
Methods inherited from class org.apache.jdo.tck.JDO_Test
addTearDownClass, addTearDownClass, addTearDownInstance, addTearDownObjectId, appendMessage, cleanupPM, cleanupPM, closePMF, compareStates, currentState, deleteTearDownClasses, deleteTearDownInstances, dumpSupportedOptions, fail, failOnError, getAllObjects, getFailedPersistenceManagers, getModifiableFields, getPM, getPMF, getPMFProperty, getStateOfInstance, isApplicationIdentitySupported, isArrayListSupported, isArraySupported, isBinaryCompatibilitySupported, isChangeApplicationIdentitySupported, isClassLoadable, isDataStoreConnectionSupported, isDatastoreIdentitySupported, isHashMapSupported, isHashtableSupported, isJRE14orBetter, isLinkedListSupported, isListSupported, isMapSupported, isNonDurableIdentitySupported, isNontransactionalReadSupported, isNontransactionalWriteSupported, isNullCollectionSupported, isOptimisticSupported, isRetainValuesSupported, isSQLSupported, isTestToBePerformed, isTransientTransactionalSupported, isTreeMapSupported, isTreeSetSupported, isUnconstrainedVariablesSupported, isVectorSupported, loadProperties, localSetUp, localTearDown, mangleObject, printNonApplicableIdentityType, printUnsupportedOptionalFeatureNotTested, retrieveMessages, runBare, runsWithApplicationIdentity, setUp, tearDown
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

oid

protected java.lang.Object oid
The ObjectId of the pc instance, set by method createAndModifyInstance.


originalXValue

protected int originalXValue
The original value of the X field of the pc instance, set by method createAndModifyInstance.


newXValue

protected int newXValue

conflictXValue

protected int conflictXValue
Constructor Detail

NontransactionalWriteTest

public NontransactionalWriteTest()
Method Detail

createAndModifyVersionedPCPoint

protected VersionedPCPoint createAndModifyVersionedPCPoint()
Create a new VersionedPCPoint instance,modify its X value, and store its oid in the test class oid. The persistence manager referenced by the pm field (in the superclass) manages the nontransactional dirty instance. This method is only executed if the JDO implementation supports the required features, otherwise this method would be localSetUp.


beginAndRollbackTransaction

protected void beginAndRollbackTransaction(boolean optimistic)
Begin and rollback a transaction using the persistence manager that manages the nontransactional dirty instance.

Parameters:
optimistic - use optimistic transaction

beginAndCommitTransaction

protected void beginAndCommitTransaction(boolean optimistic)
Begin and commit a transaction using the persistence manager that manages the nontransactional dirty instance.

Parameters:
optimistic - use optimistic transaction

beginAndCommitTransactionFails

protected void beginAndCommitTransactionFails(java.lang.String location,
                                              boolean optimistic)
Begin and commit a transaction using the persistence manager that manages the nontransactional dirty instance. This transaction must fail due to a conflicting update.

Parameters:
optimistic - use optimistic transaction

checkXValue

protected void checkXValue(java.lang.String location,
                           int expectedXValue)
Check the x value of the persistent instance referenced by the oid. Use a new persistence manager and check the value in a new transaction so there is no interference with the persistence manager that managed the nontransactional dirty instance.


conflictingUpdate

protected void conflictingUpdate()
Perform a conflicting transaction that updates the same field as the nontransactional dirty instance. The field value is conflictXValue. This conflicting transaction uses a new persistence manager.


checkNontransactionalFeaturesSupported

protected boolean checkNontransactionalFeaturesSupported(boolean optimistic)
Check that all Nontransactional features are supported.

Parameters:
optimistic - check for whether Optimistic is supported as well.

checkNontransactionalWriteSupported

protected boolean checkNontransactionalWriteSupported()
Check if NontransactionalWrite is supported, and log a debug message if it is not.


checkNontransactionalReadSupported

protected boolean checkNontransactionalReadSupported()
Check if NontransactionalRead is supported, and log a debug message if it is not.


checkOptimisticSupported

protected boolean checkOptimisticSupported()
Check if Optimistic is supported, and log a debug message if it is not.


checkRetainValuesSupported

protected boolean checkRetainValuesSupported()
Check if RetainValues is supported, and log a debug message if it is not.



Copyright © 2005-2007 Apache Software Foundation. All Rights Reserved.