From 7f6e2676e6153a3e0cde1a757409c32dc7a34cb5 Mon Sep 17 00:00:00 2001 From: mdavila Date: Tue, 5 Jun 2018 07:33:47 -0400 Subject: [PATCH 1/4] MOB-5721 fix date pattern for QueryDate, hh --> HH --- .../jackson/JacksonConverterFactory.java | 2 +- .../constantcontact/v2/QueryDateTests.java | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 components/src/test/java/com/constantcontact/v2/QueryDateTests.java diff --git a/components/src/main/java/com/constantcontact/v2/converter/jackson/JacksonConverterFactory.java b/components/src/main/java/com/constantcontact/v2/converter/jackson/JacksonConverterFactory.java index f0477c6e..b357cbc4 100644 --- a/components/src/main/java/com/constantcontact/v2/converter/jackson/JacksonConverterFactory.java +++ b/components/src/main/java/com/constantcontact/v2/converter/jackson/JacksonConverterFactory.java @@ -29,7 +29,7 @@ * The converter factory used for Jackson JSON conversion */ public class JacksonConverterFactory extends Converter.Factory { - public final static String ISO_8601_DATE_PATTERN = "yyyy-MM-dd'T'hh:mm:ss.SS'Z'"; + public final static String ISO_8601_DATE_PATTERN = "yyyy-MM-dd'T'HH:mm:ss.SS'Z'"; public final static SimpleDateFormat ISO_8601_DATE_FORMAT; diff --git a/components/src/test/java/com/constantcontact/v2/QueryDateTests.java b/components/src/test/java/com/constantcontact/v2/QueryDateTests.java new file mode 100644 index 00000000..665ec60d --- /dev/null +++ b/components/src/test/java/com/constantcontact/v2/QueryDateTests.java @@ -0,0 +1,19 @@ +package com.constantcontact.v2; + +import org.junit.Test; + +import java.time.ZonedDateTime; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.not; + +public class QueryDateTests { + + @Test + public void test24HourDateConversions() { + ZonedDateTime date = ZonedDateTime.parse("2018-06-04T09:07:30-04:00"); + QueryDate qd = new QueryDate(date.toInstant().toEpochMilli()); + assertThat(qd.toString().indexOf("2018-06-04T13:07:30"), not(equalTo(-1))); + } +} From de371cd67dd9a4a2cbb7db5e3dfa31c734723cb5 Mon Sep 17 00:00:00 2001 From: mdavila Date: Mon, 11 Jun 2018 07:37:56 -0400 Subject: [PATCH 2/4] MOB-5721 use full format for ISO-8601 dates, with "Z" at the end --- .../src/test/java/com/constantcontact/v2/QueryDateTests.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/src/test/java/com/constantcontact/v2/QueryDateTests.java b/components/src/test/java/com/constantcontact/v2/QueryDateTests.java index 665ec60d..02907c56 100644 --- a/components/src/test/java/com/constantcontact/v2/QueryDateTests.java +++ b/components/src/test/java/com/constantcontact/v2/QueryDateTests.java @@ -12,8 +12,8 @@ public class QueryDateTests { @Test public void test24HourDateConversions() { - ZonedDateTime date = ZonedDateTime.parse("2018-06-04T09:07:30-04:00"); + ZonedDateTime date = ZonedDateTime.parse("2018-06-04T09:07:30-04:00Z"); QueryDate qd = new QueryDate(date.toInstant().toEpochMilli()); - assertThat(qd.toString().indexOf("2018-06-04T13:07:30"), not(equalTo(-1))); + assertThat(qd.toString().indexOf("2018-06-04T13:07:30:00Z"), not(equalTo(-1))); } } From 69ededc8b9cae3f883520268ff6d46d9fe124d51 Mon Sep 17 00:00:00 2001 From: mdavila Date: Mon, 11 Jun 2018 11:30:23 -0400 Subject: [PATCH 3/4] MOB-5721 the 'Z' is for zulu time only, not for time patterns with time zone offset --- .../src/test/java/com/constantcontact/v2/QueryDateTests.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/src/test/java/com/constantcontact/v2/QueryDateTests.java b/components/src/test/java/com/constantcontact/v2/QueryDateTests.java index 02907c56..b02edb39 100644 --- a/components/src/test/java/com/constantcontact/v2/QueryDateTests.java +++ b/components/src/test/java/com/constantcontact/v2/QueryDateTests.java @@ -12,8 +12,8 @@ public class QueryDateTests { @Test public void test24HourDateConversions() { - ZonedDateTime date = ZonedDateTime.parse("2018-06-04T09:07:30-04:00Z"); + ZonedDateTime date = ZonedDateTime.parse("2018-06-04T09:07:30-04:00"); QueryDate qd = new QueryDate(date.toInstant().toEpochMilli()); - assertThat(qd.toString().indexOf("2018-06-04T13:07:30:00Z"), not(equalTo(-1))); + assertThat(qd.toString().indexOf("2018-06-04T13:07:30.00Z"), not(equalTo(-1))); } } From 984227bac3668fd82c67041f7b183484fb8df46d Mon Sep 17 00:00:00 2001 From: mdavila Date: Tue, 12 Jun 2018 08:34:06 -0400 Subject: [PATCH 4/4] MOB-5721 increase the release version because of this bug fix --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index d1f46a87..28b6fbb2 100644 --- a/build.gradle +++ b/build.gradle @@ -32,7 +32,7 @@ allprojects { group = 'com.constantcontact' def isRelease = Boolean.valueOf(project.hasProperty("release") ? project.property("release") as String : "false") - version = '5.2.1' + (isRelease ? "" : "-SNAPSHOT") + version = '5.2.2' + (isRelease ? "" : "-SNAPSHOT") } apply plugin: "net.wooga.github"