diff --git a/pom.xml b/pom.xml
index e4766787..cd7aab95 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
4.0.0
com.testdroid
testdroid-api
- 2.82
+ 2.83
jar
Bitbar API v2
https://github.com/bitbar/testdroid-api
diff --git a/src/main/java/com/testdroid/api/APIEntity.java b/src/main/java/com/testdroid/api/APIEntity.java
index 9ed39d82..319d6641 100644
--- a/src/main/java/com/testdroid/api/APIEntity.java
+++ b/src/main/java/com/testdroid/api/APIEntity.java
@@ -18,9 +18,6 @@
import javax.xml.bind.annotation.XmlSeeAlso;
import java.io.File;
import java.io.InputStream;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
/**
* @author Łukasz Kajda
@@ -49,6 +46,7 @@
APIBasicDeviceTime.class,
APIBasicJiraProject.class,
APIBillingPeriod.class,
+ APIBillingPeriodUsage.class,
APIBuildConfig.class,
APIBuildExecutor.class,
APIBuildResultConfig.class,
@@ -115,8 +113,6 @@
})
public abstract class APIEntity {
- private static final DateFormat API_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd_HH:mm");
-
public static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
static {
@@ -137,12 +133,6 @@ public APIEntity(Long id) {
this.id = id;
}
- @Deprecated
- @JsonIgnore
- public static String format(Date date) {
- return API_DATE_FORMAT.format(date);
- }
-
@JsonIgnore
protected static String createUri(String preUri, String postUri) {
if (preUri.contains("?")) {
diff --git a/src/main/java/com/testdroid/api/APIKeyClient.java b/src/main/java/com/testdroid/api/APIKeyClient.java
index 7ddae8b5..b999ed79 100644
--- a/src/main/java/com/testdroid/api/APIKeyClient.java
+++ b/src/main/java/com/testdroid/api/APIKeyClient.java
@@ -19,6 +19,8 @@
import java.security.GeneralSecurityException;
+import static org.apache.commons.lang3.StringUtils.EMPTY;
+
/**
* @author Michał Szpruta
*/
@@ -91,6 +93,6 @@ private void initializeDefaultAPIClient(String cloudURL, String apiKey) {
@Override
protected HttpHeaders getHttpHeaders() {
- return new HttpHeaders().setAccept(ACCEPT_HEADER).setBasicAuthentication(apiKey, "");
+ return new HttpHeaders().setAccept(ACCEPT_HEADER).setBasicAuthentication(apiKey, EMPTY);
}
}
diff --git a/src/main/java/com/testdroid/api/AbstractAPIClient.java b/src/main/java/com/testdroid/api/AbstractAPIClient.java
index e825a216..4e36af6f 100644
--- a/src/main/java/com/testdroid/api/AbstractAPIClient.java
+++ b/src/main/java/com/testdroid/api/AbstractAPIClient.java
@@ -23,6 +23,7 @@
import static com.testdroid.api.APIEntity.OBJECT_MAPPER;
import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.apache.commons.lang3.StringUtils.EMPTY;
import static org.apache.http.HttpStatus.*;
/**
@@ -327,7 +328,7 @@ protected String buildUrl(String url, Context context)
if (context != null) {
for (Map.Entry> entry : context.build().asMap().entrySet()) {
for (Object value : entry.getValue()) {
- builder.addParameter(entry.getKey(), value == null ? "" : value.toString());
+ builder.addParameter(entry.getKey(), value == null ? EMPTY : value.toString());
}
}
}
@@ -344,7 +345,7 @@ protected void fixMapParameters(Map map) {
key = entry.getKey();
value = entry.getValue();
if (value == null) {
- map.put(key, "");
+ map.put(key, EMPTY);
}
if (value instanceof Enum>) {
map.put(key, value.toString());
diff --git a/src/main/java/com/testdroid/api/DefaultAPIClient.java b/src/main/java/com/testdroid/api/DefaultAPIClient.java
index 926013f8..cfd2bcb7 100644
--- a/src/main/java/com/testdroid/api/DefaultAPIClient.java
+++ b/src/main/java/com/testdroid/api/DefaultAPIClient.java
@@ -1,10 +1,10 @@
package com.testdroid.api;
-import com.fasterxml.jackson.core.type.TypeReference;
import com.google.api.client.auth.oauth2.BearerToken;
import com.google.api.client.auth.oauth2.Credential;
import com.google.api.client.http.*;
import com.google.api.client.http.apache.ApacheHttpTransport;
+import com.testdroid.api.util.TypeReferenceFactory;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpHost;
@@ -136,7 +136,7 @@ protected String acquireAccessToken() throws APIException {
HttpResponse response = null;
try {
if (username == null && password == null) {
- return "";
+ return StringUtils.EMPTY;
}
GenericUrl url = new GenericUrl(String.format("%s/oauth/token", cloudURL));
@@ -158,8 +158,7 @@ protected String acquireAccessToken() throws APIException {
}
String responseJson = StringUtils.join(IOUtils.readLines(response.getContent(), UTF_8), "\n");
- Map json = fromJson(responseJson, new TypeReference