Search in sources :

Example 1 with TestClusterService

use of io.atomix.cluster.TestClusterService in project atomix by atomix.

the class PrimaryBackupTest method createClient.

/**
 * Creates a Raft client.
 */
private PrimaryBackupClient createClient() throws Throwable {
    NodeId nodeId = nextNodeId();
    PrimaryBackupClient client = PrimaryBackupClient.builder().withClientName("test").withClusterService(new TestClusterService(nodeId, nodes)).withSessionIdProvider(() -> CompletableFuture.completedFuture(nextSessionId())).withPrimaryElection(election).withProtocol(protocolFactory.newClientProtocol(nodeId)).build();
    clients.add(client);
    return client;
}
Also used : TestClusterService(io.atomix.cluster.TestClusterService) NodeId(io.atomix.cluster.NodeId)

Example 2 with TestClusterService

use of io.atomix.cluster.TestClusterService in project atomix by atomix.

the class PrimaryBackupTest method createServer.

/**
 * Creates a Raft server.
 */
private PrimaryBackupServer createServer(NodeId nodeId) {
    PrimaryBackupServer server = PrimaryBackupServer.builder().withServerName("test").withProtocol(protocolFactory.newServerProtocol(nodeId)).withClusterService(new TestClusterService(nodeId, nodes)).withMemberGroupProvider(MemberGroupStrategy.NODE_AWARE).withPrimaryElection(election).addPrimitiveType(TestPrimitiveType.INSTANCE).build();
    servers.add(server);
    return server;
}
Also used : TestClusterService(io.atomix.cluster.TestClusterService)

Aggregations

TestClusterService (io.atomix.cluster.TestClusterService)2 NodeId (io.atomix.cluster.NodeId)1