.setType( KieSessionType.STATELESS )
.setClockType( ClockTypeOption.get( "pseudo" ) );
KieServices ks = KieServices.Factory.get();
KieFileSystemImpl kfs = ( KieFileSystemImpl ) ks.newKieFileSystem();
kfs.write( "src/main/resources/META-INF/beans.xml", generateBeansXML( ) );
kfs.writeKModuleXML( ((KieModuleModelImpl)kproj).toXML() );
ReleaseId releaseId = ks.newReleaseId(namespace, "art1", version);
kfs.generateAndWritePomXML(releaseId);
String kBase1R1 = getRule( namespace + ".test1", "rule1", version );
String kBase1R2 = getRule( namespace + ".test1", "rule2", version );
String kbase2R1 = getRule( namespace + ".test2", "rule1", version );
String kbase2R2 = getRule( namespace + ".test2", "rule2", version );
String fldKB1 = "src/main/resources/" + kieBaseModel1.getName().replace( '.', '/' );
String fldKB2 = "src/main/resources/" + kieBaseModel2.getName().replace( '.', '/' );
kfs.write( fldKB1 + "/rule1.drl", kBase1R1.getBytes() );
kfs.write( fldKB1 + "/rule2.drl", kBase1R2.getBytes() );
kfs.write( fldKB2 + "/rule1.drl", kbase2R1.getBytes() );
kfs.write( fldKB2 + "/rule2.drl", kbase2R2.getBytes() );
kfs.write( "src/main/java/org/drools/compiler/cdi/test/KProjectTestClass" + namespace + ".java" ,generateKProjectTestClass( kproj, namespace ) );
KieBuilder kBuilder = ks.newKieBuilder( kfs );
kBuilder.buildAll();