use of org.opennms.core.ipc.sink.mock.MockMessageDispatcherFactory 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));
}
Aggregations