@Override
public void entitiesAdded(Set<CategoryEvent> events) {
CategoryEvent event = events.iterator().next();
try {
categoryAddedCalled[0] = true;
Category dbCategory = (Category) event.getEntity();
initialCategory[0].setId(dbCategory.getId());
assertTrue(initialCategory[0].isIdentical(dbCategory));
dbCategory.setDomain("newDomain/newDomain");
updatedCategory[0] = dbCategory;
DynamicDAO.save(dbCategory);
} catch (PersistenceException e) {
fail(e.getMessage());
}
}
@Override
public void entitiesUpdated(Set<CategoryEvent> events) {
CategoryEvent event = events.iterator().next();
categoryUpdatedCalled[0] = true;
Category dbCategory = (Category) event.getEntity();
assertTrue(updatedCategory[0].isIdentical(dbCategory));
}
};
DynamicDAO.addEntityListener(ICategory.class, categoryListener);
DynamicDAO.save(initialCategory[0]);