All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.testdroid.api.model.APITestRunConfig Maven / Gradle / Ivy

There is a newer version: 3.34.0
Show newest version
package com.testdroid.api.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.testdroid.api.APIEntity;
import jakarta.xml.bind.annotation.XmlType;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Optional;

/**
 * @author Łukasz Kajda 
 */
public class APITestRunConfig extends APIEntity implements Serializable {

    public static final String DEFAULT_RUNNER = "android.test.InstrumentationTestRunner";

    public static final String SCREENSHOT_DIR = "/sdcard/test-screenshots";

    private static final long serialVersionUID = 1L;

    @XmlType(namespace = "APITestRunConfig")
    public enum LimitationType {
        PACKAGE,
        CLASS
    }

    @XmlType(namespace = "APITestRunConfig")
    public enum Scheduler {
        PARALLEL,
        SERIAL,
        SINGLE,
        ALL_INSTANCES
    }

    private String appiumBrokerAddress;

    private String appiumBrokerQueueName;

    private String applicationPassword;

    private String applicationUsername;

    private List availableDeviceGroups;

    private List availableDevices;

    private List availableFrameworks;

    private List availableOsTypes;

    private boolean biometricInstrumentation;

    private APIClientSideTestConfig clientSideTestConfig;

    private List computedDevices;

    private Long creditsPrice;

    private Long deviceGroupId;

    private List deviceIds;

    private String deviceLanguageCode = Locale.US.toString();

    private String deviceNamePattern;

    private boolean disableResigning;

    private List files = new ArrayList<>();

    private Long frameworkId;

    private String hookURL;

    private String instrumentationRunner;

    private LimitationType limitationType;

    private String limitationValue;

    private boolean loadedPrevious;

    private Integer maxAutoRetriesCount;

    private Long maxWaitTime;

    private APIDuration maxTestTimeout;

    private APIDevice.OsType osType = APIDevice.OsType.UNDEFINED;

    private Long projectId;

    private String projectName;

    private boolean resignFiles;

    private boolean runAvailable;

    private Scheduler scheduler = Scheduler.PARALLEL;

    private String screenshotDir;

    private String status;

    private int statusCode;

    private Long testRunId;

    private String testRunName;

    private List testRunParameters = new ArrayList<>();

    private Long timeout;

    private APITunnelSettings tunnelSettings;

    private boolean useSamples;

    private String usedDeviceGroupName;

    private boolean videoRecordingEnabled;

    private String withAnnotation;

    private String withoutAnnotation;

    public APITestRunConfig() {
        // need for serialization/deserialization
    }

    public Long getProjectId() {
        return projectId;
    }

    public void setProjectId(Long projectId) {
        this.projectId = projectId;
    }

    public Scheduler getScheduler() {
        return scheduler;
    }

    public void setScheduler(Scheduler scheduler) {
        this.scheduler = scheduler;
    }

    public LimitationType getLimitationType() {
        return limitationType;
    }

    public void setLimitationType(LimitationType limitationType) {
        this.limitationType = limitationType;
    }

    public boolean isRunAvailable() {
        return runAvailable;
    }

    public void setRunAvailable(boolean runAvailable) {
        this.runAvailable = runAvailable;
    }

    public String getScreenshotDir() {
        return screenshotDir;
    }

    public void setScreenshotDir(String screenshotDir) {
        this.screenshotDir = screenshotDir;
    }

    public String getLimitationValue() {
        return limitationValue;
    }

    public void setLimitationValue(String limitationValue) {
        this.limitationValue = limitationValue;
    }

    public String getWithAnnotation() {
        return withAnnotation;
    }

    public void setWithAnnotation(String withAnnotation) {
        this.withAnnotation = withAnnotation;
    }

    public String getWithoutAnnotation() {
        return withoutAnnotation;
    }

    public void setWithoutAnnotation(String withoutAnnotation) {
        this.withoutAnnotation = withoutAnnotation;
    }

    public String getApplicationUsername() {
        return applicationUsername;
    }

    public void setApplicationUsername(String applicationUsername) {
        this.applicationUsername = applicationUsername;
    }

    public String getApplicationPassword() {
        return applicationPassword;
    }

    public void setApplicationPassword(String applicationPassword) {
        this.applicationPassword = applicationPassword;
    }

    public Long getDeviceGroupId() {
        return deviceGroupId;
    }

    public void setDeviceGroupId(Long deviceGroupId) {
        this.deviceGroupId = deviceGroupId;
    }

    public String getUsedDeviceGroupName() {
        return usedDeviceGroupName;
    }

    public void setUsedDeviceGroupName(String usedDeviceGroupName) {
        this.usedDeviceGroupName = usedDeviceGroupName;
    }

    public boolean isBiometricInstrumentation() {
        return biometricInstrumentation;
    }

