org.apache.jdo.tck
Class JDO_Test

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.apache.jdo.tck.JDO_Test
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
AfterCloseGetPMThrowsException, AfterCloseSetMethodsThrowException, AfterCompletionMethodCalledWhenCommitted, AfterCompletionMethodCalledWhenRolledback, AfterGetPersistenceManagerNoSetMethodsSucceed, BeforeCompletionMethodCalled, BeforeCompletionMethodNotCalledBeforeRollback, CallingJdoPostload, CallingJdoPredelete, CallingJdoPrestore, Close, CloseFailsIfTransactionActive, CloseWithoutPermissionThrowsSecurityException, Commit, ComparisonTests, ConcurrentPersistenceManagers, EnhancerTest, org.apache.jdo.tck.extents.ExtentTest, GetObjectId, GetObjectIdForNull, GetObjectIdForTransient, GetObjectIdNotPersistenceCapable, GetOptimistic, GetPersistenceManager, GetPersistenceManager, GetPersistenceManager, GetPersistenceManagerFactoryByPropertiesInstance, GetPersistenceManagerForNull, GetPersistenceManagerForTransient, GetPersistenceManagerForUser, GetPersistenceManagerNotPersistenceCapable, GetProperties, GetRetainValues, GetSynchronization, GetTransactionalObjectId, GetTransactionalObjectIdForNull, GetTransactionalObjectIdForTransient, GetTransactionalObjectIdNotPersistenceCapable, HollowInstanceMaintainsPK, IsActive, IsActiveUntilAfterCompletionMethodCalled, IsDeleted, IsDeletedFalse, IsDeletedForNull, IsDeletedForTransient, IsDeletedNotPersistenceCapable, IsDirty, IsDirtyFalse, IsDirtyForNull, IsDirtyForTransient, IsDirtyNotPersistenceCapable, IsNew, IsNewFalse, IsNewForNull, IsNewForTransient, IsNewNotPersistenceCapable, IsPersistent, IsPersistentFalse, IsPersistentForNull, IsPersistentForTransient, IsPersistentNotPersistenceCapable, IsTransactional, IsTransactionalFalse, IsTransactionalForNull, IsTransactionalForTransient, IsTransactionalNotPersistenceCapable, MakeDirty, MakeDirtyForNull, MakeDirtyForTransient, MakeDirtyNotPersistenceCapable, ModificationOfNontransactionalInstanceOutsideTransaction, ModificationOfNontransactionalNonpersistentFields, MultiplePMsReturnInstancesRepresentingSamePC, NoAccessToFieldsAfterPredelete, NoPersistenceManagerIfTransient, ObjectIdNotModifiedWhenObjectIdInstanceModified, OnePersistenceManagerIfPersistentOrTransactional, PersistenceManagerTest, PMReturnsIdenticalInstancesForEqualObjIds, PMsCanSharePCClassesButNotPCInstances, QueryTest, Rollback, SameTransactionInstanceForAllCallsToCurrentTransaction, SecondClassObjectsTrackTheirChanges, SetConnectionPassword, SetConnectionURL, SetConnectionUserName, SetIgnoreCache, SetMultithreaded, SetNontransactionalRead, SetNonTransactionalRead, SetNontransactionalReadCalledDuringTxCompletion, SetNontransactionalReadTrueWhenNotSupported, SetNonTransactionalWrite, SetNontransactionalWriteCalledDuringTxCompletion, SetOptimistic, SetOptimistic, SetOptimisticCalledDuringTxCompletion, SetOptimisticDuringTransaction, SetOptimisticTrueWhenNotSupported, SetRetainValues, SetRetainValues, SetRetainValuesCalledDuringTxCompletion, SetRetainValuesTrueWhenNotSupported, SetSynchronization, SetSynchronizationToNull, StateTransitions, SupportedOptions, TestArrayCollections, TestArrayListCollections, TestCollectionCollections, TestFieldsOfBigDecimal, TestFieldsOfBigInteger, TestFieldsOfBoolean, TestFieldsOfByte, TestFieldsOfCharacter, TestFieldsOfDate, TestFieldsOfDouble, TestFieldsOfFloat, TestFieldsOfInteger, TestFieldsOfLocale, TestFieldsOfLong, TestFieldsOfObject, TestFieldsOfPrimitiveboolean, TestFieldsOfPrimitivebyte, TestFieldsOfPrimitivechar, TestFieldsOfPrimitivedouble, TestFieldsOfPrimitivefloat, TestFieldsOfPrimitiveint, TestFieldsOfPrimitivelong, TestFieldsOfPrimitiveshort, TestFieldsOfShort, TestFieldsOfSimpleClass, TestFieldsOfSimpleInterface, TestFieldsOfString, TestHashMapStringKeyCollections, TestHashMapStringValueCollections, TestHashSetCollections, TestHashtableStringKeyCollections, TestHashtableStringValueCollections, TestLinkedListCollections, TestListCollections, TestMapStringKeyCollections, TestMapStringValueCollections, TestParts, TestParts, TestSetCollections, TestTreeMapStringKeyCollections, TestTreeMapStringValueCollections, TestTreeSetCollections, TestVectorCollections, TransientTransactionalStateCommit, TransientTransactionalStateRollback, WhenNontransactionalReadIsFalse

