This is an automated email from the ASF dual-hosted git repository.
gitgabrio pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-drools.git
The following commit(s) were added to refs/heads/main by this push:
new 34370478c3 [incubator-kie-issues#2010] Enabled and fixed dmn-pmml
tests (#6380)
34370478c3 is described below
commit 34370478c35bc7cc65ccb77fbeec7117d7856ea1
Author: Gabriele Cardosi <[email protected]>
AuthorDate: Mon Jul 7 13:38:16 2025 +0200
[incubator-kie-issues#2010] Enabled and fixed dmn-pmml tests (#6380)
* [incubator-kie-issues#2010] Enabled and fixed dmn-pmml tests
* [incubator-kie-issues#2010] Fix behavior on windows
---------
Co-authored-by: Gabriele-Cardosi <[email protected]>
---
.../src/main/java/org/kie/dmn/core/compiler/DMNImportsUtil.java | 9 ++++++++-
.../src/main/java/org/kie/dmn/core/pmml/EfestoPMMLUtils.java | 9 ++++++++-
kie-dmn/kie-dmn-pmml-tests-parent/pom.xml | 8 ++++++++
3 files changed, 24 insertions(+), 2 deletions(-)
diff --git
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNImportsUtil.java
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNImportsUtil.java
index 78bb78003f..2880f40a0c 100644
---
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNImportsUtil.java
+++
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNImportsUtil.java
@@ -371,10 +371,17 @@ public class DMNImportsUtil {
* @throws IllegalStateException if the file can not be found
*/
static String getPmmlFileContent(String pmmlFileName, ClassLoader
classLoader) {
- return getPmmlFileContentFromClasspath(pmmlFileName).or(() ->
getPmmlFileContentFromClassloader(pmmlFileName, classLoader))
+ return getPmmlFileContentFromContextStorage(pmmlFileName)
+ .or(() -> getPmmlFileContentFromClasspath(pmmlFileName))
+ .or(() -> getPmmlFileContentFromClassloader(pmmlFileName,
classLoader))
.orElseThrow(() -> new IllegalStateException("Could not find
PMML file: " + pmmlFileName));
}
+ static Optional<String> getPmmlFileContentFromContextStorage(String
pmmlFileName) {
+ ModelLocalUriId sourceLocalUriId =
EfestoPMMLUtils.getPmmlModelLocalUriId(pmmlFileName, "source");
+ return Optional.ofNullable(
EfestoPMMLUtils.getPmmlSourceFromContextStorage(sourceLocalUriId));
+ }
+
static Optional<String> getPmmlFileContentFromClasspath(String
pmmlFileName) {
String toReturn = null;
try {
diff --git
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/pmml/EfestoPMMLUtils.java
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/pmml/EfestoPMMLUtils.java
index 7b58eee3b0..4db43ab213 100644
---
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/pmml/EfestoPMMLUtils.java
+++
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/pmml/EfestoPMMLUtils.java
@@ -147,6 +147,8 @@ public class EfestoPMMLUtils {
.findFirst()
.orElse(null);
ContextStorage.putEfestoCompilationContext(pmmlModelLocalUriId,
pmmlCompilationContext);
+ ModelLocalUriId sourceLocalUriId = getPmmlModelLocalUriId(fileName,
"source");
+ ContextStorage.putEfestoCompilationSource(sourceLocalUriId,
pmmlSource);
}
/**
@@ -241,11 +243,16 @@ public class EfestoPMMLUtils {
File parentDir = null;
if (dmnResource instanceof FileSystemResource fileSystemResource &&
fileSystemResource.getFile() != null) {
parentDir = fileSystemResource.getFile().getParentFile();
+ return parentDir.toPath();
} else if (dmnResource instanceof ClassPathResource classPathResource)
{
try {
URL resourceUrl = classPathResource.getURL();
if (resourceUrl != null && resourceUrl.getFile() != null) {
- parentDir = new
File(resourceUrl.getFile()).getParentFile();
+ String filePath = resourceUrl.getFile();
+ if (filePath.startsWith("file:")) {
+ filePath = filePath.substring(5);
+ }
+ parentDir = new File(filePath).getParentFile();
}
} catch (Exception e) {
logger.warn("Failed to retrieve the URL from ClassPathResource
{}", classPathResource, e);
diff --git a/kie-dmn/kie-dmn-pmml-tests-parent/pom.xml
b/kie-dmn/kie-dmn-pmml-tests-parent/pom.xml
index 85c37fa46a..09982a8ea3 100644
--- a/kie-dmn/kie-dmn-pmml-tests-parent/pom.xml
+++ b/kie-dmn/kie-dmn-pmml-tests-parent/pom.xml
@@ -71,4 +71,12 @@
</dependencies>
</dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
</project>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]