Package net.kuujo.copycat.test

Examples of net.kuujo.copycat.test.TestNode.instance()


      .withLastApplied(6);
    cluster.addNode(node3);

    cluster.start();

    node3.instance().cluster().config().addRemoteMember(new Member("foobarbaz"));

    // First, the leader should have replicated a join configuration.
    node1.await().membershipChange();
    Assert.assertNotNull(node1.instance().clusterManager().cluster().remoteMember("foobarbaz"));
    cluster.stop();
View Full Code Here


      .withLastApplied(6);
    cluster.addNode(node3);

    cluster.start();

    node3.instance().cluster().config().removeRemoteMember(new Member("foobarbaz"));

    // First, the leader should have replicated a join configuration.
    if (node1.instance().clusterManager().cluster().remoteMember("foobarbaz") == null) {
      Assert.assertNull(node1.instance().clusterManager().cluster().remoteMember("foobarbaz"));
    } else {
View Full Code Here

    TestCluster cluster = new TestCluster();
    TestNode node1 = new TestNode().withCluster("foo").withProtocol(protocol);
    cluster.addNode(node1);
    cluster.start();
    node1.await().electedLeader();
    Assert.assertTrue(node1.instance().isLeader());
    cluster.stop();
  }

  /**
   * Tests that a leader is elected in a double-node cluster.
View Full Code Here

    cluster.addNode(node1);
    TestNode node2 = new TestNode().withCluster("bar", "foo").withProtocol(protocol);
    cluster.addNode(node2);
    cluster.start();
    node1.await().leaderElected();
    Assert.assertTrue(node1.instance().isLeader() || node2.instance().isLeader());
    cluster.stop();
  }

  /**
   * Tests that a leader is elected in a triple-node cluster.
View Full Code Here

    cluster.addNode(node2);
    TestNode node3 = new TestNode().withCluster("baz", "foo", "bar").withProtocol(protocol);
    cluster.addNode(node3);
    cluster.start();
    node1.await().leaderElected();
    Assert.assertTrue(node1.instance().isLeader() || node2.instance().isLeader() || node3.instance().isLeader());
    cluster.stop();
  }

  /**
   * Tests that the candidate with the most up-to-date log is elected on startup.
View Full Code Here

    cluster.addNode(node2);

    cluster.start();

    node2.await().electedLeader();
    Assert.assertTrue(node2.instance().isLeader());
    cluster.stop();
  }

  /**
   * Tests that candidates restart an election during a split vote.
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.