Skip to content

Commit

Permalink
Merge pull request #660 from goldmansachs/minor-changes
Browse files Browse the repository at this point in the history
Minor changes
  • Loading branch information
opatrascoiu authored May 17, 2024
2 parents fb1d913 + 1b5b1fe commit 58f07b3
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,18 +191,12 @@ public UnaryTests<T> toAny() {
}

public PositiveUnaryTest<T> toPositiveUnaryTest(Expression<T> expression) {
if (expression instanceof SimplePositiveUnaryTest) {
// since DMN 1.1
return (PositiveUnaryTest<T>) expression;
} else if (expression instanceof NullTest) {
if (expression instanceof PositiveUnaryTest) {
// since DMN 1.1
return (PositiveUnaryTest<T>) expression;
} else if (expression instanceof NullLiteral) {
// since DMN 1.1
return toNullPositiveUnaryTest();
} else if (expression instanceof NamedExpression || expression instanceof PathExpression) {
// since DMN 1.1
return toOperatorRange(null, expression);
} else if (expression instanceof SimpleLiteral) {
// since DMN 1.1
return toOperatorRange(null, expression);
Expand All @@ -219,9 +213,6 @@ public PositiveUnaryTest<T> toPositiveUnaryTest(Expression<T> expression) {
}
}
return toListTest((ListLiteral<T>) toListLiteral(puts));
} else if (expression instanceof ExpressionTest) {
// since DMN 1.2
return (PositiveUnaryTest<T>) expression;
} else {
// Since DMN 1.2
if (containsQuestionMark(expression)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public DMNModelRepository transform(DMNModelRepository repository) {
}

for (TDefinitions definitions: repository.getAllDefinitions()) {
this.logger.info(String.format("Replace inputExpressions with ? in inputEntries in model '%s'", definitions.getName()));
this.logger.debug(String.format("Replace inputExpressions with ? in inputEntries in model '%s'", definitions.getName()));
definitions.accept(this.visitor, null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ private String condition(TDRGElement element, TExpression decisionTable, TUnaryT
try {
return inputEntryToNative(element, inputExpressionText, inputEntryText);
} catch (Exception e) {
throw new DMNRuntimeException(String.format("Cannot build condition for input clause '%s' for entry '%s' in element '%s' in rule %d", inputExpressionText, inputEntryText, element.getName(), ruleIndex + 1), e);
throw new DMNRuntimeException(String.format("Cannot build condition for input clause '%s' for entry '%s' in element '%s' in rule %d", inputExpressionText, inputEntryText, this.dmnModelRepository.displayName(element), ruleIndex + 1), e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public void testUpdateUnaryTests() {
// TODO Add more tests
doTest("contains(x.y.z, \"123\")", "x.y.z", "contains(?, \"123\")");
doTest("review.nextActionNew", "review.nextAction", "review.nextActionNew");
doTest("input1 == 123", "input", "input1 == 123");
}

private void doTest(String unaryTestsText, String inputExpression, String expectedValue) {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.outputEncoding>UTF-8</project.build.outputEncoding>
<java.version>17</java.version>
<java.version>1.8</java.version>
<maven.version>3.9.4</maven.version>

<antlr4.version>4.13.1</antlr4.version>
Expand Down

0 comments on commit 58f07b3

Please sign in to comment.