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>() { - }); + Map json = fromJson(responseJson, TypeReferenceFactory.getMapTypeReference()); accessTokenExpireTime = System.currentTimeMillis() + (Long.parseLong(json.get("expires_in")) * 1000); refreshToken = json.get("refresh_token"); return json.get("access_token"); @@ -198,8 +197,7 @@ protected String refreshAccessToken() throws APIException { } String jsonContent = StringUtils.join(IOUtils.readLines(response.getContent(), UTF_8), "\n"); - Map json = fromJson(jsonContent, new TypeReference>() { - }); + Map json = fromJson(jsonContent, TypeReferenceFactory.getMapTypeReference()); accessTokenExpireTime = System.currentTimeMillis() + (Long.parseLong(json.get("expires_in")) * 1000); refreshToken = json.get("refresh_token"); return json.get("access_token"); diff --git a/src/main/java/com/testdroid/api/filter/DateFilterEntry.java b/src/main/java/com/testdroid/api/filter/DateFilterEntry.java deleted file mode 100644 index 585d08c6..00000000 --- a/src/main/java/com/testdroid/api/filter/DateFilterEntry.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.testdroid.api.filter; - -import com.testdroid.api.dto.Operand; - -import java.util.Date; - -/** - * @author Damian Sniezek - */ -@Deprecated -public class DateFilterEntry extends FilterEntry { - - public DateFilterEntry(String field, Operand comparison, Date value) { - super(field, comparison, value); - } - - public DateFilterEntry(String field, Operand comparison) { - super(field, comparison); - } - - @Override - public String toString() { - return String.format("d_%s", super.toString()); - } - -} diff --git a/src/main/java/com/testdroid/api/filter/DateTimeFilterEntry.java b/src/main/java/com/testdroid/api/filter/DateTimeFilterEntry.java index 03ab1950..53b1cd5f 100644 --- a/src/main/java/com/testdroid/api/filter/DateTimeFilterEntry.java +++ b/src/main/java/com/testdroid/api/filter/DateTimeFilterEntry.java @@ -1,7 +1,6 @@ package com.testdroid.api.filter; import com.testdroid.api.dto.Operand; -import com.testdroid.api.util.TimeConverter; import java.time.LocalDateTime; @@ -10,12 +9,6 @@ */ public class DateTimeFilterEntry extends FilterEntry { - @Deprecated - public DateTimeFilterEntry(DateFilterEntry dateFilterEntry) { - super(dateFilterEntry.getField(), dateFilterEntry.getOperand(), dateFilterEntry.getValue() == null ? null - : TimeConverter.fromDateFields(dateFilterEntry.getValue())); - } - public DateTimeFilterEntry(String field, Operand comparison, LocalDateTime value) { super(field, comparison, value); } diff --git a/src/main/java/com/testdroid/api/model/APIBillingPeriod.java b/src/main/java/com/testdroid/api/model/APIBillingPeriod.java index 3fcc629c..ec1d086f 100644 --- a/src/main/java/com/testdroid/api/model/APIBillingPeriod.java +++ b/src/main/java/com/testdroid/api/model/APIBillingPeriod.java @@ -7,6 +7,7 @@ import javax.xml.bind.annotation.XmlRootElement; import java.time.LocalDateTime; import java.util.Date; +import java.util.List; /** * @author Damian Sniezek @@ -48,6 +49,8 @@ public class APIBillingPeriod extends APIEntity { private APIBillingPeriodType apiBillingPeriodType; + private List usages; + public APIBillingPeriod() { } @@ -228,6 +231,14 @@ public void setAccountServiceId(Long accountServiceId) { this.accountServiceId = accountServiceId; } + public List getUsages() { + return usages; + } + + public void setUsages(List usages) { + this.usages = usages; + } + @Override protected void clone(T from) { APIBillingPeriod period = (APIBillingPeriod) from; @@ -247,5 +258,6 @@ protected void clone(T from) { this.createTime = period.createTime; this.apiBillingPeriodType = period.apiBillingPeriodType; this.accountServiceId = period.accountServiceId; + this.usages = period.usages; } } diff --git a/src/main/java/com/testdroid/api/model/APIBillingPeriodUsage.java b/src/main/java/com/testdroid/api/model/APIBillingPeriodUsage.java new file mode 100644 index 00000000..6d9c963b --- /dev/null +++ b/src/main/java/com/testdroid/api/model/APIBillingPeriodUsage.java @@ -0,0 +1,73 @@ +package com.testdroid.api.model; + +import com.testdroid.api.APIEntity; + +import javax.xml.bind.annotation.XmlRootElement; + +/** + * @author Michał Szpruta + */ +@XmlRootElement +public class APIBillingPeriodUsage extends APIEntity { + + private APIDeviceSession.Type type; + + private APIDevice.OsType osType; + + private long billableSeconds; + + private long nonBillableSeconds; + + public APIBillingPeriodUsage() { + } + + public APIBillingPeriodUsage( + APIDeviceSession.Type type, APIDevice.OsType osType, long billableSeconds, long nonBillableSeconds) { + this.type = type; + this.osType = osType; + this.billableSeconds = billableSeconds; + this.nonBillableSeconds = nonBillableSeconds; + } + + public APIDeviceSession.Type getType() { + return type; + } + + public APIDevice.OsType getOsType() { + return osType; + } + + public long getBillableSeconds() { + return billableSeconds; + } + + public long getNonBillableSeconds() { + return nonBillableSeconds; + } + + public void setType(APIDeviceSession.Type type) { + this.type = type; + } + + public void setOsType(APIDevice.OsType osType) { + this.osType = osType; + } + + public void setBillableSeconds(long billableSeconds) { + this.billableSeconds = billableSeconds; + } + + public void setNonBillableSeconds(long nonBillableSeconds) { + this.nonBillableSeconds = nonBillableSeconds; + } + + @Override + protected void clone(T from) { + APIBillingPeriodUsage original = (APIBillingPeriodUsage) from; + cloneBase(from); + this.type = original.type; + this.osType = original.osType; + this.billableSeconds = original.billableSeconds; + this.nonBillableSeconds = original.nonBillableSeconds; + } +} diff --git a/src/main/java/com/testdroid/api/model/APIDevice.java b/src/main/java/com/testdroid/api/model/APIDevice.java index 932c8d1d..0bd04e73 100644 --- a/src/main/java/com/testdroid/api/model/APIDevice.java +++ b/src/main/java/com/testdroid/api/model/APIDevice.java @@ -15,14 +15,6 @@ @XmlRootElement public class APIDevice extends APIEntity { - @XmlType - @Deprecated - public enum DeviceFilter { - FREE, - RECOMMENDED, - NEW - } - @XmlType public enum DeviceGroupOrigin { STATIC, diff --git a/src/main/java/com/testdroid/api/model/APIDeviceGroup.java b/src/main/java/com/testdroid/api/model/APIDeviceGroup.java index dd8eede7..af6616d2 100644 --- a/src/main/java/com/testdroid/api/model/APIDeviceGroup.java +++ b/src/main/java/com/testdroid/api/model/APIDeviceGroup.java @@ -17,9 +17,6 @@ @XmlRootElement public class APIDeviceGroup extends APIEntity { - @Deprecated - private Long creditsPrice; - private Long deviceCount; private String displayName; @@ -43,7 +40,6 @@ public APIDeviceGroup( this.id = id; this.name = name; this.displayName = displayName; - this.creditsPrice = deviceCount; this.deviceCount = deviceCount; this.userId = userId; this.osType = osType; @@ -75,14 +71,6 @@ public void setDeviceCount(Long deviceCount) { this.deviceCount = deviceCount; } - public Long getCreditsPrice() { - return creditsPrice; - } - - public void setCreditsPrice(Long creditsPrice) { - this.creditsPrice = creditsPrice; - } - public Long getUserId() { return userId; } @@ -160,7 +148,6 @@ public void deleteDevice(APIDevice device) throws APIException { protected void clone(T from) { APIDeviceGroup apiDeviceGroup = (APIDeviceGroup) from; cloneBase(from); - this.creditsPrice = apiDeviceGroup.creditsPrice; this.deviceCount = apiDeviceGroup.deviceCount; this.name = apiDeviceGroup.name; this.displayName = apiDeviceGroup.displayName; diff --git a/src/main/java/com/testdroid/api/model/APILicense.java b/src/main/java/com/testdroid/api/model/APILicense.java index f0b4d01a..4989a40c 100644 --- a/src/main/java/com/testdroid/api/model/APILicense.java +++ b/src/main/java/com/testdroid/api/model/APILicense.java @@ -10,6 +10,8 @@ import java.time.LocalDateTime; import java.util.Date; +import static org.apache.commons.lang3.StringUtils.EMPTY; + /** * @author Łukasz Kajda * @author Michał Szpruta @@ -25,7 +27,7 @@ public enum Status { CLOSED } - public static final String DISABLED_TEXT = ""; + public static final String DISABLED_TEXT = EMPTY; public static final String ENABLED_TEXT = "on"; @@ -139,7 +141,7 @@ public APILicense( } private static String getTextValue(Integer i) { - return i != null ? Integer.toString(i) : ""; + return i != null ? Integer.toString(i) : EMPTY; } private static String getTextValue(boolean b) { diff --git a/src/main/java/com/testdroid/api/model/APIProject.java b/src/main/java/com/testdroid/api/model/APIProject.java index d46756df..251cb68d 100644 --- a/src/main/java/com/testdroid/api/model/APIProject.java +++ b/src/main/java/com/testdroid/api/model/APIProject.java @@ -100,6 +100,8 @@ public APIProjectJobConfig.Type getJobConfigType() { private boolean isShared; + private boolean isSharedWithCaller; + private Double successRatio; private APIDevice.OsType osType; @@ -208,6 +210,14 @@ public void setShared(boolean isShared) { this.isShared = isShared; } + public boolean isSharedWithCaller() { + return isSharedWithCaller; + } + + public void setSharedWithCaller(boolean sharedWithCaller) { + isSharedWithCaller = sharedWithCaller; + } + public APIArchivingStrategy getArchivingStrategy() { return archivingStrategy; } @@ -314,6 +324,8 @@ protected void clone(T from) { this.jobConfig = apiProject.jobConfig; this.name = apiProject.name; this.sharedById = apiProject.sharedById; + this.isShared = apiProject.isShared; + this.isSharedWithCaller = apiProject.isSharedWithCaller; this.testRunConfig = apiProject.testRunConfig; this.type = apiProject.type; this.archivingStrategy = apiProject.archivingStrategy; diff --git a/src/main/java/com/testdroid/api/model/APITestRun.java b/src/main/java/com/testdroid/api/model/APITestRun.java index 5adaf2e6..a28492c5 100644 --- a/src/main/java/com/testdroid/api/model/APITestRun.java +++ b/src/main/java/com/testdroid/api/model/APITestRun.java @@ -71,7 +71,7 @@ public enum State { private Integer testCaseCount; - @Deprecated + @Deprecated // use deviceCount private Integer totalDeviceCount; private Integer warningDeviceCount; diff --git a/src/main/java/com/testdroid/api/model/APIUser.java b/src/main/java/com/testdroid/api/model/APIUser.java index 8a84e00f..bef323d1 100644 --- a/src/main/java/com/testdroid/api/model/APIUser.java +++ b/src/main/java/com/testdroid/api/model/APIUser.java @@ -23,6 +23,7 @@ @XmlRootElement public class APIUser extends APIEntity { + @XmlType(namespace = "APIUser") public enum Status { INACTIVE("Inactive"), DISABLED("Disabled"), @@ -111,24 +112,6 @@ public String getDisplayName() { private MfaStatus mfaStatus; - @Deprecated - @XmlType(namespace = "APIUser", name = "APIUserEmailNotification") - public enum EmailNotification { - ALWAYS("always"), - NEVER("never"), - ON_FAILURE("on failure"); - - private final String displayName; - - EmailNotification(String displayName) { - this.displayName = displayName; - } - - public String getDisplayName() { - return displayName; - } - } - public APIUser() { } diff --git a/src/main/java/com/testdroid/api/model/devicetime/APIDeviceTimeCountSessionReportEntry.java b/src/main/java/com/testdroid/api/model/devicetime/APIDeviceTimeCountSessionReportEntry.java index f24a4462..db0083e5 100644 --- a/src/main/java/com/testdroid/api/model/devicetime/APIDeviceTimeCountSessionReportEntry.java +++ b/src/main/java/com/testdroid/api/model/devicetime/APIDeviceTimeCountSessionReportEntry.java @@ -3,6 +3,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.testdroid.api.APIEntity; +import com.testdroid.api.model.APIDevice; import javax.xml.bind.annotation.XmlRootElement; import java.util.Date; @@ -12,26 +13,12 @@ */ @XmlRootElement @JsonInclude(JsonInclude.Include.NON_EMPTY) -public class APIDeviceTimeCountSessionReportEntry extends APIBasicDeviceTime { - - private Long userId; - - private String userEmail; - - private Long deviceModelId; - - private String deviceModelName; - - private String projectId; - - private String projectName; +public class APIDeviceTimeCountSessionReportEntry extends APIDeviceTimeReportEntry { private Long countTestRuns; private Long countDeviceSessions; - private Date day; - public APIDeviceTimeCountSessionReportEntry() { } @@ -39,80 +26,27 @@ public APIDeviceTimeCountSessionReportEntry() { public APIDeviceTimeCountSessionReportEntry( Date day, Long deviceTime, Long userId, String userEmail, Long deviceModelId, String deviceModelName, - String projectId, String projectName, Long countTestRuns, Long countDeviceSessions) { - super(deviceTime); - this.day = day; - this.userId = userId; - this.userEmail = userEmail; - this.deviceModelId = deviceModelId; - this.deviceModelName = deviceModelName; - this.projectId = projectId; - this.projectName = projectName; + String projectId, String projectName, APIDevice.OsType osType, Long countTestRuns, + Long countDeviceSessions) { + super(day, deviceTime, userId, userEmail, deviceModelId, deviceModelName, projectId, projectName, osType); this.countTestRuns = countTestRuns; this.countDeviceSessions = countDeviceSessions; } - public String getUserEmail() { - return userEmail; - } - - public String getDeviceModelName() { - return deviceModelName; - } - - public String getProjectName() { - return projectName; - } - public Long getCountTestRuns() { return countTestRuns; } - public Date getDay() { - return day; - } - public Long getCountDeviceSessions() { return countDeviceSessions; } - public void setUserEmail(String userEmail) { - this.userEmail = userEmail; - } - - public void setDeviceModelName(String deviceModelName) { - this.deviceModelName = deviceModelName; - } - - public void setProjectName(String projectName) { - this.projectName = projectName; - } - - public void setCountDeviceSessions(Long countDeviceSessions) { - this.countDeviceSessions = countDeviceSessions; - } - - public void setCountTestRuns(Long countTestRuns) { - this.countTestRuns = countTestRuns; - } - - public void setDay(Date day) { - this.day = day; - } - @Override @JsonIgnore protected void clone(T from) { APIDeviceTimeCountSessionReportEntry apiDeviceTimeCountSessionReportEntry = (APIDeviceTimeCountSessionReportEntry) from; super.clone(from); - this.day = apiDeviceTimeCountSessionReportEntry.day; - this.userId = apiDeviceTimeCountSessionReportEntry.userId; - this.userEmail = apiDeviceTimeCountSessionReportEntry.userEmail; - this.deviceModelId = apiDeviceTimeCountSessionReportEntry.deviceModelId; - this.deviceModelName = apiDeviceTimeCountSessionReportEntry.deviceModelName; - this.projectId = apiDeviceTimeCountSessionReportEntry.projectId; - this.projectName = apiDeviceTimeCountSessionReportEntry.projectName; this.countTestRuns = apiDeviceTimeCountSessionReportEntry.countTestRuns; this.countDeviceSessions = apiDeviceTimeCountSessionReportEntry.countDeviceSessions; } diff --git a/src/main/java/com/testdroid/api/model/devicetime/APIDeviceTimeReportEntry.java b/src/main/java/com/testdroid/api/model/devicetime/APIDeviceTimeReportEntry.java new file mode 100644 index 00000000..cd33d755 --- /dev/null +++ b/src/main/java/com/testdroid/api/model/devicetime/APIDeviceTimeReportEntry.java @@ -0,0 +1,103 @@ +package com.testdroid.api.model.devicetime; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.testdroid.api.APIEntity; +import com.testdroid.api.model.APIDevice; + +import javax.xml.bind.annotation.XmlRootElement; +import java.util.Date; + +/** + * @author Damian Sniezek + */ +@XmlRootElement +@JsonInclude(JsonInclude.Include.NON_EMPTY) +public abstract class APIDeviceTimeReportEntry extends APIBasicDeviceTime { + + private Long userId; + + private String userEmail; + + private Long deviceModelId; + + private String deviceModelName; + + private String projectId; + + private String projectName; + + private APIDevice.OsType osType; + + private Date day; + + APIDeviceTimeReportEntry() { + + } + + APIDeviceTimeReportEntry( + Date day, + Long deviceTime, Long userId, String userEmail, Long deviceModelId, String deviceModelName, + String projectId, String projectName, APIDevice.OsType osType) { + super(deviceTime); + this.day = day; + this.userId = userId; + this.userEmail = userEmail; + this.deviceModelId = deviceModelId; + this.deviceModelName = deviceModelName; + this.projectId = projectId; + this.projectName = projectName; + this.osType = osType; + } + + public String getUserEmail() { + return userEmail; + } + + public String getDeviceModelName() { + return deviceModelName; + } + + public String getProjectName() { + return projectName; + } + + public Date getDay() { + return day; + } + + public APIDevice.OsType getOsType() { + return osType; + } + + public void setUserEmail(String userEmail) { + this.userEmail = userEmail; + } + + public void setDeviceModelName(String deviceModelName) { + this.deviceModelName = deviceModelName; + } + + public void setProjectName(String projectName) { + this.projectName = projectName; + } + + public void setDay(Date day) { + this.day = day; + } + + @Override + @JsonIgnore + protected void clone(T from) { + APIDeviceTimeReportEntry apiDeviceTimeReportEntry = (APIDeviceTimeReportEntry) from; + super.clone(from); + this.day = apiDeviceTimeReportEntry.day; + this.userId = apiDeviceTimeReportEntry.userId; + this.userEmail = apiDeviceTimeReportEntry.userEmail; + this.deviceModelId = apiDeviceTimeReportEntry.deviceModelId; + this.deviceModelName = apiDeviceTimeReportEntry.deviceModelName; + this.projectId = apiDeviceTimeReportEntry.projectId; + this.projectName = apiDeviceTimeReportEntry.projectName; + this.osType = apiDeviceTimeReportEntry.osType; + } +} diff --git a/src/main/java/com/testdroid/api/model/devicetime/APIDeviceTimeStepTimeReportEntry.java b/src/main/java/com/testdroid/api/model/devicetime/APIDeviceTimeStepTimeReportEntry.java index 4fdb32a5..b08694f9 100644 --- a/src/main/java/com/testdroid/api/model/devicetime/APIDeviceTimeStepTimeReportEntry.java +++ b/src/main/java/com/testdroid/api/model/devicetime/APIDeviceTimeStepTimeReportEntry.java @@ -3,6 +3,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.testdroid.api.APIEntity; +import com.testdroid.api.model.APIDevice; import javax.xml.bind.annotation.XmlRootElement; import java.util.Date; @@ -12,26 +13,12 @@ */ @XmlRootElement @JsonInclude(JsonInclude.Include.NON_EMPTY) -public class APIDeviceTimeStepTimeReportEntry extends APIBasicDeviceTime { - - private Long userId; - - private String userEmail; - - private Long deviceModelId; - - private String deviceModelName; - - private String projectId; - - private String projectName; +public class APIDeviceTimeStepTimeReportEntry extends APIDeviceTimeReportEntry { private Long preparationTime; private Long waitingTime; - private Date day; - public APIDeviceTimeStepTimeReportEntry() { } @@ -39,63 +26,16 @@ public APIDeviceTimeStepTimeReportEntry() { public APIDeviceTimeStepTimeReportEntry( Date day, Long deviceTime, Long userId, String userEmail, Long deviceModelId, String deviceModelName, - String projectId, String projectName, Long preparationTime, Long waitingTime) { - super(deviceTime); - this.day = day; - this.userId = userId; - this.userEmail = userEmail; - this.deviceModelId = deviceModelId; - this.deviceModelName = deviceModelName; - this.projectId = projectId; - this.projectName = projectName; + String projectId, String projectName, APIDevice.OsType osType, Long preparationTime, Long waitingTime) { + super(day, deviceTime, userId, userEmail, deviceModelId, deviceModelName, projectId, projectName, osType); this.preparationTime = preparationTime; this.waitingTime = waitingTime; } - public String getUserEmail() { - return userEmail; - } - - public String getDeviceModelName() { - return deviceModelName; - } - - public String getProjectName() { - return projectName; - } - - public Date getDay() { - return day; - } - - public void setUserEmail(String userEmail) { - this.userEmail = userEmail; - } - - public void setDeviceModelName(String deviceModelName) { - this.deviceModelName = deviceModelName; - } - - public void setProjectName(String projectName) { - this.projectName = projectName; - } - - public void setDay(Date day) { - this.day = day; - } - public Long getPreparationTime() { return preparationTime; } - public void setPreparationTime(Long preparationTime) { - this.preparationTime = preparationTime; - } - - public void setWaitingTime(Long waitingTime) { - this.waitingTime = waitingTime; - } - public Long getWaitingTime() { return waitingTime; } @@ -105,13 +45,6 @@ public Long getWaitingTime() { protected void clone(T from) { APIDeviceTimeStepTimeReportEntry apiDeviceTimeReportEntry = (APIDeviceTimeStepTimeReportEntry) from; super.clone(from); - this.day = apiDeviceTimeReportEntry.day; - this.userId = apiDeviceTimeReportEntry.userId; - this.userEmail = apiDeviceTimeReportEntry.userEmail; - this.deviceModelId = apiDeviceTimeReportEntry.deviceModelId; - this.deviceModelName = apiDeviceTimeReportEntry.deviceModelName; - this.projectId = apiDeviceTimeReportEntry.projectId; - this.projectName = apiDeviceTimeReportEntry.projectName; this.preparationTime = apiDeviceTimeReportEntry.preparationTime; this.waitingTime = apiDeviceTimeReportEntry.waitingTime; } diff --git a/src/main/java/com/testdroid/api/util/TypeReferenceFactory.java b/src/main/java/com/testdroid/api/util/TypeReferenceFactory.java index 4a6d4c07..f4657eb7 100644 --- a/src/main/java/com/testdroid/api/util/TypeReferenceFactory.java +++ b/src/main/java/com/testdroid/api/util/TypeReferenceFactory.java @@ -39,6 +39,8 @@ public class TypeReferenceFactory { }); TYPE_REFERENCE_LIST_MAP.put(APIBillingPeriod.class, new TypeReference>() { }); + TYPE_REFERENCE_LIST_MAP.put(APIBillingPeriodUsage.class, new TypeReference>() { + }); TYPE_REFERENCE_LIST_MAP.put(APIConnection.class, new TypeReference>() { }); TYPE_REFERENCE_LIST_MAP.put(APIDevice.class, new TypeReference>() { @@ -164,6 +166,8 @@ public class TypeReferenceFactory { }); TYPE_REFERENCE_MAP.put(APIBillingPeriod.class, new TypeReference() { }); + TYPE_REFERENCE_MAP.put(APIBillingPeriodUsage.class, new TypeReference() { + }); TYPE_REFERENCE_MAP.put(APIFramework.class, new TypeReference() { }); TYPE_REFERENCE_MAP.put(APIAccount.class, new TypeReference() {