Search in sources :

Example 1 with TrapdConfig

use of org.opennms.netmgt.config.TrapdConfig in project opennms by OpenNMS.

the class TrapdConfigReloadIT method verifyReload.

@Test
public void verifyReload() throws Exception {
    // Check that it has not yet been refreshed
    TrapdConfig trapdConfig = getOsgiService(TrapdConfig.class);
    Assert.assertEquals(true, trapdConfig.getSnmpV3Users().isEmpty());
    // The setSnmpV3Users method must have been invoked
    Thread.sleep(20000);
    // Verify
    Assert.assertEquals(1, trapdConfig.getSnmpV3Users().size());
}
Also used : TrapdConfig(org.opennms.netmgt.config.TrapdConfig) Test(org.junit.Test) CamelBlueprintTest(org.opennms.core.test.camel.CamelBlueprintTest)

Example 2 with TrapdConfig

use of org.opennms.netmgt.config.TrapdConfig in project opennms by OpenNMS.

the class TrapSinkModuleTest method testEqualsAndHashCode.

@Test
public void testEqualsAndHashCode() throws Exception {
    SinkModule<Message, Message> mockModule = Mockito.mock(SinkModule.class);
    Mockito.when(mockModule.getId()).thenReturn("id");
    OnmsDistPoller distPollerMock = Mockito.mock(OnmsDistPoller.class);
    TrapdConfig config = new TrapdConfigBean();
    final TrapSinkModule module = new TrapSinkModule(config, distPollerMock);
    Assert.assertEquals(module, module);
    Assert.assertEquals(module.hashCode(), module.hashCode());
    final TrapSinkModule other = new TrapSinkModule(config, distPollerMock);
    Assert.assertEquals(module, other);
    Assert.assertEquals(module.hashCode(), other.hashCode());
    Assert.assertNotEquals(module, mockModule);
    Assert.assertNotEquals(module.hashCode(), mockModule.hashCode());
}
Also used : Message(org.opennms.core.ipc.sink.api.Message) OnmsDistPoller(org.opennms.netmgt.model.OnmsDistPoller) TrapdConfig(org.opennms.netmgt.config.TrapdConfig) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 TrapdConfig (org.opennms.netmgt.config.TrapdConfig)2 Message (org.opennms.core.ipc.sink.api.Message)1 CamelBlueprintTest (org.opennms.core.test.camel.CamelBlueprintTest)1 OnmsDistPoller (org.opennms.netmgt.model.OnmsDistPoller)1