Examples of BroadcastGroup


Examples of org.hornetq.core.server.cluster.BroadcastGroup

      String node2 = "node-2::" + RandomUtil.randomString();

      String node3 = "node-3::" + RandomUtil.randomString();

      BroadcastGroup bg1 = new BroadcastGroupImpl(node1,
                                                  RandomUtil.randomString(),
                                                  null,
                                                  -1,
                                                  groupAddress1,
                                                  groupPort1,
                                                  true);

      BroadcastGroup bg2 = new BroadcastGroupImpl(node2,
                                                  RandomUtil.randomString(),
                                                  null,
                                                  -1,
                                                  groupAddress2,
                                                  groupPort2,
                                                  true);

      BroadcastGroup bg3 = new BroadcastGroupImpl(node3,
                                                  RandomUtil.randomString(),
                                                  null,
                                                  -1,
                                                  groupAddress3,
                                                  groupPort3,
                                                  true);
      bg2.start();
      bg1.start();
      bg3.start();

      TransportConfiguration live1 = generateTC("live1");

      TransportConfiguration live2 = generateTC("live2");

      TransportConfiguration live3 = generateTC("live3");

      bg1.addConnector(live1);
      bg2.addConnector(live2);
      bg3.addConnector(live3);

      DiscoveryGroup dg1 = new DiscoveryGroupImpl("group-1::" + RandomUtil.randomString(),
                                                  "group-1::" + RandomUtil.randomString(),
                                                  null,
                                                  groupAddress1,
                                                  groupPort1,
                                                  timeout);
      dg1.start();

      DiscoveryGroup dg2 = new DiscoveryGroupImpl("group-2::" + RandomUtil.randomString(),
                                                  "group-2::" + RandomUtil.randomString(),
                                                  null,
                                                  groupAddress2,
                                                  groupPort2,
                                                  timeout);
      dg2.start();

      DiscoveryGroup dg3 = new DiscoveryGroupImpl("group-3::" + RandomUtil.randomString(),
                                                  "group-3::" + RandomUtil.randomString(),
                                                  null,
                                                  groupAddress3,
                                                  groupPort3,
                                                  timeout);
      dg3.start();

      bg1.broadcastConnectors();

      bg2.broadcastConnectors();

      bg3.broadcastConnectors();

      boolean ok = dg1.waitForBroadcast(timeout);
      Assert.assertTrue(ok);
      List<DiscoveryEntry> entries = dg1.getDiscoveryEntries();
      assertEqualsDiscoveryEntries(Arrays.asList(live1), entries);

      ok = dg2.waitForBroadcast(timeout);
      Assert.assertTrue(ok);
      entries = dg2.getDiscoveryEntries();
      assertEqualsDiscoveryEntries(Arrays.asList(live2), entries);

      ok = dg3.waitForBroadcast(timeout);
      Assert.assertTrue(ok);
      entries = dg3.getDiscoveryEntries();
      assertEqualsDiscoveryEntries(Arrays.asList(live3), entries);

      bg1.stop();
      bg2.stop();
      bg3.stop();

      dg1.stop();
      dg2.stop();
      dg3.stop();
   }
View Full Code Here

Examples of org.hornetq.core.server.cluster.BroadcastGroup

      final int groupPort = getUDPDiscoveryPort();
      final int timeout = 500;

      String nodeID = RandomUtil.randomString();

      BroadcastGroup bg = new BroadcastGroupImpl(nodeID,
                                                 RandomUtil.randomString(),
                                                 null,
                                                 -1,
                                                 groupAddress,
                                                 groupPort,
                                                 true);

      bg.start();

      TransportConfiguration live1 = generateTC();

      bg.addConnector(live1);

      DiscoveryGroup dg = new DiscoveryGroupImpl(RandomUtil.randomString(),
                                                 RandomUtil.randomString(),
                                                 null,
                                                 groupAddress,
                                                 groupPort,
                                                 timeout);

      MyListener listener1 = new MyListener();
      MyListener listener2 = new MyListener();
      MyListener listener3 = new MyListener();

      dg.registerListener(listener1);
      dg.registerListener(listener2);
      dg.registerListener(listener3);

      dg.start();

      bg.broadcastConnectors();
      boolean ok = dg.waitForBroadcast(1000);
      Assert.assertTrue(ok);

      Assert.assertTrue(listener1.called);
      Assert.assertTrue(listener2.called);
      Assert.assertTrue(listener3.called);

      listener1.called = false;
      listener2.called = false;
      listener3.called = false;

      bg.broadcastConnectors();
      ok = dg.waitForBroadcast(1000);
      Assert.assertTrue(ok);

      // Won't be called since connectors haven't changed
      Assert.assertFalse(listener1.called);
      Assert.assertFalse(listener2.called);
      Assert.assertFalse(listener3.called);

      bg.stop();

      dg.stop();
   }
