Search in sources :

Example 16 with AutoCloseableApp

use of io.vertigo.app.AutoCloseableApp in project vertigo by KleeGroup.

the class ComponentSpace3Test method testInjectPluginsConstructorOrder.

@Test
public void testInjectPluginsConstructorOrder() {
    final AppConfig appConfig = createHomeWithInjectPluginsConstructor(false);
    try (AutoCloseableApp app = new AutoCloseableApp(appConfig)) {
        final FunctionManager functionManager = app.getComponentSpace().resolve(FunctionManager.class);
        assertEquals(26, functionManager.computeAll(3));
    }
}
Also used : AutoCloseableApp(io.vertigo.app.AutoCloseableApp) AppConfig(io.vertigo.app.config.AppConfig) FunctionManager(io.vertigo.core.spaces.component.data.FunctionManager) Test(org.junit.jupiter.api.Test)

Example 17 with AutoCloseableApp

use of io.vertigo.app.AutoCloseableApp in project vertigo by KleeGroup.

the class ComponentSpace4Test method testStartedComponent.

@Test
public void testStartedComponent() {
    final AppConfig appConfig = AppConfig.builder().beginBoot().withLogConfig(new LogConfig("/log4j.xml")).endBoot().addModule(ModuleConfig.builder("Started").addComponent(StartedManager.class, StartedManagerImpl.class).build()).addInitializer(StartedManagerInitializer.class).build();
    final StartedManager startedManager;
    try (AutoCloseableApp app = new AutoCloseableApp(appConfig)) {
        startedManager = app.getComponentSpace().resolve(StartedManager.class);
        assertTrue(startedManager.isInitialized(), "Component StartedManager not Initialized");
        assertTrue(startedManager.isStarted(), "Component StartedManager not Started");
        assertTrue(startedManager.isAppPreActivated(), "Component StartedManager not PostStarted");
    }
    assertFalse(startedManager.isStarted(), "Component StartedManager not Stopped");
}
Also used : StartedManager(io.vertigo.core.spaces.component.data.StartedManager) AutoCloseableApp(io.vertigo.app.AutoCloseableApp) AppConfig(io.vertigo.app.config.AppConfig) StartedManagerInitializer(io.vertigo.core.spaces.component.data.StartedManagerInitializer) LogConfig(io.vertigo.app.config.LogConfig) Test(org.junit.jupiter.api.Test)

Example 18 with AutoCloseableApp

use of io.vertigo.app.AutoCloseableApp 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)18 AppConfig (io.vertigo.app.config.AppConfig)11 Test (org.junit.jupiter.api.Test)8 LogConfig (io.vertigo.app.config.LogConfig)4 FunctionManager (io.vertigo.core.spaces.component.data.FunctionManager)4 Test (org.junit.Test)4 BioManager (io.vertigo.core.spaces.component.data.BioManager)3 MathPlugin (io.vertigo.core.spaces.component.data.MathPlugin)3 Domain (io.vertigo.dynamo.domain.metamodel.Domain)3 Before (org.junit.Before)3 BioManagerImpl (io.vertigo.core.spaces.component.data.BioManagerImpl)2 DtDefinition (io.vertigo.dynamo.domain.metamodel.DtDefinition)2 DynamoDefinitionProvider (io.vertigo.dynamo.plugins.environment.DynamoDefinitionProvider)2 XMLAppConfigBuilder (io.vertigo.app.config.xml.XMLAppConfigBuilder)1 RedisConnector (io.vertigo.commons.impl.connectors.redis.RedisConnector)1 Param (io.vertigo.core.param.Param)1 XmlParamPlugin (io.vertigo.core.plugins.param.xml.XmlParamPlugin)1 DummyPlugin (io.vertigo.core.spaces.component.data.DummyPlugin)1 StartedManager (io.vertigo.core.spaces.component.data.StartedManager)1 StartedManagerInitializer (io.vertigo.core.spaces.component.data.StartedManagerInitializer)1