use of org.opennms.core.ipc.sink.mock.MockMessageConsumerManager in project opennms by OpenNMS.
the class TrapdConfigReloadIT method addServicesOnStartup.
@Override
protected void addServicesOnStartup(Map<String, KeyValueHolder<Object, Dictionary>> services) {
final RestClient client;
try {
client = mock(RestClient.class);
when(client.getSnmpV3Users()).thenReturn("<?xml version='1.0'?>" + "<trapd-configuration xmlns='http://xmlns.opennms.org/xsd/config/trapd' snmp-trap-address='127.0.0.1' snmp-trap-port='10500' new-suspect-on-trap='true'>" + " <snmpv3-user security-name='opennms' security-level='0' auth-protocol='MD5' auth-passphrase='0p3nNMSv3' privacy-protocol='DES' privacy-passphrase='0p3nNMSv3' />" + "</trapd-configuration>");
} catch (Exception e) {
throw Throwables.propagate(e);
}
// add mocked services to osgi mocked container (Felix Connect)
services.put(RestClient.class.getName(), asService(client, null, null));
services.put(MessageConsumerManager.class.getName(), asService(new MockMessageConsumerManager(), null, null));
services.put(MessageDispatcherFactory.class.getName(), asService(new MockMessageDispatcherFactory<>(), null, null));
services.put(DistPollerDao.class.getName(), asService(distPollerDao, null, null));
}
use of org.opennms.core.ipc.sink.mock.MockMessageConsumerManager in project opennms by OpenNMS.
the class TrapdSinkPatternWiringIT method addServicesOnStartup.
@Override
protected void addServicesOnStartup(Map<String, KeyValueHolder<Object, Dictionary>> services) {
final MessageDispatcherFactory mockMessageDispatcherFactory = mock(MessageDispatcherFactory.class);
when(mockMessageDispatcherFactory.createAsyncDispatcher(Mockito.any(TrapSinkModule.class))).thenAnswer(invocation -> {
messageProcessedLatch.countDown();
return mock(MessageProducer.class);
});
// add mocked services to osgi mocked container (Felix Connect)
services.put(MessageConsumerManager.class.getName(), asService(new MockMessageConsumerManager(), null, null));
services.put(MessageDispatcherFactory.class.getName(), asService(mockMessageDispatcherFactory, null, null));
services.put(RestClient.class.getName(), asService(mock(RestClient.class), null, null));
services.put(DistPollerDao.class.getName(), asService(distPollerDao, null, null));
}
Aggregations