use of org.apache.activemq.artemis.core.server.cluster.qourum.QuorumVoteServerConnect in project activemq-artemis by apache.
the class QuorumVoteServerConnectTest method testSuccessfulVote.
@Test
public void testSuccessfulVote() {
QuorumVoteServerConnect quorum = new QuorumVoteServerConnect(size, "foo");
for (int i = 0; i < trueVotes - 1; i++) {
quorum.vote(new ServerConnectVote("foo", true));
}
if (size > 1) {
assertFalse(quorum.getDecision());
}
quorum = new QuorumVoteServerConnect(size, "foo");
for (int i = 0; i < trueVotes; i++) {
quorum.vote(new ServerConnectVote("foo", true));
}
assertTrue(quorum.getDecision());
}
use of org.apache.activemq.artemis.core.server.cluster.qourum.QuorumVoteServerConnect in project activemq-artemis by apache.
the class QuorumVoteServerConnectTest method testUnSuccessfulVote.
@Test
public void testUnSuccessfulVote() {
QuorumVoteServerConnect quorum = new QuorumVoteServerConnect(size, "foo");
for (int i = 0; i < trueVotes - 1; i++) {
quorum.vote(new ServerConnectVote("foo", true));
}
if (size > 1) {
assertFalse(quorum.getDecision());
}
quorum = new QuorumVoteServerConnect(size, "foo");
for (int i = 0; i < trueVotes - 1; i++) {
quorum.vote(new ServerConnectVote("foo", true));
}
if (size == 1) {
assertTrue(quorum.getDecision());
} else {
assertFalse(quorum.getDecision());
}
}
Aggregations