use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class JRobinRrdStrategyTest method testSampleSetFloatingPointValueWithExtraJunk.
/**
* This test fails because of
* <a href="http://bugzilla.opennms.org/show_bug.cgi?id=2272">bug #2272</a>
* in org.jrobin.core.Sample.
*/
@Test
@Ignore("fails due to bug 2272")
public void testSampleSetFloatingPointValueWithExtraJunk() throws Exception {
File rrdFile = createRrdFile();
RrdDb openedFile = m_strategy.openFile(rrdFile.getAbsolutePath());
Sample sample = openedFile.createSample();
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new Exception("Some exception that complains about bogus data"));
try {
sample.set("N:1.234 extra junk");
} catch (Throwable t) {
ta.throwableReceived(t);
} finally {
m_strategy.closeFile(openedFile);
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class JRobinRrdStrategyTest method testCommandWithoutDrawing.
@Test
public void testCommandWithoutDrawing() throws Exception {
long end = System.currentTimeMillis();
long start = end - (24 * 60 * 60 * 1000);
String command = "--start=" + start + " --end=" + end;
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new RrdException(ThrowableAnticipator.IGNORE_MESSAGE));
try {
m_strategy.createGraph(command, new File(""));
} catch (Throwable t) {
ta.throwableReceived(t);
// We don't care about the exact message, just a few details
String problemText = "no graph was produced";
assertTrue("cause message should contain '" + problemText + "'", t.getMessage().contains(problemText));
String suggestionText = "Does the command have any drawing commands";
assertTrue("cause message should contain '" + suggestionText + "'", t.getMessage().contains(suggestionText));
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class GenericIndexResourceTypeTest method testNullResourceType.
@Test
public void testNullResourceType() {
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalArgumentException("resourceType argument must not be null"));
try {
new GenericIndexResourceType(null, null, null);
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class DefaultDistributedStatusServiceTest method testCreateFacilityStatusTableNoStartDate.
public void testCreateFacilityStatusTableNoStartDate() {
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalArgumentException("argument start cannot be null"));
m_easyMockUtils.replayAll();
try {
m_service.createFacilityStatusTable(null, new Date());
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
m_easyMockUtils.verifyAll();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class DefaultDistributedStatusServiceTest method testFindLocationSpecificStatusNullApplication.
public void testFindLocationSpecificStatusNullApplication() {
DistributedStatusDetailsCommand command = new DistributedStatusDetailsCommand();
Errors errors = new BindException(command, "command");
command.setLocation(m_locationDefinition1.getLocationName());
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalArgumentException("application cannot be null"));
try {
m_service.findLocationSpecificStatus(command, errors);
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
Aggregations