Search in sources :

Example 1 with TestMessageSerializationRegistryImpl

use of org.apache.ignite.network.TestMessageSerializationRegistryImpl in project ignite-3 by apache.

the class ItRecoveryHandshakeTest method startManager.

/**
 * Starts a {@link ConnectionManager} with a normal handshake manager adding it to the {@link #startedManagers} list.
 *
 * @param port Port.
 * @return Connection manager
 */
private ConnectionManager startManager(int port) {
    var registry = new TestMessageSerializationRegistryImpl();
    var serializationService = new SerializationService(registry, mock(UserObjectSerializationContext.class));
    var messageFactory = new NetworkMessagesFactory();
    UUID launchId = UUID.randomUUID();
    String consistentId = UUID.randomUUID().toString();
    networkConfiguration.port().update(port).join();
    NetworkView cfg = networkConfiguration.value();
    NettyBootstrapFactory bootstrapFactory = new NettyBootstrapFactory(networkConfiguration, consistentId);
    bootstrapFactory.start();
    startedBootstrapFactories.add(bootstrapFactory);
    var manager = new ConnectionManager(cfg, serializationService, consistentId, () -> new RecoveryServerHandshakeManager(launchId, consistentId, messageFactory), () -> new RecoveryClientHandshakeManager(launchId, consistentId, messageFactory), bootstrapFactory);
    manager.start();
    startedManagers.add(manager);
    return manager;
}
Also used : TestMessageSerializationRegistryImpl(org.apache.ignite.network.TestMessageSerializationRegistryImpl) NettyBootstrapFactory(org.apache.ignite.network.NettyBootstrapFactory) ConnectionManager(org.apache.ignite.internal.network.netty.ConnectionManager) NetworkMessagesFactory(org.apache.ignite.internal.network.NetworkMessagesFactory) SerializationService(org.apache.ignite.internal.network.serialization.SerializationService) UUID(java.util.UUID) UserObjectSerializationContext(org.apache.ignite.internal.network.serialization.UserObjectSerializationContext) NetworkView(org.apache.ignite.configuration.schemas.network.NetworkView)

Example 2 with TestMessageSerializationRegistryImpl

use of org.apache.ignite.network.TestMessageSerializationRegistryImpl in project ignite-3 by apache.

the class ItRecoveryHandshakeTest method startManager.

/**
 * Starts a {@link ConnectionManager} adding it to the {@link #startedManagers} list.
 *
 * @param port                  Port for the server.
 * @param serverHandshakeFailAt At what stage to fail server handshake.
 * @param clientHandshakeFailAt At what stage to fail client handshake.
 * @return Connection manager.
 */
private ConnectionManager startManager(int port, ServerStageFail serverHandshakeFailAt, ClientStageFail clientHandshakeFailAt) {
    var registry = new TestMessageSerializationRegistryImpl();
    var serializationService = new SerializationService(registry, mock(UserObjectSerializationContext.class));
    var messageFactory = new NetworkMessagesFactory();
    UUID launchId = UUID.randomUUID();
    String consistentId = UUID.randomUUID().toString();
    networkConfiguration.port().update(port).join();
    NetworkView cfg = networkConfiguration.value();
    NettyBootstrapFactory bootstrapFactory = new NettyBootstrapFactory(networkConfiguration, consistentId);
    bootstrapFactory.start();
    startedBootstrapFactories.add(bootstrapFactory);
    var manager = new ConnectionManager(cfg, serializationService, consistentId, () -> new FailingRecoveryServerHandshakeManager(launchId, consistentId, serverHandshakeFailAt, messageFactory), () -> new FailingRecoveryClientHandshakeManager(launchId, consistentId, clientHandshakeFailAt, messageFactory), bootstrapFactory);
    manager.start();
    startedManagers.add(manager);
    return manager;
}
Also used : TestMessageSerializationRegistryImpl(org.apache.ignite.network.TestMessageSerializationRegistryImpl) NettyBootstrapFactory(org.apache.ignite.network.NettyBootstrapFactory) ConnectionManager(org.apache.ignite.internal.network.netty.ConnectionManager) NetworkMessagesFactory(org.apache.ignite.internal.network.NetworkMessagesFactory) SerializationService(org.apache.ignite.internal.network.serialization.SerializationService) UUID(java.util.UUID) UserObjectSerializationContext(org.apache.ignite.internal.network.serialization.UserObjectSerializationContext) NetworkView(org.apache.ignite.configuration.schemas.network.NetworkView)

Aggregations

UUID (java.util.UUID)2 NetworkView (org.apache.ignite.configuration.schemas.network.NetworkView)2 NetworkMessagesFactory (org.apache.ignite.internal.network.NetworkMessagesFactory)2 ConnectionManager (org.apache.ignite.internal.network.netty.ConnectionManager)2 SerializationService (org.apache.ignite.internal.network.serialization.SerializationService)2 UserObjectSerializationContext (org.apache.ignite.internal.network.serialization.UserObjectSerializationContext)2 NettyBootstrapFactory (org.apache.ignite.network.NettyBootstrapFactory)2 TestMessageSerializationRegistryImpl (org.apache.ignite.network.TestMessageSerializationRegistryImpl)2