ReleaseId releaseId1 = ks.newReleaseId( "org.kie", "test-kie-builder", "1.0.0" );
Resource r1 = ResourceFactory.newByteArrayResource( drl1.getBytes() ).setResourceType( ResourceType.DRL ).setSourcePath( "kbase1/drl1.drl" );
Resource r2 = ResourceFactory.newByteArrayResource( drl2.getBytes() ).setResourceType( ResourceType.GDRL ).setSourcePath( "kbase1/drl2.gdrl" );
Resource r3 = ResourceFactory.newByteArrayResource( drl3.getBytes() ).setResourceType( ResourceType.RDRL ).setSourcePath( "kbase1/drl3.rdrl" );
Resource r4 = ResourceFactory.newByteArrayResource( drl4.getBytes() ).setResourceType( ResourceType.TDRL ).setSourcePath( "kbase1/drl4.tdrl" );
KieModule km = createAndDeployJar( ks,
kmodule,
releaseId1,
r1,
r2,
r3,
r4 );
InternalKieModule ikm = (InternalKieModule) km;
assertNotNull( ikm.getResource( r1.getSourcePath() ) );
assertNotNull( ikm.getResource( r2.getSourcePath() ) );
assertNotNull( ikm.getResource( r3.getSourcePath() ) );
assertNotNull( ikm.getResource( r4.getSourcePath() ) );
// Create a session and fire rules
KieContainer kc = ks.newKieContainer( km.getReleaseId() );
KieSession ksession = kc.newKieSession();
ksession.insert( new Message( "Hello World" ) );
assertEquals( 2, ksession.fireAllRules() );
ksession.dispose();
}