config.setOption( EventProcessingOption.CLOUD );
KnowledgeBase kbase = loadKnowledgeBase( new StringReader( str ),
config );
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
WorkingMemoryEntryPoint ep = ksession.getWorkingMemoryEntryPoint("X");
ep.insert(new StockTick(1, "RHT", 10, 1000 ));
int rulesFired = ksession.fireAllRules();
assertEquals( 0, rulesFired );
org.drools.definition.type.FactType event = kbase.getFactType("org.drools.cloud", "Event");
Object e1 = event.newInstance();
event.set(e1, "name", "someKey");
event.set(e1, "value", "someValue");
ep.insert(e1);
rulesFired = ksession.fireAllRules();
assertEquals( 1, rulesFired );
// let some time be spent
Thread.currentThread().sleep( 1000 );
// check both events are still in memory as we are running in CLOUD mode
assertEquals( 2, ep.getFactCount() );
}