Search in sources :

Example 1 with BioManager

use of io.vertigo.core.spaces.component.data.BioManager 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());
    }
}
Also used : AutoCloseableApp(io.vertigo.app.AutoCloseableApp) AppConfig(io.vertigo.app.config.AppConfig) BioManager(io.vertigo.core.spaces.component.data.BioManager) MathPlugin(io.vertigo.core.spaces.component.data.MathPlugin) BioManagerImpl(io.vertigo.core.spaces.component.data.BioManagerImpl) LogConfig(io.vertigo.app.config.LogConfig) Test(org.junit.jupiter.api.Test)

Example 2 with BioManager

use of io.vertigo.core.spaces.component.data.BioManager in project vertigo by KleeGroup.

the class AppConfigTest method HomeTest.

@Test
public void HomeTest() {
    final String locales = "fr_FR";
    final AppConfig appConfig = AppConfig.builder().beginBoot().withLocales(locales).addPlugin(ClassPathResourceResolverPlugin.class).addPlugin(XmlParamPlugin.class, Param.of("url", "io/vertigo/app/config/xml2/basic-app-config.xml")).endBoot().addModule(ModuleConfig.builder("bio").addComponent(BioManager.class, BioManagerImpl.class).addComponent(MathManager.class, MathManagerImpl.class, Param.of("start", "${math.test.start}")).addPlugin(MathPlugin.class, Param.of("factor", "20")).build()).build();
    try (AutoCloseableApp app = new AutoCloseableApp(appConfig)) {
        assertEquals(app, app);
        assertTrue(app.getComponentSpace().contains("bioManager"));
        final BioManager bioManager = app.getComponentSpace().resolve(BioManager.class);
        final int res = bioManager.add(1, 2, 3);
        assertEquals(366, res);
        assertTrue(bioManager.isActive());
    }
}
Also used : AutoCloseableApp(io.vertigo.app.AutoCloseableApp) AppConfig(io.vertigo.app.config.AppConfig) BioManager(io.vertigo.core.spaces.component.data.BioManager) XmlParamPlugin(io.vertigo.core.plugins.param.xml.XmlParamPlugin) MathPlugin(io.vertigo.core.spaces.component.data.MathPlugin) BioManagerImpl(io.vertigo.core.spaces.component.data.BioManagerImpl) Test(org.junit.jupiter.api.Test)

Example 3 with BioManager

use of io.vertigo.core.spaces.component.data.BioManager in project vertigo by KleeGroup.

the class AppConfig2Test method testBioManager.

private void testBioManager(final AppConfig appConfig) {
    try (AutoCloseableApp app = new AutoCloseableApp(appConfig)) {
        assertEquals(app, app);
        assertTrue(app.getComponentSpace().contains("bioManager"));
        final BioManager bioManager = app.getComponentSpace().resolve(BioManager.class);
        final int res = bioManager.add(1, 2, 3);
        assertEquals(366, res);
        assertTrue(bioManager.isActive());
    }
}
Also used : AutoCloseableApp(io.vertigo.app.AutoCloseableApp) BioManager(io.vertigo.core.spaces.component.data.BioManager)

Aggregations

AutoCloseableApp (io.vertigo.app.AutoCloseableApp)3 BioManager (io.vertigo.core.spaces.component.data.BioManager)3 AppConfig (io.vertigo.app.config.AppConfig)2 BioManagerImpl (io.vertigo.core.spaces.component.data.BioManagerImpl)2 MathPlugin (io.vertigo.core.spaces.component.data.MathPlugin)2 Test (org.junit.jupiter.api.Test)2 LogConfig (io.vertigo.app.config.LogConfig)1 XmlParamPlugin (io.vertigo.core.plugins.param.xml.XmlParamPlugin)1