public static void main(String args[]){
String file = "c:\\eclipse\\workspace\\DTRules\\com.dtrules.testfiles\\DTRules.xml";
IRSession session;
DTState state;
RulesDirectory rd;
RuleSet rs;
try {
rd = new RulesDirectory("",file);
rs = rd.getRuleSet(RName.getRName("test",true));
session = rs.newSession();
state = session.getState();
} catch (RulesException e1) {
System.out.println("Failed to initialize the Rules Engine");
return;
}
for(int i=0;i<tests.length;i+=2){
try{
session.execute(tests[i]);
String result = state.datapop().stringValue();
if(tests[i+1].equals(result.trim())){
state.debug("test: << "+tests[i]+" >> expected: "+tests[i+1]+" --passed\n");
}else{
state.debug("test: << "+tests[i]+" >> expected: "+tests[i+1]+" result:"+result+" --FAILED\n");
}
state.debug("\n");
}catch(Exception e){
state.error(" Exception Thrown:\n");
state.error("test: "+tests[i]+"expected: "+tests[i+1]+" result: Exception thrown --FAILED\n");
state.error(e+"\n");
}
}
}