View Full Code Here

Examples of org.hornetq.core.server.cluster.BroadcastGroup

      String node1 = RandomUtil.randomString();
      String node2 = RandomUtil.randomString();
      String node3 = RandomUtil.randomString();

      BroadcastGroup bg1 = new BroadcastGroupImpl(node1,
                                                  RandomUtil.randomString(),
                                                  null,
                                                  -1,
                                                  groupAddress,
                                                  groupPort,
                                                  true);
      bg1.start();

      BroadcastGroup bg2 = new BroadcastGroupImpl(node2,
                                                  RandomUtil.randomString(),
                                                  null,
                                                  -1,
                                                  groupAddress,
                                                  groupPort,
                                                  true);
      bg2.start();

      BroadcastGroup bg3 = new BroadcastGroupImpl(node3,
                                                  RandomUtil.randomString(),
                                                  null,
                                                  -1,
                                                  groupAddress,
                                                  groupPort,
                                                  true);
      bg3.start();

      TransportConfiguration live1 = generateTC();
      bg1.addConnector(live1);

      TransportConfiguration live2 = generateTC();
      bg2.addConnector(live2);

      TransportConfiguration live3 = generateTC();
      bg3.addConnector(live3);

      DiscoveryGroup dg = new DiscoveryGroupImpl(RandomUtil.randomString(),
                                                 RandomUtil.randomString(),
                                                 null,
                                                 groupAddress,
                                                 groupPort,
                                                 timeout);

      MyListener listener1 = new MyListener();
      dg.registerListener(listener1);
      MyListener listener2 = new MyListener();
      dg.registerListener(listener2);

      dg.start();

      bg1.broadcastConnectors();
      boolean ok = dg.waitForBroadcast(1000);
      Assert.assertTrue(ok);
      List<DiscoveryEntry> entries = dg.getDiscoveryEntries();
      assertEqualsDiscoveryEntries(Arrays.asList(live1), entries);
      Assert.assertTrue(listener1.called);
      Assert.assertTrue(listener2.called);
      listener1.called = false;
      listener2.called = false;

      bg2.broadcastConnectors();
      ok = dg.waitForBroadcast(1000);
      Assert.assertTrue(ok);
      entries = dg.getDiscoveryEntries();
      assertEqualsDiscoveryEntries(Arrays.asList(live1, live2), entries);
      Assert.assertTrue(listener1.called);
      Assert.assertTrue(listener2.called);
      listener1.called = false;
      listener2.called = false;

      bg3.broadcastConnectors();
      ok = dg.waitForBroadcast(1000);
      Assert.assertTrue(ok);
      entries = dg.getDiscoveryEntries();
      assertEqualsDiscoveryEntries(Arrays.asList(live1, live2, live3), entries);
      Assert.assertTrue(listener1.called);
      Assert.assertTrue(listener2.called);
      listener1.called = false;
      listener2.called = false;

      bg1.broadcastConnectors();
      ok = dg.waitForBroadcast(1000);
      Assert.assertTrue(ok);
      entries = dg.getDiscoveryEntries();
      assertEqualsDiscoveryEntries(Arrays.asList(live1, live2, live3), entries);
      Assert.assertFalse(listener1.called);
      Assert.assertFalse(listener2.called);
      listener1.called = false;
      listener2.called = false;

      bg2.broadcastConnectors();
      ok = dg.waitForBroadcast(1000);
      Assert.assertTrue(ok);
      entries = dg.getDiscoveryEntries();
      assertEqualsDiscoveryEntries(Arrays.asList(live1, live2, live3), entries);
      Assert.assertFalse(listener1.called);
      Assert.assertFalse(listener2.called);
      listener1.called = false;
      listener2.called = false;

      bg3.broadcastConnectors();
      ok = dg.waitForBroadcast(1000);
      Assert.assertTrue(ok);
      entries = dg.getDiscoveryEntries();
      assertEqualsDiscoveryEntries(Arrays.asList(live1, live2, live3), entries);
      Assert.assertFalse(listener1.called);
      Assert.assertFalse(listener2.called);
      listener1.called = false;
      listener2.called = false;

      bg2.removeConnector(live2);
      bg2.broadcastConnectors();
      ok = dg.waitForBroadcast(1000);
      Assert.assertTrue(ok);

      // Connector2 should still be there since not timed out yet

      entries = dg.getDiscoveryEntries();
      assertEqualsDiscoveryEntries(Arrays.asList(live1, live2, live3), entries);
      Assert.assertFalse(listener1.called);
      Assert.assertFalse(listener2.called);
      listener1.called = false;
      listener2.called = false;

      Thread.sleep(timeout);

      bg1.broadcastConnectors();
      ok = dg.waitForBroadcast(1000);
      bg2.broadcastConnectors();
      ok = dg.waitForBroadcast(1000);
      bg3.broadcastConnectors();
      ok = dg.waitForBroadcast(1000);

      entries = dg.getDiscoveryEntries();
      assertEqualsDiscoveryEntries(Arrays.asList(live1, live3), entries);
      Assert.assertTrue(listener1.called);
      Assert.assertTrue(listener2.called);
      listener1.called = false;
      listener2.called = false;

      bg1.removeConnector(live1);
      bg3.removeConnector(live3);

      Thread.sleep(timeout);

      bg1.broadcastConnectors();
      ok = dg.waitForBroadcast(1000);
      bg2.broadcastConnectors();
      ok = dg.waitForBroadcast(1000);
      bg3.broadcastConnectors();
      ok = dg.waitForBroadcast(1000);

      entries = dg.getDiscoveryEntries();
      Assert.assertNotNull(entries);
      Assert.assertEquals(0, entries.size());
      Assert.assertTrue(listener1.called);
      Assert.assertTrue(listener2.called);
      listener1.called = false;
      listener2.called = false;

      bg1.broadcastConnectors();
      ok = dg.waitForBroadcast(1000);
      bg2.broadcastConnectors();
      ok = dg.waitForBroadcast(1000);
      bg3.broadcastConnectors();
      ok = dg.waitForBroadcast(1000);

      entries = dg.getDiscoveryEntries();
      Assert.assertNotNull(entries);
      Assert.assertEquals(0, entries.size());
      Assert.assertFalse(listener1.called);
      Assert.assertFalse(listener2.called);

      bg1.stop();
      bg2.stop();
      bg3.stop();

      dg.stop();
   }
