dialectRegistry,
javaDialect );
pkgBuilder.addPackageFromDrl( new StringReader( "package pkg1;\nglobal Boolean value;" ) );
ReturnValueConstraintEvaluator node = new ReturnValueConstraintEvaluator();
final JavaReturnValueEvaluatorBuilder builder = new JavaReturnValueEvaluatorBuilder();
builder.build( context,
node,
descr,
null );
ProcessDialectRegistry.getDialect(JavaDialect.ID).addProcess( context );
javaDialect.compileAll();
assertEquals( 0, javaDialect.getResults().size() );
final KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
List<KnowledgePackage> packages = new ArrayList<KnowledgePackage>();
packages.add( new KnowledgePackageImp(pkgBuilder.getPackage()) );
kbase.addKnowledgePackages( packages );
final StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
ksession.setGlobal( "value", true );
RuleFlowProcessInstance processInstance = new RuleFlowProcessInstance();
processInstance.setKnowledgeRuntime( (InternalKnowledgeRuntime) ksession );
SplitInstance splitInstance = new SplitInstance();
splitInstance.setProcessInstance( processInstance );
assertTrue( node.evaluate( splitInstance,
null,
null ) );
ksession.setGlobal( "value",
false );
assertFalse( node.evaluate( splitInstance,
null,
null ) );
}