-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kie-issues#1448: matches()
function wrongly behaves
#6085
Conversation
# Conflicts: # kie-dmn/kie-dmn-feel/src/test/java/org/kie/dmn/feel/runtime/functions/MatchesFunctionTest.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @yesamer
I would ask just a couple minor adjustments
kie-dmn/kie-dmn-feel/src/test/java/org/kie/dmn/feel/util/XQueryImplUtilTest.java
Outdated
Show resolved
Hide resolved
kie-dmn/kie-dmn-feel/src/test/java/org/kie/dmn/feel/util/XQueryImplUtilTest.java
Show resolved
Hide resolved
PR job Reproducerbuild-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 #6085 --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-6085/1/display/redirect Test results:
Those are the test failures: org.kie.maven.plugin.it.kie-maven-plugin-test-kjar-2.kie-maven-plugin-test-kjar-2The build exited with code 143. See /home/jenkins/jenkins-agent/workspace/llrequest_jobs_drools-pr_PR-6085/kogito-pipelines/bc/apache_incubator-kie-drools/kie-maven-plugin/target/it/kie-maven-plugin-test-kjar-2/build.log for details. |
@gitgabrio Tests fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx @yesamer !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly some fixes to make the tests clearer and crisper.
- very good to use parametric tests
- do not use parameters that are constants - if they do not change they should not be parameters
- consider adding a parametric name for the tests, this would make it easier to read them. See https://junit.org/junit5/docs/current/user-guide/#writing-tests-display-names for reference.
kie-dmn/kie-dmn-feel/src/test/java/org/kie/dmn/feel/runtime/functions/MatchesFunctionTest.java
Outdated
Show resolved
Hide resolved
kie-dmn/kie-dmn-feel/src/test/java/org/kie/dmn/feel/runtime/functions/MatchesFunctionTest.java
Outdated
Show resolved
Hide resolved
kie-dmn/kie-dmn-feel/src/test/java/org/kie/dmn/feel/runtime/functions/MatchesFunctionTest.java
Show resolved
Hide resolved
kie-dmn/kie-dmn-feel/src/test/java/org/kie/dmn/feel/runtime/functions/MatchesFunctionTest.java
Show resolved
Hide resolved
kie-dmn/kie-dmn-feel/src/test/java/org/kie/dmn/feel/runtime/functions/MatchesFunctionTest.java
Outdated
Show resolved
Hide resolved
kie-dmn/kie-dmn-feel/src/test/java/org/kie/dmn/feel/runtime/functions/MatchesFunctionTest.java
Show resolved
Hide resolved
kie-dmn/kie-dmn-feel/src/test/java/org/kie/dmn/feel/runtime/functions/ReplaceFunctionTest.java
Outdated
Show resolved
Hide resolved
kie-dmn/kie-dmn-feel/src/test/java/org/kie/dmn/feel/runtime/functions/ReplaceFunctionTest.java
Outdated
Show resolved
Hide resolved
kie-dmn/kie-dmn-feel/src/test/java/org/kie/dmn/feel/runtime/functions/ReplaceFunctionTest.java
Outdated
Show resolved
Hide resolved
kie-dmn/kie-dmn-feel/src/test/java/org/kie/dmn/feel/util/XQueryImplUtilTest.java
Outdated
Show resolved
Hide resolved
@pibizza I applied your suggestion in all the places where I'm sure the parameter will always be a constant (basically all the exceptions). Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Failures:
on runtimes are unrelated to these PR changes. |
* matches and replace using saxon * saxon usage simplified and modified tests * clean up code as per standards * changes as per suggestions * changes as per suggestions and restored the earlier tests * changes as per suggestions and restored the earlier tests * changes as per suggestions * exceptions handled and changes to util class * wip * wip * wip * wip * wip * CR * CR * CR * CR * Notice updated * CR --------- Co-authored-by: bncriju <[email protected]>
Closes: apache/incubator-kie-issues#1448
According to the DMN specs, the matches() and replace() functions should behave according to the xQuery 1.0 specification.
Our current implementation doesn't rely on that, using the native Java implementation to manage both.
Unfortunately, the Java regex management differs from the xQuery specs, and natively implementing the xQuery specs leads to huge effort (and complex) work. For that reason, we agreed to rely on an external library that already implemented xQuery specs in Java.
After a quick analysis (https://en.wikipedia.org/wiki/XQuery#Implementations), we choose Saxon-He as the best fit for this purpose.
The scope of the ticket is to integrate this new external dependency into our code base, so that both matches() and replace() can rely on that implementation to correctly behave.
How to replicate CI configuration locally?
Build Chain tool does "simple" maven build(s), the builds are just Maven commands, but because the repositories relates and depends on each other and any change in API or class method could affect several of those repositories there is a need to use build-chain tool to handle cross repository builds and be sure that we always use latest version of the code for each repository.
build-chain tool is a build tool which can be used on command line locally or in Github Actions workflow(s), in case you need to change multiple repositories and send multiple dependent pull requests related with a change you can easily reproduce the same build by executing it on Github hosted environment or locally in your development environment. See local execution details to get more information about it.
How to retest this PR or trigger a specific build:
for pull request and downstream checks
for a full downstream build
run_fdb
for Jenkins PR check only
Build Now
button.