List<String> list = new ArrayList<String>();
ksession.setGlobal("list", list);
ksession.insert("Some String");
ksession.insert("Some Other String");
QueryResults queryResults = ksession.getQueryResults("all the Strings");
assertEquals(2, queryResults.size());
Iterator<QueryResultsRow> iterator = queryResults.iterator();
while (iterator.hasNext()){
System.out.println("Row= "+iterator.next().get("$strings"));
}
//we are going to modify the query definition
String query1V2 = "";
query1V2 += "query \"all the Strings\"\n";
query1V2 += " $strings : String(this == \"Some String\")\n";
query1V2 += "end\n";
fileManager.write("rule1.drl", this.createDefaultRule("rule1") + " \n " + query1V2 );
this.scan(kagent);
queryResults = ksession.getQueryResults("all the Strings");
assertEquals(1, queryResults.size());
assertEquals("Some String",queryResults.iterator().next().get("$strings"));
ksession.dispose();
kagent.dispose();
}