use of org.drools.core.QueryResultsRowImpl in project drools by kiegroup.
the class QueryTest method testQuery.
@Test
public void testQuery() throws Exception {
KieBase kbase = SerializationHelper.serializeObject(loadKnowledgeBase("simple_query_test.drl"));
KieSession session = createKieSession(kbase);
final Cheese stilton = new Cheese("stinky", 5);
FactHandle factHandle = session.insert(stilton);
session = SerializationHelper.getSerialisedStatefulKnowledgeSession(session, true);
String queryName = "simple query";
org.kie.api.runtime.rule.QueryResults results = getQueryResults(session, queryName);
assertEquals(1, results.size());
QueryResultsRow row = results.iterator().next();
if (row instanceof FlatQueryResultRow) {
FlatQueryResultRow flatRow = (FlatQueryResultRow) row;
assertEquals(0, flatRow.getIdentifiers().size());
} else if (row instanceof QueryResultsRowImpl) {
QueryResultsRowImpl rowImpl = (QueryResultsRowImpl) row;
assertEquals(0, rowImpl.getDeclarations().size());
}
}
Aggregations