.setResourceType( ResourceType.DRL )
.setSourcePath( "drl1.drl" ) );
kieBuilder.buildAll();
KieContainer kc = ks.newKieContainer( id );
KieSession ksession = kc.newKieSession();
List<String> list = new ArrayList<String>();
ksession.setGlobal( "list", list );
ksession.insert( "X" );
ksession.fireAllRules();
assertTrue( list.contains( "AX" ) );
KieFileSystem kfs2 = ks.newKieFileSystem();
KieBuilder kieBuilder2 = ks.newKieBuilder( kfs2 );
kfs2.generateAndWritePomXML( id );
kfs2.write( ks.getResources()
.newReaderResource( new StringReader( drl2 ) )
.setResourceType( ResourceType.DRL )
.setSourcePath( "drla.drl" ) );
kieBuilder2.buildAll();
KieContainer kc2 = ks.newKieContainer( id );
KieSession ksession2 = kc2.newKieSession();
ksession2.setGlobal( "list", list );
ksession2.insert( "X" );
ksession2.fireAllRules();
kfs2.write( ks.getResources()
.newReaderResource( new StringReader( drl3 ) )
.setResourceType( ResourceType.DRL )
.setSourcePath( "drlb.drl" ) );
IncrementalResults results = ( (InternalKieBuilder) kieBuilder2 ).incrementalBuild();
assertEquals( 0, results.getAddedMessages().size() );
Results updateResults = kc2.updateToVersion( id );
ksession2.fireAllRules();
assertEquals( Arrays.asList( "AX", "BX", "CX" ), list );
}