public static final FluentKieModuleDeploymentHelper newFluentInstance() { 
        return new KieModuleDeploymentHelperImpl();
    }
@Test
    public void testFluentDeploymentHelper() throws Exception {
        int numFiles = 0;
        int numDirs = 0;
        
        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("/META-INF/WorkDefinitions.conf") // from the drools-core jar
                .addClass(KieModuleDeploymentHelperTest.class)
                .addClass(KieModule.class)
                .addClass(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 += 2;
        // 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.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>();
        Set<String> jarDirs = new HashSet<String>();
        ZipEntry ze = zip.getNextEntry();
        logger.debug("Getting files form deployed jar: ");
        while( ze != null ) { 
            String fileName = ze.getName();
            if( fileName.endsWith("drl")
                    || fileName.endsWith("class")
                    || fileName.endsWith("tst")
                    || fileName.endsWith("conf")
                    || fileName.endsWith("xml")
                    || fileName.endsWith("info")
                    || fileName.endsWith("properties")
                    || fileName.endsWith("cache") ) { 
                jarFiles.add(fileName);
                logger.debug("> " + fileName);
            } else { 
                jarDirs.add(fileName);
                logger.debug("] " + fileName);
            }
            ze = zip.getNextEntry();
        }
        assertThat(jarFiles.size()).as("Num files in kjar").isEqualTo(numFiles);
    }