Re: [PR] [incubator-kie-issues#2021] DMN boxed filter behavior in relation to implicit conversions [incubator-kie-drools]
baldimir merged PR #6393: URL: https://github.com/apache/incubator-kie-drools/pull/6393 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] - To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Re: [PR] [incubator-kie-issues#2021] DMN boxed filter behavior in relation to implicit conversions [incubator-kie-drools]
ChinchuAjith commented on code in PR #6393:
URL:
https://github.com/apache/incubator-kie-drools/pull/6393#discussion_r2200120749
##
kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/DMNRuntimeTest.java:
##
@@ -463,6 +462,112 @@ void boxedContext(boolean useExecModelCompiler) {
assertThat((Map)
dmnResult.getContext().get("Math")).containsEntry("Product",
BigDecimal.valueOf(50));
}
+@ParameterizedTest
+@MethodSource("params")
+void boxedFilter(boolean useExecModelCompiler) {
+init(useExecModelCompiler);
+final DMNRuntime runtime =
DMNRuntimeUtil.createRuntime("valid_models/DMNv1_6/BoxedFilter.dmn",
this.getClass());
+final DMNModel dmnModel = runtime.getModel(
+"https://kie.org/dmn/_42BAF435-BAF7-460A-8C5D-351ABB98403C";,
+"DMN_DFD7A647-6D67-4014-834B-E7559668C4B5"
+);
+assertThat(dmnModel).isNotNull();
+
assertThat(dmnModel.hasErrors()).as(DMNRuntimeUtil.formatMessages(dmnModel.getMessages())).isFalse();
+
+final DMNContext context = DMNFactory.newContext();
+context.set("fruit", "Mango");
+
+final DMNResult dmnResult = runtime.evaluateAll(dmnModel, context);
+assertThat(dmnResult).isNotNull();
+
assertThat(dmnResult.hasErrors()).as(DMNRuntimeUtil.formatMessages(dmnResult.getMessages())).isFalse();
+
assertThat(dmnResult.getContext().get("BoxedFilter")).isEqualTo(Collections.singletonList("Mango"));
+}
+
+@ParameterizedTest
+@MethodSource("params")
+void boxedFilterInvalidCondition(boolean useExecModelCompiler) {
+init(useExecModelCompiler);
+final DMNRuntime runtime =
DMNRuntimeUtil.createRuntime("valid_models/DMNv1_6/BoxedFilter.dmn",
this.getClass());
+final DMNModel dmnModel = runtime.getModel(
+"https://kie.org/dmn/_42BAF435-BAF7-460A-8C5D-351ABB98403C";,
+"DMN_DFD7A647-6D67-4014-834B-E7559668C4B5"
+);
+assertThat(dmnModel).isNotNull();
+
assertThat(dmnModel.hasErrors()).as(DMNRuntimeUtil.formatMessages(dmnModel.getMessages())).isFalse();
+
+final DMNContext context = DMNFactory.newContext();
+context.set("fruit", "Kiwi");
+
+final DMNResult dmnResult = runtime.evaluateAll(dmnModel, context);
+assertThat(dmnResult).isNotNull();
+
assertThat(dmnResult.hasErrors()).as(DMNRuntimeUtil.formatMessages(dmnResult.getMessages())).isFalse();
+
assertThat(dmnResult.getContext().get("BoxedFilter")).isEqualTo(Collections.emptyList());
+}
+
+@ParameterizedTest
+@MethodSource("params")
+void boxedIterator(boolean useExecModelCompiler) {
+init(useExecModelCompiler);
+final DMNRuntime runtime =
DMNRuntimeUtil.createRuntime("valid_models/DMNv1_6/BoxedIterator.dmn",
this.getClass());
+final DMNModel dmnModel = runtime.getModel(
+"https://kie.org/dmn/_60C30701-AFB7-49C5-9B23-A0167DDC6795";,
+"DMN_A15DEB5A-841F-4AC0-8C09-2403F5707373"
+);
+assertThat(dmnModel).isNotNull();
+
assertThat(dmnModel.hasErrors()).as(DMNRuntimeUtil.formatMessages(dmnModel.getMessages())).isFalse();
+
+final DMNContext context = DMNFactory.newContext();
+context.set("singleNumber", 5);
+final DMNResult dmnResult = runtime.evaluateAll(dmnModel, context);
+assertThat(dmnResult).isNotNull();
+
assertThat(dmnResult.hasErrors()).as(DMNRuntimeUtil.formatMessages(dmnResult.getMessages())).isFalse();
+
assertThat(dmnResult.getContext().get("BoxedIterator")).isEqualTo(Collections.singletonList(BigDecimal.valueOf(30)));
+}
+
+@ParameterizedTest
+@MethodSource("params")
+void boxedFilterInvalidConditionWithInvalidInput(boolean
useExecModelCompiler) {
+init(useExecModelCompiler);
+final DMNRuntime runtime =
DMNRuntimeUtil.createRuntime("valid_models/DMNv1_6/BoxedIterator.dmn",
this.getClass());
+final DMNModel dmnModel = runtime.getModel(
+"https://kie.org/dmn/_60C30701-AFB7-49C5-9B23-A0167DDC6795";,
+"DMN_A15DEB5A-841F-4AC0-8C09-2403F5707373"
+);
+assertThat(dmnModel).isNotNull();
+
assertThat(dmnModel.hasErrors()).as(DMNRuntimeUtil.formatMessages(dmnModel.getMessages())).isFalse();
+
+final DMNContext context = DMNFactory.newContext();
+context.set("singleNumber", "invalid");
+
+final DMNResult dmnResult = runtime.evaluateAll(dmnModel, context);
+assertThat(dmnResult).isNotNull();
+assertThat(dmnResult.hasErrors()).isTrue();
+assertThat(dmnResult.getContext().get("BoxedFilter")).isNull();
Review Comment:
Corrected
##
kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/DMNRuntimeTest.java:
##
@@ -463,6 +462,112 @@ void boxedContext(boolean useExecModelCompiler) {
assertThat((Map)
dmnResult.getContext().get("Math")).
Re: [PR] [incubator-kie-issues#2021] DMN boxed filter behavior in relation to implicit conversions [incubator-kie-drools]
Copilot commented on code in PR #6393:
URL:
https://github.com/apache/incubator-kie-drools/pull/6393#discussion_r2199957380
##
kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/DMNRuntimeTest.java:
##
@@ -463,6 +462,112 @@ void boxedContext(boolean useExecModelCompiler) {
assertThat((Map)
dmnResult.getContext().get("Math")).containsEntry("Product",
BigDecimal.valueOf(50));
}
+@ParameterizedTest
+@MethodSource("params")
+void boxedFilter(boolean useExecModelCompiler) {
+init(useExecModelCompiler);
+final DMNRuntime runtime =
DMNRuntimeUtil.createRuntime("valid_models/DMNv1_6/BoxedFilter.dmn",
this.getClass());
+final DMNModel dmnModel = runtime.getModel(
+"https://kie.org/dmn/_42BAF435-BAF7-460A-8C5D-351ABB98403C";,
+"DMN_DFD7A647-6D67-4014-834B-E7559668C4B5"
+);
+assertThat(dmnModel).isNotNull();
+
assertThat(dmnModel.hasErrors()).as(DMNRuntimeUtil.formatMessages(dmnModel.getMessages())).isFalse();
+
+final DMNContext context = DMNFactory.newContext();
+context.set("fruit", "Mango");
+
+final DMNResult dmnResult = runtime.evaluateAll(dmnModel, context);
+assertThat(dmnResult).isNotNull();
+
assertThat(dmnResult.hasErrors()).as(DMNRuntimeUtil.formatMessages(dmnResult.getMessages())).isFalse();
+
assertThat(dmnResult.getContext().get("BoxedFilter")).isEqualTo(Collections.singletonList("Mango"));
+}
+
+@ParameterizedTest
+@MethodSource("params")
+void boxedFilterInvalidCondition(boolean useExecModelCompiler) {
+init(useExecModelCompiler);
+final DMNRuntime runtime =
DMNRuntimeUtil.createRuntime("valid_models/DMNv1_6/BoxedFilter.dmn",
this.getClass());
+final DMNModel dmnModel = runtime.getModel(
+"https://kie.org/dmn/_42BAF435-BAF7-460A-8C5D-351ABB98403C";,
+"DMN_DFD7A647-6D67-4014-834B-E7559668C4B5"
+);
+assertThat(dmnModel).isNotNull();
+
assertThat(dmnModel.hasErrors()).as(DMNRuntimeUtil.formatMessages(dmnModel.getMessages())).isFalse();
+
+final DMNContext context = DMNFactory.newContext();
+context.set("fruit", "Kiwi");
+
+final DMNResult dmnResult = runtime.evaluateAll(dmnModel, context);
+assertThat(dmnResult).isNotNull();
+
assertThat(dmnResult.hasErrors()).as(DMNRuntimeUtil.formatMessages(dmnResult.getMessages())).isFalse();
+
assertThat(dmnResult.getContext().get("BoxedFilter")).isEqualTo(Collections.emptyList());
+}
+
+@ParameterizedTest
+@MethodSource("params")
+void boxedIterator(boolean useExecModelCompiler) {
+init(useExecModelCompiler);
+final DMNRuntime runtime =
DMNRuntimeUtil.createRuntime("valid_models/DMNv1_6/BoxedIterator.dmn",
this.getClass());
+final DMNModel dmnModel = runtime.getModel(
+"https://kie.org/dmn/_60C30701-AFB7-49C5-9B23-A0167DDC6795";,
+"DMN_A15DEB5A-841F-4AC0-8C09-2403F5707373"
+);
+assertThat(dmnModel).isNotNull();
+
assertThat(dmnModel.hasErrors()).as(DMNRuntimeUtil.formatMessages(dmnModel.getMessages())).isFalse();
+
+final DMNContext context = DMNFactory.newContext();
+context.set("singleNumber", 5);
+final DMNResult dmnResult = runtime.evaluateAll(dmnModel, context);
+assertThat(dmnResult).isNotNull();
+
assertThat(dmnResult.hasErrors()).as(DMNRuntimeUtil.formatMessages(dmnResult.getMessages())).isFalse();
+
assertThat(dmnResult.getContext().get("BoxedIterator")).isEqualTo(Collections.singletonList(BigDecimal.valueOf(30)));
+}
+
+@ParameterizedTest
+@MethodSource("params")
+void boxedFilterInvalidConditionWithInvalidInput(boolean
useExecModelCompiler) {
+init(useExecModelCompiler);
+final DMNRuntime runtime =
DMNRuntimeUtil.createRuntime("valid_models/DMNv1_6/BoxedIterator.dmn",
this.getClass());
+final DMNModel dmnModel = runtime.getModel(
+"https://kie.org/dmn/_60C30701-AFB7-49C5-9B23-A0167DDC6795";,
+"DMN_A15DEB5A-841F-4AC0-8C09-2403F5707373"
+);
+assertThat(dmnModel).isNotNull();
+
assertThat(dmnModel.hasErrors()).as(DMNRuntimeUtil.formatMessages(dmnModel.getMessages())).isFalse();
+
+final DMNContext context = DMNFactory.newContext();
+context.set("singleNumber", "invalid");
+
+final DMNResult dmnResult = runtime.evaluateAll(dmnModel, context);
+assertThat(dmnResult).isNotNull();
+assertThat(dmnResult.hasErrors()).isTrue();
+assertThat(dmnResult.getContext().get("BoxedFilter")).isNull();
Review Comment:
The assertion checks for 'BoxedFilter' but the test is using
BoxedIterator.dmn model. This should be 'BoxedIterator' to match the actual
decision being evaluated.
```suggestion
assertThat(dmnResult.getContext().get("BoxedIterator"))
Re: [PR] [incubator-kie-issues#2021] DMN boxed filter behavior in relation to implicit conversions [incubator-kie-drools]
ChinchuAjith commented on code in PR #6393: URL: https://github.com/apache/incubator-kie-drools/pull/6393#discussion_r2197365761 ## kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/DMNRuntimeTest.java: ## @@ -29,14 +29,15 @@ import java.time.ZonedDateTime; import java.time.chrono.ChronoPeriod; import java.time.temporal.ChronoUnit; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; import java.util.Collection; import java.util.HashMap; -import java.util.List; import java.util.Map; +import java.util.Arrays; Review Comment: Done -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] - To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Re: [PR] [incubator-kie-issues#2021] DMN boxed filter behavior in relation to implicit conversions [incubator-kie-drools]
ChinchuAjith commented on code in PR #6393: URL: https://github.com/apache/incubator-kie-drools/pull/6393#discussion_r2196519557 ## kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/BoxedExpressions.dmn: ## @@ -0,0 +1,59 @@ + + +https://www.omg.org/spec/DMN/20240513/MODEL/"; Review Comment: Done -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] - To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Re: [PR] [incubator-kie-issues#2021] DMN boxed filter behavior in relation to implicit conversions [incubator-kie-drools]
kie-ci3 commented on PR #6393:
URL:
https://github.com/apache/incubator-kie-drools/pull/6393#issuecomment-3048756926
**PR job** `#3` was: **UNSTABLE**
Possible explanation: This should be test failures
Reproducer
build-chain build full_downstream -f
'https://raw.githubusercontent.com/${AUTHOR:apache}/incubator-kie-kogito-pipelines/${BRANCH:main}/.ci/buildchain-config-pr-cdb.yaml'
-o 'bc' -p apache/incubator-kie-drools -u
https://github.com/apache/incubator-kie-drools/pull/6393 --skipParallelCheckout
NOTE: To install the build-chain tool, please refer to
https://github.com/kiegroup/github-action-build-chain#local-execution
Please look here:
https://ci-builds.apache.org/job/KIE/job/drools/job/main/job/pullrequest_jobs/job/drools-pr/job/PR-6393/3/display/redirect
**Test results:**
- PASSED: 23656
- FAILED: 1
Those are the test failures:
https://ci-builds.apache.org/job/KIE/job/drools/job/main/job/pullrequest_jobs/job/drools-pr/job/PR-6393/3/testReport/org.kie.dmn.validation/ValidatorTest/validateAllValidSharedModels/";>org.kie.dmn.validation.ValidatorTest.validateAllValidSharedModels
Expecting empty but was: [Message [id=0, level=WARNING,
path=valid_models/DMNv1_6/BoxedExpressions.dmn, line=30, column=-1
text=DMN: Variable named 'boxedFilter' is missing its type reference on node
'boxedFilter' (DMN id: _F2C7743C-F89C-42D1-89DA-689DFF6E11DA, Type ref not
defined) ],Message [id=0, level=WARNING,
path=valid_models/DMNv1_6/BoxedExpressions.dmn, line=36, column=-1
text=DMN: Variable named 'boxedIterator' is missing its type reference on node
'boxedIterator' (DMN id: _CABFAFAB-3829-46C9-9584-EF093B904CBA, Type ref not
defined) ]]
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
Re: [PR] [incubator-kie-issues#2021] DMN boxed filter behavior in relation to implicit conversions [incubator-kie-drools]
yesamer commented on code in PR #6393: URL: https://github.com/apache/incubator-kie-drools/pull/6393#discussion_r2191735117 ## kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/DMNRuntimeTest.java: ## @@ -29,14 +29,15 @@ import java.time.ZonedDateTime; import java.time.chrono.ChronoPeriod; import java.time.temporal.ChronoUnit; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; import java.util.Collection; import java.util.HashMap; -import java.util.List; import java.util.Map; +import java.util.Arrays; Review Comment: @ChinchuAjith Please merge all java.util imports in the same block and in alphabetical order. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] - To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Re: [PR] [incubator-kie-issues#2021] DMN boxed filter behavior in relation to implicit conversions [incubator-kie-drools]
gitgabrio commented on code in PR #6393: URL: https://github.com/apache/incubator-kie-drools/pull/6393#discussion_r2191730907 ## kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/BoxedExpressions.dmn: ## @@ -0,0 +1,59 @@ + + +https://www.omg.org/spec/DMN/20240513/MODEL/"; Review Comment: HI @ChinchuAjith Please move this model under kie-dmn-test-resources, in the 1.6 folder. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] - To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
