Search in sources :

Example 6 with RrdException

use of org.opennms.netmgt.rrd.RrdException 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();
}
Also used : RrdException(org.opennms.netmgt.rrd.RrdException) File(java.io.File) ThrowableAnticipator(org.opennms.test.ThrowableAnticipator) Test(org.junit.Test)

Aggregations

RrdException (org.opennms.netmgt.rrd.RrdException)6 File (java.io.File)2 IOException (java.io.IOException)2 InputStreamReader (java.io.InputStreamReader)2 BufferedReader (java.io.BufferedReader)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 PersistException (org.opennms.netmgt.collection.api.PersistException)1 RrdDataSource (org.opennms.netmgt.rrd.RrdDataSource)1 ThrowableAnticipator (org.opennms.test.ThrowableAnticipator)1