Search in sources :

Example 1 with StandaloneEngineMain

use of org.openksavi.sponge.standalone.StandaloneEngineMain in project sponge by softelnet.

the class StandaloneCamelXmlTest method testCamelRouteXml.

@Test
public void testCamelRouteXml() {
    StandaloneEngineMain engineMain = new StandaloneEngineMain(true);
    try {
        engineMain.startup("-c", "config/config.xml");
        SpongeEngine engine = engineMain.getEngine();
        await().atMost(60, TimeUnit.SECONDS).until(() -> engine.getOperations().getVariable("message") != null && engine.getOperations().getVariable(Boolean.class, "sent"));
        assertTrue(engine.getOperations().getVariable(String.class, "message").contains("Send me to Camel"));
    } finally {
        engineMain.shutdown();
    }
}
Also used : StandaloneEngineMain(org.openksavi.sponge.standalone.StandaloneEngineMain) SpongeEngine(org.openksavi.sponge.engine.SpongeEngine) Test(org.junit.Test)

Example 2 with StandaloneEngineMain

use of org.openksavi.sponge.standalone.StandaloneEngineMain in project sponge by softelnet.

the class StandaloneTest method testCamelRssNews.

@Test
public void testCamelRssNews() throws InterruptedException {
    StandaloneEngineMain engineMain = null;
    try {
        engineMain = StandaloneTestUtils.startupStandaloneEngineMain("-c", "examples/standalone/camel_rss_news/config/config.xml");
        SpongeEngine engine = engineMain.getEngine();
        await().atMost(TIMEOUT, TimeUnit.SECONDS).until(() -> engine.getOperations().getVariable("stoppedSources", null) != null && engine.getOperations().getVariable(AtomicBoolean.class, "stoppedSources").get() && engine.getOperations().getVariable(AtomicBoolean.class, "alarmSounded").get());
        TimeUnit.SECONDS.sleep(SLEEP);
        assertFalse(engine.isError());
    } finally {
        StandaloneTestUtils.shutdownStandaloneEngineMain(engineMain);
    }
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) StandaloneEngineMain(org.openksavi.sponge.standalone.StandaloneEngineMain) SpongeEngine(org.openksavi.sponge.engine.SpongeEngine) Test(org.junit.Test)

Example 3 with StandaloneEngineMain

use of org.openksavi.sponge.standalone.StandaloneEngineMain in project sponge by softelnet.

the class StandaloneTest method testCamelTemplate.

@Test
public void testCamelTemplate() throws InterruptedException {
    StandaloneEngineMain engineMain = null;
    try {
        engineMain = StandaloneTestUtils.startupStandaloneEngineMain("-c", "examples/standalone/camel_template/config.xml");
        SpongeEngine engine = engineMain.getEngine();
        await().atMost(TIMEOUT, TimeUnit.SECONDS).until(() -> engine.getOperations().getVariable("alarmSounded", null) != null && engine.getOperations().getVariable(AtomicBoolean.class, "alarmSounded").get());
        TimeUnit.SECONDS.sleep(SLEEP);
        assertFalse(engine.isError());
    } finally {
        StandaloneTestUtils.shutdownStandaloneEngineMain(engineMain);
    }
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) StandaloneEngineMain(org.openksavi.sponge.standalone.StandaloneEngineMain) SpongeEngine(org.openksavi.sponge.engine.SpongeEngine) Test(org.junit.Test)

Example 4 with StandaloneEngineMain

use of org.openksavi.sponge.standalone.StandaloneEngineMain in project sponge by softelnet.

the class StandaloneTest method testExecuteScript.

@Test
public void testExecuteScript() {
    StandaloneEngineMain engineMain = StandaloneTestUtils.startupStandaloneEngineMain("-k", "examples/standalone/execute_script.py");
    assertFalse(engineMain.getEngine().isError());
}
Also used : StandaloneEngineMain(org.openksavi.sponge.standalone.StandaloneEngineMain) Test(org.junit.Test)

Example 5 with StandaloneEngineMain

use of org.openksavi.sponge.standalone.StandaloneEngineMain in project sponge by softelnet.

the class StandaloneCamelGroovyTest method testCamelRouteXml.

@Test
public void testCamelRouteXml() {
    StandaloneEngineMain engineMain = new StandaloneEngineMain(true);
    try {
        engineMain.startup("-c", "config/config.xml");
        SpongeEngine engine = engineMain.getEngine();
        await().atMost(60, TimeUnit.SECONDS).until(() -> engine.getOperations().getVariable("message") != null && engine.getOperations().getVariable(Boolean.class, "sent"));
        assertTrue(engine.getOperations().getVariable(String.class, "message").contains("Send me to Camel"));
    } finally {
        engineMain.shutdown();
    }
}
Also used : StandaloneEngineMain(org.openksavi.sponge.standalone.StandaloneEngineMain) SpongeEngine(org.openksavi.sponge.engine.SpongeEngine) Test(org.junit.Test)

Aggregations

StandaloneEngineMain (org.openksavi.sponge.standalone.StandaloneEngineMain)9 Test (org.junit.Test)7 SpongeEngine (org.openksavi.sponge.engine.SpongeEngine)6 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)3 ArrayList (java.util.ArrayList)1 SpongeException (org.openksavi.sponge.SpongeException)1