public abstract class JDO_Test
extends junit.framework.TestCase


Field Summary
protected  boolean debug
          true if debug logging in enabled.
static int HOLLOW
           
static int ILLEGAL_STATE
           
protected  org.apache.commons.logging.Log logger
          Logger
static int NUM_STATES
           
static int PERSISTENT_CLEAN
           
static int PERSISTENT_DELETED
           
static int PERSISTENT_DIRTY
           
static int PERSISTENT_NEW
           
static int PERSISTENT_NEW_DELETED
           
static int PERSISTENT_NONTRANSACTIONAL
           
protected  javax.jdo.PersistenceManager pm
          The PersistenceManager.
protected  javax.jdo.PersistenceManagerFactory pmf
          The PersistenceManagerFactory.
protected static java.lang.String PMFProperties
          Name of the file contaninig the properties for the PMF.
protected static java.util.Properties PMFPropertiesObject
          The Properties object for the PersistenceManagerFactory.
static java.lang.String[] states
           
protected  boolean testSucceeded
           
static int TRANSIENT
           
static int TRANSIENT_CLEAN
           
static int TRANSIENT_DIRTY
           
 
Constructor Summary
protected JDO_Test()
           
 
Method Summary
protected  void cleanup()
          This method cleans up the environment: closes the PersistenceManager.
protected  void cleanupPM(javax.jdo.PersistenceManager pm)
          This method cleans up the specified PersistenceManager.
protected  void closePMF()
          Closes the pmf stored in this instance.
static int currentState(java.lang.Object o)
          This method will return the current lifecycle state of an instance.
 void fail(java.lang.String assertionFailure, java.lang.String msg)
          Prints the specified msg (if debug is true), before it aborts the test case.
protected  javax.jdo.PersistenceManager[] getFailedPersistenceManagers(java.lang.String assertionFailure, javax.jdo.JDOException ex)
           
protected  javax.jdo.PersistenceManager getPM()
          Get the PersistenceManager instance for the implementation under test.
protected  javax.jdo.PersistenceManagerFactory getPMF()
          Get the PersistenceManagerFactory instance for the implementation under test.
