final List results = new ArrayList();
session.setGlobal("results",
results);
StockTickInterface tick1 = new StockTick(1,
"DROO",
50,
System.currentTimeMillis());
StockTickInterface tick2 = new StockTick(2,
"ACME",
10,
System.currentTimeMillis());
StockTickInterface tick3 = new StockTick(3,
"ACME",
10,
System.currentTimeMillis());
StockTickInterface tick4 = new StockTick(4,
"DROO",
50,
System.currentTimeMillis());
InternalFactHandle handle1 = (InternalFactHandle) session.insert(tick1);
InternalFactHandle handle2 = (InternalFactHandle) session.insert(tick2);
InternalFactHandle handle3 = (InternalFactHandle) session.insert(tick3);
InternalFactHandle handle4 = (InternalFactHandle) session.insert(tick4);
assertNotNull(handle1);
assertNotNull(handle2);
assertNotNull(handle3);
assertNotNull(handle4);
assertTrue(handle1.isEvent());
assertTrue(handle2.isEvent());
assertTrue(handle3.isEvent());
assertTrue(handle4.isEvent());
session.fireAllRules();
assertEquals(0,
results.size());
StockTickInterface tick5 = new StockTick(5,
"DROO",
50,
System.currentTimeMillis());
StockTickInterface tick6 = new StockTick(6,
"ACME",
10,
System.currentTimeMillis());
StockTickInterface tick7 = new StockTick(7,
"ACME",
15,
System.currentTimeMillis());
StockTickInterface tick8 = new StockTick(8,
"DROO",
50,
System.currentTimeMillis());
WorkingMemoryEntryPoint entry = session.getWorkingMemoryEntryPoint("StockStream");