Package net.kuujo.vertigo.component

Examples of net.kuujo.vertigo.component.VerticleConfig


    assertEquals("test", network.getName());
  }

  @Test
  public void testVerticleDefaults() {
    VerticleConfig verticle = new DefaultVerticleConfig("test", "test.py", new DefaultNetworkConfig("test"));
    assertEquals("test", verticle.getName());
    assertTrue(verticle.getType().equals(ComponentConfig.Type.VERTICLE));
    assertEquals("test.py", verticle.getMain());
    assertEquals(new JsonObject(), verticle.getConfig());
    assertEquals(1, verticle.getInstances());
    assertFalse(verticle.isWorker());
    assertFalse(verticle.isMultiThreaded());
  }
View Full Code Here


    assertFalse(verticle.isMultiThreaded());
  }

  @Test
  public void testDefaultVerticleConfig() {
    VerticleConfig verticle = new DefaultVerticleConfig("test", "test.py", new DefaultNetworkConfig("test"));
    assertEquals("test", verticle.getName());
    assertTrue(verticle.getType().equals(ComponentConfig.Type.VERTICLE));
    assertEquals("test.py", verticle.getMain());
    verticle.setMain("foo.js");
    assertEquals("foo.js", verticle.getMain());
    assertEquals(new JsonObject(), verticle.getConfig());
    verticle.setConfig(new JsonObject().putString("foo", "bar"));
    assertEquals("bar", verticle.getConfig().getString("foo"));
    assertEquals(1, verticle.getInstances());
    verticle.setInstances(4);
    assertEquals(4, verticle.getInstances());
    verticle.setGroup("test");
    assertEquals("test", verticle.getGroup());
    assertFalse(verticle.isWorker());
    verticle.setWorker(true);
    assertTrue(verticle.isWorker());
    assertFalse(verticle.isMultiThreaded());
    verticle.setMultiThreaded(true);
    assertTrue(verticle.isMultiThreaded());
    verticle.setWorker(false);
    assertFalse(verticle.isMultiThreaded());
  }
View Full Code Here

  @Test
  public void testAddFeederVerticle() {
    NetworkConfig network = new DefaultNetworkConfig("test");
    assertEquals("test", network.getName());
    VerticleConfig verticle1 = network.addVerticle("verticle1", "verticle1.py");
    assertEquals("verticle1", verticle1.getName());
    assertTrue(verticle1.getType().equals(ComponentConfig.Type.VERTICLE));
    assertEquals("verticle1.py", verticle1.getMain());
    assertEquals(new JsonObject(), verticle1.getConfig());
    assertEquals(1, verticle1.getInstances());
    VerticleConfig verticle2 = network.addVerticle("verticle2", "verticle2.py", new JsonObject().putString("foo", "bar"));
    assertEquals("verticle2", verticle2.getName());
    assertTrue(verticle2.getType().equals(ComponentConfig.Type.VERTICLE));
    assertEquals("verticle2.py", verticle2.getMain());
    assertEquals("bar", verticle2.getConfig().getString("foo"));
    assertEquals(1, verticle2.getInstances());
    VerticleConfig verticle3 = network.addVerticle("verticle3", "verticle3.py", 2);
    assertEquals("verticle3", verticle3.getName());
    assertTrue(verticle3.getType().equals(ComponentConfig.Type.VERTICLE));
    assertEquals("verticle3.py", verticle3.getMain());
    assertEquals(new JsonObject(), verticle3.getConfig());
    assertEquals(2, verticle3.getInstances());
    VerticleConfig verticle4 = network.addVerticle("verticle4", "verticle4.py", new JsonObject().putString("foo", "bar"), 2);
    assertEquals("verticle4", verticle4.getName());
    assertTrue(verticle4.getType().equals(ComponentConfig.Type.VERTICLE));
    assertEquals("verticle4.py", verticle4.getMain());
    assertEquals("bar", verticle4.getConfig().getString("foo"));
    assertEquals(2, verticle4.getInstances());
  }
View Full Code Here

  @Test
  public void testAddWorkerVerticle() {
    NetworkConfig network = new DefaultNetworkConfig("test");
    assertEquals("test", network.getName());
    VerticleConfig verticle1 = network.addVerticle("verticle1", "verticle1.py");
    assertEquals("verticle1", verticle1.getName());
    assertTrue(verticle1.getType().equals(ComponentConfig.Type.VERTICLE));
    assertEquals("verticle1.py", verticle1.getMain());
    assertEquals(new JsonObject(), verticle1.getConfig());
    assertEquals(1, verticle1.getInstances());
    VerticleConfig verticle2 = network.addVerticle("verticle2", "verticle2.py", new JsonObject().putString("foo", "bar"));
    assertEquals("verticle2", verticle2.getName());
    assertTrue(verticle2.getType().equals(ComponentConfig.Type.VERTICLE));
    assertEquals("verticle2.py", verticle2.getMain());
    assertEquals("bar", verticle2.getConfig().getString("foo"));
    assertEquals(1, verticle2.getInstances());
    VerticleConfig verticle3 = network.addVerticle("verticle3", "verticle3.py", 2);
    assertEquals("verticle3", verticle3.getName());
    assertTrue(verticle3.getType().equals(ComponentConfig.Type.VERTICLE));
    assertEquals("verticle3.py", verticle3.getMain());
    assertEquals(new JsonObject(), verticle3.getConfig());
    assertEquals(2, verticle3.getInstances());
    VerticleConfig verticle4 = network.addVerticle("verticle4", "verticle4.py", new JsonObject().putString("foo", "bar"), 2);
    assertEquals("verticle4", verticle4.getName());
    assertTrue(verticle4.getType().equals(ComponentConfig.Type.VERTICLE));
    assertEquals("verticle4.py", verticle4.getMain());
    assertEquals("bar", verticle4.getConfig().getString("foo"));
    assertEquals(2, verticle4.getInstances());
  }
