activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [1/2] activemq-artemis git commit: ARTEMIS-742 = test fixes
Date Fri, 23 Sep 2016 13:04:40 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 42fa3931e -> 590578b3e


 ARTEMIS-742 = test fixes

https://issues.apache.org/jira/browse/ARTEMIS-742


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/4c1d9e2c
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/4c1d9e2c
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/4c1d9e2c

Branch: refs/heads/master
Commit: 4c1d9e2c0f5799477b002a1fb643b8acf554fc4b
Parents: 42fa393
Author: Andy Taylor <andy.tayls67@gmail.com>
Authored: Fri Sep 23 08:17:56 2016 +0100
Committer: Andy Taylor <andy.tayls67@gmail.com>
Committed: Fri Sep 23 08:18:03 2016 +0100

----------------------------------------------------------------------
 .../failover/QuorumVoteServerConnectTest.java   | 31 ++++++++++++++++----
 1 file changed, 25 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/4c1d9e2c/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/QuorumVoteServerConnectTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/QuorumVoteServerConnectTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/QuorumVoteServerConnectTest.java
index 283705b..aeb3009 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/QuorumVoteServerConnectTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/QuorumVoteServerConnectTest.java
@@ -35,7 +35,7 @@ public class QuorumVoteServerConnectTest extends ActiveMQTestBase {
 
    @Parameterized.Parameters(name = "size={0} trueVotes={1}")
    public static Collection primeNumbers() {
-      return Arrays.asList(new Object[][]{{1, 0}, {2, 0}, {3, 1}, {4, 2}, {5, 3}, {6, 3},
{7, 4}, {8, 4}, {9, 5}, {10, 5}});
+      return Arrays.asList(new Object[][]{{1, 0}, {2, 1}, {3, 2}, {4, 3}, {5, 3}, {6, 4},
{7, 4}, {8, 5}, {9, 5}, {10, 6}});
    }
 
    public QuorumVoteServerConnectTest(int size, int trueVotes) {
@@ -45,16 +45,13 @@ public class QuorumVoteServerConnectTest extends ActiveMQTestBase {
    }
 
    @Test
-   public void testClusterSize() {
+   public void testSuccessfulVote() {
       QuorumVoteServerConnect quorum = new QuorumVoteServerConnect(size, new FakeStorageManager());
       for (int i = 0; i < trueVotes - 1; i++) {
          quorum.vote(new BooleanVote(true));
       }
 
-      if (size <= 2) {
-         assertTrue(quorum.getDecision());
-      }
-      else {
+      if (size > 1) {
          assertFalse(quorum.getDecision());
       }
       quorum = new QuorumVoteServerConnect(size, new FakeStorageManager());
@@ -63,4 +60,26 @@ public class QuorumVoteServerConnectTest extends ActiveMQTestBase {
       }
       assertTrue(quorum.getDecision());
    }
+
+   @Test
+   public void testUnSuccessfulVote() {
+      QuorumVoteServerConnect quorum = new QuorumVoteServerConnect(size, new FakeStorageManager());
+      for (int i = 0; i < trueVotes - 1; i++) {
+         quorum.vote(new BooleanVote(true));
+      }
+
+      if (size > 1) {
+         assertFalse(quorum.getDecision());
+      }
+      quorum = new QuorumVoteServerConnect(size, new FakeStorageManager());
+      for (int i = 0; i < trueVotes - 1; i++) {
+         quorum.vote(new BooleanVote(true));
+      }
+      if (size == 1) {
+         assertTrue(quorum.getDecision());
+      }
+      else {
+         assertFalse(quorum.getDecision());
+      }
+   }
 }


Mime
View raw message