225226227228229230231232233234235236237238
} public void testExplicitVersionUpdateOnSync() throws Exception { setup(ENTITY_EXPLICIT_VERSION_LOCKING); Facade facade = getFacadeHome().create(); try { facade.testExplicitVersionUpdateOnSync(ENTITY_EXPLICIT_VERSION_LOCKING, id); } catch(Exception e) { fail("Locked fields are not updated on sync: " + e.getMessage()); }
243244245246247248249250251252253254255256
} public void testGroupStrategyPass() throws Exception { setup(ENTITY_GROUP_LOCKING); Facade facade = getFacadeHome().create(); try { facade.testGroupStrategyPass(ENTITY_GROUP_LOCKING, id); } finally { tearDown(ENTITY_GROUP_LOCKING); }
257258259260261262263264265266267268269270
} public void testGroupStrategyFail() throws Exception { setup(ENTITY_GROUP_LOCKING); Facade facade = getFacadeHome().create(); try { facade.testGroupStrategyFail(ENTITY_GROUP_LOCKING, id); fail("Should have failed to update!"); } catch(Exception e) { }
275276277278279280281282283284285286287288
} public void testReadStrategyPass() throws Exception { setup(ENTITY_READ_LOCKING); Facade facade = getFacadeHome().create(); try { facade.testReadStrategyPass(ENTITY_READ_LOCKING, id); } finally { tearDown(ENTITY_READ_LOCKING); }
289290291292293294295296297298299300301302
} public void testReadStrategyFail() throws Exception { setup(ENTITY_READ_LOCKING); Facade facade = getFacadeHome().create(); try { facade.testReadStrategyFail(ENTITY_READ_LOCKING, id); fail("Should have failed to update."); } catch(Exception e) { }
307308309310311312313314315316317318319320
} public void testModifiedStrategyPass() throws Exception { setup(ENTITY_MODIFIED_LOCKING); Facade facade = getFacadeHome().create(); try { facade.testModifiedStrategyPass(ENTITY_MODIFIED_LOCKING, id); } finally { tearDown(ENTITY_MODIFIED_LOCKING); }
321322323324325326327328329330331332333334
} public void testModifiedStrategyFail() throws Exception { setup(ENTITY_MODIFIED_LOCKING); Facade facade = getFacadeHome().create(); try { facade.testModifiedStrategyFail(ENTITY_MODIFIED_LOCKING, id); fail("Should have failed to update!"); } catch(Exception e) { // expected
340341342343344345346347348349350351352353
} public void testUpdateLockOnSync() throws Exception { setup(ENTITY_VERSION_LOCKING); Facade facade = getFacadeHome().create(); try { facade.testUpdateLockOnSync(ENTITY_VERSION_LOCKING, id); } catch(Exception e) { fail("Locked fields are not updated on sync!"); }
359360361362363364365366367368
// Private private void setup(String jndiName) throws Exception { Facade facade = getFacadeHome().create(); facade.createCmpEntity(jndiName, id, "str1", new Integer(1), new Double(1.1), "str2", new Integer(2), new Double(2.2)); }
367368369370371372373374
"str2", new Integer(2), new Double(2.2)); } private void tearDown(String jndiName) throws Exception { Facade facade = getFacadeHome().create(); facade.safeRemove(jndiName, id); }