Skip to content

Commit

Permalink
Merge pull request #388 from snieguu/master
Browse files Browse the repository at this point in the history
Version 2.103
  • Loading branch information
lastverb authored Aug 13, 2020
2 parents b691397 + 01a0f2f commit 20ebc36
Show file tree
Hide file tree
Showing 8 changed files with 176 additions and 9 deletions.
2 changes: 1 addition & 1 deletion 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.102</version>
<version>2.103</version>
<packaging>jar</packaging>
<name>Bitbar API v2</name>
<url>https://github.com/bitbar/testdroid-api</url>
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 @@ -83,6 +83,7 @@ public class MappingKey {
public static final String DEVICE_DOT_ARCHIVE_TIME = "device.archiveTime";
public static final String DEVICE_DOT_DISPLAY_NAME = "device.displayName";
public static final String DEVICE_DOT_ID = "device.id";
public static final String DEVICE_FILTER_GROUP_NAME= "deviceFilterGroup.name";
public static final String DEVICE_ID = "deviceId";
public static final String DEVICE_IDS_ARR = "deviceIds[]";
public static final String DEVICE_MODEL_DOT_ID = "deviceModel.id";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package com.testdroid.api.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.testdroid.api.APIEntity;

import javax.xml.bind.annotation.XmlRootElement;
import java.util.Objects;

/**
* @author Damian Sniezek <[email protected]>
*/
@XmlRootElement
public class APIAccountConcurrencyStatus extends APIEntity {

private Long runningSessions;

private Long waitingSessions;

private Long sessions;

private Integer accountConcurrency;

private String mainUserEmail;

private Boolean unlimitedConcurrency;

APIAccountConcurrencyStatus(){

}

public Integer getAccountConcurrency() {
return accountConcurrency;
}

public Long getRunningSessions() {
return runningSessions;
}

public Long getWaitingSessions() {
return waitingSessions;
}

public Long getSessions() {
return sessions;
}

public String getMainUserEmail() {
return mainUserEmail;
}

public Boolean getUnlimitedConcurrency() {
return unlimitedConcurrency;
}

public APIAccountConcurrencyStatus(
Long accountId, String mainUserEmail, Long waitingSessions, Long runningSessions,
Integer accountConcurrency, Boolean hasMobileConcurrencyRole) {
super(accountId);
this.runningSessions = runningSessions;
this.waitingSessions = waitingSessions;
this.sessions = runningSessions + waitingSessions;
this.mainUserEmail = mainUserEmail;
this.accountConcurrency = accountConcurrency;
this.unlimitedConcurrency = hasMobileConcurrencyRole && Objects.isNull(accountConcurrency);
}

@Override
@JsonIgnore
protected <T extends APIEntity> void clone(T from) {
APIAccountConcurrencyStatus origin = (APIAccountConcurrencyStatus) from;
cloneBase(from);
this.runningSessions = origin.runningSessions;
this.waitingSessions = origin.waitingSessions;
this.sessions = origin.sessions;
this.accountConcurrency = origin.accountConcurrency;
this.mainUserEmail = origin.mainUserEmail;
}
}
61 changes: 61 additions & 0 deletions src/main/java/com/testdroid/api/model/APIAccountPreference.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package com.testdroid.api.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.testdroid.api.APIEntity;

import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
* @author Damian Sniezek <[email protected]>
*/
@XmlRootElement
public class APIAccountPreference extends APIEntity implements Serializable {

private static final long serialVersionUID = 1L;

private List<String> allowedFileExtensions = new ArrayList<>();

public List<String> getAllowedFileExtensions() {
return allowedFileExtensions;
}

public APIAccountPreference setAllowedFileExtensions(List<String> allowedFileExtensions) {
this.allowedFileExtensions = allowedFileExtensions;
return this;
}

@Override
public void setId(Long id) {
super.setId(id);
this.selfURI = String.format("/accounts/%s/preferences", id);
}

@Override
@JsonIgnore
protected <T extends APIEntity> void clone(T from) {
APIAccountPreference prototype = (APIAccountPreference) from;
cloneBase(from);
this.allowedFileExtensions = prototype.allowedFileExtensions;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
APIAccountPreference that = (APIAccountPreference) o;
return allowedFileExtensions.equals(that.allowedFileExtensions);
}

@Override
public int hashCode() {
return Objects.hash(allowedFileExtensions);
}
}
20 changes: 16 additions & 4 deletions src/main/java/com/testdroid/api/model/APIDeviceFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,22 @@ public class APIDeviceFilter extends APIEntity {

private boolean hidden;

//Technical field to allow group by it
@JsonIgnore
private String labelGroupDisplayName;

public APIDeviceFilter() {
}

public APIDeviceFilter(Long id, String name, String displayName, boolean hidden) {
super(id);
this.name = name;
this.displayName = displayName;
public APIDeviceFilter(
Long labelId, String labelName, String labelDisplayName, Long labelGroupId, String labelGroupDisplayName,
boolean hidden, Long order) {
super(labelId);
this.parentId = labelGroupId;
this.name = labelName;
this.displayName = labelDisplayName;
this.hidden = hidden;
this.labelGroupDisplayName = labelGroupDisplayName;
}

public String getName() {
Expand All @@ -51,6 +59,10 @@ public void setHidden(boolean hidden) {
this.hidden = hidden;
}

public String getLabelGroupDisplayName() {
return labelGroupDisplayName;
}

@Override
@JsonIgnore
protected <T extends APIEntity> void clone(T from) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ public List<APIDeviceFilter> getDeviceFilters() {
return deviceFilters;
}

public void setDeviceFilters(List<APIDeviceFilter> deviceFilters) {
public APIDeviceFilterGroup setDeviceFilters(List<APIDeviceFilter> deviceFilters) {
this.deviceFilters = deviceFilters;
return this;
}

@Override
Expand Down
18 changes: 15 additions & 3 deletions src/main/java/com/testdroid/api/model/APIDeviceSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,15 @@ public boolean isFinished() {

private Integer rowIndex;

private Long accountId;

public APIDeviceSession() {
}

public APIDeviceSession(
Long id, Long userId, String userEmail, APIDeviceSession.Type type, LocalDateTime createTime,
LocalDateTime startTime, LocalDateTime installTime, LocalDateTime endTime, Long timeLimit,
Long launchAppDuration, Long deviceLogFirstTimestamp, APIDeviceSession.State state,
Long id, Long userId, String userEmail, Long accountId, APIDeviceSession.Type type,
LocalDateTime createTime, LocalDateTime startTime, LocalDateTime installTime, LocalDateTime endTime,
Long timeLimit, Long launchAppDuration, Long deviceLogFirstTimestamp, APIDeviceSession.State state,
Integer testCasePassedCount, Integer testCaseFailedCount, Integer testCaseSkippedCount, Boolean billable,
Long deviceModelId, String displayName, Integer creditsPrice, String imagePrefix, Integer imageTop,
Integer imageLeft, Integer imageWidth, Integer imageHeight, Integer frameExtraWidth,
Expand All @@ -157,6 +159,7 @@ public APIDeviceSession(
super(id);
this.userId = userId;
this.userEmail = userEmail;
this.accountId = accountId;
this.type = type;
this.createTime = TimeConverter.toDate(createTime);
this.startTime = TimeConverter.toDate(startTime);
Expand Down Expand Up @@ -446,6 +449,14 @@ public void setRowIndex(Integer rowIndex) {
this.rowIndex = rowIndex;
}

public Long getAccountId() {
return accountId;
}

public void setAccountId(Long accountId) {
this.accountId = accountId;
}

@JsonIgnore
public APIListResource<APIDeviceSessionStep> getDeviceSessionStepsResource() throws APIException {
return getListResource(createUri(selfURI, "/steps"), APIDeviceSessionStep.class);
Expand Down Expand Up @@ -481,6 +492,7 @@ protected <T extends APIEntity> void clone(T from) {
cloneBase(from);
this.userId = apiDeviceSession.userId;
this.userEmail = apiDeviceSession.userEmail;
this.accountId = apiDeviceSession.accountId;
this.createTime = apiDeviceSession.createTime;
this.startTime = apiDeviceSession.startTime;
this.installTime = apiDeviceSession.installTime;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ public class TypeReferenceFactory {
});
TYPE_REFERENCE_MAP.put(APIAccount.class, new TypeReference<APIAccount>() {
});
TYPE_REFERENCE_MAP.put(APIAccountPreference.class, new TypeReference<APIAccountPreference>() {
});
TYPE_REFERENCE_MAP.put(APIAdminOverview.class, new TypeReference<APIAdminOverview>() {
});
TYPE_REFERENCE_MAP.put(APICloudInfo.class, new TypeReference<APICloudInfo>() {
Expand Down

0 comments on commit 20ebc36

Please sign in to comment.