use of alma.acs.alarmsystem.generated.Category in project ACS by ACS-Community.
the class CategoryManagerTest method testLoadFromCDB.
public void testLoadFromCDB() {
CategoryManager cm = _alarmSystemManager.getCategoryManager();
cm.loadFromCDB();
List<Category> categories1 = cm.getAllCategories();
assertNotNull(categories1);
cm.loadFromCDB();
List<Category> categories2 = cm.getAllCategories();
assertNotNull(categories2);
assertEquals(categories1.size(), categories2.size());
Iterator<Category> iterator1 = categories1.iterator();
Iterator<Category> iterator2 = categories2.iterator();
for (; iterator1.hasNext(); ) {
Category category1 = (Category) iterator1.next();
Category category2 = (Category) iterator2.next();
assertEquals(category1.getDescription(), category2.getDescription());
assertEquals(category1.getIsDefault(), category2.getIsDefault());
assertEquals(category1.getPath(), category2.getPath());
}
}
use of alma.acs.alarmsystem.generated.Category in project ACS by ACS-Community.
the class CategoryManagerTest method testDeleteCategory.
public void testDeleteCategory() throws Exception {
CategoryManager cm = _alarmSystemManager.getCategoryManager();
List<Category> categories1 = cm.getAllCategories();
assertNotNull(categories1);
boolean check = false;
try {
cm.deleteCategory(categories1.get(0));
} catch (IllegalOperationException e) {
check = true;
}
assertTrue(check);
// List<Category> categories2 = cm.getAllCategories();
// assertNotNull(categories2);
// int size2 = categories2.size();
// assertEquals(size1-1,size2);
boolean exception = false;
try {
cm.deleteCategory(null);
} catch (NullPointerException e) {
exception = true;
}
assertTrue(exception);
Category c = new Category();
exception = false;
try {
cm.deleteCategory(c);
} catch (NullPointerException e) {
exception = true;
}
assertTrue(exception);
c.setPath("foobar");
assertFalse(cm.deleteCategory(c));
}
Aggregations