support both jdk 8 and 9

This commit is contained in:
jackyq2015 2018-12-08 15:31:01 -05:00
parent 5421a23fba
commit d1ed842f02
5 changed files with 10 additions and 21 deletions

View File

@ -2,6 +2,8 @@ language: java
jdk: jdk:
- oraclejdk8 - oraclejdk8
- openjdk8 - openjdk8
- oraclejdk9
- openjdk9
addons: addons:
mariadb: '10.0' mariadb: '10.0'

View File

@ -475,6 +475,11 @@
<version>1.7.1</version> <version>1.7.1</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -2,7 +2,6 @@ package com.google.refine.tests.expr.functions.date;
import java.time.OffsetDateTime; import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.Properties; import java.util.Properties;
@ -58,12 +57,7 @@ public class DatePartTests extends RefineTest {
} }
} }
private DateTimeFormatter formatter = new DateTimeFormatterBuilder() private DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd-HH:mm:ss.SSSSSSSSSX");
.append(DateTimeFormatter.BASIC_ISO_DATE).appendLiteral('-')
.appendPattern("HH:mm:ss")
.appendPattern("[.SSSSSSSSS][.SSSSSS][.SSS]") // optional nanos, with 9, 6 or 3 digits
.appendOffset("+HH:mm", "Z")
.toFormatter();
@Test @Test
public void testOffsetDateTimeDatePart() { public void testOffsetDateTimeDatePart() {

View File

@ -2,7 +2,6 @@ package com.google.refine.tests.expr.functions.date;
import java.time.OffsetDateTime; import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import java.util.Properties; import java.util.Properties;
@ -23,12 +22,7 @@ import com.google.refine.tests.util.TestUtils;
public class IncTests extends RefineTest { public class IncTests extends RefineTest {
private static Properties bindings; private static Properties bindings;
private DateTimeFormatter formatter = new DateTimeFormatterBuilder() private DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd-HH:mm:ss.SSSSSSSSSX");
.append(DateTimeFormatter.BASIC_ISO_DATE).appendLiteral('-')
.appendPattern("HH:mm:ss")
.appendPattern("[.SSSSSSSSS][.SSSSSS][.SSS]") // optional nanos, with 9, 6 or 3 digits
.appendOffset("+HH:mm", "Z")
.toFormatter();
@Override @Override
@BeforeTest @BeforeTest

View File

@ -2,7 +2,6 @@ package com.google.refine.tests.expr.functions.date;
import java.time.OffsetDateTime; import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.util.Properties; import java.util.Properties;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -21,12 +20,7 @@ import com.google.refine.tests.util.TestUtils;
public class NowTests extends RefineTest { public class NowTests extends RefineTest {
private static Properties bindings; private static Properties bindings;
private DateTimeFormatter formatter = new DateTimeFormatterBuilder() private DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd-HH:mm:ss.SSSSSSSSSX");
.append(DateTimeFormatter.BASIC_ISO_DATE).appendLiteral('-')
.appendPattern("HH:mm:ss")
.appendPattern("[.SSSSSSSSS][.SSSSSS][.SSS]") // optional nanos, with 9, 6 or 3 digits
.appendOffset("+HH:mm", "Z")
.toFormatter();
@Override @Override
@BeforeTest @BeforeTest