use of io.vertigo.app.config.AppConfig in project vertigo by KleeGroup.
the class ComponentSpace3Test method testInjectPluginsAttribute.
@Test
public void testInjectPluginsAttribute() {
final AppConfig appConfig = createHomeWithInjectPluginsAttribute(true);
try (AutoCloseableApp app = new AutoCloseableApp(appConfig)) {
final FunctionManager functionManager = app.getComponentSpace().resolve(FunctionManager.class);
assertEquals(4, functionManager.compute("x+1", 3));
assertEquals(6, functionManager.compute("2x", 3));
assertEquals(15, functionManager.compute("4x+3", 3));
assertEquals(1, functionManager.compute("0x+1", 3));
assertEquals(-7, functionManager.compute("x-10", 3));
assertEquals(-9, functionManager.computeAll(3));
}
}
use of io.vertigo.app.config.AppConfig in project vertigo by KleeGroup.
the class ComponentSpace3Test method testInjectPluginsConstructor.
@Test
public void testInjectPluginsConstructor() {
final AppConfig appConfig = createHomeWithInjectPluginsConstructor(true);
try (AutoCloseableApp app = new AutoCloseableApp(appConfig)) {
final FunctionManager functionManager = app.getComponentSpace().resolve(FunctionManager.class);
assertEquals(4, functionManager.compute("x+1", 3));
assertEquals(6, functionManager.compute("2x", 3));
assertEquals(15, functionManager.compute("4x+3", 3));
assertEquals(1, functionManager.compute("0x+1", 3));
assertEquals(-7, functionManager.compute("x-10", 3));
assertEquals(-9, functionManager.computeAll(3));
}
}
use of io.vertigo.app.config.AppConfig in project vertigo by KleeGroup.
the class ComponentSpaceTest method testHome.
@Test
public void testHome() {
final AppConfig appConfig = AppConfig.builder().beginBoot().withLogConfig(new LogConfig("/log4j.xml")).endBoot().addModule(ModuleConfig.builder("Bio").addComponent(BioManager.class, BioManagerImpl.class).addComponent(MathManager.class, MathManagerImpl.class, Param.of("start", "100")).addPlugin(MathPlugin.class, Param.of("factor", "20")).build()).build();
try (AutoCloseableApp app = new AutoCloseableApp(appConfig)) {
final BioManager bioManager = app.getComponentSpace().resolve(BioManager.class);
final int res = bioManager.add(1, 2, 3);
assertEquals(366, res);
assertTrue(bioManager.isActive());
}
}
use of io.vertigo.app.config.AppConfig in project vertigo by KleeGroup.
the class ComponentSpaceTest method testHome2.
@Test
public void testHome2() {
final AppConfig appConfig = AppConfig.builder().beginBoot().withLogConfig(new LogConfig("/log4j.xml")).endBoot().addModule(ModuleConfig.builder("Bio").addComponent(BioManager.class, BioManagerImpl.class).addPlugin(DummyPlugin.class).addComponent(MathManager.class, MathManagerImpl.class, Param.of("start", "100")).addPlugin(MathPlugin.class, Param.of("factor", "20")).build()).build();
Assertions.assertThrows(RuntimeException.class, () -> {
try (AutoCloseableApp app = new AutoCloseableApp(appConfig)) {
//
}
});
}
use of io.vertigo.app.config.AppConfig in project vertigo by KleeGroup.
the class AppConfig2Test method HomeTest.
@Test
public void HomeTest() {
final AppConfig appConfig = new XMLAppConfigBuilder().withModules(getClass(), new Properties(), "bio.xml").build();
testBioManager(appConfig);
}
Aggregations