Skip to content

Commit

Permalink
Merge pull request #540 from maciej-lendzion/master
Browse files Browse the repository at this point in the history
Version 3.37
  • Loading branch information
lastverb authored Dec 9, 2024
2 parents 5c6445f + f90e85d commit 56b6942
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 72 deletions.
10 changes: 5 additions & 5 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>3.36.0</version>
<version>3.37.0</version>
<packaging>jar</packaging>
<name>Bitbar API v2</name>
<url>https://github.com/bitbar/testdroid-api</url>
Expand All @@ -18,11 +18,11 @@
<jacoco-maven-plugin.skip>true</jacoco-maven-plugin.skip>
<!-- disable default deployment -->
<maven.deploy.skip>true</maven.deploy.skip>
<org.springframework.boot.spring-boot-dependencies>3.3.4</org.springframework.boot.spring-boot-dependencies>
<org.springframework.boot.spring-boot-dependencies>3.3.5</org.springframework.boot.spring-boot-dependencies>
<org.apache.commons.collections4.version>4.4</org.apache.commons.collections4.version>
<org.apache.commons.io.version>2.17.0</org.apache.commons.io.version>
<org.apache.commons.io.version>2.18.0</org.apache.commons.io.version>
<commons-text.version>1.10.0</commons-text.version>
<dependency-check-maven.version>10.0.3</dependency-check-maven.version>
<dependency-check-maven.version>11.1.0</dependency-check-maven.version>
<jacoco-maven-plugin.version>0.8.12</jacoco-maven-plugin.version>
<org.reflections.version>0.10.2</org.reflections.version>
</properties>
Expand Down Expand Up @@ -71,7 +71,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.4.0</version>
<version>3.5.2</version>
<executions>
<execution>
<id>default-test</id>
Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/testdroid/api/dto/MappingKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ private MappingKey() {
public static final String ARCHIVING_ITEM_COUNT = "archivingItemCount";
public static final String ARCHIVING_STRATEGY = "archivingStrategy";
public static final String ASL_ON = "aslOn";
public static final String AUTO_RENEW = "autoRenew";
public static final String AVG_WAITING_TIME = "avgWaitingTime";
public static final String BATTERY_LEVEL = "batteryLevel";
public static final String BILLABLE = "billable";
Expand Down
19 changes: 1 addition & 18 deletions src/main/java/com/testdroid/api/model/APIAccountService.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ public enum DeactivateReason {

private boolean active;

private boolean autoRenew;

private String braintreeId;

private Date createTime;
Expand Down Expand Up @@ -82,7 +80,7 @@ public APIAccountService() {
@SuppressWarnings("squid:S107")
public APIAccountService(
Long accountId, String accountName, Long activatedById, String activatedByName, boolean active,
boolean autoRenew, String braintreeId, LocalDateTime createTime, Long deactivatedById,
String braintreeId, LocalDateTime createTime, Long deactivatedById,
String deactivatedByName, LocalDateTime endTime, boolean finished, Long id, LocalDateTime lastPaymentTime,
APIPaymentMethod paymentMethod, Integer price, Long serviceId, LocalDateTime startTime, Integer vatRate,
Unit unit, Integer unitCount, Integer serviceCount, String serviceName, DeactivateReason deactivateReason,
Expand All @@ -93,7 +91,6 @@ public APIAccountService(
this.activatedById = activatedById;
this.activatedByName = activatedByName;
this.active = active;
this.autoRenew = autoRenew;
this.braintreeId = braintreeId;
this.createTime = TimeConverter.toDate(createTime);
this.deactivatedById = deactivatedById;
Expand Down Expand Up @@ -230,14 +227,6 @@ public void setPrice(Integer price) {
this.price = price;
}

public boolean isAutoRenew() {
return autoRenew;
}

public void setAutoRenew(boolean autoRenew) {
this.autoRenew = autoRenew;
}

public String getBraintreeId() {
return braintreeId;
}
Expand Down Expand Up @@ -318,11 +307,6 @@ public String getSubscriptionManagementURL() {
return subscriptionManagementURL;
}

@JsonIgnore
public Integer getPayUnitCount() {
return autoRenew ? unitCount : unitCount * serviceCount;
}

@JsonIgnore
public String getVatPriceString() {
float vatPrice = (getPrice() * getVatRate()) / 100f;
Expand All @@ -349,7 +333,6 @@ public <T extends APIEntity> void clone(T from) {
this.accountName = accountService.accountName;
this.active = accountService.active;
this.finished = accountService.finished;
this.autoRenew = accountService.autoRenew;
this.price = accountService.price;
this.activatedById = accountService.activatedById;
this.activatedByName = accountService.activatedByName;
Expand Down
55 changes: 33 additions & 22 deletions src/main/java/com/testdroid/api/model/APIAdminDeviceModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public class APIAdminDeviceModel extends APIEntity {

private Boolean enabled;

private Integer creditsPrice;

private APIDevice.OsType osType;

private APIDevice.Platform platform;
Expand All @@ -33,14 +35,13 @@ public class APIAdminDeviceModel extends APIEntity {
private String releaseVersion;

public APIAdminDeviceModel() {

}

@SuppressWarnings("squid:S107")
public APIAdminDeviceModel(
Long id, String name, APIDevice.OsType osType, APIDevice.Platform platform, String location,
Boolean dedicated, String releaseVersion, Boolean enabled, Integer online, Integer total, Long running,
Long queueSize, Double avgWaitingTime) {
Boolean dedicated, String releaseVersion, Boolean enabled, Integer creditsPrice, Integer online,
Integer total, Long running, Long queueSize, Double avgWaitingTime) {
super(id);
this.name = name;
this.osType = osType;
Expand All @@ -49,32 +50,14 @@ public APIAdminDeviceModel(
this.dedicated = dedicated;
this.releaseVersion = releaseVersion;
this.enabled = enabled;
this.creditsPrice = creditsPrice;
this.online = online;
this.total = total;
this.running = running;
this.queueSize = queueSize;
this.avgWaitingTime = avgWaitingTime != null ? avgWaitingTime.longValue() : 0;
}

@Override
@JsonIgnore
protected <T extends APIEntity> void clone(T from) {
APIAdminDeviceModel model = (APIAdminDeviceModel) from;
cloneBase(from);
this.name = model.name;
this.osType = model.osType;
this.platform = model.platform;
this.location = model.location;
this.dedicated = model.dedicated;
this.releaseVersion = model.releaseVersion;
this.enabled = model.enabled;
this.online = model.online;
this.total = model.total;
this.running = model.running;
this.queueSize = model.queueSize;
this.avgWaitingTime = model.avgWaitingTime;
}

public String getName() {
return name;
}
Expand Down Expand Up @@ -170,4 +153,32 @@ public String getReleaseVersion() {
public void setReleaseVersion(String releaseVersion) {
this.releaseVersion = releaseVersion;
}

public Integer getCreditsPrice() {
return creditsPrice;
}

public void setCreditsPrice(Integer creditsPrice) {
this.creditsPrice = creditsPrice;
}

@Override
@JsonIgnore
protected <T extends APIEntity> void clone(T from) {
APIAdminDeviceModel model = (APIAdminDeviceModel) from;
cloneBase(from);
this.name = model.name;
this.osType = model.osType;
this.platform = model.platform;
this.location = model.location;
this.dedicated = model.dedicated;
this.releaseVersion = model.releaseVersion;
this.enabled = model.enabled;
this.creditsPrice = model.creditsPrice;
this.online = model.online;
this.total = model.total;
this.running = model.running;
this.queueSize = model.queueSize;
this.avgWaitingTime = model.avgWaitingTime;
}
}
15 changes: 14 additions & 1 deletion src/main/java/com/testdroid/api/model/APIAdminDeviceProblem.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,24 @@ public class APIAdminDeviceProblem extends APIEntity {

private String deviceName;

private String location;

private List<APIAdminDeviceProblemPair> problems;

public APIAdminDeviceProblem() {
}

@SuppressWarnings("squid:S107")
public APIAdminDeviceProblem(
Long clusterId, String clusterName, Long deviceId, String deviceName, Long deviceModelId,
String deviceModelName, List<APIAdminDeviceProblemPair> problems) {
String deviceModelName, String location, List<APIAdminDeviceProblemPair> problems) {
this.clusterId = clusterId;
this.clusterName = clusterName;
this.deviceId = deviceId;
this.deviceName = deviceName;
this.deviceModelId = deviceModelId;
this.deviceModelName = deviceModelName;
this.location = location;
this.problems = problems;
}

Expand Down Expand Up @@ -87,6 +91,14 @@ public void setDeviceModelName(String deviceModelName) {
this.deviceModelName = deviceModelName;
}

public String getLocation() {
return location;
}

public void setLocation(String location) {
this.location = location;
}

public List<APIAdminDeviceProblemPair> getProblems() {
return problems;
}
Expand All @@ -106,6 +118,7 @@ protected <T extends APIEntity> void clone(T from) {
this.deviceName = apiAdminDeviceProblem.deviceName;
this.deviceModelId = apiAdminDeviceProblem.deviceModelId;
this.deviceModelName = apiAdminDeviceProblem.deviceModelName;
this.location = apiAdminDeviceProblem.location;
this.problems = apiAdminDeviceProblem.problems;
}
}
22 changes: 15 additions & 7 deletions src/main/java/com/testdroid/api/model/APIDevice.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.testdroid.api.APIEntity;
import com.testdroid.api.APIList;
import org.apache.commons.lang3.StringUtils;

import jakarta.xml.bind.annotation.XmlType;
import org.apache.commons.lang3.StringUtils;

import java.util.*;

Expand All @@ -27,7 +26,6 @@ public enum DeviceGroupOrigin {

public enum Creator {
MANUAL,
ROBOT,
AUTOMATIC
}

Expand Down Expand Up @@ -160,7 +158,9 @@ public List<OsType> getFamily() {

private APIDeviceAvailability availability;

// Technical fields to calculate others
@JsonIgnore
private String location;

@JsonIgnore
private Integer onlineDevices;

Expand All @@ -178,7 +178,7 @@ public APIDevice(
Long id, String displayName, String manufacturer, String releaseVersion, Integer apiLevel,
Integer creditsPrice, String imagePrefix, Integer imageTop, Integer imageLeft, Integer imageWidth,
Integer imageHeight, Integer frameExtraWidth, OsType osType, Platform platform, Boolean online,
Boolean locked, Boolean enabled, Long accountId, String accountName, Integer onlineDevices,
Boolean locked, Boolean enabled, String location, Long accountId, String accountName, Integer onlineDevices,
Integer availableDevices) {
super(id);
this.displayName = displayName;
Expand All @@ -196,6 +196,7 @@ public APIDevice(
this.locked = locked;
this.online = online;
this.enabled = enabled;
this.location = location;
this.accountId = accountId;
this.accountName = accountName;
this.onlineDevices = onlineDevices;
Expand Down Expand Up @@ -421,12 +422,18 @@ public void setAvailability(APIDeviceAvailability availability) {
this.availability = availability;
}

@JsonIgnore
public String getLocation() {
return location;
}

public void setLocation(String location) {
this.location = location;
}

public Integer getOnlineDevices() {
return onlineDevices;
}

@JsonIgnore
public Integer getAvailableDevices() {
return availableDevices;
}
Expand Down Expand Up @@ -474,5 +481,6 @@ protected <T extends APIEntity> void clone(T from) {
this.availability = apiDevice.availability;
this.onlineDevices = apiDevice.onlineDevices;
this.availableDevices = apiDevice.availableDevices;
this.location = apiDevice.location;
}
}
4 changes: 2 additions & 2 deletions src/main/java/com/testdroid/api/model/APIDeviceSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public APIDeviceSession(
String releaseVersion, Integer apiLevel, ExcludeReason excludeReason, Long deviceInstanceId,
RetryState retryState, Integer autoRetriesLeftCount, Long deviceTime, Long duration, Long projectId,
String projectName, Long testRunId, String testRunName, Float successRatio, String name,
APIDeviceSessionConfig config, Boolean biometricInstrumentation) {
APIDeviceSessionConfig config, Boolean biometricInstrumentation, String location) {
super(id);
this.externalId = externalId;
this.clientSideId = clientSideId;
Expand All @@ -202,7 +202,7 @@ public APIDeviceSession(
this.endTime = TimeConverter.toDate(endTime);
this.device = new APIDevice(deviceModelId, displayName, deviceManufacturer, releaseVersion,
apiLevel, creditsPrice, imagePrefix, imageTop, imageLeft, imageWidth, imageHeight, frameExtraWidth,
osType, platform, null, locked, enabled, null, null, null, null);
osType, platform, null, locked, enabled, location, null, null, null, null);
this.timeLimit = timeLimit;
this.deviceLogFirstTimestamp = deviceLogFirstTimestamp;
this.state = state;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/testdroid/api/model/APIDeviceUsage.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ public APIDeviceUsage(
Long id, String displayName, String manufacturer, String releaseVersion,
Integer apiLevel, Integer creditsPrice, String imagePrefix, Integer imageTop, Integer imageLeft,
Integer imageWidth, Integer imageHeight, Integer frameExtraWidth, APIDevice.OsType osType,
APIDevice.Platform platform, Boolean online, Boolean locked, Boolean enabled, Long totalDeviceSessions,
Long failedDeviceSessions) {
APIDevice.Platform platform, Boolean online, Boolean locked, Boolean enabled, String location,
Long totalDeviceSessions, Long failedDeviceSessions) {
super(id);
this.device = new APIDevice(id, displayName, manufacturer, releaseVersion, apiLevel,
creditsPrice, imagePrefix, imageTop, imageLeft, imageWidth, imageHeight, frameExtraWidth, osType,
platform, online, locked, enabled, null, null, null, null);
platform, online, locked, enabled, location, null, null, null, null);
this.totalDeviceSessions = totalDeviceSessions;
this.failedDeviceSessions = failedDeviceSessions;
}
Expand Down
14 changes: 1 addition & 13 deletions src/main/java/com/testdroid/api/model/APIService.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
public class APIService extends APIEntity {

private boolean autoRenew;

private String externalId;

private String commonId;
Expand Down Expand Up @@ -60,13 +58,12 @@ public APIService() {

@SuppressWarnings("squid:S107")
public APIService(
Long id, String name, String description, boolean autoRenew, Integer centPrice, Integer includedHours,
Long id, String name, String description, Integer centPrice, Integer includedHours,
Integer pricePerHour, String externalId, String commonId, LocalDateTime archiveTime, LocalDateTime activateTime,
boolean activated, boolean customPlan, ChargeType chargeType, Unit unit, String features) {
super(id);
this.name = name;
this.description = description;
this.autoRenew = autoRenew;
this.centPrice = centPrice;
this.includedHours = includedHours;
this.pricePerHour = pricePerHour;
Expand All @@ -81,14 +78,6 @@ public APIService(
this.features = features;
}

public boolean isAutoRenew() {
return autoRenew;
}

public void setAutoRenew(boolean autoRenew) {
this.autoRenew = autoRenew;
}

public Integer getCentPrice() {
return centPrice;
}
Expand All @@ -104,7 +93,6 @@ protected <T extends APIEntity> void clone(T from) {
this.name = apiService.name;
this.description = apiService.description;
this.features = apiService.features;
this.autoRenew = apiService.autoRenew;
this.centPrice = apiService.centPrice;
this.externalId = apiService.externalId;
this.commonId = apiService.commonId;
Expand Down

0 comments on commit 56b6942

Please sign in to comment.