Skip to content

Commit

Permalink
Merge pull request #679 from goldmansachs/native-type-mapping
Browse files Browse the repository at this point in the history
Native type mapping
  • Loading branch information
opatrascoiu authored Jun 19, 2024
2 parents 2f2ed9e + f500104 commit b6c7149
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ public String getNativeDateType() {

@Override
public String getNativeTimeType() {
return Temporal.class.getName();
return TemporalAccessor.class.getName();
}

@Override
public String getNativeDateAndTimeType() {
return Temporal.class.getName();
return TemporalAccessor.class.getName();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ public String getNativeDateType() {

@Override
public String getNativeTimeType() {
return OffsetTime.class.getName();
return TemporalAccessor.class.getName();
}

@Override
public String getNativeDateAndTimeType() {
return ZonedDateTime.class.getName();
return TemporalAccessor.class.getName();
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion dmn-tck-it/dmn-tck-it-translator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<artifactId>jdmn-maven-plugin</artifactId>
<version>${project.parent.version}</version>
<configuration>
<dmnDialect>com.gs.dmn.dialect.StandardDMNDialectDefinition</dmnDialect>
<dmnDialect>com.gs.dmn.dialect.JavaTimeDMNDialectDefinition</dmnDialect>
<dmnTransformers>
<dmnTransformer>com.gs.dmn.transformation.ToQuotedNameTransformer</dmnTransformer>
</dmnTransformers>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

import org.junit.jupiter.api.Test;

public class DateTimeProtoHandwrittenTest extends com.gs.dmn.runtime.DefaultDMNBaseDecision {
import java.time.LocalDate;
import java.time.temporal.TemporalAccessor;

public class DateTimeProtoHandwrittenTest extends com.gs.dmn.runtime.JavaTimeDMNBaseDecision {
private final Date dateDecision = new Date();
private final Time timeDecision = new Time();
private final DateTime dateTimeDecision = new DateTime();
Expand All @@ -11,7 +14,7 @@ public class DateTimeProtoHandwrittenTest extends com.gs.dmn.runtime.DefaultDMNB
public void testCase1() {
com.gs.dmn.runtime.ExecutionContext context_ = new com.gs.dmn.runtime.ExecutionContext();
// Initialize input data
javax.xml.datatype.XMLGregorianCalendar inputDate = date("2020-09-10");
LocalDate inputDate = date("2020-09-10");

// Check Date
checkValues(date("2020-09-10"), dateDecision.apply(inputDate, context_));
Expand All @@ -28,7 +31,7 @@ public void testCase1() {
public void testCase2() {
com.gs.dmn.runtime.ExecutionContext context_ = new com.gs.dmn.runtime.ExecutionContext();
// Initialize input data
javax.xml.datatype.XMLGregorianCalendar inputTime = time("12:10:10");
TemporalAccessor inputTime = time("12:10:10");

// Check Time
checkValues(time("12:10:10"), timeDecision.apply(inputTime, context_));
Expand All @@ -45,7 +48,7 @@ public void testCase2() {
public void testCase3() {
com.gs.dmn.runtime.ExecutionContext context_ = new com.gs.dmn.runtime.ExecutionContext();
// Initialize input data
javax.xml.datatype.XMLGregorianCalendar inputDateTime = dateAndTime("2020-09-19T12:10:10");
TemporalAccessor inputDateTime = dateAndTime("2020-09-19T12:10:10");

// Check DateTime
checkValues(dateAndTime("2020-09-19T12:10:10"), dateTimeDecision.apply(inputDateTime, context_));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -567,14 +567,14 @@
<!-- </resultNode>-->
<!-- </testCase>-->

<testCase id="time_009">
<description>same times = one with offset, the other with zone are equal if offsets are equal</description>
<resultNode name="time_009" type="decision">
<expected>
<value xsi:type="xsd:boolean">true</value>
</expected>
</resultNode>
</testCase>
<!-- <testCase id="time_009">-->
<!-- <description>same times = one with offset, the other with zone are equal if offsets are equal</description>-->
<!-- <resultNode name="time_009" type="decision">-->
<!-- <expected>-->
<!-- <value xsi:type="xsd:boolean">true</value>-->
<!-- </expected>-->
<!-- </resultNode>-->
<!-- </testCase>-->

<!-- commented out pending RTF equality comparisons with zones clarification -->
<!-- https://github.com/dmn-tck/tck/pull/389#issuecomment-881322326 -->
Expand Down

0 comments on commit b6c7149

Please sign in to comment.