use of org.openksavi.sponge.engine.SpongeEngine in project sponge by softelnet.
the class TriggersTestTemplate method testTriggersEventPatternIncorrect.
public static void testTriggersEventPatternIncorrect(KnowledgeBaseType type) {
SpongeEngine engine = null;
try {
engine = ScriptTestUtils.startWithKnowledgeBase(type, "triggers_event_pattern_incorrect");
fail("Expected pattern syntax exception");
} catch (SpongeException e) {
if (ExceptionUtils.indexOfThrowable(e, PatternSyntaxException.class) < 0) {
throw e;
}
} finally {
if (engine != null) {
engine.shutdown();
}
}
}
use of org.openksavi.sponge.engine.SpongeEngine in project sponge by softelnet.
the class StandaloneTest method testPythonRss.
@Test
public void testPythonRss() {
StandaloneEngineMain engineMain = null;
try {
engineMain = StandaloneTestUtils.startupStandaloneEngineMain("-c", "examples/standalone/python_rss/sponge_python_rss.xml");
SpongeEngine engine = engineMain.getEngine();
await().atMost(TIMEOUT, TimeUnit.SECONDS).until(() -> engine.getOperations().getVariable(Number.class, "receivedRssCount").intValue() > 1);
assertFalse(engine.isError());
} finally {
StandaloneTestUtils.shutdownStandaloneEngineMain(engineMain);
}
}
use of org.openksavi.sponge.engine.SpongeEngine in project sponge by softelnet.
the class StandaloneTest method testNews.
@Test
public void testNews() throws InterruptedException {
StandaloneEngineMain engineMain = null;
try {
engineMain = StandaloneTestUtils.startupStandaloneEngineMain("-c", "examples/standalone/news/config/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);
}
}
use of org.openksavi.sponge.engine.SpongeEngine in project sponge by softelnet.
the class ScriptTestUtils method startWithKnowledgeBase.
public static SpongeEngine startWithKnowledgeBase(KnowledgeBaseType type, String knowledgeBaseFile) {
SpongeEngine engine = buildWithKnowledgeBase(type, knowledgeBaseFile);
engine.startup();
return engine;
}
use of org.openksavi.sponge.engine.SpongeEngine in project sponge by softelnet.
the class ScriptTestUtils method startWithConfig.
public static SpongeEngine startWithConfig(KnowledgeBaseType type, String config) {
SpongeEngine engine = DefaultSpongeEngine.builder().config(getConfigFileName(type, config)).build();
engine.startup();
return engine;
}
Aggregations