static java.lang.String getStateOfInstance(java.lang.Object o)
          This utility method returns a String that indicates the current state of an instance.
 boolean isApplicationIdentitySupported()
          Reports whether Application Identity is supported.
 boolean isArrayListSupported()
          Reports whether an ArrayList collection is supported.
 boolean isArraySupported()
          Reports whether arrays are supported.
 boolean isChangeApplicationIdentitySupported()
          Reports whether Changing Application Identity is supported.
 boolean isDatastoreIdentitySupported()
          Reports whether Datastore Identity is supported.
 boolean isHashMapSupported()
          Reports whether a HashMap collection is supported.
 boolean isHashtableSupported()
          Reports whether a Hashtable collection is supported.
 boolean isLinkedListSupported()
          Reports whether a LinkedList collection is supported.
 boolean isListSupported()
          Reports whether a List collection is supported.
 boolean isMapSupported()
          Reports whether a Map collection is supported.
 boolean isNonDurableIdentitySupported()
          Reports whether Non-Durable Identity is supported.
 boolean isNontransactionalReadSupported()
          Reports whether NontransactionalRead is supported.
 boolean isNontransactionalWriteSupported()
          Reports whether NontransactionalWrite is supported.
 boolean isNullCollectionSupported()
          Reports whether a null collection is supported.
 boolean isOptimisticSupported()
          Reports whether Optimistic is supported.
 boolean isRetainValuesSupported()
          Reports whether RetainValues is supported.
 boolean isTransientTransactionalSupported()
          Reports whether TransientTransactional is supported.
 boolean isTreeMapSupported()
          Reports whether a TreeMap collection is supported.
 boolean isTreeSetSupported()
          Reports whether a TreeSet collection is supported.
 boolean isVectorSupported()
          Reports whether a Vector collection is supported.
protected  java.util.Properties loadProperties(java.lang.String fileName)
          This method load Properties from a given file.
protected  void mangleObject(java.lang.Object oid)
          This method mangles an object by changing all its public fields
protected  void printUnsupportedOptionalFeatureNotTested(java.lang.String testName, java.lang.String optionalFeature)
          Prints a message (if debug is true) saying the test with the specified name is not executed, because the JDO implementation under test does not support the specified optional feature.
 void runBare()
          Runs the bare test sequence.
protected  void setUp()
           
protected  void 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TRANSIENT

public static final int TRANSIENT
See Also:
Constant Field Values

PERSISTENT_NEW

public static final int PERSISTENT_NEW
See Also:
Constant Field Values

PERSISTENT_CLEAN

public static final int PERSISTENT_CLEAN
See Also:
Constant Field Values

PERSISTENT_DIRTY

public static final int PERSISTENT_DIRTY
See Also:
Constant Field Values

HOLLOW

public static final int HOLLOW
See Also:
Constant Field Values

TRANSIENT_CLEAN

public static final int TRANSIENT_CLEAN
See Also:
Constant Field Values

TRANSIENT_DIRTY

public static final int TRANSIENT_DIRTY
See Also:
Constant Field Values

PERSISTENT_NEW_DELETED

public static final int PERSISTENT_NEW_DELETED
See Also:
Constant Field Values

PERSISTENT_DELETED

public static final int PERSISTENT_DELETED
See Also:
Constant Field Values

PERSISTENT_NONTRANSACTIONAL

public static final int PERSISTENT_NONTRANSACTIONAL
See Also:
Constant Field Values

NUM_STATES

public static final int NUM_STATES
See Also:
Constant Field Values

ILLEGAL_STATE

public static final int ILLEGAL_STATE
See Also:
Constant Field Values

states

public static final java.lang.String[] states

PMFProperties

protected static java.lang.String PMFProperties
Name of the file contaninig the properties for the PMF.


PMFPropertiesObject

protected static java.util.Properties PMFPropertiesObject
The Properties object for the PersistenceManagerFactory.


pmf

protected javax.jdo.PersistenceManagerFactory pmf
The PersistenceManagerFactory.


pm

protected javax.jdo.PersistenceManager pm
The PersistenceManager.


testSucceeded

protected boolean testSucceeded

logger

protected org.apache.commons.logging.Log logger
Logger


debug

protected boolean debug
true if debug logging in enabled.

Constructor Detail

JDO_Test

protected JDO_Test()
Method Detail

setUp

protected void setUp()
              throws java.lang.Exception
Throws:
java.lang.Exception

runBare

public void runBare()
             throws java.lang.Throwable
Runs the bare test sequence.

Throws:
java.lang.Throwable - if any exception is thrown

tearDown

protected void tearDown()

getPMF

protected javax.jdo.PersistenceManagerFactory getPMF()
Get the PersistenceManagerFactory instance for the implementation under test.


getPM

protected javax.jdo.PersistenceManager getPM()
Get the PersistenceManager instance for the implementation under test.


cleanup

