Search in sources :

Example 1 with RestClient

use of org.opennms.minion.core.api.RestClient 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));
}
Also used : DistPollerDao(org.opennms.netmgt.dao.api.DistPollerDao) MockMessageDispatcherFactory(org.opennms.core.ipc.sink.mock.MockMessageDispatcherFactory) RestClient(org.opennms.minion.core.api.RestClient) MockMessageConsumerManager(org.opennms.core.ipc.sink.mock.MockMessageConsumerManager) MessageDispatcherFactory(org.opennms.core.ipc.sink.api.MessageDispatcherFactory) MockMessageDispatcherFactory(org.opennms.core.ipc.sink.mock.MockMessageDispatcherFactory) MockMessageConsumerManager(org.opennms.core.ipc.sink.mock.MockMessageConsumerManager) MessageConsumerManager(org.opennms.core.ipc.sink.api.MessageConsumerManager)

Aggregations

MessageConsumerManager (org.opennms.core.ipc.sink.api.MessageConsumerManager)1 MessageDispatcherFactory (org.opennms.core.ipc.sink.api.MessageDispatcherFactory)1 MockMessageConsumerManager (org.opennms.core.ipc.sink.mock.MockMessageConsumerManager)1 MockMessageDispatcherFactory (org.opennms.core.ipc.sink.mock.MockMessageDispatcherFactory)1 RestClient (org.opennms.minion.core.api.RestClient)1 DistPollerDao (org.opennms.netmgt.dao.api.DistPollerDao)1