in drools-benchmarks-parent/drools-benchmarks/src/main/java/org/drools/benchmarks/dmn/codegen/AbstractCodegenBenchmark.java [65:91]
protected void setupModelAndContext() {
Function<DMNCompilerConfiguration, DMNCompiler> dmnCompilerFn = dmnCompilerConfiguration -> {
((DMNCompilerConfigurationImpl) dmnCompilerConfiguration).addFEELProfile(new DoCompileFEELProfile());
return new DMNCompilerImpl(dmnCompilerConfiguration);
};
DMNRuntimeBuilder.DMNRuntimeBuilderConfigured dmnRuntimeBuilderConfigured = DMNRuntimeBuilder.fromDefaults()
.buildConfigurationUsingCustomCompiler(dmnCompilerFn);
Either<Exception, DMNRuntime> exceptionDMNRuntimeEither;
if (getAdditionalResources() != null && !getAdditionalResources().isEmpty()) {
exceptionDMNRuntimeEither = dmnRuntimeBuilderConfigured
.fromClasspathResources(getResource(), this.getClass(), getAdditionalResources().toArray(new String[0]));
} else {
exceptionDMNRuntimeEither = dmnRuntimeBuilderConfigured
.fromClasspathResource(getResource(), this.getClass());
}
dmnRuntime = exceptionDMNRuntimeEither
.getOrElseThrow(e -> new RuntimeException("Error initializing DMNRuntime", e));
((DMNRuntimeImpl) dmnRuntime).setOption(new RuntimeTypeCheckOption(true));
dmnModel = dmnRuntime.getModel(
getNameSpace(),
getModelName());
if (dmnModel == null) {
throw new RuntimeException("Model " + getNameSpace() + "." + getModelName() + " not found");
}
dmnContext = dmnRuntime.newContext();
getInputData().forEach((key, value) -> dmnContext.set(key, value));
}