use of org.openksavi.sponge.engine.SpongeEngine in project sponge by softelnet.
the class SyncAsyncEventSetProcessorsTest method testSyncEventSetProcessorsConfig.
@Test
public void testSyncEventSetProcessorsConfig() throws InterruptedException {
SpongeEngine engine = DefaultSpongeEngine.builder().knowledgeBase("kb", "examples/core/sync_async_event_set_processors.py").build();
engine.startup();
assertFalse(engine.getConfigurationManager().getEventSetProcessorDefaultSynchronous());
doTestAsyncEventSetProcessors(engine);
}
use of org.openksavi.sponge.engine.SpongeEngine in project sponge by softelnet.
the class LoadTest method testTriggersLoad.
@Test
public void testTriggersLoad() {
SpongeEngine engine = DefaultSpongeEngine.builder().knowledgeBase(TestUtils.DEFAULT_KB, "examples/performance/triggers_load.py").build();
engine.startup();
int sleepMinutes = 2;
try {
TimeUnit.MINUTES.sleep(sleepMinutes);
logger.info("Event performance after {} minutes is: {}", sleepMinutes, String.format("%.2f events/s", engine.getStatisticsManager().getEventPerformance()));
} catch (InterruptedException e) {
throw SpongeUtils.wrapException(e);
} finally {
engine.shutdown();
}
}
use of org.openksavi.sponge.engine.SpongeEngine in project sponge by softelnet.
the class CoreVariablesJythonBugTest method testGlobalVariablesJythonBug.
/**
* This test detects a Jython 2.7.1 bug: http://bugs.jython.org/issue2487.
*/
@Test
public void testGlobalVariablesJythonBug() {
SpongeEngine engine = DefaultSpongeEngine.builder().knowledgeBase(TestUtils.DEFAULT_KB, "examples/core/stability/global_variable_access_jython_bug.py").build();
engine.startup();
try {
await().atMost(30, TimeUnit.MINUTES).until(() -> engine.getOperations().getVariable(AtomicBoolean.class, "stopped").get() || engine.isError());
assertFalse(engine.isError());
} finally {
engine.shutdown();
}
}
use of org.openksavi.sponge.engine.SpongeEngine in project sponge by softelnet.
the class ConfigurationKnowledgeBaseFileTest method doTestExisting.
private void doTestExisting(String config) {
SpongeEngine engine = DefaultSpongeEngine.builder().config(DIR + config).build();
engine.startup();
try {
assertTrue(engine.getOperations().getVariable(Boolean.class, "loaded"));
assertFalse(engine.isError());
} finally {
engine.shutdown();
}
}
use of org.openksavi.sponge.engine.SpongeEngine in project sponge by softelnet.
the class ConfigurationTest method testPropertySubstitution.
@Test
public void testPropertySubstitution() throws InterruptedException {
SpongeEngine engine = DefaultSpongeEngine.builder().property("sourceProperty", "source").config("examples/core/configuration/property_substitution.xml").build();
engine.startup();
try {
assertEquals("source value", engine.getConfigurationManager().getProperty("resultProperty"));
assertFalse(engine.isError());
} finally {
engine.shutdown();
}
}
Aggregations