Skip to content

Commit

Permalink
Merge pull request #353 from szprutamich/master
Browse files Browse the repository at this point in the history
Version 2.69
  • Loading branch information
lastverb authored Dec 14, 2018
2 parents aa20663 + 1df57a0 commit f16f625
Show file tree
Hide file tree
Showing 18 changed files with 509 additions and 20 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.testdroid</groupId>
<artifactId>testdroid-api</artifactId>
<version>2.68</version>
<version>2.69</version>
<packaging>jar</packaging>
<name>Testdroid API v2</name>
<url>https://github.com/bitbar/testdroid-api</url>
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/testdroid/api/APIEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
*/
@XmlRootElement(namespace = "com.testdroid.api")
@XmlSeeAlso({
APIAccessGroup.class,
APIAccount.class,
APIAccountService.class,
APIAccountServicePayment.class,
Expand Down Expand Up @@ -96,6 +97,7 @@
APIScreenshot.class,
APIScreenshotExtended.class,
APIService.class,
APISharedResource.class,
APISoftwareVersion.class,
APITag.class,
APITestCaseRun.class,
Expand Down
22 changes: 18 additions & 4 deletions src/main/java/com/testdroid/api/dto/MappingKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
*/
public class MappingKey {

public static final String ACCESS_GROUP_ID = "accessGroupId";

public static final String ACCOUNT_ID = "accountId";

public static final String ACCOUNT_ROLE_ID = "accountRoleId";
Expand All @@ -13,6 +15,8 @@ public class MappingKey {

public static final String ACTIVATE_TIME = "activateTime";

public static final String ACTIVE_ONLY = "activeOnly";

public static final String ACTIVE_SERVICE_ID = "activeServiceId";

public static final String ADD_LABEL_TO_DEVICES = "addLabelToDevices";
Expand Down Expand Up @@ -151,6 +155,12 @@ public class MappingKey {

public static final String DESCRIPTION = "description";

public static final String DESKTOP_DEVICE_LIMIT = "desktopDeviceLimit";

public static final String DESKTOP_ENABLED = "desktopEnabled";

public static final String DESKTOP_PROJECT_LIMIT = "desktopProjectLimit";

public static final String DEVICE_COUNT = "deviceCount";

public static final String DEVICE_DOT_ARCHIVE_TIME = "device.archiveTime";
Expand Down Expand Up @@ -235,8 +245,6 @@ public class MappingKey {

public static final String FOR_PROJECTS = "forProjects";

public static final String FOR_SECONDS = "forSeconds";

public static final String FRAMEWORK_ID = "frameworkId";

public static final String FRAMEWORK_NAME = "frameworkName";
Expand Down Expand Up @@ -287,6 +295,8 @@ public class MappingKey {

public static final String INSTRUMENTATION_RUNNER = "instrumentationRunner";

public static final String IN_USE = "inUse";

public static final String INTERNAL_STORAGE = "internalStorage";

public static final String INTERNET_ACCESS = "internetAccess";
Expand Down Expand Up @@ -443,6 +453,8 @@ public class MappingKey {

public static final String QUEUE_SIZE = "queueSize";

public static final String READ_ONLY = "readOnly";

public static final String RECORDER_ENABLED = "recorderEnabled";

public static final String RECORDER_LIMIT = "recorderLimit";
Expand All @@ -457,6 +469,8 @@ public class MappingKey {

public static final String REQUIRED_TEST_EXTENSIONS = "requiredTestExtensions";

public static final String RESOURCE_ID = "resourceId";

public static final String RESULT = "result";

public static final String RETRYABLE = "retryable";
Expand All @@ -475,6 +489,8 @@ public class MappingKey {

public static final String SCHEDULER = "scheduler";

public static final String SCOPE = "scope";

public static final String SCREENSHOT = "screenshot";

public static final String SCREENSHOT_DIR = "screenshotDir";
Expand All @@ -491,8 +507,6 @@ public class MappingKey {

public static final String SELENIUM_ENABLED = "seleniumEnabled";

public static final String SEND_MAIL = "sendMail";

public static final String SENT = "sent";

public static final String SENT_TIME = "sentTime";
Expand Down
71 changes: 71 additions & 0 deletions src/main/java/com/testdroid/api/model/APIAccessGroup.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package com.testdroid.api.model;

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

import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

/**
* @author Michał Szpruta <[email protected]>
*/
@XmlRootElement
public class APIAccessGroup extends APIEntity {

@XmlType(namespace = "APIAccessGroup")
public enum Scope {
USER,
ACCOUNT,
GLOBAL
}

private String name;

private Long userId;

private Scope scope;

public APIAccessGroup() {
}

public APIAccessGroup(Long id, String name, Scope scope, Long userId) {
super(id);
this.name = name;
this.scope = scope;
this.userId = userId;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public Long getUserId() {
return userId;
}

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

public Scope getScope() {
return scope;
}

public void setScope(Scope scope) {
this.scope = scope;
}

@Override
@JsonIgnore
protected <T extends APIEntity> void clone(T from) {
APIAccessGroup original = (APIAccessGroup) from;
cloneBase(from);
this.name = original.name;
this.userId = original.userId;
this.scope = original.scope;
}
}
82 changes: 82 additions & 0 deletions src/main/java/com/testdroid/api/model/APIClientSideTestConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package com.testdroid.api.model;

import org.apache.commons.lang3.EnumUtils;

import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import java.io.Serializable;
import java.util.Optional;

/**
* @author Michał Szpruta <[email protected]>
*/
@XmlRootElement
public class APIClientSideTestConfig implements Serializable {

private static final long serialVersionUID = 1L;

private String browserName;

private String platform;

private String version;

private Target target;

@XmlType(namespace = "APIClientSideTestConfig")
public enum Target {
ANDROID,
IOS,
SELENDROID,
SAFARI,
CHROME,
XCUITEST,
DESKTOP;

public static Optional<Target> fromString(String name) {
return Optional.ofNullable(EnumUtils.getEnum(Target.class, name.toUpperCase()));
}
}

public APIClientSideTestConfig() {
}

public APIClientSideTestConfig(Target target, String browserName, String platform, String version) {
this.target = target;
this.browserName = browserName;
this.platform = platform;
this.version = version;
}

public Target getTarget() {
return target;
}

public void setTarget(Target target) {
this.target = target;
}

public String getBrowserName() {
return browserName;
}

public void setBrowserName(String browserName) {
this.browserName = browserName;
}

public String getPlatform() {
return platform;
}

public void setPlatform(String platform) {
this.platform = platform;
}

public String getVersion() {
return version;
}

public void setVersion(String version) {
this.version = version;
}
}
5 changes: 5 additions & 0 deletions src/main/java/com/testdroid/api/model/APIDevice.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public enum DeviceGroupOrigin {
public enum OsType {
IOS("iOS"),
ANDROID("Android"),
DESKTOP("Desktop"),
UNDEFINED("Undefined");

private final String displayName;
Expand All @@ -53,6 +54,10 @@ public boolean isAndroid() {
public boolean isIos() {
return this == IOS;
}

public boolean isDesktop() {
return this == DESKTOP;
}
}

private Integer creditsPrice;
Expand Down
27 changes: 26 additions & 1 deletion src/main/java/com/testdroid/api/model/APIDeviceGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,25 @@ public class APIDeviceGroup extends APIEntity {

private Long userId;

private String userEmail;

private boolean isShared;

public APIDeviceGroup() {
}

public APIDeviceGroup(
Long id, String name, String displayName, APIDevice.OsType osType, Long deviceCount, Long userId) {
Long id, String name, String displayName, APIDevice.OsType osType, Long deviceCount, Long userId,
String userEmail, boolean isShared) {
this.id = id;
this.name = name;
this.displayName = displayName;
this.creditsPrice = deviceCount;
this.deviceCount = deviceCount;
this.userId = userId;
this.osType = osType;
this.userEmail = userEmail;
this.isShared = isShared;
}

public String getName() {
Expand Down Expand Up @@ -92,6 +99,22 @@ public void setOsType(APIDevice.OsType osType) {
this.osType = osType;
}

public String getUserEmail() {
return userEmail;
}

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

public boolean isShared() {
return isShared;
}

public void setShared(boolean shared) {
isShared = shared;
}

@JsonIgnore
public boolean isPublic() {
return userId == null;
Expand Down Expand Up @@ -143,5 +166,7 @@ protected <T extends APIEntity> void clone(T from) {
this.displayName = apiDeviceGroup.displayName;
this.userId = apiDeviceGroup.userId;
this.osType = apiDeviceGroup.osType;
this.userEmail = apiDeviceGroup.userEmail;
this.isShared = apiDeviceGroup.isShared;
}
}
Loading

0 comments on commit f16f625

Please sign in to comment.