use of io.atomix.cluster.TestClusterMembershipService in project atomix by atomix.
the class PrimaryBackupTest method createClient.
/**
* Creates a Raft client.
*/
private PrimaryBackupClient createClient() throws Throwable {
MemberId memberId = nextMemberId();
PrimaryBackupClient client = PrimaryBackupClient.builder().withClientName("test").withPartitionId(PartitionId.from("test", 1)).withMembershipService(new TestClusterMembershipService(memberId, nodes)).withSessionIdProvider(() -> CompletableFuture.completedFuture(nextSessionId())).withPrimaryElection(election).withProtocol(protocolFactory.newClientProtocol(memberId)).build();
clients.add(client);
return client;
}
use of io.atomix.cluster.TestClusterMembershipService in project atomix by atomix.
the class DistributedLogTest method createClient.
/**
* Creates a Raft client.
*/
private DistributedLogSessionClient createClient() throws Throwable {
MemberId memberId = nextMemberId();
DistributedLogSessionClient client = DistributedLogSessionClient.builder().withClientName("test").withPartitionId(PartitionId.from("test", 1)).withMembershipService(new TestClusterMembershipService(memberId, nodes)).withSessionIdProvider(() -> CompletableFuture.completedFuture(nextSessionId())).withPrimaryElection(election).withProtocol(protocolFactory.newClientProtocol(memberId)).build();
clients.add(client);
return client;
}
use of io.atomix.cluster.TestClusterMembershipService in project atomix by atomix.
the class DistributedLogTest method createServer.
/**
* Creates a Raft server.
*/
private DistributedLogServer createServer(MemberId memberId) {
DistributedLogServer server = DistributedLogServer.builder().withServerName("test").withProtocol(protocolFactory.newServerProtocol(memberId)).withMembershipService(new TestClusterMembershipService(memberId, nodes)).withMemberGroupProvider(MemberGroupStrategy.NODE_AWARE).withPrimaryElection(election).withDirectory(new File("target/test-logs", memberId.id())).withMaxSegmentSize(1024 * 8).withMaxLogSize(1024).withMaxLogAge(Duration.ofMillis(10)).build();
servers.add(server);
return server;
}
Aggregations