use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class InstallerDbIT method testCatchIpInterfaceHasNullIpAddrValueOnUpgrade.
@Test
@Ignore("Tests deprecated upgrade functions of InstallerDb")
public void testCatchIpInterfaceHasNullIpAddrValueOnUpgrade() throws Exception {
getInstallerDb().createSequences();
getInstallerDb().updatePlPgsql();
getInstallerDb().addStoredProcedures();
addTableFromSQL("distpoller");
addTableFromSQL("node");
addTableFromSQL("snmpinterface");
addTableFromSQLWithReplacements("ipinterface", new String[][] { new String[] { "(?i)ipAddr\\s+text\\s+not null,", "ipAddr text," } });
executeSQL("INSERT INTO node (nodeId, nodeCreateTime) VALUES ( 1, now() )");
executeSQL("INSERT INTO snmpInterface (nodeId, snmpIfIndex) VALUES ( 1, 1 )");
executeSQL("INSERT INTO ipInterface (nodeId, ipAddr, ifIndex) VALUES ( 1, null, 1 )");
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new Exception("Error changing table 'ipinterface'. Nested exception: The 'ipAddr' column in the 'ipInterface' table should never be null, but the entry for this row does have a null 'ipAddr' column. It needs to be removed or udpated to reflect a valid 'ipAddr' value."));
try {
getInstallerDb().createTables();
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class EventIpcManagerDefaultImplTest method testRemoveEventListenerTwoArgumentStringNullListener.
public void testRemoveEventListenerTwoArgumentStringNullListener() throws Exception {
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalArgumentException("listener argument cannot be null"));
try {
m_manager.removeEventListener((EventListener) null, "");
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class EventIpcManagerDefaultImplTest method testAddEventListenerTwoArgumentListNullUeiList.
public void testAddEventListenerTwoArgumentListNullUeiList() throws Exception {
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalArgumentException("ueilist argument cannot be null"));
try {
m_manager.addEventListener(m_listener, (List<String>) null);
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class EventIpcManagerDefaultImplTest method testSendNowNullEventLog.
public void testSendNowNullEventLog() throws Exception {
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalArgumentException("eventLog argument cannot be null"));
try {
m_manager.sendNow((Log) null);
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
use of org.opennms.test.ThrowableAnticipator in project opennms by OpenNMS.
the class EventExpanderTest method testAfterPropertiesSetWithNoEventConfDao.
@Test
public void testAfterPropertiesSetWithNoEventConfDao() {
m_mocks.replayAll();
ThrowableAnticipator ta = new ThrowableAnticipator();
ta.anticipate(new IllegalStateException("property eventConfDao must be set"));
EventExpander expander = new EventExpander(new MetricRegistry());
try {
expander.afterPropertiesSet();
} catch (Throwable t) {
ta.throwableReceived(t);
}
ta.verifyAnticipated();
}
Aggregations