.setResourceType( ResourceType.DRL )
.setSourcePath( "drl1.txt" ) );
kieBuilder.buildAll();
assertEquals( 0, kieBuilder.getResults().getMessages().size() );
KieModule kieModule = kieBuilder.getKieModule();
assertEquals( releaseId1, kieModule.getReleaseId() );
KieContainer kc = ks.newKieContainer( releaseId1 );
KieSession ksession = kc.newKieSession();
List<String> list = new ArrayList<String>();
ksession.setGlobal( "list", list );
ksession.insert( "Foo" );
ksession.fireAllRules();
assertEquals( 2, list.size() );
assertTrue( list.containsAll( asList( "000", "aFoo" ) ) );
list.clear();
kfs.generateAndWritePomXML( releaseId2 );
kfs.write( ks.getResources()
.newReaderResource( new StringReader( drl2 ) )
.setResourceType( ResourceType.DRL )
.setSourcePath( "drl2.txt" ) );
IncrementalResults results = ( (InternalKieBuilder) kieBuilder ).incrementalBuild();
assertEquals( 0, results.getAddedMessages().size() );
kieModule = kieBuilder.getKieModule();
assertEquals( releaseId2, kieModule.getReleaseId() );
Results updateResults = kc.updateToVersion( releaseId2 );
assertEquals( 0, updateResults.getMessages().size() );
ksession.insert( "Bar" );