Search in sources :

Example 1 with RoleClients

use of com.alibaba.graphscope.groot.rpc.RoleClients in project GraphScope by alibaba.

the class RoleClientsTest method testRoleClients.

@Test
void testRoleClients() {
    Configs configs = Configs.newBuilder().put(CommonConfig.STORE_NODE_COUNT.getKey(), "1").put(CommonConfig.DISCOVERY_MODE.getKey(), "zookeeper").build();
    ChannelManager channelManager = new ChannelManager(configs, new MockFactory());
    RoleClients<MockRoleClient> clients = new RoleClients<>(channelManager, RoleType.STORE, MockRoleClient::new);
    channelManager.start();
    assertNotNull(clients.getClient(0));
    assertThrows(NodeConnectException.class, () -> clients.getClient(1));
    channelManager.stop();
}
Also used : RoleClients(com.alibaba.graphscope.groot.rpc.RoleClients) ChannelManager(com.alibaba.graphscope.groot.rpc.ChannelManager) Configs(com.alibaba.maxgraph.common.config.Configs) MockFactory(com.alibaba.maxgraph.tests.common.rpc.MockFactory) Test(org.junit.jupiter.api.Test)

Aggregations

ChannelManager (com.alibaba.graphscope.groot.rpc.ChannelManager)1 RoleClients (com.alibaba.graphscope.groot.rpc.RoleClients)1 Configs (com.alibaba.maxgraph.common.config.Configs)1 MockFactory (com.alibaba.maxgraph.tests.common.rpc.MockFactory)1 Test (org.junit.jupiter.api.Test)1