use of org.openksavi.sponge.engine.QueueFullException in project sponge by softelnet.
the class EventOverloadTest method testEventOverload.
@Test
public void testEventOverload() {
EngineBuilder<DefaultSpongeEngine> builder = DefaultSpongeEngine.builder().knowledgeBase("kb", "examples/core/event_overload.py");
builder.getEngineDefaultParameters().setMainEventQueueCapacity(2);
builder.getEngineDefaultParameters().setDecomposedQueueCapacity(2);
SpongeEngine engine = builder.build();
// Caution: this test depends on the exact configuration values as they are specified below.
engine.getConfigurationManager().setMainProcessingUnitThreadCount(1);
engine.getConfigurationManager().setEventQueueCapacity(5);
// engine.getConfigurationManager().setEventSetProcessorDefaultSynchronous(false);
engine.startup();
try {
await().atMost(120, TimeUnit.SECONDS).until(() -> engine.getOperations().getVariable("testStatus") != null);
assertTrue(engine.getOperations().getVariable("testStatus") instanceof QueueFullException);
assertFalse(engine.isError());
} finally {
engine.shutdown();
}
}
Aggregations