KieServices ks = KieServices.Factory.get();
ReleaseId containerReleaseId = KieServices.Factory.get().newReleaseId( "org.kie", "test-container", "1.0.0-SNAPSHOT" );
ReleaseId includedReleaseId = KieServices.Factory.get().newReleaseId( "org.kie", "test-project", "1.0.0-SNAPSHOT" );
InternalKieModule kJar1 = createKieJar(ks, includedReleaseId, "rule1");
repository.deployArtifact(includedReleaseId, kJar1, createKPom(fileManager, includedReleaseId));
resetFileManager();
KieFileSystem kfs = ks.newKieFileSystem();
KieModuleModel kproj = ks.newKieModuleModel();
kproj.newKieBaseModel("KBase2").addInclude("KBase1").newKieSessionModel("KSession2");
kfs.writeKModuleXML(kproj.toXML());
kfs.writePomXML(getPom(containerReleaseId, includedReleaseId));
KieBuilder kieBuilder = ks.newKieBuilder(kfs);
assertTrue(kieBuilder.buildAll().getResults().getMessages().isEmpty());
InternalKieModule containerKJar = (InternalKieModule) kieBuilder.getKieModule();
repository.deployArtifact(containerReleaseId, containerKJar, createKPom(fileManager, containerReleaseId, includedReleaseId));
KieContainer kieContainer = ks.newKieContainer(containerReleaseId);
KieSession ksession = kieContainer.newKieSession("KSession2");
checkKSession(ksession, "rule1");
KieScanner scanner = ks.newKieScanner(kieContainer);
InternalKieModule kJar2 = createKieJar(ks, includedReleaseId, "rule2");
repository.deployArtifact(includedReleaseId, kJar2, createKPom(fileManager, includedReleaseId));
scanner.scanNow();
KieSession ksession2 = kieContainer.newKieSession("KSession2");