Description of problem:
When length sliding windows is defined in query with specific value X in drl file, events are gradually inserted into kiesession and query is called, result always contains all inserted events, but it should contains only X last values.
Version-Release number of selected component (if applicable):
Pull request #214 submited in Drools.
Steps to Reproduce:
1. Make a drl file with one query (using length sliding window), which accumulates last ten events and returns number of accumulated events.
2. Write a test, gradually insert into kiesession events one by one.
3. After each insertion, run query.
Returns all inserted events (1, 2, 3, ..., 10, 11, 12, 13, 14, ...)-
It should returns last ten events (1, 2, 3, ..., 10, 10, 10, 10, ...).
I merged the tests and checked that they are passing now. Very likely the problem was caused by the fact that the kieBase was running in cloud mode (even if properly configured in the provided test to run in stream mode). I also added a check to enforce that stream mode is used when necessary. This means that if you now try to run in cloud mode a kiebasae that actually requires the stream one (because it uses sliding windown or other fusion related features) it will throw a RuntimeException saying:
"The requested KieBase $kiebasename has been set to run in CLOUD mode but requires features only available in STREAM mode"
Verified on BRMS 6.0.0.ER5.