Esempio n. 1
0
 // Verify that the Quorum Creation behave appropriately
 @Test
 public void testQuorumCreation() throws IOException {
   quorum1 = new Quorum("q1test", hive, channel1);
   assertEquals(quorum1.Id, "q1test");
   assertTrue(quorum1.getList().getNodesMap().containsValue(channel1));
   assertTrue(hive.contains("q1test"));
   assertTrue(quorum1.isAlive());
 }
Esempio n. 2
0
 // Verify that Duplicate Quourms added to the Hive Fails
 @Test
 public void testDuplicateQuorumFailure() {
   try {
     quorum1 = new Quorum("q1test", hive, channel1);
     quorumOne = new Quorum("q1test", hive, channel1);
     fail();
   } catch (IOException e) {
   }
   assertTrue(quorum1.getList().getNodesMap().containsValue(channel1));
   assertTrue(hive.contains("q1test"));
   assertTrue(hive.getQuorumsMap().containsValue(quorum1));
   assertFalse(hive.getQuorumsMap().containsValue(quorumOne));
   assertTrue(quorum1.isAlive());
 }
Esempio n. 3
0
  // Remove all channels from Quorum and verify that the Quorum is removed
  @Test
  public void testRemoveAllChannels() throws IOException {
    quorum1 = new Quorum("q1test", hive, channel1);
    quorum1.addChannel(channel2);
    assertTrue(quorum1.getList().getNodesMap().containsValue(channel2));
    quorum1.addChannel(channel3);
    assertTrue(quorum1.getList().getNodesMap().containsValue(channel3));

    quorum1.removeChannel(channel1);
    quorum1.removeChannel(channel2);
    quorum1.removeChannel(channel3);
    Utility.pause(500);

    assertFalse(quorum1.getList().getNodesMap().containsValue(channel2));
    assertFalse(quorum1.getList().getNodesMap().containsValue(channel1));
    assertFalse(quorum1.getList().getNodesMap().containsValue(channel3));

    assertFalse(hive.contains("q1test"));
    assertFalse(hive.getQuorumsMap().containsValue(quorum1));
    assertFalse(quorum1.isAlive());
  }