    public void setBiometricInstrumentation(boolean biometricInstrumentation) {
        this.biometricInstrumentation = biometricInstrumentation;
    }

    public Long getCreditsPrice() {
        return creditsPrice;
    }

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

    public String getDeviceLanguageCode() {
        return deviceLanguageCode;
    }

    public void setDeviceLanguageCode(String deviceLanguageCode) {
        this.deviceLanguageCode = deviceLanguageCode;
    }

    public String getHookURL() {
        return hookURL;
    }

    public void setHookURL(String hookURL) {
        this.hookURL = hookURL;
    }

    public String getInstrumentationRunner() {
        return instrumentationRunner;
    }

    public void setInstrumentationRunner(String instrumentationRunner) {
        this.instrumentationRunner = instrumentationRunner;
    }

    public Long getTimeout() {
        return timeout;
    }

    public void setTimeout(Long timeout) {
        this.timeout = timeout;
    }

    public void setMaxTestTimeout(APIDuration maxTestTimeout) {
        this.maxTestTimeout = maxTestTimeout;
    }

    public APIDuration getMaxTestTimeout() {
        return maxTestTimeout;
    }

    public boolean isVideoRecordingEnabled() {
        return videoRecordingEnabled;
    }

    public void setVideoRecordingEnabled(boolean videoRecordingEnabled) {
        this.videoRecordingEnabled = videoRecordingEnabled;
    }

    public String getAppiumBrokerAddress() {
        return appiumBrokerAddress;
    }

    public void setAppiumBrokerAddress(String appiumBrokerAddress) {
        this.appiumBrokerAddress = appiumBrokerAddress;
    }

    public String getAppiumBrokerQueueName() {
        return appiumBrokerQueueName;
    }

    public void setAppiumBrokerQueueName(String appiumBrokerQueueName) {
        this.appiumBrokerQueueName = appiumBrokerQueueName;
    }

    public Integer getMaxAutoRetriesCount() {
        return maxAutoRetriesCount;
    }

    public void setMaxAutoRetriesCount(Integer maxAutoRetriesCount) {
        this.maxAutoRetriesCount = maxAutoRetriesCount;
    }

    public Long getMaxWaitTime() {
        return maxWaitTime;
    }

    public void setMaxWaitTime(Long maxWaitTime) {
        this.maxWaitTime = maxWaitTime;
    }

    public Long getFrameworkId() {
        return frameworkId;
    }

    public void setFrameworkId(Long frameworkId) {
        this.frameworkId = frameworkId;
    }

    public List getAvailableDeviceGroups() {
        return availableDeviceGroups;
    }

    public void setAvailableDeviceGroups(List availableDeviceGroups) {
        this.availableDeviceGroups = availableDeviceGroups;
    }

    public List getAvailableDevices() {
        return availableDevices;
    }

    public void setAvailableDevices(List availableDevices) {
        this.availableDevices = availableDevices;
    }

    public List getAvailableFrameworks() {
        return availableFrameworks;
    }

    public void setAvailableFrameworks(List availableFrameworks) {
        this.availableFrameworks = availableFrameworks;
    }

    public List getAvailableOsTypes() {
        return availableOsTypes;
    }

    public void setAvailableOsTypes(List availableOsTypes) {
        this.availableOsTypes = availableOsTypes;
    }

    public List getFiles() {
        return files;
    }