View Full Code Here

Examples of org.hornetq.core.server.cluster.BroadcastGroup

      final int groupPort = getUDPDiscoveryPort();
      final int timeout = 500;

      String nodeID = RandomUtil.randomString();

      BroadcastGroup bg = new BroadcastGroupImpl(nodeID,
                                                 RandomUtil.randomString(),
                                                 null,
                                                 -1,
                                                 groupAddress,
                                                 groupPort,
                                                 true);

      bg.start();

      TransportConfiguration live1 = generateTC();

      bg.addConnector(live1);

      DiscoveryGroup dg1 = new DiscoveryGroupImpl(RandomUtil.randomString(),
                                                  RandomUtil.randomString(),
                                                  null,
                                                  groupAddress,
                                                  groupPort,
                                                  timeout);

      DiscoveryGroup dg2 = new DiscoveryGroupImpl(RandomUtil.randomString(),
                                                  RandomUtil.randomString(),
                                                  null,
                                                  groupAddress,
                                                  groupPort,
                                                  timeout);

      DiscoveryGroup dg3 = new DiscoveryGroupImpl(RandomUtil.randomString(),
                                                  RandomUtil.randomString(),
                                                  null,
                                                  groupAddress,
                                                  groupPort,
                                                  timeout);

      dg1.start();
      dg2.start();
      dg3.start();

      bg.broadcastConnectors();

      boolean ok = dg1.waitForBroadcast(1000);
      Assert.assertTrue(ok);
      List<DiscoveryEntry> entries = dg1.getDiscoveryEntries();
      assertEqualsDiscoveryEntries(Arrays.asList(live1), entries);

      ok = dg2.waitForBroadcast(1000);
      Assert.assertTrue(ok);
      entries = dg2.getDiscoveryEntries();
      assertEqualsDiscoveryEntries(Arrays.asList(live1), entries);

      ok = dg3.waitForBroadcast(1000);
      Assert.assertTrue(ok);
      entries = dg3.getDiscoveryEntries();
      assertEqualsDiscoveryEntries(Arrays.asList(live1), entries);

      bg.stop();

      dg1.stop();
      dg2.stop();
      dg3.stop();
   }
View Full Code Here

