org.apache.jdo.tck.api.persistencemanagerfactory
Class GetPMFByStreamAndClassLoader

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.apache.jdo.tck.JDO_Test
              extended byorg.apache.jdo.tck.api.persistencemanagerfactory.AbstractGetPMF
                  extended byorg.apache.jdo.tck.api.persistencemanagerfactory.GetPMFByStreamAndClassLoader
All Implemented Interfaces:
junit.framework.Test

public class GetPMFByStreamAndClassLoader
extends org.apache.jdo.tck.api.persistencemanagerfactory.AbstractGetPMF

Title:GetPMFByStreamAndClassLoader of PersistenceManagerFactory
Keywords: persistencemanagerfactory
Assertion IDs: A8.6-18.
Assertion Description: Uses the parameter(s) passed as arguments to construct a Properties instance, and then delegates to the static method getPersistenceManagerFactory in the class named in the property javax.jdo.PersistenceManagerFactoryClass. If there are any exceptions while trying to construct the Properties instance or to call the static method, then either A8.6-4 [JDOFatalUserException] or A8.6-5 [JDOFatalInternalException is thrown], depending on whether the exception is due to the user or the implementation. The nested exception indicates the cause of the exception.

Author:
Michael Watzek

Field Summary
protected static java.lang.String invalidPropertiesFile
          Used as the PMF name in negative tests.
protected static java.lang.String jndiName
          Used as the PMF name in positive JNDI tests.
protected static java.lang.String validPropertiesFile
          Used as the PMF name in positive tests.
 
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
GetPMFByStreamAndClassLoader()
           
 
Method Summary
protected  void checkGetPMFWithInvalidProperties(java.lang.String assertionMessage)
          This method creates a PMF calling method AbstractGetPMF#getPMF(name).
protected  void checkGetPMFWithValidProperties()
          This method creates a PMF calling method AbstractGetPMF#getPMF(name).
protected  javax.jdo.PersistenceManagerFactory getPMF(java.lang.String name)
          Returns pmf instance for the given name.
static void main(java.lang.String[] args)
          The main is called when the class is directly executed from the command line.
protected  void makePersistent()
           
protected  java.lang.String removePathPrefix(java.lang.String name)
          Removing the path prefix from argument name.
 void testInvalidGetPMF()
           
 void testValidGetPMF()
           
protected  void verifyProperties(javax.jdo.PersistenceManagerFactory pmf, java.util.Properties props)
          Verify that the Properties are correctly set in the PMF.
 
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

validPropertiesFile

protected static final java.lang.String validPropertiesFile
Used as the PMF name in positive tests. The variable is set to test/conf/jdori.properties. This file contains valid JDO properties.


invalidPropertiesFile

protected static java.lang.String invalidPropertiesFile
Used as the PMF name in negative tests. The variable is set to test/conf/logging.properties. This file does not contain valid JDO properties.


jndiName

protected static final java.lang.String jndiName
Used as the PMF name in positive JNDI tests. The variable is set to jdori.properties. This resource contains valid JDO properties.

Constructor Detail

GetPMFByStreamAndClassLoader

public GetPMFByStreamAndClassLoader()
Method Detail

main

public static void main(java.lang.String[] args)
The main is called when the class is directly executed from the command line.

Parameters:
args - The arguments passed to the program.

testInvalidGetPMF

public void testInvalidGetPMF()

testValidGetPMF

public void testValidGetPMF()

getPMF

protected javax.jdo.PersistenceManagerFactory getPMF(java.lang.String name)
Description copied from class: org.apache.jdo.tck.api.persistencemanagerfactory.AbstractGetPMF
Returns pmf instance for the given name. Subclasses may use argument name as file name, resource name etc.

Parameters:
name - the name
Returns:
the pmf instance

removePathPrefix

protected java.lang.String removePathPrefix(java.lang.String name)
Removing the path prefix from argument name.

Returns:
argument name removed by the path prefix.

makePersistent

protected void makePersistent()

checkGetPMFWithInvalidProperties

protected void checkGetPMFWithInvalidProperties(java.lang.String assertionMessage)
This method creates a PMF calling method AbstractGetPMF#getPMF(name). It passes an name of an invalid properties file as parameter. The method expects the PMF creation to fail.

Parameters:
assertionMessage - the assertion message if the test fails.

checkGetPMFWithValidProperties

protected void checkGetPMFWithValidProperties()
This method creates a PMF calling method AbstractGetPMF#getPMF(name). It passes an name of a valid properties file as parameter. The method expects the PMF creation to succeed.


verifyProperties

protected void verifyProperties(javax.jdo.PersistenceManagerFactory pmf,
                                java.util.Properties props)
Verify that the Properties are correctly set in the PMF.



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