    //TODO maybe we should handle all Collections in that way
    @JsonSetter(nulls = Nulls.AS_EMPTY)
    public void setFiles(List files) {
        this.files = files;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public APIDevice.OsType getOsType() {
        return osType;
    }

    public void setOsType(APIDevice.OsType osType) {
        this.osType = osType;
    }

    public List getTestRunParameters() {
        return testRunParameters;
    }

    public void setTestRunParameters(List testRunParameters) {
        this.testRunParameters = testRunParameters;
    }

    public List getDeviceIds() {
        return deviceIds;
    }

    public void setDeviceIds(List deviceIds) {
        this.deviceIds = deviceIds;
    }

    public String getTestRunName() {
        return testRunName;
    }

    public void setTestRunName(String testRunName) {
        this.testRunName = testRunName;
    }

    public Long getTestRunId() {
        return testRunId;
    }

    public void setTestRunId(Long testRunId) {
        this.testRunId = testRunId;
    }

    public String getDeviceNamePattern() {
        return deviceNamePattern;
    }

    public void setDeviceNamePattern(String deviceNamePattern) {
        this.deviceNamePattern = deviceNamePattern;
    }

    public String getProjectName() {
        return projectName;
    }

    public void setProjectName(String projectName) {
        this.projectName = projectName;
    }

    public int getStatusCode() {
        return statusCode;
    }

    public void setStatusCode(int statusCode) {
        this.statusCode = statusCode;
    }

    public boolean isResignFiles() {
        return resignFiles;
    }

    public void setResignFiles(boolean resignFiles) {
        this.resignFiles = resignFiles;
    }

    public boolean isLoadedPrevious() {
        return loadedPrevious;
    }

    public void setLoadedPrevious(boolean loadedPrevious) {
        this.loadedPrevious = loadedPrevious;
    }

    public APIClientSideTestConfig getClientSideTestConfig() {
        return clientSideTestConfig;
    }

    public void setClientSideTestConfig(APIClientSideTestConfig clientSideTestConfig) {
        this.clientSideTestConfig = clientSideTestConfig;
    }

    public List getComputedDevices() {
        return computedDevices;
    }

    public void setComputedDevices(List computedDevices) {
        this.computedDevices = computedDevices;
    }

    public boolean isUseSamples() {
        return useSamples;
    }

    public void setUseSamples(boolean useSamples) {
        this.useSamples = useSamples;
    }

    public boolean isDisableResigning() {
        return disableResigning;
    }

    public void setDisableResigning(boolean disableResigning) {
        this.disableResigning = disableResigning;
    }

    public Optional findAnyFileByAction(APIFileConfig.Action action) {
        return getFiles().stream().filter(fc -> fc.getAction() == action).map(APIFileConfig::getFile).findAny();
    }

    public APITunnelSettings getTunnelSettings() {
        return tunnelSettings;
    }

    public void setTunnelSettings(APITunnelSettings tunnelSettings) {
        this.tunnelSettings = tunnelSettings;
    }

    @Override
    @JsonIgnore
    protected  void clone(T from) {
        APITestRunConfig apiTestRunConfig = (APITestRunConfig) from;
        cloneBase(from);
        this.appiumBrokerAddress = apiTestRunConfig.appiumBrokerAddress;
        this.appiumBrokerQueueName = apiTestRunConfig.appiumBrokerQueueName;
        this.applicationPassword = apiTestRunConfig.applicationPassword;
        this.applicationUsername = apiTestRunConfig.applicationUsername;
        this.availableDeviceGroups = apiTestRunConfig.availableDeviceGroups;
        this.availableDevices = apiTestRunConfig.availableDevices;
        this.availableFrameworks = apiTestRunConfig.availableFrameworks;
        this.availableOsTypes = apiTestRunConfig.availableOsTypes;
        this.biometricInstrumentation = apiTestRunConfig.biometricInstrumentation;
        this.clientSideTestConfig = apiTestRunConfig.clientSideTestConfig;
        this.creditsPrice = apiTestRunConfig.creditsPrice;
        this.deviceGroupId = apiTestRunConfig.deviceGroupId;
        this.deviceIds = apiTestRunConfig.deviceIds;
        this.deviceLanguageCode = apiTestRunConfig.deviceLanguageCode;
        this.disableResigning = apiTestRunConfig.disableResigning;
        this.files = apiTestRunConfig.files;
        this.frameworkId = apiTestRunConfig.frameworkId;
        this.hookURL = apiTestRunConfig.hookURL;
        this.instrumentationRunner = apiTestRunConfig.instrumentationRunner;
        this.limitationType = apiTestRunConfig.limitationType;
        this.limitationValue = apiTestRunConfig.limitationValue;
        this.maxAutoRetriesCount = apiTestRunConfig.maxAutoRetriesCount;
        this.maxWaitTime = apiTestRunConfig.maxWaitTime;
        this.osType = apiTestRunConfig.osType;
        this.projectId = apiTestRunConfig.projectId;
        this.projectName = apiTestRunConfig.projectName;
        this.resignFiles = apiTestRunConfig.resignFiles;
        this.runAvailable = apiTestRunConfig.runAvailable;
        this.scheduler = apiTestRunConfig.scheduler;
        this.screenshotDir = apiTestRunConfig.screenshotDir;
        this.status = apiTestRunConfig.status;
        this.statusCode = apiTestRunConfig.statusCode;
        this.testRunId = apiTestRunConfig.testRunId;
        this.testRunName = apiTestRunConfig.testRunName;
        this.testRunParameters = apiTestRunConfig.testRunParameters;
        this.timeout = apiTestRunConfig.timeout;
        this.tunnelSettings = apiTestRunConfig.tunnelSettings;
        this.useSamples = apiTestRunConfig.useSamples;
        this.usedDeviceGroupName = apiTestRunConfig.usedDeviceGroupName;
        this.videoRecordingEnabled = apiTestRunConfig.videoRecordingEnabled;
        this.withAnnotation = apiTestRunConfig.withAnnotation;
        this.withoutAnnotation = apiTestRunConfig.withoutAnnotation;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy