Search in sources :

Example 1 with TestClusterMembershipService

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;
}
Also used : MemberId(io.atomix.cluster.MemberId) TestClusterMembershipService(io.atomix.cluster.TestClusterMembershipService)

Example 2 with TestClusterMembershipService

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;
}
Also used : MemberId(io.atomix.cluster.MemberId) TestClusterMembershipService(io.atomix.cluster.TestClusterMembershipService)

Example 3 with TestClusterMembershipService

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;
}
Also used : TestClusterMembershipService(io.atomix.cluster.TestClusterMembershipService) File(java.io.File)

Aggregations

TestClusterMembershipService (io.atomix.cluster.TestClusterMembershipService)3 MemberId (io.atomix.cluster.MemberId)2 File (java.io.File)1