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
}
}
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);
}
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());
}
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));
}
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);
}
Aggregations