Skip to content

Commit

Permalink
[incubator-kie-issues#1627] Change log level from error to debug insi…
Browse files Browse the repository at this point in the history
…de ImportDMNResolverUtil (apache#6172)

* change log level

* change log level

* change log level
  • Loading branch information
yesamer authored and rgdoliveira committed Dec 2, 2024
1 parent 06951a9 commit a27fb09
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ public static <T> Either<String, T> resolveImportDMN(Import importElement, Colle
"Importing a DMN model with namespace={} name={} locationURI={}, modelName={}",
importerDMNName, importerDMNNamespace, importNamespace, importName, importLocationURI, importModelName);

if (dmns.isEmpty()) {
return Either.ofLeft("Impossible to resolve an import against an empty DMN collection");
}

List<T> matchingDMNList = dmns.stream()
.filter(m -> idExtractor.apply(m).getNamespaceURI().equals(importNamespace))
.toList();
Expand All @@ -64,7 +68,7 @@ public static <T> Either<String, T> resolveImportDMN(Import importElement, Colle
importerDMNName, importerDMNNamespace, importNamespace, importName, importLocationURI, importModelName);
return Either.ofRight(located);
} else {
LOGGER.debug("DMN Model with name={} and namespace={} can't import a DMN with namespace={}, name={}, modelName={}, " +
LOGGER.error("DMN Model with name={} and namespace={} can't import a DMN with namespace={}, name={}, modelName={}, " +
"located within namespace only {} but does not match for the actual modelName",
importerDMNName, importerDMNNamespace, importNamespace, importName, importModelName, idExtractor.apply(located));
return Either.ofLeft(String.format(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.kie.dmn.core.compiler;

import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -156,7 +157,6 @@ void locateInNSnoModelNameWithAlias2() {

@Test
void locateInNSAliasedBadScenario() {
// this is a BAD scenario are in namespace `nsA` there are 2 models with the same name.
final Import i = makeImport("nsA", "aliased", "mA");
final List<QName> available = Arrays.asList(new QName("nsA", "mA"),
new QName("nsA", "mA"),
Expand All @@ -165,6 +165,13 @@ void locateInNSAliasedBadScenario() {
assertThat(result.isLeft()).isTrue();
}

@Test
void emptyDMNCollection() {
final Import i = makeImport("nsA", "aliased", "mA");
final Either<String, QName> result = ImportDMNResolverUtil.resolveImportDMN(i, Collections.emptyList(), Function.identity());
assertThat(result.isLeft()).isTrue();
}

private Import makeImport(final String namespace, final String name, final String modelName) {
final Import i = new TImport();
i.setNamespace(namespace);
Expand Down

0 comments on commit a27fb09

Please sign in to comment.