Search in sources :

Example 21 with Category

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());
    }
}
Also used : Category(alma.acs.alarmsystem.generated.Category)

Example 22 with Category

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));
}
Also used : Category(alma.acs.alarmsystem.generated.Category)

Aggregations

Category (alma.acs.alarmsystem.generated.Category)22 Alarms (alma.acs.alarmsystem.generated.Alarms)8 ArrayList (java.util.ArrayList)5 Categories (alma.acs.alarmsystem.generated.Categories)4 FaultFamily (alma.acs.alarmsystem.generated.FaultFamily)4 IllegalOperationException (cl.utfsm.acs.acg.core.IllegalOperationException)3 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)3 ACSAlarmDAOImpl (cl.utfsm.acs.acg.dao.ACSAlarmDAOImpl)2 Vector (java.util.Vector)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 SelectionListener (org.eclipse.swt.events.SelectionListener)2 Point (org.eclipse.swt.graphics.Point)2 GridData (org.eclipse.swt.layout.GridData)2 GridLayout (org.eclipse.swt.layout.GridLayout)2 Event (org.eclipse.swt.widgets.Event)2 Group (org.eclipse.swt.widgets.Group)2 Label (org.eclipse.swt.widgets.Label)2 Listener (org.eclipse.swt.widgets.Listener)2 Menu (org.eclipse.swt.widgets.Menu)2 MenuItem (org.eclipse.swt.widgets.MenuItem)2