Search in sources :

Example 6 with VerticleFactory

use of io.vertx.core.spi.VerticleFactory in project vert.x by eclipse.

the class VerticleFactoryTest method testUnregisterTwice.

@Test
public void testUnregisterTwice() {
    VerticleFactory fact1 = new TestVerticleFactory("foo");
    vertx.registerVerticleFactory(fact1);
    vertx.unregisterVerticleFactory(fact1);
    try {
        vertx.unregisterVerticleFactory(fact1);
        fail("Should throw exception");
    } catch (IllegalArgumentException e) {
    // OK
    }
}
Also used : VerticleFactory(io.vertx.core.spi.VerticleFactory) Test(org.junit.Test)

Example 7 with VerticleFactory

use of io.vertx.core.spi.VerticleFactory in project vert.x by eclipse.

the class VerticleFactoryTest method setUp.

public void setUp() throws Exception {
    super.setUp();
    // Unregister the factory that's loaded from the classpath
    VerticleFactory factory = vertx.verticleFactories().iterator().next();
    vertx.unregisterVerticleFactory(factory);
}
Also used : VerticleFactory(io.vertx.core.spi.VerticleFactory)

Example 8 with VerticleFactory

use of io.vertx.core.spi.VerticleFactory in project vert.x by eclipse.

the class VerticleFactoryTest method testUnregister.

@Test
public void testUnregister() {
    VerticleFactory fact1 = new TestVerticleFactory("foo");
    vertx.registerVerticleFactory(fact1);
    assertEquals(1, vertx.verticleFactories().size());
    assertTrue(vertx.verticleFactories().contains(fact1));
    vertx.unregisterVerticleFactory(fact1);
    assertFalse(vertx.verticleFactories().contains(fact1));
    assertTrue(vertx.verticleFactories().isEmpty());
}
Also used : VerticleFactory(io.vertx.core.spi.VerticleFactory) Test(org.junit.Test)

Example 9 with VerticleFactory

use of io.vertx.core.spi.VerticleFactory in project vert.x by eclipse.

the class VerticleFactoryTest method testRegisterUnregisterTwo.

@Test
public void testRegisterUnregisterTwo() {
    VerticleFactory fact1 = new TestVerticleFactory("foo");
    VerticleFactory fact2 = new TestVerticleFactory("bar");
    vertx.registerVerticleFactory(fact1);
    assertEquals(1, vertx.verticleFactories().size());
    vertx.registerVerticleFactory(fact2);
    assertEquals(2, vertx.verticleFactories().size());
    assertTrue(vertx.verticleFactories().contains(fact1));
    assertTrue(vertx.verticleFactories().contains(fact2));
    vertx.unregisterVerticleFactory(fact1);
    assertFalse(vertx.verticleFactories().contains(fact1));
    assertEquals(1, vertx.verticleFactories().size());
    assertTrue(vertx.verticleFactories().contains(fact2));
    vertx.unregisterVerticleFactory(fact2);
    assertTrue(vertx.verticleFactories().isEmpty());
    assertFalse(vertx.verticleFactories().contains(fact1));
    assertFalse(vertx.verticleFactories().contains(fact2));
}
Also used : VerticleFactory(io.vertx.core.spi.VerticleFactory) Test(org.junit.Test)

Example 10 with VerticleFactory

use of io.vertx.core.spi.VerticleFactory in project vert.x by eclipse.

the class DeploymentManager method loadVerticleFactories.

private void loadVerticleFactories() {
    Collection<VerticleFactory> factories = ServiceHelper.loadFactories(VerticleFactory.class);
    factories.forEach(this::registerVerticleFactory);
    VerticleFactory defaultFactory = new JavaVerticleFactory();
    defaultFactory.init(vertx);
    defaultFactories.add(defaultFactory);
}
Also used : VerticleFactory(io.vertx.core.spi.VerticleFactory)

Aggregations

VerticleFactory (io.vertx.core.spi.VerticleFactory)10 Test (org.junit.Test)7 MalformedURLException (java.net.MalformedURLException)1