Example #1
0
 // Fail adding a channel to Non-Existent Room
 @Test(expected = IOException.class)
 public void testSendMessageToNonExistentRoom() throws IOException {
   quorum1 = new Quorum("q1test", hive, channel1);
   quorum1.removeChannel(channel1);
   Utility.pause(500);
   quorum1.addChannel(channel2);
   fail();
 }
Example #2
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());
  }
Example #3
0
  // Remove Channel from Quorum
  @Test
  public void testChannelRemoval() 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(channel3);
    assertTrue(quorum1.getList().getNodesMap().containsValue(channel2));
    assertTrue(quorum1.getList().getNodesMap().containsValue(channel1));
    assertFalse(quorum1.getList().getNodesMap().containsValue(channel3));
  }