Package net.kuujo.copycat.protocol

Examples of net.kuujo.copycat.protocol.LocalProtocol


  /**
   * Tests that the leader takes a snapshot of its state machine and compacts its log.
   */
  public void testLeaderTakesSnapshotAndCompactsLog() {
    Protocol<Member> protocol = new LocalProtocol();
    TestCluster cluster = new TestCluster();
    TestNode node1 = new TestNode()
      .withCluster("foo", "bar", "baz")
      .withProtocol(protocol)
      .withConfig(new CopycatConfig().withMaxLogSize(512))
View Full Code Here


  /**
   * Tests that a follower takes a snapshot of its state machine and compacts its log.
   */
  public void testFollowerTakesSnapshotAndCompactsLog() {
    Protocol<Member> protocol = new LocalProtocol();
    TestCluster cluster = new TestCluster();
    TestNode node1 = new TestNode()
      .withCluster("foo", "bar", "baz")
      .withProtocol(protocol)
      .withConfig(new CopycatConfig().withMaxLogSize(512))
View Full Code Here

  /**
   * Tests that the leader replicates its snapshot to far out of sync followers.
   */
  public void testLeaderReplicatesSnapshotToOutOfSyncFollowers() throws Exception {
    Protocol<Member> protocol = new LocalProtocol();

    TestLog log1 = new TestLog();
    log1.appendEntry(new ConfigurationEntry(1, new ClusterConfig()
      .withLocalMember(new Member("foo"))
      .withRemoteMembers(new Member("bar"), new Member("baz"))));
View Full Code Here

    Member remoteMember2 = new Member(new MemberConfig("baz"));
    remoteMembers.add(remoteMember1);
    remoteMembers.add(remoteMember2);
    config.setRemoteMembers(remoteMembers);
    Cluster<Member> cluster = new LocalCluster(config);
    ClusterManager<Member> clusterManager = new ClusterManager<>(cluster, new LocalProtocol());
    assertEquals(localMember, clusterManager.localNode().member());
    assertEquals(2, clusterManager.remoteNodes().size());
    assertEquals(remoteMember1, clusterManager.remoteNode("bar").member());
    assertEquals(remoteMember2, clusterManager.remoteNode("baz").member());
  }
View Full Code Here

    Member remoteMember2 = new Member(new MemberConfig("baz"));
    remoteMembers.add(remoteMember1);
    remoteMembers.add(remoteMember2);
    config.setRemoteMembers(remoteMembers);
    Cluster<Member> cluster = new LocalCluster(config);
    ClusterManager<Member> clusterManager = new ClusterManager<>(cluster, new LocalProtocol());
    assertEquals(localMember, clusterManager.localNode().member());
    assertEquals(2, clusterManager.remoteNodes().size());
    assertEquals(remoteMember1, clusterManager.remoteNode("bar").member());
    assertEquals(remoteMember2, clusterManager.remoteNode("baz").member());
    Member remoteMember3 = new Member(new MemberConfig("foobarbaz"));
View Full Code Here

    Member remoteMember2 = new Member(new MemberConfig("baz"));
    remoteMembers.add(remoteMember1);
    remoteMembers.add(remoteMember2);
    config.setRemoteMembers(remoteMembers);
    Cluster<Member> cluster = new LocalCluster(config);
    ClusterManager<Member> clusterManager = new ClusterManager<>(cluster, new LocalProtocol());
    assertEquals(localMember, clusterManager.localNode().member());
    assertEquals(2, clusterManager.remoteNodes().size());
    assertEquals(remoteMember1, clusterManager.remoteNode("bar").member());
    assertEquals(remoteMember2, clusterManager.remoteNode("baz").member());
    Member remoteMember3 = new Member(new MemberConfig("foobarbaz"));
View Full Code Here

TOP

Related Classes of net.kuujo.copycat.protocol.LocalProtocol

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.