Search in sources :

Example 1 with ChannelManager

use of com.alibaba.graphscope.groot.rpc.ChannelManager 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)

Example 2 with ChannelManager

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

the class ChannelManagerTest method testChannelManager.

@Test
void testChannelManager() {
    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());
    channelManager.registerRole(RoleType.STORE);
    channelManager.start();
    Assertions.assertNotNull(channelManager.getChannel(RoleType.STORE, 0));
    Assertions.assertThrows(NodeConnectException.class, () -> channelManager.getChannel(RoleType.STORE, 1));
    channelManager.stop();
}
Also used : ChannelManager(com.alibaba.graphscope.groot.rpc.ChannelManager) Configs(com.alibaba.maxgraph.common.config.Configs) Test(org.junit.jupiter.api.Test)

Aggregations

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