From 2bcbeeebd430ae05a567bb5dab98a34105d34a5c Mon Sep 17 00:00:00 2001 From: "michal.szpruta" Date: Tue, 6 Dec 2022 12:33:37 +0100 Subject: [PATCH] Version 3.10 --- pom.xml | 4 +- .../com/testdroid/api/filter/FilterEntry.java | 7 +- .../testdroid/api/model/APIAdminTestRun.java | 18 +-- .../com/testdroid/api/model/APIFramework.java | 2 +- .../testdroid/api/model/APITestRunConfig.java | 11 -- .../notification/APINotificationPlan.java | 153 ------------------ .../com/testdroid/api/util/TimeConverter.java | 4 + .../api/util/TypeReferenceFactory.java | 3 - 8 files changed, 14 insertions(+), 188 deletions(-) delete mode 100644 src/main/java/com/testdroid/api/model/notification/APINotificationPlan.java diff --git a/pom.xml b/pom.xml index 148014c6..deefdca8 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.testdroid testdroid-api - 3.9 + 3.10 jar Bitbar API v2 https://github.com/bitbar/testdroid-api @@ -12,7 +12,7 @@ true true - 2.7.4 + 2.7.5 4.4 2.11.0 1.10.0 diff --git a/src/main/java/com/testdroid/api/filter/FilterEntry.java b/src/main/java/com/testdroid/api/filter/FilterEntry.java index aa36240d..e1cc1196 100644 --- a/src/main/java/com/testdroid/api/filter/FilterEntry.java +++ b/src/main/java/com/testdroid/api/filter/FilterEntry.java @@ -5,7 +5,7 @@ import org.apache.commons.lang3.StringUtils; import java.time.LocalDateTime; -import java.util.List; +import java.util.Collection; import java.util.Objects; import java.util.stream.Collectors; @@ -125,7 +125,8 @@ private String valueToString(Object value) { return singleToString(value); case Integer.MAX_VALUE: default: - return ((List) value).stream().map(this::singleToString).collect(Collectors.joining(ARG_DELIMITER)); + return ((Collection) value).stream().map(this::singleToString) + .collect(Collectors.joining(ARG_DELIMITER)); } } @@ -134,7 +135,7 @@ private void validate() { throw new IllegalArgumentException("Operand does not accept any value"); } if (StringUtils.isBlank(rawValue) && operand.getArity().equals(Integer.MAX_VALUE)) { - throw new IllegalArgumentException("Operand requires a list of values"); + throw new IllegalArgumentException("Operand requires a collection of values"); } } diff --git a/src/main/java/com/testdroid/api/model/APIAdminTestRun.java b/src/main/java/com/testdroid/api/model/APIAdminTestRun.java index 564ff477..f49394c7 100644 --- a/src/main/java/com/testdroid/api/model/APIAdminTestRun.java +++ b/src/main/java/com/testdroid/api/model/APIAdminTestRun.java @@ -15,8 +15,6 @@ public class APIAdminTestRun extends APIEntity { private Date endTime; - private Boolean appCrawlerRun; - private APITestRun.State state; private Float successRatio; @@ -71,12 +69,11 @@ public APIAdminTestRun( public APIAdminTestRun( Long id, LocalDateTime createTime, LocalDateTime startTime, LocalDateTime endTime, APITestRun.State state, - Long startedById, String userName, String projectName, String testRunName, Boolean appCrawlerRun, - Float successRatio, Integer priority, Long projectId, Long duration, - APITestRunConfig.Scheduler scheduler, Long frameworkId, String frameworkName) { + Long startedById, String userName, String projectName, String testRunName, Float successRatio, + Integer priority, Long projectId, Long duration, APITestRunConfig.Scheduler scheduler, Long frameworkId, + String frameworkName) { this(id, createTime, startTime, endTime, state, startedById, userName, projectName, testRunName, successRatio, priority, projectId, duration, frameworkId, frameworkName); - this.appCrawlerRun = appCrawlerRun; this.scheduler = scheduler; } @@ -128,14 +125,6 @@ public void setCreateTime(Date createTime) { this.createTime = createTime; } - public Boolean getAppCrawlerRun() { - return appCrawlerRun; - } - - public void setAppCrawlerRun(Boolean appCrawlerRun) { - this.appCrawlerRun = appCrawlerRun; - } - public String getUserName() { return userName; } @@ -228,7 +217,6 @@ protected void clone(T from) { this.state = apiAdminTestRun.state; this.projectName = apiAdminTestRun.projectName; this.testRunName = apiAdminTestRun.testRunName; - this.appCrawlerRun = apiAdminTestRun.appCrawlerRun; this.successRatio = apiAdminTestRun.successRatio; this.priority = apiAdminTestRun.priority; this.projectId = apiAdminTestRun.projectId; diff --git a/src/main/java/com/testdroid/api/model/APIFramework.java b/src/main/java/com/testdroid/api/model/APIFramework.java index f8137b61..393faa6e 100644 --- a/src/main/java/com/testdroid/api/model/APIFramework.java +++ b/src/main/java/com/testdroid/api/model/APIFramework.java @@ -15,7 +15,7 @@ public class APIFramework extends APIEntity { @XmlType(namespace = "APIFramework") public enum Type { - APP_CRAWLER, + @Deprecated APP_CRAWLER, CLIENT_SIDE, MANUAL, REMOTE diff --git a/src/main/java/com/testdroid/api/model/APITestRunConfig.java b/src/main/java/com/testdroid/api/model/APITestRunConfig.java index b2610c04..10804fde 100644 --- a/src/main/java/com/testdroid/api/model/APITestRunConfig.java +++ b/src/main/java/com/testdroid/api/model/APITestRunConfig.java @@ -37,8 +37,6 @@ public enum Scheduler { ALL_INSTANCES } - private boolean appCrawlerRun; - private String appiumBrokerAddress; private String appiumBrokerQueueName; @@ -151,14 +149,6 @@ public void setScheduler(Scheduler scheduler) { this.scheduler = scheduler; } - public boolean isAppCrawlerRun() { - return appCrawlerRun; - } - - public void setAppCrawlerRun(boolean appCrawlerRun) { - this.appCrawlerRun = appCrawlerRun; - } - public LimitationType getLimitationType() { return limitationType; } @@ -524,7 +514,6 @@ public void setTunnelSettings(APITunnelSettings tunnelSettings) { protected void clone(T from) { APITestRunConfig apiTestRunConfig = (APITestRunConfig) from; cloneBase(from); - this.appCrawlerRun = apiTestRunConfig.appCrawlerRun; this.appiumBrokerAddress = apiTestRunConfig.appiumBrokerAddress; this.appiumBrokerQueueName = apiTestRunConfig.appiumBrokerQueueName; this.applicationPassword = apiTestRunConfig.applicationPassword; diff --git a/src/main/java/com/testdroid/api/model/notification/APINotificationPlan.java b/src/main/java/com/testdroid/api/model/notification/APINotificationPlan.java deleted file mode 100644 index 8faa6d16..00000000 --- a/src/main/java/com/testdroid/api/model/notification/APINotificationPlan.java +++ /dev/null @@ -1,153 +0,0 @@ -package com.testdroid.api.model.notification; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.testdroid.api.APIEntity; -import com.testdroid.api.util.TimeConverter; - -import java.time.LocalDateTime; -import java.util.Date; - -/** - * @author Damian Sniezek - */ -@JsonInclude(JsonInclude.Include.NON_NULL) -public class APINotificationPlan extends APIEntity { - - private String name; - - private Long handlerId; - - private String handlerEmail; - - private String contentTemplate; - - private String subjectTemplate; - - private Date createTime; - - private Date updateTime; - - private Date sentTime; - - private APINotificationChannel channel; - - private APINotificationScope scope; - - public APINotificationPlan() { - - } - - public APINotificationPlan( - Long id, String name, Long handlerId, String handlerEmail, String contentTemplate, String subjectTemplate, - LocalDateTime createTime, LocalDateTime updateTime, LocalDateTime sentTime, - APINotificationChannel channel, APINotificationScope scope) { - super(id); - this.name = name; - this.handlerId = handlerId; - this.handlerEmail = handlerEmail; - this.contentTemplate = contentTemplate; - this.subjectTemplate = subjectTemplate; - this.createTime = TimeConverter.toDate(createTime); - this.updateTime = TimeConverter.toDate(updateTime); - this.sentTime = TimeConverter.toDate(sentTime); - this.channel = channel; - this.scope = scope; - } - - public Long getHandlerId() { - return handlerId; - } - - public void setHandlerId(Long handlerId) { - this.handlerId = handlerId; - } - - public String getHandlerEmail() { - return handlerEmail; - } - - public void setHandlerEmail(String handlerEmail) { - this.handlerEmail = handlerEmail; - } - - public String getContentTemplate() { - return contentTemplate; - } - - public void setContentTemplate(String contentTemplate) { - this.contentTemplate = contentTemplate; - } - - public String getSubjectTemplate() { - return subjectTemplate; - } - - public void setSubjectTemplate(String subjectTemplate) { - this.subjectTemplate = subjectTemplate; - } - - public Date getCreateTime() { - return createTime; - } - - public void setCreateTime(Date createTime) { - this.createTime = createTime; - } - - public Date getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Date updateTime) { - this.updateTime = updateTime; - } - - public Date getSentTime() { - return sentTime; - } - - public void setSentTime(Date sentTime) { - this.sentTime = sentTime; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public APINotificationChannel getChannel() { - return channel; - } - - public void setChannel(APINotificationChannel channel) { - this.channel = channel; - } - - public APINotificationScope getScope() { - return scope; - } - - public void setScope(APINotificationScope scope) { - this.scope = scope; - } - - @Override - protected void clone(T from) { - APINotificationPlan notificationPlan = (APINotificationPlan) from; - cloneBase(from); - this.name = notificationPlan.name; - this.handlerId = notificationPlan.handlerId; - this.handlerEmail = notificationPlan.handlerEmail; - this.contentTemplate = notificationPlan.contentTemplate; - this.subjectTemplate = notificationPlan.subjectTemplate; - this.createTime = notificationPlan.createTime; - this.updateTime = notificationPlan.updateTime; - this.sentTime = notificationPlan.sentTime; - this.channel = notificationPlan.channel; - this.scope = notificationPlan.scope; - } - -} diff --git a/src/main/java/com/testdroid/api/util/TimeConverter.java b/src/main/java/com/testdroid/api/util/TimeConverter.java index 34899a91..a09141ba 100644 --- a/src/main/java/com/testdroid/api/util/TimeConverter.java +++ b/src/main/java/com/testdroid/api/util/TimeConverter.java @@ -54,6 +54,10 @@ public static Date toDate(LocalDateTime localDateTime) { return localDateTime == null ? null : Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant()); } + public static long toTimestamp(LocalDateTime localDateTime) { + return localDateTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli() / 1000L; + } + public static long toMilli(LocalDateTime localDateTime) { return localDateTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli(); } diff --git a/src/main/java/com/testdroid/api/util/TypeReferenceFactory.java b/src/main/java/com/testdroid/api/util/TypeReferenceFactory.java index 0c0579ca..e61ad276 100644 --- a/src/main/java/com/testdroid/api/util/TypeReferenceFactory.java +++ b/src/main/java/com/testdroid/api/util/TypeReferenceFactory.java @@ -8,7 +8,6 @@ import com.testdroid.api.model.devicetime.APIDeviceTimeCountSessionReportEntry; import com.testdroid.api.model.devicetime.APIDeviceTimeStepTimeReportEntry; import com.testdroid.api.model.notification.APINotification; -import com.testdroid.api.model.notification.APINotificationPlan; import java.util.HashMap; import java.util.Map; @@ -61,7 +60,6 @@ public class TypeReferenceFactory { LIST_MAP.put(APILabelGroup.class, new TypeReference>() {}); LIST_MAP.put(APILicense.class, new TypeReference>() {}); LIST_MAP.put(APINotification.class, new TypeReference>() {}); - LIST_MAP.put(APINotificationPlan.class, new TypeReference>() {}); LIST_MAP.put(APIProject.class, new TypeReference>() {}); LIST_MAP.put(APIProjectJobConfig.class, new TypeReference>() {}); LIST_MAP.put(APIProperty.class, new TypeReference>() {}); @@ -134,7 +132,6 @@ public class TypeReferenceFactory { MAP.put(APIMaintenance.class, new TypeReference() {}); MAP.put(APIMessage.class, new TypeReference() {}); MAP.put(APINotification.class, new TypeReference() {}); - MAP.put(APINotificationPlan.class, new TypeReference() {}); MAP.put(APIProject.class, new TypeReference() {}); MAP.put(APIProjectJobConfig.class, new TypeReference() {}); MAP.put(APIProperty.class, new TypeReference() {});