From fd34a698f7d348690bd9bbd67dd27fde684fb4f1 Mon Sep 17 00:00:00 2001 From: Chad Retz Date: Wed, 17 Dec 2014 13:16:34 -0600 Subject: [PATCH 1/5] Added Travis CI YAML file --- .travis.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..122387c --- /dev/null +++ b/.travis.yml @@ -0,0 +1,6 @@ +language: java +jdk: + - oraclejdk8 + - oraclejdk7 + - openjdk7 + - openjdk6 \ No newline at end of file From 5dbaa2a5d78345e23b8ca789284760dbc5cae6da Mon Sep 17 00:00:00 2001 From: Chad Retz Date: Wed, 17 Dec 2014 13:17:39 -0600 Subject: [PATCH 2/5] Added build status image --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 2c1bb6f..e4315d5 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # SoftLayer API Client for Java +[![Build Status](https://travis-ci.org/softlayer/softlayer-java.svg)](https://travis-ci.org/softlayer/softlayer-java) + ## Introduction This library provides a JVM client for the [SoftLayer API](http://sldn.softlayer.com/article/SoftLayer-API-Overview). It From 1ebdfb88fadc6140e2e6e6f6c5830a954d267df3 Mon Sep 17 00:00:00 2001 From: Chad Retz Date: Wed, 17 Dec 2014 13:27:21 -0600 Subject: [PATCH 3/5] Removed GPG execution from Travis build --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 122387c..fa4eb57 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,4 +3,5 @@ jdk: - oraclejdk8 - oraclejdk7 - openjdk7 - - openjdk6 \ No newline at end of file + - openjdk6 +install: mvn install -DskipTests=true -Dmaven.javadoc.skip=true -Dgpg.skip=true \ No newline at end of file From 707c84bdcbbf6ef0b46c6460f6db8d6ca2c48753 Mon Sep 17 00:00:00 2001 From: Chad Retz Date: Wed, 17 Dec 2014 16:40:56 -0600 Subject: [PATCH 4/5] Fix test to respect default timezone of server --- .../com/softlayer/api/json/GsonJsonMarshallerFactory.java | 2 +- .../softlayer/api/json/GsonJsonMarshallerFactoryTest.java | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/softlayer/api/json/GsonJsonMarshallerFactory.java b/src/main/java/com/softlayer/api/json/GsonJsonMarshallerFactory.java index 63376bc..4c97e56 100644 --- a/src/main/java/com/softlayer/api/json/GsonJsonMarshallerFactory.java +++ b/src/main/java/com/softlayer/api/json/GsonJsonMarshallerFactory.java @@ -277,7 +277,7 @@ public GregorianCalendar read(JsonReader in) throws IOException { String date = in.nextString(); // Remove the colon date = date.substring(0, date.length() - 3) + date.substring(date.length() - 2); - // Use decimal presense to determine format and trim to ms precision + // Use decimal presence to determine format and trim to ms precision DateFormat format; int decimalIndex = date.indexOf('.'); if (decimalIndex != -1) { diff --git a/src/test/java/com/softlayer/api/json/GsonJsonMarshallerFactoryTest.java b/src/test/java/com/softlayer/api/json/GsonJsonMarshallerFactoryTest.java index 51ec1cd..d08be72 100644 --- a/src/test/java/com/softlayer/api/json/GsonJsonMarshallerFactoryTest.java +++ b/src/test/java/com/softlayer/api/json/GsonJsonMarshallerFactoryTest.java @@ -90,7 +90,6 @@ public void testWrite() throws Exception { obj.setFoo("some string"); obj.setBaz(null); obj.setDate(new GregorianCalendar(1984, Calendar.FEBRUARY, 25, 20, 15, 25)); - obj.getDate().setTimeZone(TimeZone.getTimeZone("GMT-06:00")); obj.setNotApiProperty("bad value"); obj.setChild(new TestEntity()); obj.getChild().setFoo("child string"); @@ -104,7 +103,11 @@ public void testWrite() throws Exception { expected.put("complexType", "SoftLayer_TestEntity"); expected.put("bar", "some string"); expected.put("baz", null); - expected.put("date", "1984-02-25T20:15:25-06:00"); + int offsetMinutes = TimeZone.getDefault().getOffset(obj.getDate().getTimeInMillis()) / 60000; + String expectedTimeZone = + (offsetMinutes < 0 ? '-' : '+') + + String.format("%1$02d:%2$02d", Math.abs(offsetMinutes / 60), Math.abs(offsetMinutes % 60)); + expected.put("date", "1984-02-25T20:15:25" + expectedTimeZone); Map childMap = new HashMap(); childMap.put("complexType", "SoftLayer_TestEntity"); childMap.put("bar", "child string"); From 1b4dc4fedeaa895f30129497f5a2684157c59ee9 Mon Sep 17 00:00:00 2001 From: Chad Retz Date: Wed, 17 Dec 2014 18:10:59 -0600 Subject: [PATCH 5/5] Added predictable map ordering on URL tests that were failing JDK8 UTs --- src/test/java/com/softlayer/api/RestApiClientTest.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/test/java/com/softlayer/api/RestApiClientTest.java b/src/test/java/com/softlayer/api/RestApiClientTest.java index 9205f89..3492bde 100644 --- a/src/test/java/com/softlayer/api/RestApiClientTest.java +++ b/src/test/java/com/softlayer/api/RestApiClientTest.java @@ -4,6 +4,7 @@ import java.io.ByteArrayOutputStream; import java.io.PrintStream; +import java.net.URLEncoder; import java.util.Collections; import java.util.GregorianCalendar; import java.util.List; @@ -313,7 +314,7 @@ public void testWithMask() throws Exception { service.withMask().child().baz(); assertEquals("some response", service.doSomethingStatic(123L, entity)); assertEquals("http://example.com/SoftLayer_TestEntity/doSomethingStatic.json" - + "?objectMask=mask%5Bbar%2Cchild%5Bbaz%2Cdate%5D%5D", http.fullUrl); + + "?objectMask=" + URLEncoder.encode(service.withMask().getMask(), "UTF-8"), http.fullUrl); assertTrue(http.invokeSyncCalled); } @@ -332,7 +333,7 @@ public void testSetObjectMask() throws Exception { service.setMask(mask); assertEquals("some response", service.doSomethingStatic(123L, entity)); assertEquals("http://example.com/SoftLayer_TestEntity/doSomethingStatic.json" - + "?objectMask=mask%5Bbar%2Cchild%5Bbaz%2Cdate%5D%5D", http.fullUrl); + + "?objectMask=" + URLEncoder.encode(mask.getMask(), "UTF-8"), http.fullUrl); assertTrue(http.invokeSyncCalled); }