KieFileSystem kfs = ks.newKieFileSystem()
.generateAndWritePomXML( releaseId )
.write( "src/main/resources/KBase1/org/pkg1/r1.drl", drl1 )
.writeKModuleXML( kproj.toXML() );
KieBuilder kieBuilder = ks.newKieBuilder( kfs );
kieBuilder.buildAll();
assertEquals( 0, kieBuilder.getResults().getMessages().size() );
KieModule kieModule = kieBuilder.getKieModule();
KieContainer kc = ks.newKieContainer( releaseId );
KieSession ksession = kc.newKieSession( "KSession2" );
List<String> list = new ArrayList<String>();
ksession.setGlobal( "list", list );
ksession.insert( "Foo" );
ksession.fireAllRules();
assertEquals( 1, list.size() );
assertEquals( "aFoo", list.get( 0 ) );
list.clear();
kfs.delete( "src/main/resources/KBase1/org/pkg1/r1.drl" );
kfs.write( "src/main/resources/KBase1/org/pkg1/r2.drl", drl2 );
IncrementalResults results = ( (InternalKieBuilder) kieBuilder ).incrementalBuild();
assertEquals( 0, results.getAddedMessages().size() );
kieModule = kieBuilder.getKieModule();
Results updateResults = kc.updateToVersion( releaseId );
assertEquals( 0, updateResults.getMessages().size() );
ksession.insert( "Bar" );