View Full Code Here

        .putBoolean(VerticleConfig.VERTICLE_IS_WORKER, true)
        .putBoolean(VerticleConfig.VERTICLE_IS_MULTI_THREADED, true);
    json.putObject(NetworkConfig.NETWORK_COMPONENTS, new JsonObject().putObject("feeder", jsonFeeder));
    NetworkConfig network = new Vertigo(null, null).createNetwork(json);
    assertEquals("test", network.getName());
    VerticleConfig verticle = network.getComponent("feeder");
    assertEquals("feeder", verticle.getName());
    assertEquals("test.py", verticle.getMain());
    assertEquals("bar", verticle.getConfig().getString("foo"));
    assertEquals(2, verticle.getInstances());
    assertTrue(verticle.getType().equals(ComponentConfig.Type.VERTICLE));
    assertTrue(verticle.isWorker());
    assertTrue(verticle.isMultiThreaded());
  }
View Full Code Here

        .putBoolean(VerticleConfig.VERTICLE_IS_WORKER, true)
        .putBoolean(VerticleConfig.VERTICLE_IS_MULTI_THREADED, true);
    json.putObject(NetworkConfig.NETWORK_COMPONENTS, new JsonObject().putObject("worker", jsonWorker));
    NetworkConfig network = new Vertigo(null, null).createNetwork(json);
    assertEquals("test", network.getName());
    VerticleConfig verticle = network.getComponent("worker");
    assertEquals("worker", verticle.getName());
    assertEquals("test.py", verticle.getMain());
    assertEquals("bar", verticle.getConfig().getString("foo"));
    assertEquals(2, verticle.getInstances());
    assertTrue(verticle.getType().equals(ComponentConfig.Type.VERTICLE));
    assertTrue(verticle.isWorker());
    assertTrue(verticle.isMultiThreaded());
  }
View Full Code Here

  }

  @Test
  public void testConfiguredFeederVerticleContext() {
    DefaultNetworkConfig network = new DefaultNetworkConfig("test");
    VerticleConfig verticle = network.addVerticle("feeder", "feeder.py");
    verticle.setMain("feeder.py");
    verticle.setConfig(new JsonObject().putString("foo", "bar"));
    verticle.setInstances(2);
    verticle.setGroup("test");
    verticle.setWorker(true);
    verticle.setMultiThreaded(true);
    NetworkContext context = ContextBuilder.buildContext(network, "vertigo");
    assertEquals("vertigo.test", context.address());
    VerticleContext verticleContext = context.component("feeder");
    assertEquals("feeder", verticleContext.name());
    assertEquals("vertigo.test.feeder", verticleContext.address());
View Full Code Here

  }

  @Test
  public void testConfiguredWorkerVerticleContext() {
    DefaultNetworkConfig network = new DefaultNetworkConfig("test");
    VerticleConfig verticle = network.addVerticle("worker", "worker.py");
    verticle.setMain("worker.py");
    verticle.setConfig(new JsonObject().putString("foo", "bar"));
    verticle.setInstances(2);
    verticle.setGroup("test");
    verticle.setWorker(true);
    verticle.setMultiThreaded(true);
    NetworkContext context = ContextBuilder.buildContext(network, "vertigo");
    assertEquals("vertigo.test", context.address());
    VerticleContext verticleContext = context.component("worker");
    assertEquals("worker", verticleContext.name());
    assertEquals("vertigo.test.worker", verticleContext.address());
View Full Code Here

  }

  @Test
  public void testInstanceContext() {
    DefaultNetworkConfig network = new DefaultNetworkConfig("test");
    VerticleConfig verticle = network.addVerticle("feeder", "feeder.py");
    verticle.setInstances(2);
    NetworkContext context = ContextBuilder.buildContext(network, "vertigo");
    assertEquals("vertigo.test", context.address());
    VerticleContext verticleContext = context.component("feeder");
    assertEquals("feeder", verticleContext.name());
    assertEquals("vertigo.test.feeder", verticleContext.address());
View Full Code Here

    return addVerticle(name, main, null, instances, doneHandler);
  }

  @Override
  public VerticleConfig addVerticle(String name, String main, JsonObject config, int instances, Handler<AsyncResult<ActiveNetwork>> doneHandler) {
    VerticleConfig verticle = network.addVerticle(name, main, config, instances);
    cluster.deployNetwork(network, doneHandler);
    return verticle;
  }
View Full Code Here

TOP

Related Classes of net.kuujo.vertigo.component.VerticleConfig

Copyright © 2018 www.massapicom. 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.