log.info("BEGIN");
WeblogManager mgr = WebloggerFactory.getWeblogger().getWeblogManager();
// start at root
WeblogCategory root = mgr.getRootWeblogCategory(TestUtils.getManagedWebsite(testWeblog));
// walk first level
Set cats = root.getWeblogCategories();
assertEquals(2, cats.size());
assertTrue(cats.contains(testCat));
// find cat1
WeblogCategory cat = null;
for(Iterator it = cats.iterator(); it.hasNext(); ) {
cat = (WeblogCategory) it.next();
if(cat.getName().equals(cat1.getName())) {
break;
}
}
// walk second level
cats = cat.getWeblogCategories();
assertEquals(1, cats.size());
assertTrue(cats.contains(cat2));
// find cat2
cat = (WeblogCategory) cats.iterator().next();
// walk third level
cats = cat.getWeblogCategories();
assertEquals(1, cats.size());
assertTrue(cats.contains(cat3));
// find cat3
cat = (WeblogCategory) cats.iterator().next();
// make sure this is the end of the tree
cats = cat.getWeblogCategories();
assertEquals(0, cats.size());
log.info("END");
}