protected void cleanup()
This method cleans up the environment: closes the PersistenceManager. This should avoid leaving multiple PersistenceManager instances around, in case the PersistenceManagerFactory performs PersistenceManager pooling.


cleanupPM

protected void cleanupPM(javax.jdo.PersistenceManager pm)
This method cleans up the specified PersistenceManager. If the pm still has an open transaction, it will be rolled back, before closing the pm.


closePMF

protected void closePMF()
Closes the pmf stored in this instance.


getFailedPersistenceManagers

protected javax.jdo.PersistenceManager[] getFailedPersistenceManagers(java.lang.String assertionFailure,
                                                                      javax.jdo.JDOException ex)

loadProperties

protected java.util.Properties loadProperties(java.lang.String fileName)
This method load Properties from a given file.


fail

public void fail(java.lang.String assertionFailure,
                 java.lang.String msg)
Prints the specified msg (if debug is true), before it aborts the test case.


printUnsupportedOptionalFeatureNotTested

protected void printUnsupportedOptionalFeatureNotTested(java.lang.String testName,
                                                        java.lang.String optionalFeature)
Prints a message (if debug is true) saying the test with the specified name is not executed, because the JDO implementation under test does not support the specified optional feature.

Parameters:
testName - the name of the test method that is skipped.
optionalFeature - the name of the option not supported by the JDO implementation under tets.

isTransientTransactionalSupported

public boolean isTransientTransactionalSupported()
Reports whether TransientTransactional is supported.


isNontransactionalReadSupported

public boolean isNontransactionalReadSupported()
Reports whether NontransactionalRead is supported.


isNontransactionalWriteSupported

public boolean isNontransactionalWriteSupported()
Reports whether NontransactionalWrite is supported.


isRetainValuesSupported

public boolean isRetainValuesSupported()
Reports whether RetainValues is supported.


isOptimisticSupported

public boolean isOptimisticSupported()
Reports whether Optimistic is supported.


isApplicationIdentitySupported

public boolean isApplicationIdentitySupported()
Reports whether Application Identity is supported.


isDatastoreIdentitySupported

public boolean isDatastoreIdentitySupported()
Reports whether Datastore Identity is supported.


isNonDurableIdentitySupported

public boolean isNonDurableIdentitySupported()
Reports whether Non-Durable Identity is supported.


isArrayListSupported

public boolean isArrayListSupported()
Reports whether an ArrayList collection is supported.


isHashMapSupported

public boolean isHashMapSupported()
Reports whether a HashMap collection is supported.


isHashtableSupported

public boolean isHashtableSupported()
Reports whether a Hashtable collection is supported.


isLinkedListSupported

public boolean isLinkedListSupported()
Reports whether a LinkedList collection is supported.


isTreeMapSupported

public boolean isTreeMapSupported()
Reports whether a TreeMap collection is supported.


isTreeSetSupported

public boolean isTreeSetSupported()
Reports whether a TreeSet collection is supported.


isVectorSupported

public boolean isVectorSupported()
Reports whether a Vector collection is supported.


isMapSupported

public boolean isMapSupported()
Reports whether a Map collection is supported.


isListSupported

public boolean isListSupported()
Reports whether a List collection is supported.


isArraySupported

public boolean isArraySupported()
Reports whether arrays are supported.


isNullCollectionSupported

public boolean isNullCollectionSupported()
Reports whether a null collection is supported.


isChangeApplicationIdentitySupported

public boolean isChangeApplicationIdentitySupported()
Reports whether Changing Application Identity is supported.


getStateOfInstance

public static java.lang.String getStateOfInstance(java.lang.Object o)
This utility method returns a String that indicates the current state of an instance.

Parameters:
o - The object.
Returns:
The current state of the instance, by using the JDOHelper state interrogation methods.

currentState

public static int currentState(java.lang.Object o)
This method will return the current lifecycle state of an instance.


mangleObject

protected void mangleObject(java.lang.Object oid)
                     throws java.lang.Exception
This method mangles an object by changing all its public fields

Throws:
java.lang.Exception


Copyright © 2005 Apache Software Foundation. All Rights Reserved.