*
* @throws Exception
*/
@Test
public void testFlatCategoryEvents() throws Exception {
CategoryListener categoryListener = null;
try {
/* Add */
FeedReference feedRef = new FeedReference(DynamicDAO.save(fFactory.createFeed(null, new URI("http://www.feed2.com"))).getId());
NewsReference newsRef = new NewsReference(DynamicDAO.save(fFactory.createNews(null, feedRef.resolve(), new Date())).getId());
ICategory category1 = fFactory.createCategory(null, feedRef.resolve());
category1.setName("Category");
ICategory category2 = fFactory.createCategory(null, newsRef.resolve());
category2.setName("Category");
final boolean categoryEvents[] = new boolean[6];
final CategoryReference categoryReference[] = new CategoryReference[2];
categoryListener = new CategoryListener() {
public void entitiesAdded(Set<CategoryEvent> events) {
for (CategoryEvent event : events) {
assertTrue("Expected this Event to be Root Event", event.isRoot());
if (categoryEvents[0])
categoryEvents[1] = true;