* person - That UPDATE event is issued - Getting of person
*/
@Test
public void testAddUpdateAndGetPerson() {
IFeed feed = createFeed();
final Person initialJohn = (Person) createPersonJohn(feed);
final Person[] updatedJohn = new Person[1];
final boolean[] personAddedCalled = new boolean[] { false };
final boolean[] personUpdatedCalled = new boolean[] { false };
PersonListener personListener = null;
try {
personListener = new PersonAdapter() {
@Override
public void entitiesAdded(Set<PersonEvent> events) {
for (PersonEvent event : events) {
personAddedCalled[0] = true;
Person dbPerson = (Person) event.getEntity();
initialJohn.setId(dbPerson.getId());
assertTrue(initialJohn.isIdentical(dbPerson));
}
}
@Override
public void entitiesUpdated(Set<PersonEvent> events) {
PersonEvent event = events.iterator().next();
personUpdatedCalled[0] = true;
Person dbPerson = (Person) event.getEntity();
assertTrue(updatedJohn[0].isIdentical(dbPerson));
}
};
DynamicDAO.addEntityListener(IPerson.class, personListener);
long savedJohnId = DynamicDAO.save(initialJohn).getId().longValue();