Search in sources :

Example 16 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 17 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)

Example 18 with VerticleFactory

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

the class VerticleManager 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)

Example 19 with VerticleFactory

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

the class VerticleFactoryTest method testRegisterTwice.

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

Example 20 with VerticleFactory

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

the class VerticleFactoryTest method testUnregisterNoFact.

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

Aggregations

VerticleFactory (io.vertx.core.spi.VerticleFactory)21 Test (org.junit.Test)16 DeploymentOptions (io.vertx.core.DeploymentOptions)1 Vertx (io.vertx.core.Vertx)1 VertxTestBase (io.vertx.test.core.VertxTestBase)1 MalformedURLException (java.net.MalformedURLException)1 Callable (java.util.concurrent.Callable)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 ApplicationContext (org.springframework.context.ApplicationContext)1 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)1