use of org.kie.api.runtime.rule.QueryResults in project drools by kiegroup.
the class QueryCepFireUntilHaltTest method noResultTest.
@Test(timeout = 10000L)
public void noResultTest() {
QueryResults results = ksession.getQueryResults("EventsFromStream");
assertEquals(0, results.size());
}
use of org.kie.api.runtime.rule.QueryResults in project drools by kiegroup.
the class QueryCepTest method noResultTest.
@Test
public void noResultTest() {
QueryResults results = ksession.getQueryResults("EventsFromStream");
assertEquals(0, results.size());
}
use of org.kie.api.runtime.rule.QueryResults in project drools by kiegroup.
the class QueryCepTest method withResultTest.
@Test
public void withResultTest() {
secondEntryPoint.insert(new TestEvent("minusOne"));
clock.advanceTime(5, TimeUnit.SECONDS);
firstEntryPoint.insert(new TestEvent("zero"));
secondEntryPoint.insert(new TestEvent("one"));
clock.advanceTime(10, TimeUnit.SECONDS);
secondEntryPoint.insert(new TestEvent("two"));
clock.advanceTime(5, TimeUnit.SECONDS);
secondEntryPoint.insert(new TestEvent("three"));
QueryResults results = ksession.getQueryResults("ZeroToNineteenSeconds");
assertEquals(1, results.size());
}
use of org.kie.api.runtime.rule.QueryResults in project drools by kiegroup.
the class QueryCepTest method withNoResultTest.
@Test
public void withNoResultTest() {
secondEntryPoint.insert(new TestEvent("minusOne"));
clock.advanceTime(5, TimeUnit.SECONDS);
firstEntryPoint.insert(new TestEvent("zero"));
secondEntryPoint.insert(new TestEvent("one"));
clock.advanceTime(10, TimeUnit.SECONDS);
secondEntryPoint.insert(new TestEvent("two"));
// the following expires event "zero" and "one", causing the query to no longer match
clock.advanceTime(10, TimeUnit.SECONDS);
secondEntryPoint.insert(new TestEvent("three"));
QueryResults results = ksession.getQueryResults("ZeroToNineteenSeconds");
assertEquals(0, results.size());
}
use of org.kie.api.runtime.rule.QueryResults in project drools by kiegroup.
the class QueryTest method testQuery2.
@Test
public void testQuery2() throws Exception {
KieBase kbase = SerializationHelper.serializeObject(loadKnowledgeBase("test_Query.drl"));
KieSession session = createKieSession(kbase);
session.fireAllRules();
QueryResults results = getQueryResults(session, "assertedobjquery");
assertEquals(1, results.size());
assertEquals(new InsertedObject("value1"), ((InternalFactHandle) results.iterator().next().getFactHandle("assertedobj")).getObject());
}
Aggregations