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;
}
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;
}
Aggregations