Search in sources :

Example 1 with FunctionManager

use of io.vertigo.core.spaces.component.data.FunctionManager 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));
    }
}
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 2 with FunctionManager

use of io.vertigo.core.spaces.component.data.FunctionManager 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));
    }
}
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 3 with FunctionManager

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

the class ComponentSpace3Test method testInjectPluginsAttributeOrder.

@Test
public void testInjectPluginsAttributeOrder() {
    final AppConfig appConfig = createHomeWithInjectPluginsAttribute(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 4 with FunctionManager

use of io.vertigo.core.spaces.component.data.FunctionManager 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)

Aggregations

AutoCloseableApp (io.vertigo.app.AutoCloseableApp)4 AppConfig (io.vertigo.app.config.AppConfig)4 FunctionManager (io.vertigo.core.spaces.component.data.FunctionManager)4 Test (org.junit.jupiter.api.Test)4