tempFile.deleteOnExit();
FileOutputStream fos = new FileOutputStream(tempFile);
fos.write(content.getBytes());
fos.close();
FluentKieModuleDeploymentHelper deploymentHelper = KieModuleDeploymentHelper.newFluentInstance();
String groupId = "org.kie.api.builder.fluent";
String artifactId = "test-kjar";
String version = "0.1-SNAPSHOT";
deploymentHelper = deploymentHelper.setGroupId(groupId)
.setArtifactId(artifactId)
.setVersion(version)
.addResourceFilePath("builder/test/", "builder/simple_query_test.drl")
.addResourceFilePath(tempFile.getAbsolutePath())
.addResourceFilePath("/META-INF/WorkDefinitions.conf") // from the drools-core jar
.addClass(KieModuleDeploymentHelperTest.class)
.addClass(KieModule.class)
.addClass(org.drools.compiler.Cheese.class);
// class dirs
numDirs += 5; // org.kie.api.builder.helper
numDirs += 2; // (org.)drools.compiler
// pom.xml, pom.properties
numFiles += 3;
// kmodule.xml, kmodule.info
numFiles += 2;
// kbase.cache x 2
numFiles += 2;
// drl files
numFiles += 3;
// WorkDefinitions
++numFiles;
// classes
numFiles += 3;
// META-INF/maven/org.kie.api.builder/test-kjar
numDirs += 4;
// defaultKiebase, META-INF/defaultKieBase
numDirs += 2;
KieBaseModel kbaseModel = deploymentHelper.getKieModuleModel().newKieBaseModel("otherKieBase");
kbaseModel.setEqualsBehavior(EqualityBehaviorOption.EQUALITY).setEventProcessingMode(EventProcessingOption.STREAM);
kbaseModel.newKieSessionModel("otherKieSession").setClockType(ClockTypeOption.get("realtime"));
// META-INF/otherKieBase
++numDirs;
deploymentHelper.getKieModuleModel().getKieBaseModels().get("defaultKieBase").newKieSessionModel("secondKieSession");
deploymentHelper.createKieJarAndDeployToMaven();
File artifactFile = MavenRepository.getMavenRepository().resolveArtifact(groupId + ":" + artifactId + ":" + version).getFile();
zip = new ZipInputStream(new FileInputStream(artifactFile));
Set<String> jarFiles = new HashSet<String>();