Search in sources :

Example 66 with PersistenceManagerFactory

use of javax.jdo.PersistenceManagerFactory in project tests by datanucleus.

the class CacheTest method testDetachAllOnCommitWithL2.

/**
 * Basic test for "detachAllOnCommit" WITH L2 cache usage.
 */
public void testDetachAllOnCommitWithL2() {
    Properties userProps = new Properties();
    userProps.setProperty(PropertyNames.PROPERTY_DETACH_ALL_ON_COMMIT, "true");
    userProps.setProperty(PropertyNames.PROPERTY_CACHE_L1_TYPE, "weak");
    userProps.setProperty(PropertyNames.PROPERTY_CACHE_L2_TYPE, "weak");
    PersistenceManagerFactory cachePMF = getPMF(1, userProps);
    runL2CacheDetachmentTestForPMF(cachePMF, 5);
}
Also used : PersistenceManagerFactory(javax.jdo.PersistenceManagerFactory) JDOPersistenceManagerFactory(org.datanucleus.api.jdo.JDOPersistenceManagerFactory) Properties(java.util.Properties)

Example 67 with PersistenceManagerFactory

use of javax.jdo.PersistenceManagerFactory in project tests by datanucleus.

the class IdentifierFactoryTest method testJPOX.

/**
 * Verify that putting "datanucleus.identifierFactory=jpox" results in JPOXIdentifierFactory being used
 */
public void testJPOX() {
    Properties props = new Properties();
    props.put("datanucleus.identifierFactory", "jpox");
    PersistenceManagerFactory pmf2 = getPMF(1, props);
    PersistenceManager pm = pmf2.getPersistenceManager();
    ExecutionContext ec = ((JDOPersistenceManager) pm).getExecutionContext();
    IdentifierFactory identifierFactory = ((RDBMSStoreManager) ec.getStoreManager()).getIdentifierFactory();
    assertTrue(identifierFactory instanceof JPOXIdentifierFactory);
}
Also used : JDOPersistenceManager(org.datanucleus.api.jdo.JDOPersistenceManager) JPOXIdentifierFactory(org.datanucleus.store.rdbms.identifier.JPOXIdentifierFactory) ExecutionContext(org.datanucleus.ExecutionContext) JDOPersistenceManager(org.datanucleus.api.jdo.JDOPersistenceManager) PersistenceManager(javax.jdo.PersistenceManager) PersistenceManagerFactory(javax.jdo.PersistenceManagerFactory) JDOPersistenceManagerFactory(org.datanucleus.api.jdo.JDOPersistenceManagerFactory) Properties(java.util.Properties) JPOXIdentifierFactory(org.datanucleus.store.rdbms.identifier.JPOXIdentifierFactory) IdentifierFactory(org.datanucleus.store.rdbms.identifier.IdentifierFactory) RDBMSStoreManager(org.datanucleus.store.rdbms.RDBMSStoreManager)

Aggregations

PersistenceManagerFactory (javax.jdo.PersistenceManagerFactory)67 PersistenceManager (javax.jdo.PersistenceManager)52 Transaction (javax.jdo.Transaction)44 Properties (java.util.Properties)40 JDOPersistenceManagerFactory (org.datanucleus.api.jdo.JDOPersistenceManagerFactory)34 Employee (org.jpox.samples.models.company.Employee)18 Query (javax.jdo.Query)15 JDOUserException (javax.jdo.JDOUserException)13 Manager (org.jpox.samples.models.company.Manager)13 Iterator (java.util.Iterator)12 JDOObjectNotFoundException (javax.jdo.JDOObjectNotFoundException)11 Extent (javax.jdo.Extent)10 JDODataStoreCache (org.datanucleus.api.jdo.JDODataStoreCache)10 JDOFatalUserException (javax.jdo.JDOFatalUserException)9 Collection (java.util.Collection)8 JDOException (javax.jdo.JDOException)8 DataStoreCache (javax.jdo.datastore.DataStoreCache)8 JDOPersistenceManager (org.datanucleus.api.jdo.JDOPersistenceManager)8 Level2Cache (org.datanucleus.cache.Level2Cache)8 SQLException (java.sql.SQLException)7