Search in sources :

Example 11 with EchoResponse

use of org.opennms.core.rpc.echo.EchoResponse in project opennms by OpenNMS.

the class EchoRpcIT method canExecuteRpcViaAnotherLocationWithSystemId.

@Test(timeout = 60000)
public void canExecuteRpcViaAnotherLocationWithSystemId() throws Exception {
    assertNotEquals(REMOTE_LOCATION_NAME, identity.getLocation());
    EchoRpcModule echoRpcModule = new EchoRpcModule();
    CamelContext context = getContext();
    context.start();
    MinionIdentity minionIdentity = new MockMinionIdentity(REMOTE_LOCATION_NAME);
    CamelRpcServerRouteManager routeManager = getRouteManager(context);
    routeManager.bind(echoRpcModule);
    EchoRequest request = new EchoRequest("HELLO!!!");
    // Specify the system id
    assertNotNull(minionIdentity.getId());
    request.setSystemId(minionIdentity.getId());
    request.setLocation(REMOTE_LOCATION_NAME);
    EchoResponse expectedResponse = new EchoResponse("HELLO!!!");
    EchoResponse actualResponse = echoClient.execute(request).get();
    assertEquals(expectedResponse, actualResponse);
    routeManager.unbind(echoRpcModule);
    context.stop();
}
Also used : CamelContext(org.apache.camel.CamelContext) EchoResponse(org.opennms.core.rpc.echo.EchoResponse) EchoRpcModule(org.opennms.core.rpc.echo.EchoRpcModule) EchoRequest(org.opennms.core.rpc.echo.EchoRequest) MinionIdentity(org.opennms.minion.core.api.MinionIdentity) Test(org.junit.Test)

Aggregations

EchoRequest (org.opennms.core.rpc.echo.EchoRequest)11 EchoResponse (org.opennms.core.rpc.echo.EchoResponse)11 Test (org.junit.Test)8 CamelContext (org.apache.camel.CamelContext)5 EchoRpcModule (org.opennms.core.rpc.echo.EchoRpcModule)5 DefaultExchange (org.apache.camel.impl.DefaultExchange)3 ConsoleReporter (com.codahale.metrics.ConsoleReporter)2 Counter (com.codahale.metrics.Counter)2 Histogram (com.codahale.metrics.Histogram)2 MetricRegistry (com.codahale.metrics.MetricRegistry)2 CountDownLatch (java.util.concurrent.CountDownLatch)2 CamelBlueprintTest (org.opennms.core.test.camel.CamelBlueprintTest)2 ExecutionException (java.util.concurrent.ExecutionException)1 MinionIdentity (org.opennms.minion.core.api.MinionIdentity)1 OnmsNode (org.opennms.netmgt.model.OnmsNode)1