use of org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl in project drools by kiegroup.
the class CommonTestMethodBase method loadKnowledgePackages.
public Collection<KiePackage> loadKnowledgePackages(KnowledgeBuilderConfiguration kbuilderConf, boolean serialize, String... classPathResources) {
if (kbuilderConf == null) {
kbuilderConf = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
}
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(kbuilderConf);
for (String classPathResource : classPathResources) {
kbuilder.add(ResourceFactory.newClassPathResource(classPathResource, getClass()), ResourceType.DRL);
}
if (kbuilder.hasErrors()) {
fail(kbuilder.getErrors().toString());
}
Collection<KiePackage> knowledgePackages = null;
if (serialize) {
try {
knowledgePackages = SerializationHelper.serializeObject(kbuilder.getKnowledgePackages(), ((KnowledgeBuilderConfigurationImpl) kbuilderConf).getClassLoader());
} catch (Exception e) {
throw new RuntimeException(e);
}
} else {
knowledgePackages = kbuilder.getKnowledgePackages();
}
return knowledgePackages;
}
use of org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl in project drools by kiegroup.
the class AbstractKieModule method getBuilderConfiguration.
public KnowledgeBuilderConfiguration getBuilderConfiguration(KieBaseModel kBaseModel) {
KnowledgeBuilderConfigurationImpl pconf = new KnowledgeBuilderConfigurationImpl();
setModelPropsOnConf((KieBaseModelImpl) kBaseModel, pconf);
return pconf;
}
use of org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl in project drools by kiegroup.
the class AbstractKieProject method getBuilderConfiguration.
protected KnowledgeBuilderConfigurationImpl getBuilderConfiguration(KieBaseModelImpl kBaseModel, InternalKieModule kModule) {
KnowledgeBuilderConfigurationImpl pconf = new KnowledgeBuilderConfigurationImpl(getClassLoader());
pconf.setCompilationCache(kModule.getCompilationCache(kBaseModel.getName()));
AbstractKieModule.setModelPropsOnConf(kBaseModel, pconf);
return pconf;
}
use of org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl in project drools by kiegroup.
the class XmlPackageReaderTest method getXmReader.
private XmlPackageReader getXmReader() {
KnowledgeBuilderConfigurationImpl conf = new KnowledgeBuilderConfigurationImpl();
XmlPackageReader xmlReader = new XmlPackageReader(conf.getSemanticModules());
xmlReader.getParser().setClassLoader(XmlPackageReaderTest.class.getClassLoader());
return xmlReader;
}
use of org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl in project drools by kiegroup.
the class PackageBuilderConfigurationTest method testResultSeverityNonExistingValueDefaultToInfo.
@Test
public void testResultSeverityNonExistingValueDefaultToInfo() {
System.setProperty("drools.kbuilder.severity." + DuplicateFunction.KEY, "FOO");
KnowledgeBuilderConfigurationImpl cfg = new KnowledgeBuilderConfigurationImpl();
assertEquals(cfg.getOptionKeys(KBuilderSeverityOption.class).size(), 1);
assertEquals(cfg.getOption(KBuilderSeverityOption.class, DuplicateFunction.KEY).getSeverity(), ResultSeverity.INFO);
}
Aggregations