use of org.opennms.web.svclayer.model.LocationMonitorIdCommand in project opennms by OpenNMS.
the class DefaultDistributedPollerServiceTest method testResumeLocationMonitorNotPaused.
public void testResumeLocationMonitorNotPaused() {
OnmsLocationMonitor locationMonitor = new OnmsLocationMonitor();
locationMonitor.setId(LOCATION_MONITOR_ID);
locationMonitor.setStatus(MonitorStatus.STARTED);
expect(m_locationMonitorDao.load(locationMonitor.getId())).andReturn(locationMonitor);
LocationMonitorIdCommand command = new LocationMonitorIdCommand();
command.setMonitorId(LOCATION_MONITOR_ID);
BindException errors = new BindException(command, "command");
replayMocks();
m_distributedPollerService.resumeLocationMonitor(command, errors);
verifyMocks();
assertEquals("error count", 1, errors.getErrorCount());
List<ObjectError> errorList = getErrorList(errors);
assertEquals("error list count", 1, errorList.size());
assertEquals("error 0 code", "distributed.locationMonitor.notPaused", errorList.get(0).getCode());
}
use of org.opennms.web.svclayer.model.LocationMonitorIdCommand in project opennms by OpenNMS.
the class DefaultDistributedPollerServiceTest method testResumeLocationMonitorNullBindException.
public void testResumeLocationMonitorNullBindException() {
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalStateException("errors argument cannot be null"));
LocationMonitorIdCommand command = new LocationMonitorIdCommand();
replayMocks();
try {
m_distributedPollerService.resumeLocationMonitor(command, null);
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
verifyMocks();
}
use of org.opennms.web.svclayer.model.LocationMonitorIdCommand in project opennms by OpenNMS.
the class DefaultDistributedPollerServiceTest method testPauseLocationMonitorBindingErrors.
public void testPauseLocationMonitorBindingErrors() {
LocationMonitorIdCommand command = new LocationMonitorIdCommand();
BindException errors = new BindException(command, "command");
errors.addError(new ObjectError("foo", null, null, "foo"));
assertEquals("error count before pause", 1, errors.getErrorCount());
replayMocks();
m_distributedPollerService.pauseLocationMonitor(command, errors);
verifyMocks();
assertEquals("error count after pause", 1, errors.getErrorCount());
}
use of org.opennms.web.svclayer.model.LocationMonitorIdCommand in project opennms by OpenNMS.
the class DefaultDistributedPollerServiceTest method testPauseLocationMonitorNullCommand.
public void testPauseLocationMonitorNullCommand() {
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalStateException("command argument cannot be null"));
LocationMonitorIdCommand command = new LocationMonitorIdCommand();
BindException errors = new BindException(command, "command");
replayMocks();
try {
m_distributedPollerService.pauseLocationMonitor(null, errors);
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
verifyMocks();
}
use of org.opennms.web.svclayer.model.LocationMonitorIdCommand in project opennms by OpenNMS.
the class DefaultDistributedPollerServiceTest method testDeleteLocationMonitorSuccess.
public void testDeleteLocationMonitorSuccess() {
OnmsLocationMonitor locationMonitor = new OnmsLocationMonitor();
locationMonitor.setId(LOCATION_MONITOR_ID);
expect(m_locationMonitorDao.load(locationMonitor.getId())).andReturn(locationMonitor);
m_locationMonitorDao.delete(locationMonitor);
LocationMonitorIdCommand command = new LocationMonitorIdCommand();
command.setMonitorId(LOCATION_MONITOR_ID);
BindException errors = new BindException(command, "command");
replayMocks();
m_distributedPollerService.deleteLocationMonitor(command, errors);
verifyMocks();
assertEquals("error count", 0, errors.getErrorCount());
}
Aggregations