Search in sources :

Example 1 with CamelBlueprintTest

use of org.opennms.core.test.camel.CamelBlueprintTest in project opennms by OpenNMS.

the class TrapdSinkPatternWiringIT method testWiring.

// The CamelBlueprintTest should have started the bundle and therefore also started
// the TrapListener (see blueprint-trapd-listener.xml), which listens to traps.
@Test
public void testWiring() throws Exception {
    // No traps received or processed
    Assert.assertEquals(1, messageProcessedLatch.getCount());
    // At this point everything should be set up correctly
    final SnmpTrapBuilder builder = SnmpUtils.getV2TrapBuilder();
    builder.addVarBind(SnmpObjId.get(".1.3.6.1.2.1.1.3.0"), SnmpUtils.getValueFactory().getTimeTicks(0));
    builder.addVarBind(SnmpObjId.get(".1.3.6.1.6.3.1.1.4.1.0"), SnmpUtils.getValueFactory().getObjectId(SnmpObjId.get(".1.3.6.1.6.3.1.1.5.2")));
    builder.addVarBind(SnmpObjId.get(".1.3.6.1.6.3.1.1.4.3.0"), SnmpUtils.getValueFactory().getObjectId(SnmpObjId.get(".1.3.6.1.4.1.5813")));
    builder.send("localhost", m_port.get(), "public");
    // Wait before continuing
    messageProcessedLatch.await(10, TimeUnit.SECONDS);
    // Trap should be received and processed
    Assert.assertEquals(0, messageProcessedLatch.getCount());
}
Also used : SnmpTrapBuilder(org.opennms.netmgt.snmp.SnmpTrapBuilder) Test(org.junit.Test) CamelBlueprintTest(org.opennms.core.test.camel.CamelBlueprintTest)

Aggregations

Test (org.junit.Test)1 CamelBlueprintTest (org.opennms.core.test.camel.CamelBlueprintTest)1 SnmpTrapBuilder (org.opennms.netmgt.snmp.SnmpTrapBuilder)1