Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
language: java
jdk:
- oraclejdk8
- oraclejdk7
- openjdk7
- openjdk6
install: mvn install -DskipTests=true -Dmaven.javadoc.skip=true -Dgpg.skip=true
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions src/test/java/com/softlayer/api/RestApiClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

Expand All @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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<String, Object> childMap = new HashMap<String, Object>();
childMap.put("complexType", "SoftLayer_TestEntity");
childMap.put("bar", "child string");
Expand Down