Package net.kuujo.vertigo.network

Examples of net.kuujo.vertigo.network.NetworkConfig.createConnection()


          // We can create four instances of the "receiver" and Vertigo will still
          // ensure that each file is sent to the same "receiver" instance.
          network.addVerticle("receiver", FileReceiver.class.getName(), 4);

          // Create a connection between "sender" and "receiver" via the "file" port.
          network.createConnection("sender", "file", "receiver", "file");

          // Now deploy the network to the cluster.
          Cluster cluster = result.result();
          cluster.deployNetwork(network, new Handler<AsyncResult<ActiveNetwork>>() {
            @Override
View Full Code Here


  }

  @Test
  public void testCreateConnectionDefaultPort() {
    NetworkConfig network = new DefaultNetworkConfig("test");
    ConnectionConfig connection = network.createConnection("foo", "bar");
    assertEquals("foo", connection.getSource().getComponent());
    assertEquals("out", connection.getSource().getPort());
    assertEquals("bar", connection.getTarget().getComponent());
    assertEquals("in", connection.getTarget().getPort());
  }
View Full Code Here

  }

  @Test
  public void testDestroyConnection() {
    NetworkConfig network = new DefaultNetworkConfig("test");
    ConnectionConfig connection = network.createConnection("foo", "bar");
    network.destroyConnection("foo", "bar");
    boolean exists = false;
    for (ConnectionConfig other : network.getConnections()) {
      if (other.equals(connection)) {
        exists = true;
View Full Code Here

  public void testMergeNetworks() {
    NetworkConfig network1 = new DefaultNetworkConfig("test");
    network1.addComponent("foo", "foo.py", 2);
    NetworkConfig network2 = new DefaultNetworkConfig("test");
    network2.addComponent("bar", "bar.js", 4);
    network2.createConnection("foo", "bar");
    NetworkConfig network3 = Configs.mergeNetworks(network1, network2);
    assertTrue(network3.hasComponent("foo"));
    assertTrue(network3.hasComponent("bar"));
    boolean exists = false;
    for (ConnectionConfig connection : network3.getConnections()) {
View Full Code Here

  @Test
  public void testUnmergeNetworks() {
    NetworkConfig network1 = new DefaultNetworkConfig("test");
    network1.addComponent("foo", "foo.py", 2);
    network1.addComponent("bar", "bar.js", 4);
    network1.createConnection("foo", "bar");
    NetworkConfig network2 = new DefaultNetworkConfig("test");
    network2.addComponent("bar", "bar.js", 4);
    network2.createConnection("foo", "bar");
    NetworkConfig network3 = Configs.unmergeNetworks(network1, network2);
    assertTrue(network3.hasComponent("foo"));
View Full Code Here

    network1.addComponent("foo", "foo.py", 2);
    network1.addComponent("bar", "bar.js", 4);
    network1.createConnection("foo", "bar");
    NetworkConfig network2 = new DefaultNetworkConfig("test");
    network2.addComponent("bar", "bar.js", 4);
    network2.createConnection("foo", "bar");
    NetworkConfig network3 = Configs.unmergeNetworks(network1, network2);
    assertTrue(network3.hasComponent("foo"));
    assertFalse(network3.hasComponent("bar"));
    boolean exists = false;
    for (ConnectionConfig connection : network3.getConnections()) {
View Full Code Here

        // Deploy a network with a single component and connection. The connection
        // doesn't go anywhere, so messages sent to the sender's "out" port will
        // simply be discarded.
        NetworkConfig network = vertigo.createNetwork(name);
        network.addVerticle("sender", TestReconfigureSender.class.getName());
        network.createConnection("sender", "out", "receiver", "in");
        cluster.deployNetwork(network, new Handler<AsyncResult<ActiveNetwork>>() {
          @Override
          public void handle(AsyncResult<ActiveNetwork> result) {
            if (result.failed()) {
              assertTrue(result.cause().getMessage(), result.succeeded());
View Full Code Here

        assertTrue(result.succeeded());
        final Cluster cluster = result.result();
        NetworkConfig network = vertigo.createNetwork(name);
        network.addVerticle("sender", TestSimpleSender.class.getName());
        network.addVerticle("receiver", TestSimpleReceiver.class.getName());
        network.createConnection("sender", "out", "receiver", "in");
        cluster.deployNetwork(network, new Handler<AsyncResult<ActiveNetwork>>() {
          @Override
          public void handle(AsyncResult<ActiveNetwork> result) {
            if (result.failed()) {
              assertTrue(result.cause().getMessage(), result.succeeded());
View Full Code Here

              // the same name as the original network and add the connection to it.
              // When the new configuration is deployed, Vertigo will recognize that
              // it has the same name as the running connection and merge the two
              // networks.
              NetworkConfig network = vertigo.createNetwork(name);
              network.createConnection("sender", "out", "receiver", "in");
              cluster.deployNetwork(network, new Handler<AsyncResult<ActiveNetwork>>() {
                @Override
                public void handle(AsyncResult<ActiveNetwork> result) {
                  if (result.failed()) {
                    assertTrue(result.cause().getMessage(), result.succeeded());
View Full Code Here

          Cluster cluster = result.result();

          NetworkConfig network = vertigo.createNetwork("word-count");
          network.addVerticle("word-feeder", WordFeeder.class.getName());
          network.addVerticle("word-counter", WordCounter.class.getName(), 4);
          network.createConnection("word-feeder", "word", "word-counter", "word").hashSelect();

          cluster.deployNetwork(network, new Handler<AsyncResult<ActiveNetwork>>() {
            @Override
            public void handle(AsyncResult<ActiveNetwork> result) {
              if (result.failed()) {
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.