Hi all, executing the test in "drools/drools-compiler/src/test/java/org/drools/compiler/integrationtests/" all goes well except if i write a kmodule xml inside the KieFileSystem. Is this supposed to happen? I cannot add or remove a KieBase during incremental compilation, or I'm doing something dumb?
I'm on Ubuntu 12.04 64bit java 1.7.0_55 Heres a simple test case: ######################################### @Test public void shouldRecompileWithNewBases() { String drl1 = "global java.util.List list\n" + "rule R1 when\n" + " $s : String() " + "then\n" + " list.add( \"a\" + $s );" + "end\n"; String drl2 = "global java.util.List list\n" + "rule R2 when\n" + " $s : String() " + "then\n" + " list.add( \"b\" + $s );" + "end\n"; ReleaseId releaseId1 = KieServices.Factory.get().newReleaseId( "it.mine", "test", "1.1"); ReleaseId releaseId2 = KieServices.Factory.get().newReleaseId( "it.mine", "test", "1.2"); KieServices ks = KieServices.Factory.get(); KieModuleModel kproj = ks.newKieModuleModel(); KieBaseModel kieBaseModel1 = kproj.newKieBaseModel("KBase1") .addPackage("it.mine.test"); kieBaseModel1.newKieSessionModel("KSession1").setDefault(true); KieFileSystem kfs = ks.newKieFileSystem(); KieBuilder kieBuilder = ks.newKieBuilder(kfs); kfs.generateAndWritePomXML(releaseId1); kfs.write("src/main/resources/it/mine/test/rule.drl", drl1); // FIXME: without this line all goes well. kfs.writeKModuleXML(kproj.toXML()); 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(); list.clear(); kfs.generateAndWritePomXML(releaseId2); kfs.write("src/main/resources/it/mine/test2/rule.drl", drl2); 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()); } ######################################### Heres the stack trace: ######################################### java.lang.NullPointerException at org.drools.compiler.kie.util.ChangeSetBuilder.build(ChangeSetBuilder.java:51) at org.drools.compiler.kie.builder.impl.KieContainerImpl.update(KieContainerImpl.java:126) at org.drools.compiler.kie.builder.impl.KieContainerImpl.updateToVersion(KieContainerImpl.java:105) at it.mine.IncrementalCompilationTest.shouldRecompileWithNewBases(IncrementalCompilationTest.java:165) ######################################### Thanks for the help! Cheers, Federico. _______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users