Search in sources :

Example 1 with MockMessageHandler

use of com.baidu.hugegraph.computer.core.network.MockMessageHandler in project hugegraph-computer by hugegraph.

the class ConnectionManagerTest method setup.

@Before
public void setup() {
    Config config = UnitTestBase.updateWithRequiredOptions(ComputerOptions.TRANSPORT_SERVER_HOST, "127.0.0.1", ComputerOptions.TRANSPORT_IO_MODE, "NIO");
    MessageHandler serverHandler = new MockMessageHandler();
    ClientHandler clientHandler = new MockClientHandler();
    connectionManager = new TransportConnectionManager();
    port = connectionManager.startServer(config, serverHandler);
    connectionManager.initClientManager(config, clientHandler);
}
Also used : MockMessageHandler(com.baidu.hugegraph.computer.core.network.MockMessageHandler) MockMessageHandler(com.baidu.hugegraph.computer.core.network.MockMessageHandler) MessageHandler(com.baidu.hugegraph.computer.core.network.MessageHandler) Config(com.baidu.hugegraph.computer.core.config.Config) MockClientHandler(com.baidu.hugegraph.computer.core.network.MockClientHandler) ClientHandler(com.baidu.hugegraph.computer.core.network.ClientHandler) MockClientHandler(com.baidu.hugegraph.computer.core.network.MockClientHandler) Before(org.junit.Before)

Example 2 with MockMessageHandler

use of com.baidu.hugegraph.computer.core.network.MockMessageHandler in project hugegraph-computer by hugegraph.

the class NettyClientFactoryTest method setup.

@Before
public void setup() {
    config = UnitTestBase.updateWithRequiredOptions(ComputerOptions.TRANSPORT_SERVER_HOST, "127.0.0.1", ComputerOptions.TRANSPORT_SERVER_PORT, "8086", ComputerOptions.TRANSPORT_SERVER_THREADS, "3", ComputerOptions.TRANSPORT_IO_MODE, "NIO", ComputerOptions.TRANSPORT_RECEIVE_BUFFER_SIZE, "128", ComputerOptions.TRANSPORT_SEND_BUFFER_SIZE, "128");
    MockMessageHandler serverHandler = new MockMessageHandler();
    clientHandler = new MockClientHandler();
    this.server = new NettyTransportServer();
    this.server.listen(config, serverHandler);
}
Also used : MockMessageHandler(com.baidu.hugegraph.computer.core.network.MockMessageHandler) MockClientHandler(com.baidu.hugegraph.computer.core.network.MockClientHandler) Before(org.junit.Before)

Example 3 with MockMessageHandler

use of com.baidu.hugegraph.computer.core.network.MockMessageHandler in project hugegraph-computer by hugegraph.

the class NettyTransportServerTest method setup.

@Before
public void setup() {
    config = UnitTestBase.updateWithRequiredOptions(ComputerOptions.TRANSPORT_SERVER_HOST, "127.0.0.1", ComputerOptions.TRANSPORT_SERVER_PORT, "0", ComputerOptions.TRANSPORT_SERVER_THREADS, "3", ComputerOptions.TRANSPORT_IO_MODE, "NIO", ComputerOptions.TRANSPORT_MAX_SYN_BACKLOG, "1024");
    messageHandler = new MockMessageHandler();
    this.server = new NettyTransportServer();
}
Also used : MockMessageHandler(com.baidu.hugegraph.computer.core.network.MockMessageHandler) Before(org.junit.Before)

Example 4 with MockMessageHandler

use of com.baidu.hugegraph.computer.core.network.MockMessageHandler in project hugegraph-computer by hugegraph.

the class AbstractNetworkTest method setup.

@Before
public void setup() {
    Configurator.setAllLevels("com.baidu.hugegraph", Level.DEBUG);
    OPTIONS.put(ComputerOptions.TRANSPORT_SERVER_HOST, host);
    OPTIONS.put(ComputerOptions.TRANSPORT_IO_MODE, "AUTO");
    OPTIONS.put(ComputerOptions.TRANSPORT_SERVER_PORT, "0");
    this.initOption();
    Object[] objects = new Object[OPTIONS.size() * 2];
    Set<Map.Entry<ConfigOption<?>, String>> kvs = OPTIONS.entrySet();
    int i = 0;
    for (Map.Entry<ConfigOption<?>, String> kv : kvs) {
        objects[i++] = kv.getKey();
        objects[i++] = kv.getValue();
    }
    config = UnitTestBase.updateWithRequiredOptions(objects);
    conf = TransportConf.wrapConfig(config);
    serverHandler = Mockito.spy(new MockMessageHandler());
    clientHandler = Mockito.spy(new MockClientHandler());
    connectionManager = new TransportConnectionManager();
    port = connectionManager.startServer(config, serverHandler);
    connectionManager.initClientManager(config, clientHandler);
    this.mockSpyProtocol();
}
Also used : ConfigOption(com.baidu.hugegraph.config.ConfigOption) MockMessageHandler(com.baidu.hugegraph.computer.core.network.MockMessageHandler) HashMap(java.util.HashMap) Map(java.util.Map) MockClientHandler(com.baidu.hugegraph.computer.core.network.MockClientHandler) TransportConnectionManager(com.baidu.hugegraph.computer.core.network.connection.TransportConnectionManager) Before(org.junit.Before)

Aggregations

MockMessageHandler (com.baidu.hugegraph.computer.core.network.MockMessageHandler)4 Before (org.junit.Before)4 MockClientHandler (com.baidu.hugegraph.computer.core.network.MockClientHandler)3 Config (com.baidu.hugegraph.computer.core.config.Config)1 ClientHandler (com.baidu.hugegraph.computer.core.network.ClientHandler)1 MessageHandler (com.baidu.hugegraph.computer.core.network.MessageHandler)1 TransportConnectionManager (com.baidu.hugegraph.computer.core.network.connection.TransportConnectionManager)1 ConfigOption (com.baidu.hugegraph.config.ConfigOption)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1