Skip to content

Commit

Permalink
[#662] XML dialects: Set the dialect in JPA module to the one based o…
Browse files Browse the repository at this point in the history
…n java.time API.
  • Loading branch information
opatrascoiu committed Oct 23, 2024
1 parent 3ac6b02 commit 8001147
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion dmn-jpa-it/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
<artifactId>jdmn-maven-plugin</artifactId>
<version>${project.parent.version}</version>
<configuration>
<dmnDialect>com.gs.dmn.dialect.MixedJavaTimeDMNDialectDefinition</dmnDialect>
<dmnDialect>com.gs.dmn.dialect.JavaTimeDMNDialectDefinition</dmnDialect>
<inputParameters>
<dmnVersion>${dmn.version}</dmnVersion>
<modelVersion>${model.version}</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import javax.persistence.EntityManager;
import javax.persistence.TypedQuery;
import java.math.BigDecimal;

public class LazyPerson implements Person {
private static final Logger LOGGER = LoggerFactory.getLogger(LazyPerson.class);
Expand All @@ -42,7 +41,7 @@ public String getName() {
}

@Override
public BigDecimal getAge() {
public Number getAge() {
if (personJPA == null) {
this.personJPA = findApplicant(id);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import javax.persistence.Persistence;
import javax.persistence.TypedQuery;

public class JPAExampleCreditDecisionTest extends com.gs.dmn.runtime.MixedJavaTimeDMNBaseDecision {
public class JPAExampleCreditDecisionTest extends com.gs.dmn.runtime.JavaTimeDMNBaseDecision {
protected static EntityManagerFactory emf;
protected static EntityManager em;

Expand All @@ -45,8 +45,8 @@ public void testCase001() {
com.gs.dmn.runtime.ExecutionContext context = new com.gs.dmn.runtime.ExecutionContext();
// Initialize input data
com.gs.dmn.generated.example_credit_decision.type.Applicant applicant = findApplicant("Amy");
java.math.BigDecimal currentRiskAppetite = number("50");
java.math.BigDecimal lendingThreshold = number("25");
Number currentRiskAppetite = number("50");
Number lendingThreshold = number("25");

// Check generateOutputData
com.gs.dmn.generated.example_credit_decision.type.GenerateOutputData generateOutputDataOutput = new GenerateOutputData().apply(applicant, currentRiskAppetite, lendingThreshold, context);
Expand All @@ -58,8 +58,8 @@ public void testCase002() {
com.gs.dmn.runtime.ExecutionContext context = new com.gs.dmn.runtime.ExecutionContext();
// Initialize input data
com.gs.dmn.generated.example_credit_decision.type.Applicant applicant = findApplicant("Bill");
java.math.BigDecimal currentRiskAppetite = number("50");
java.math.BigDecimal lendingThreshold = number("25");
Number currentRiskAppetite = number("50");
Number lendingThreshold = number("25");

// Check generateOutputData
com.gs.dmn.generated.example_credit_decision.type.GenerateOutputData generateOutputDataOutput = new GenerateOutputData().apply(applicant, currentRiskAppetite, lendingThreshold, context);
Expand All @@ -71,8 +71,8 @@ public void testCase003() {
com.gs.dmn.runtime.ExecutionContext context = new com.gs.dmn.runtime.ExecutionContext();
// Initialize input data
com.gs.dmn.generated.example_credit_decision.type.Applicant applicant = findApplicant("Charlie");
java.math.BigDecimal currentRiskAppetite = number("50");
java.math.BigDecimal lendingThreshold = number("25");
Number currentRiskAppetite = number("50");
Number lendingThreshold = number("25");

// Check generateOutputData
com.gs.dmn.generated.example_credit_decision.type.GenerateOutputData generateOutputDataOutput = new GenerateOutputData().apply(applicant, currentRiskAppetite, lendingThreshold, context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import java.math.BigDecimal;

public class JPALazyInputModelTest extends com.gs.dmn.runtime.MixedJavaTimeDMNBaseDecision {
public class JPALazyInputModelTest extends com.gs.dmn.runtime.JavaTimeDMNBaseDecision {
protected static EntityManagerFactory emf;
protected static EntityManager em;

Expand All @@ -48,7 +47,7 @@ public void testCase001() {
Person applicant = makeLazyPerson(1);

// Check generateOutputData
BigDecimal score = new Decision().apply(applicant, creditRisk, context);
Number score = new Decision().apply(applicant, creditRisk, context);
checkValues(number("1"), score);
}

Expand All @@ -60,7 +59,7 @@ public void testCase002() {
Person applicant = makeLazyPerson(2);

// Check generateOutputData
BigDecimal score = new Decision().apply(applicant, creditRisk, context);
Number score = new Decision().apply(applicant, creditRisk, context);
checkValues(number("2"), score);
}

Expand All @@ -72,7 +71,7 @@ public void testCase003() {
Person applicant = makeLazyPerson(3);

// Check generateOutputData
BigDecimal score = new Decision().apply(applicant, creditRisk, context);
Number score = new Decision().apply(applicant, creditRisk, context);
checkValues(number("3"), score);
}

Expand All @@ -84,7 +83,7 @@ public void testCase004() {
Person applicant = makeLazyPerson(4);

// Check generateOutputData
BigDecimal score = new Decision().apply(applicant, creditRisk, context);
Number score = new Decision().apply(applicant, creditRisk, context);
checkValues(number("4"), score);
}

Expand All @@ -96,7 +95,7 @@ public void testCase005() {
Person applicant = makeLazyPerson(1);

// Check generateOutputData
BigDecimal score = new Decision().apply(applicant, creditRisk, context);
Number score = new Decision().apply(applicant, creditRisk, context);
checkValues(number("5"), score);
}

Expand Down

0 comments on commit 8001147

Please sign in to comment.