Skip to content

Commit 469c654

Browse files
committed
Merge pull request #5 from cretz/issue-4
Add Travis CI to build
2 parents 61cd77a + 1b4dc4f commit 469c654

5 files changed

Lines changed: 18 additions & 5 deletions

File tree

.travis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
language: java
2+
jdk:
3+
- oraclejdk8
4+
- oraclejdk7
5+
- openjdk7
6+
- openjdk6
7+
install: mvn install -DskipTests=true -Dmaven.javadoc.skip=true -Dgpg.skip=true

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# SoftLayer API Client for Java
22

3+
[![Build Status](https://travis-ci.org/softlayer/softlayer-java.svg)](https://travis-ci.org/softlayer/softlayer-java)
4+
35
## Introduction
46

57
This library provides a JVM client for the [SoftLayer API](http://sldn.softlayer.com/article/SoftLayer-API-Overview). It

src/main/java/com/softlayer/api/json/GsonJsonMarshallerFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ public GregorianCalendar read(JsonReader in) throws IOException {
277277
String date = in.nextString();
278278
// Remove the colon
279279
date = date.substring(0, date.length() - 3) + date.substring(date.length() - 2);
280-
// Use decimal presense to determine format and trim to ms precision
280+
// Use decimal presence to determine format and trim to ms precision
281281
DateFormat format;
282282
int decimalIndex = date.indexOf('.');
283283
if (decimalIndex != -1) {

src/test/java/com/softlayer/api/RestApiClientTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import java.io.ByteArrayOutputStream;
66
import java.io.PrintStream;
7+
import java.net.URLEncoder;
78
import java.util.Collections;
89
import java.util.GregorianCalendar;
910
import java.util.List;
@@ -313,7 +314,7 @@ public void testWithMask() throws Exception {
313314
service.withMask().child().baz();
314315
assertEquals("some response", service.doSomethingStatic(123L, entity));
315316
assertEquals("http://example.com/SoftLayer_TestEntity/doSomethingStatic.json"
316-
+ "?objectMask=mask%5Bbar%2Cchild%5Bbaz%2Cdate%5D%5D", http.fullUrl);
317+
+ "?objectMask=" + URLEncoder.encode(service.withMask().getMask(), "UTF-8"), http.fullUrl);
317318
assertTrue(http.invokeSyncCalled);
318319
}
319320

@@ -332,7 +333,7 @@ public void testSetObjectMask() throws Exception {
332333
service.setMask(mask);
333334
assertEquals("some response", service.doSomethingStatic(123L, entity));
334335
assertEquals("http://example.com/SoftLayer_TestEntity/doSomethingStatic.json"
335-
+ "?objectMask=mask%5Bbar%2Cchild%5Bbaz%2Cdate%5D%5D", http.fullUrl);
336+
+ "?objectMask=" + URLEncoder.encode(mask.getMask(), "UTF-8"), http.fullUrl);
336337
assertTrue(http.invokeSyncCalled);
337338
}
338339

src/test/java/com/softlayer/api/json/GsonJsonMarshallerFactoryTest.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ public void testWrite() throws Exception {
9090
obj.setFoo("some string");
9191
obj.setBaz(null);
9292
obj.setDate(new GregorianCalendar(1984, Calendar.FEBRUARY, 25, 20, 15, 25));
93-
obj.getDate().setTimeZone(TimeZone.getTimeZone("GMT-06:00"));
9493
obj.setNotApiProperty("bad value");
9594
obj.setChild(new TestEntity());
9695
obj.getChild().setFoo("child string");
@@ -104,7 +103,11 @@ public void testWrite() throws Exception {
104103
expected.put("complexType", "SoftLayer_TestEntity");
105104
expected.put("bar", "some string");
106105
expected.put("baz", null);
107-
expected.put("date", "1984-02-25T20:15:25-06:00");
106+
int offsetMinutes = TimeZone.getDefault().getOffset(obj.getDate().getTimeInMillis()) / 60000;
107+
String expectedTimeZone =
108+
(offsetMinutes < 0 ? '-' : '+') +
109+
String.format("%1$02d:%2$02d", Math.abs(offsetMinutes / 60), Math.abs(offsetMinutes % 60));
110+
expected.put("date", "1984-02-25T20:15:25" + expectedTimeZone);
108111
Map<String, Object> childMap = new HashMap<String, Object>();
109112
childMap.put("complexType", "SoftLayer_TestEntity");
110113
childMap.put("bar", "child string");

0 commit comments

Comments
 (0)