use of org.kie.api.KieServices in project drools by kiegroup.
the class KieLoggersTest method populateKieFileSystem.
private KieServices populateKieFileSystem(Resource dt) {
KieServices ks = KieServices.Factory.get();
KieFileSystem kfs = ks.newKieFileSystem().write(dt);
KieBuilder kb = ks.newKieBuilder(kfs).buildAll();
assertTrue(kb.getResults().getMessages().isEmpty());
return ks;
}
use of org.kie.api.KieServices in project drools by kiegroup.
the class KieLoggersTest method getStatelessKieSession.
private StatelessKieSession getStatelessKieSession(Resource dt) {
KieServices ks = populateKieFileSystem(dt);
// get the session
StatelessKieSession ksession = ks.newKieContainer(ks.getRepository().getDefaultReleaseId()).newStatelessKieSession();
return ksession;
}
use of org.kie.api.KieServices in project drools by kiegroup.
the class KieLoggersTest method getKieSession.
private KieSession getKieSession(Resource dt) {
KieServices ks = populateKieFileSystem(dt);
// get the session
KieSession ksession = ks.newKieContainer(ks.getRepository().getDefaultReleaseId()).newKieSession();
return ksession;
}
use of org.kie.api.KieServices in project drools by kiegroup.
the class KieRepositoryTest method testLoadingNotAKJar.
@Test
public void testLoadingNotAKJar() {
// DROOLS-1351
ClassLoader cl = Thread.currentThread().getContextClassLoader();
URLClassLoader urlClassLoader = new URLClassLoader(new URL[] { this.getClass().getResource("/only-jar-pojo-not-kjar-no-kmodule-1.0.0.jar") });
Thread.currentThread().setContextClassLoader(urlClassLoader);
try {
KieServices ks = KieServices.Factory.get();
KieRepository kieRepository = ks.getRepository();
ReleaseId releaseId = ks.newReleaseId("org.test", "only-jar-pojo-not-kjar-no-kmodule", "1.0.0");
KieModule kieModule = kieRepository.getKieModule(releaseId);
assertNull(kieModule);
} finally {
Thread.currentThread().setContextClassLoader(cl);
}
}
use of org.kie.api.KieServices in project drools by kiegroup.
the class KieRepositoryTest method testLoadKjarFromClasspath.
@Test
public void testLoadKjarFromClasspath() {
// DROOLS-1335
ClassLoader cl = Thread.currentThread().getContextClassLoader();
URLClassLoader urlClassLoader = new URLClassLoader(new URL[] { this.getClass().getResource("/kie-project-simple-1.0.0.jar") });
Thread.currentThread().setContextClassLoader(urlClassLoader);
try {
KieServices ks = KieServices.Factory.get();
KieRepository kieRepository = ks.getRepository();
ReleaseId releaseId = ks.newReleaseId("org.test", "kie-project-simple", "1.0.0");
KieModule kieModule = kieRepository.getKieModule(releaseId);
assertNotNull(kieModule);
assertEquals(releaseId, kieModule.getReleaseId());
} finally {
Thread.currentThread().setContextClassLoader(cl);
}
}
Aggregations