Skip to content

Commit

Permalink
Merge pull request #361 from snieguu/master
Browse files Browse the repository at this point in the history
Version 2.76
  • Loading branch information
snieguu authored May 21, 2019
2 parents fad00ab + a600e20 commit 2d602d7
Show file tree
Hide file tree
Showing 9 changed files with 131 additions and 73 deletions.
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.testdroid</groupId>
<artifactId>testdroid-api</artifactId>
<version>2.75</version>
<version>2.76</version>
<packaging>jar</packaging>
<name>Bitbar API v2</name>
<url>https://github.com/bitbar/testdroid-api</url>
Expand All @@ -11,11 +11,11 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<jackson.version>2.9.8</jackson.version>
<slf4j.version>1.7.13</slf4j.version>
<junit.jupiter.version>5.3.2</junit.jupiter.version>
<org.apache.commons.io.version>2.5</org.apache.commons.io.version>
<org.apache.commons.lang3.version>3.8.1</org.apache.commons.lang3.version>
<org.apache.httpcomponents.httpclient.version>4.5.5</org.apache.httpcomponents.httpclient.version>
<slf4j.version>1.7.26</slf4j.version>
<junit.jupiter.version>5.4.2</junit.jupiter.version>
<org.apache.commons.io.version>2.6</org.apache.commons.io.version>
<org.apache.commons.lang3.version>3.9</org.apache.commons.lang3.version>
<org.apache.httpcomponents.httpclient.version>4.5.6</org.apache.httpcomponents.httpclient.version>
<com.google.http-client>1.25.0</com.google.http-client>
<hamcrest.version>2.1</hamcrest.version>
</properties>
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/testdroid/api/dto/MappingKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ public class MappingKey {
public static final String STATE_CHANGE_TIME = "stateChangeTime";
public static final String STATE_TIME = "stateTime";
public static final String STATUS = "status";
public static final String STRIPE_TOKEN = "stripeToken";
public static final String SUBJECT = "subject";
public static final String SUBSCRIPTION_END = "subscriptionEnd";
public static final String SUBSCRIPTION_START = "subscriptionStart";
Expand Down
14 changes: 13 additions & 1 deletion src/main/java/com/testdroid/api/model/APIAccountService.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ public enum DeactivateReason {

private DeactivateReason deactivateReason;

private APIService.ChargeType chargeType;

public APIAccountService() {
}

Expand All @@ -83,7 +85,7 @@ public APIAccountService(
LocalDateTime endTime, boolean finished, Long id, LocalDateTime lastPaymentTime,
APIPaymentMethod paymentMethod, Integer price, Long serviceId, LocalDateTime startTime,
String userEmail, Long userId, Integer vatRate, Unit unit, Integer unitCount, Integer serviceCount,
String serviceName, DeactivateReason deactivateReason) {
String serviceName, DeactivateReason deactivateReason, APIService.ChargeType chargeType) {
super(id);
this.accountId = accountId;
this.activatedById = activatedById;
Expand All @@ -109,6 +111,7 @@ public APIAccountService(
this.serviceCount = serviceCount;
this.serviceName = serviceName;
this.deactivateReason = deactivateReason;
this.chargeType = chargeType;
}

public Long getAccountId() {
Expand Down Expand Up @@ -307,6 +310,14 @@ public void setDeactivateReason(DeactivateReason deactivateReason) {
this.deactivateReason = deactivateReason;
}

public APIService.ChargeType getChargeType() {
return chargeType;
}

public void setChargeType(APIService.ChargeType chargeType) {
this.chargeType = chargeType;
}

@JsonIgnore
public Integer getPayUnitCount() {
return autoRenew ? unitCount : unitCount * serviceCount;
Expand Down Expand Up @@ -357,6 +368,7 @@ public <T extends APIEntity> void clone(T from) {
this.userId = accountService.userId;
this.braintreeId = accountService.braintreeId;
this.deactivateReason = accountService.deactivateReason;
this.chargeType = accountService.chargeType;
}

public boolean isActiveAt(Date date) {
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/com/testdroid/api/model/APIAdminDeviceModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ public class APIAdminDeviceModel extends APIEntity {

private Integer total;

private Integer running;
private Long running;

private Integer queueSize;
private Long queueSize;

private Long avgWaitingTime;

Expand All @@ -30,7 +30,7 @@ public APIAdminDeviceModel() {
}

public APIAdminDeviceModel(
Long id, String name, Boolean enabled, Integer online, Integer total, Integer running, Integer queueSize,
Long id, String name, Boolean enabled, Integer online, Integer total, Long running, Long queueSize,
Double avgWaitingTime) {
super(id);
this.name = name;
Expand Down Expand Up @@ -80,19 +80,19 @@ public void setTotal(Integer total) {
this.total = total;
}

public Integer getRunning() {
public Long getRunning() {
return running;
}

public void setRunning(Integer running) {
public void setRunning(Long running) {
this.running = running;
}

public Integer getQueueSize() {
public Long getQueueSize() {
return queueSize;
}

public void setQueueSize(Integer queueSize) {
public void setQueueSize(Long queueSize) {
this.queueSize = queueSize;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class APIAdminFrameworkStatistics extends APIEntity {

private String cloudName;

private Date currentDate;
private Date day;

private Long frameworkId;

Expand All @@ -29,20 +29,33 @@ public class APIAdminFrameworkStatistics extends APIEntity {

private APIDeviceSession.Type type;

private Long userId;

private String userEmail;

private Long deviceModelId;

private String deviceModelName;

public APIAdminFrameworkStatistics() {
}

public APIAdminFrameworkStatistics(
Date currentDate, Long frameworkId, APIDevice.OsType osType, String releaseVersion,
String frameworkName, APIDeviceSession.State state, Long count, APIDeviceSession.Type type) {
this.currentDate = currentDate;
Date day, Long frameworkId, APIDevice.OsType osType, String releaseVersion, String frameworkName,
APIDeviceSession.State state, Long count, APIDeviceSession.Type type, Long userId, String userEmail,
Long deviceModelId, String deviceModelName) {
this.day = day;
this.frameworkId = frameworkId;
this.osType = osType;
this.releaseVersion = releaseVersion;
this.frameworkName = frameworkName;
this.state = state;
this.count = count;
this.type = type;
this.userId = userId;
this.userEmail = userEmail;
this.deviceModelId = deviceModelId;
this.deviceModelName = deviceModelName;
}

public String getCloudName() {
Expand All @@ -53,12 +66,12 @@ public void setCloudName(String cloudName) {
this.cloudName = cloudName;
}

public Date getCurrentDate() {
return currentDate;
public Date getDay() {
return day;
}

public void setCurrentDate(Date currentDate) {
this.currentDate = currentDate;
public void setDay(Date day) {
this.day = day;
}

public Long getFrameworkId() {
Expand Down Expand Up @@ -117,18 +130,54 @@ public void setType(APIDeviceSession.Type type) {
this.type = type;
}

public Long getUserId() {
return userId;
}

public void setUserId(Long userId) {
this.userId = userId;
}

public String getUserEmail() {
return userEmail;
}

public void setUserEmail(String userEmail) {
this.userEmail = userEmail;
}

public Long getDeviceModelId() {
return deviceModelId;
}

public void setDeviceModelId(Long deviceModelId) {
this.deviceModelId = deviceModelId;
}

public String getDeviceModelName() {
return deviceModelName;
}

public void setDeviceModelName(String deviceModelName) {
this.deviceModelName = deviceModelName;
}

@Override
protected <T extends APIEntity> void clone(T from) {
APIAdminFrameworkStatistics original = (APIAdminFrameworkStatistics) from;
cloneBase(from);
this.cloudName = original.cloudName;
this.currentDate = original.currentDate;
this.day = original.day;
this.frameworkId = original.frameworkId;
this.osType = original.osType;
this.releaseVersion = original.releaseVersion;
this.frameworkName = original.frameworkName;
this.state = original.state;
this.count = original.count;
this.type = original.type;
this.userId = original.userId;
this.userEmail = original.userEmail;
this.deviceModelId = original.deviceModelId;
this.deviceModelName = original.deviceModelName;
}
}
10 changes: 10 additions & 0 deletions src/main/java/com/testdroid/api/model/APIClientSideTestConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public class APIClientSideTestConfig implements Serializable {

private String appiumVersion;

private String location;

@XmlType(namespace = "APIClientSideTestConfig")
public enum Target {
ANDROID,
Expand Down Expand Up @@ -92,4 +94,12 @@ public String getAppiumVersion() {
public void setAppiumVersion(String appiumVersion) {
this.appiumVersion = appiumVersion;
}

public String getLocation() {
return location;
}

public void setLocation(String location) {
this.location = location;
}
}
26 changes: 20 additions & 6 deletions src/main/java/com/testdroid/api/model/APIService.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.testdroid.api.APIEntity;
import com.testdroid.api.formatter.CurrencyFormatter;
import com.testdroid.api.model.enums.Unit;
import com.testdroid.api.util.TimeConverter;

import javax.xml.bind.annotation.XmlRootElement;
Expand Down Expand Up @@ -42,10 +43,16 @@ public class APIService extends APIEntity {

private List<APIRole> roles = new ArrayList<>();

private Unit unit;

@XmlType(namespace = "APIService")
public enum ChargeType {
USAGE,
CONCURRENCY
CONCURRENCY;

public static ChargeType fromValue(String value) {
return "metered".equals(value) ? ChargeType.USAGE : ChargeType.CONCURRENCY;
}
}

public APIService() {
Expand All @@ -54,7 +61,7 @@ public APIService() {
public APIService(
Long id, String name, String description, boolean autoRenew, Integer centPrice, Integer includedHours,
Integer pricePerHour, String externalId, LocalDateTime archiveTime, LocalDateTime activateTime,
boolean customPlan, ChargeType chargeType) {
boolean customPlan, ChargeType chargeType, Unit unit) {
super(id);
this.name = name;
this.description = description;
Expand All @@ -67,6 +74,7 @@ public APIService(
this.activateTime = TimeConverter.toDate(activateTime);
this.customPlan = customPlan;
this.chargeType = chargeType;
this.unit = unit;
}

public boolean isAutoRenew() {
Expand Down Expand Up @@ -100,6 +108,7 @@ protected <T extends APIEntity> void clone(T from) {
this.activateTime = apiService.activateTime;
this.customPlan = apiService.customPlan;
this.chargeType = apiService.chargeType;
this.unit = apiService.unit;
}

public String getName() {
Expand Down Expand Up @@ -186,6 +195,14 @@ public void setRoles(List<APIRole> roles) {
this.roles = roles;
}

public Unit getUnit() {
return unit;
}

public void setUnit(Unit unit) {
this.unit = unit;
}

@JsonIgnore
@Override
public int hashCode() {
Expand All @@ -204,9 +221,6 @@ public boolean equals(Object object) {
return false;
}
APIService other = (APIService) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
return (this.id != null || other.id == null) && (this.id == null || this.id.equals(other.id));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
public enum APIPaymentMethod {
PAYPAL,
BRAINTREE(TRUE),
STRIPE(TRUE),
INVOICE(FALSE),
PROMOTION,
AWS(FALSE);
Expand Down
Loading

0 comments on commit 2d602d7

Please sign in to comment.