-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[incubator-kie-issues#1742] DMN: B-FEEL implementation (#6213)
* [incubator-kie-issues#1659] Implemented FEELBuilder. Removing FEEL static methods. Add usage of FEELDialect inside BaseFEELTest * [incubator-kie-issues#1187] Split EvalHelper * [private-bamoe-issues#1659] WIP - working compilation. * [private-bamoe-issues#1659] WIP - working compilation. Put on hold for other refactoring (incubator-kie-issues#1206) * [private-bamoe-issues#1659] Implementing B-FEEL - overall working. Suspend to refactor functions as per incubator-kie-issues#1344 * [incubator-kie-issues#1742] Working status - compilation and tests succeed * [incubator-kie-issues#1742] Fixed as per PR suggestion * [incubator-kie-issues#1742] Extend test coverage * [incubator-kie-issues#1742] WIP * [incubator-kie-issues#1742] Fixing headers * [incubator-kie-issues#1742] WIP * [incubator-kie-issues#1742] Implemented BFEEL local override management * [incubator-kie-issues#1742] Removing duplicated decision/assertions * [incubator-kie-issues#1742] Moving/renaming/testing "equal" method to BooleanEvalHelper * [incubator-kie-issues#1742] Extending BFEEL paradigm to all functions. Implementing overall BFEELValueFunctionTest * [incubator-kie-issues#1742] Fixed as per PR review * [incubator-kie-issues#1742] Fixing license header * [incubator-kie-issues#1742] Fixed as per PR review * [incubator-kie-issues#1742] Fixed as per PR review * [incubator-kie-issues#1742] Fixed as per PR review --------- Co-authored-by: Gabriele-Cardosi <[email protected]>
- Loading branch information
Showing
141 changed files
with
2,448 additions
and
741 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
890 changes: 501 additions & 389 deletions
890
kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNEvaluatorCompiler.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/DMNInputRuntimeBFEELTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.kie.dmn.core; | ||
|
||
import java.util.Collections; | ||
|
||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.MethodSource; | ||
import org.kie.dmn.api.core.DMNContext; | ||
import org.kie.dmn.api.core.DMNModel; | ||
import org.kie.dmn.api.core.DMNResult; | ||
import org.kie.dmn.api.core.DMNRuntime; | ||
import org.kie.dmn.core.impl.DMNModelImpl; | ||
import org.kie.dmn.core.util.DMNRuntimeUtil; | ||
import org.kie.dmn.feel.lang.FEELDialect; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
public class DMNInputRuntimeBFEELTest extends BaseInterpretedVsCompiledTest { | ||
|
||
@ParameterizedTest | ||
@MethodSource("params") | ||
void constraintsChecksBFEEL(boolean useExecModelCompiler) { | ||
init(useExecModelCompiler); | ||
final DMNRuntime runtime = DMNRuntimeUtil.createRuntime("valid_models/DMNv1_5/B-FEEL/ConstraintsChecksBFeel" + | ||
".dmn", this.getClass()); | ||
final DMNModel dmnModel = runtime.getModel( | ||
"http://www.trisotech.com/definitions/_238bd96d-47cd-4746-831b-504f3e77b442", | ||
"ConstraintsChecksBFEEL"); | ||
assertThat(dmnModel).isNotNull(); | ||
assertThat(dmnModel.hasErrors()).as(DMNRuntimeUtil.formatMessages(dmnModel.getMessages())).isFalse(); | ||
assertThat(dmnModel).isInstanceOf(DMNModelImpl.class); | ||
assertThat(((DMNModelImpl) dmnModel).getFeelDialect()).isEqualTo(FEELDialect.BFEEL); | ||
} | ||
|
||
@ParameterizedTest | ||
@MethodSource("params") | ||
void bFeelChecks(boolean useExecModelCompiler) { | ||
init(useExecModelCompiler); | ||
final DMNRuntime runtime = DMNRuntimeUtil.createRuntime("valid_models/DMNv1_5/B-FEEL/BFeelChecks.dmn", | ||
this.getClass()); | ||
final DMNModel dmnModel = runtime.getModel( | ||
"http://www.trisotech.com/definitions/_238bd96d-47cd-4746-831b-504f3e77b442", | ||
"BFEELChecks"); | ||
assertThat(dmnModel).isNotNull(); | ||
assertThat(dmnModel.hasErrors()).as(DMNRuntimeUtil.formatMessages(dmnModel.getMessages())).isFalse(); | ||
assertThat(dmnModel).isInstanceOf(DMNModelImpl.class); | ||
assertThat(((DMNModelImpl) dmnModel).getFeelDialect()).isEqualTo(FEELDialect.BFEEL); | ||
|
||
final DMNContext ctx1 = runtime.newContext(); | ||
ctx1.set("user", "a"); | ||
final DMNResult dmnResult1 = runtime.evaluateAll(dmnModel, ctx1); | ||
assertThat(dmnResult1.getDecisionResultByName("Decision1").getResult()).isEqualTo(false); | ||
assertThat(dmnResult1.getDecisionResultByName("Decision2").getResult()).isEqualTo(Collections.emptyList()); | ||
} | ||
|
||
@ParameterizedTest | ||
@MethodSource("params") | ||
void bFeelOverrideChecks(boolean useExecModelCompiler) { | ||
init(useExecModelCompiler); | ||
final DMNRuntime runtime = DMNRuntimeUtil.createRuntime("valid_models/DMNv1_5/B-FEEL/BFeelOverrideChecks.dmn", | ||
this.getClass()); | ||
final DMNModel dmnModel = runtime.getModel( | ||
"http://www.trisotech.com/definitions/_238bd96d-47cd-4746-831b-504f3e77b442", | ||
"BFEELOverrideChecks"); | ||
assertThat(dmnModel).isNotNull(); | ||
assertThat(dmnModel.hasErrors()).as(DMNRuntimeUtil.formatMessages(dmnModel.getMessages())).isFalse(); | ||
assertThat(dmnModel).isInstanceOf(DMNModelImpl.class); | ||
assertThat(((DMNModelImpl) dmnModel).getFeelDialect()).isEqualTo(FEELDialect.FEEL); | ||
|
||
final DMNContext ctx1 = runtime.newContext(); | ||
ctx1.set("user", "a"); | ||
final DMNResult dmnResult1 = runtime.evaluateAll(dmnModel, ctx1); | ||
assertThat(dmnResult1.getDecisionResultByName("Decision1").getResult()).isEqualTo(false); | ||
assertThat(dmnResult1.getDecisionResultByName("Decision2").getResult()).isNull(); | ||
assertThat(dmnResult1.getDecisionResultByName("Decision3").getResult()).isEqualTo(Collections.emptyList()); | ||
} | ||
} |
Oops, something went wrong.