use of org.datanucleus.ExecutionContextImpl in project datanucleus-core by datanucleus.
the class FrequentlyAccessedPropertiesTest method testConfiguration.
@Test
public void testConfiguration() {
Map<String, Object> props = new HashMap<String, Object>();
props.put(PropertyNames.PROPERTY_DETACH_ON_CLOSE, "true");
props.put(PropertyNames.PROPERTY_OPTIMISTIC, "true");
props.put("datanucleus.storeManagerType", StoreManagerStub.class.getName());
PersistenceNucleusContextImpl ctx = new PersistenceNucleusContextImpl(null, props) {
private static final long serialVersionUID = 6287389368679465707L;
@Override
public synchronized void initialise() {
}
};
Configuration conf = ctx.getConfiguration();
Assert.assertFalse(conf.getFrequentProperties().getDetachAllOnCommit());
Assert.assertTrue(conf.getFrequentProperties().getDetachOnClose());
ExecutionContextImpl ec = new ExecutionContextImpl(ctx, null, new HashMap<String, Object>());
Assert.assertTrue(ec.getTransaction().getOptimistic());
ec.setProperty(PropertyNames.PROPERTY_OPTIMISTIC, "false");
Assert.assertFalse(ec.getTransaction().getOptimistic());
Assert.assertTrue(conf.getFrequentProperties().getOptimisticTransaction());
}
Aggregations