Examples of org.hornetq.core.server.cluster.BroadcastGroup

      notifService.addNotificationListener(notifListener);

      final InetAddress groupAddress = InetAddress.getByName(address1);
      final int groupPort = getUDPDiscoveryPort();

      BroadcastGroup bg = new BroadcastGroupImpl(RandomUtil.randomString(),
                                                 RandomUtil.randomString(),
                                                 null,
                                                 -1,
                                                 groupAddress,
                                                 groupPort,
                                                 true);
      bg.setNotificationService(notifService);

      Assert.assertEquals(0, notifListener.getNotifications().size());

      bg.start();

      Assert.assertEquals(1, notifListener.getNotifications().size());
      Notification notif = notifListener.getNotifications().get(0);
      Assert.assertEquals(NotificationType.BROADCAST_GROUP_STARTED, notif.getType());
      Assert.assertEquals(bg.getName(), notif.getProperties()
                                             .getSimpleStringProperty(new SimpleString("name"))
                                             .toString());

      bg.stop();

      Assert.assertEquals(2, notifListener.getNotifications().size());
      notif = notifListener.getNotifications().get(1);
      Assert.assertEquals(NotificationType.BROADCAST_GROUP_STOPPED, notif.getType());
      Assert.assertEquals(bg.getName(), notif.getProperties()
                                             .getSimpleStringProperty(new SimpleString("name"))
                                             .toString());
   }
View Full Code Here

Examples of org.hornetq.core.server.cluster.BroadcastGroup

      final int groupPort = getUDPDiscoveryPort();
      final int timeout = 500;

      final String nodeID = RandomUtil.randomString();

      BroadcastGroup bg = new BroadcastGroupImpl(nodeID,
                                                 RandomUtil.randomString(),
                                                 null,
                                                 -1,
                                                 groupAddress,
                                                 groupPort,
                                                 true);

      bg.start();

      TransportConfiguration live1 = generateTC();

      bg.addConnector(live1);

      DiscoveryGroup dg = new DiscoveryGroupImpl(RandomUtil.randomString(),
                                                 RandomUtil.randomString(),
                                                 null,
                                                 groupAddress,
                                                 groupPort,
                                                 timeout);

      dg.start();

      bg.broadcastConnectors();

      boolean ok = dg.waitForBroadcast(1000);

      Assert.assertTrue(ok);

      List<DiscoveryEntry> entries = dg.getDiscoveryEntries();
      assertEqualsDiscoveryEntries(Arrays.asList(live1), entries);

      bg.stop();

      dg.stop();

   }
View Full Code Here

Examples of org.jboss.as.console.client.shared.subsys.messaging.model.BroadcastGroup

                    List<Property> model = response.get(RESULT).asPropertyList();
                    List<BroadcastGroup> groups = new ArrayList<BroadcastGroup>();
                    for(Property prop : model)
                    {
                        ModelNode node = prop.getValue();
                        BroadcastGroup entity = bcastGroupAdapter.fromDMR(node);
                        entity.setName(prop.getName());

                        entity.setConnectors(EntityAdapter.modelToList(node, "connectors"));
                        groups.add(entity);
                    }

                    getView().setBroadcastGroups(groups);
View Full Code Here

Examples of org.jboss.as.console.client.shared.subsys.messaging.model.BroadcastGroup

                    List<Property> model = response.get(RESULT).asPropertyList();
                    List<BroadcastGroup> groups = new ArrayList<BroadcastGroup>();
                    for(Property prop : model)
                    {
                        ModelNode node = prop.getValue();
                        BroadcastGroup entity = bcastGroupAdapter.fromDMR(node);
                        entity.setName(prop.getName());

                        entity.setConnectors(EntityAdapter.modelToList(node, "connectors"));
                        groups.add(entity);
                    }

                    getView().setBroadcastGroups(groups);
View Full Code Here

Examples of org.jboss.as.console.client.shared.subsys.messaging.model.BroadcastGroup

                    List<Property> model = response.get(RESULT).asPropertyList();
                    List<BroadcastGroup> groups = new ArrayList<BroadcastGroup>();
                    for(Property prop : model)
                    {
                        ModelNode node = prop.getValue();
                        BroadcastGroup entity = bcastGroupAdapter.fromDMR(node);
                        entity.setName(prop.getName());

                        entity.setConnectors(EntityAdapter.modelToList(node, "connectors"));
                        groups.add(entity);
                    }

                    getView().setBroadcastGroups(groups);
View Full Code Here

Examples of org.jboss.as.console.client.shared.subsys.messaging.model.BroadcastGroup

                    List<Property> model = response.get(RESULT).asPropertyList();
                    List<BroadcastGroup> groups = new ArrayList<BroadcastGroup>();
                    for(Property prop : model)
                    {
                        ModelNode node = prop.getValue();
                        BroadcastGroup entity = bcastGroupAdapter.fromDMR(node);
                        entity.setName(prop.getName());

                        entity.setConnectors(EntityAdapter.modelToList(node, "connectors"));
                        groups.add(entity);
                    }

                    getView().setBroadcastGroups(groups);
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.