Search in sources :

Example 1 with TestClientRouter

use of org.corfudb.runtime.clients.TestClientRouter in project CorfuDB by CorfuDB.

the class AbstractViewTest method getRouterFunction.

/** Function for obtaining a router, given a runtime and an endpoint.
     *
     * @param runtime       The CorfuRuntime to obtain a router for.
     * @param endpoint      An endpoint string for the router.
     * @return
     */
private IClientRouter getRouterFunction(CorfuRuntime runtime, String endpoint) {
    runtimeRouterMap.putIfAbsent(runtime, new ConcurrentHashMap<>());
    if (!endpoint.startsWith("test:")) {
        throw new RuntimeException("Unsupported endpoint in test: " + endpoint);
    }
    return runtimeRouterMap.get(runtime).computeIfAbsent(endpoint, x -> {
        TestClientRouter tcn = new TestClientRouter(testServerMap.get(endpoint).getServerRouter());
        tcn.addClient(new BaseClient()).addClient(new SequencerClient()).addClient(new LayoutClient()).addClient(new LogUnitClient()).addClient(new ManagementClient());
        return tcn;
    });
}
Also used : SequencerClient(org.corfudb.runtime.clients.SequencerClient) LogUnitClient(org.corfudb.runtime.clients.LogUnitClient) ManagementClient(org.corfudb.runtime.clients.ManagementClient) TestClientRouter(org.corfudb.runtime.clients.TestClientRouter) BaseClient(org.corfudb.runtime.clients.BaseClient) LayoutClient(org.corfudb.runtime.clients.LayoutClient)

Aggregations

BaseClient (org.corfudb.runtime.clients.BaseClient)1 LayoutClient (org.corfudb.runtime.clients.LayoutClient)1 LogUnitClient (org.corfudb.runtime.clients.LogUnitClient)1 ManagementClient (org.corfudb.runtime.clients.ManagementClient)1 SequencerClient (org.corfudb.runtime.clients.SequencerClient)1 TestClientRouter (org.corfudb.runtime.clients.TestClientRouter)1