Search in sources :

Example 1 with CollectorClientRpcModule

use of org.opennms.netmgt.collection.client.rpc.CollectorClientRpcModule in project opennms by OpenNMS.

the class CollectorTestUtils method createLocationAwareCollectorClient.

static LocationAwareCollectorClient createLocationAwareCollectorClient() {
    final DefaultServiceCollectorRegistry serviceCollectorRegistry = new DefaultServiceCollectorRegistry();
    final CollectorClientRpcModule collectorClientRpcModule = new CollectorClientRpcModule();
    collectorClientRpcModule.setServiceCollectorRegistry(serviceCollectorRegistry);
    collectorClientRpcModule.setExecutor(Executors.newSingleThreadExecutor());
    final MockRpcClientFactory rpcClientFactory = new MockRpcClientFactory();
    final LocationAwareCollectorClientImpl locationAwareCollectorClient = new LocationAwareCollectorClientImpl(rpcClientFactory);
    locationAwareCollectorClient.setRpcModule(collectorClientRpcModule);
    locationAwareCollectorClient.afterPropertiesSet();
    return locationAwareCollectorClient;
}
Also used : DefaultServiceCollectorRegistry(org.opennms.netmgt.collection.support.DefaultServiceCollectorRegistry) LocationAwareCollectorClientImpl(org.opennms.netmgt.collection.client.rpc.LocationAwareCollectorClientImpl) CollectorClientRpcModule(org.opennms.netmgt.collection.client.rpc.CollectorClientRpcModule) MockRpcClientFactory(org.opennms.core.rpc.mock.MockRpcClientFactory)

Example 2 with CollectorClientRpcModule

use of org.opennms.netmgt.collection.client.rpc.CollectorClientRpcModule in project opennms by OpenNMS.

the class CollectorTestUtils method createLocationAwareCollectorClient.

public static LocationAwareCollectorClient createLocationAwareCollectorClient() {
    final DefaultServiceCollectorRegistry serviceCollectorRegistry = new DefaultServiceCollectorRegistry();
    final CollectorClientRpcModule collectorClientRpcModule = new CollectorClientRpcModule();
    collectorClientRpcModule.setServiceCollectorRegistry(serviceCollectorRegistry);
    collectorClientRpcModule.setExecutor(Executors.newSingleThreadExecutor());
    final MockRpcClientFactory rpcClientFactory = new MockRpcClientFactory();
    final LocationAwareCollectorClientImpl locationAwareCollectorClient = new LocationAwareCollectorClientImpl(rpcClientFactory);
    locationAwareCollectorClient.setRpcModule(collectorClientRpcModule);
    locationAwareCollectorClient.setRpcTargetHelper(new RpcTargetHelper());
    locationAwareCollectorClient.afterPropertiesSet();
    return locationAwareCollectorClient;
}
Also used : DefaultServiceCollectorRegistry(org.opennms.netmgt.collection.support.DefaultServiceCollectorRegistry) LocationAwareCollectorClientImpl(org.opennms.netmgt.collection.client.rpc.LocationAwareCollectorClientImpl) RpcTargetHelper(org.opennms.core.rpc.utils.RpcTargetHelper) CollectorClientRpcModule(org.opennms.netmgt.collection.client.rpc.CollectorClientRpcModule) MockRpcClientFactory(org.opennms.core.rpc.mock.MockRpcClientFactory)

Aggregations

MockRpcClientFactory (org.opennms.core.rpc.mock.MockRpcClientFactory)2 CollectorClientRpcModule (org.opennms.netmgt.collection.client.rpc.CollectorClientRpcModule)2 LocationAwareCollectorClientImpl (org.opennms.netmgt.collection.client.rpc.LocationAwareCollectorClientImpl)2 DefaultServiceCollectorRegistry (org.opennms.netmgt.collection.support.DefaultServiceCollectorRegistry)2 RpcTargetHelper (org.opennms.core.rpc.utils.RpcTargetHelper)1