Skip to content

Commit

Permalink
EPMRPP-88602 Prepare models for supporting microsecons/nanosecond for…
Browse files Browse the repository at this point in the history
…mat (#2) (#4)

* EPMRPP-88602 || Migrate dates to Instant type || Implement date deserializer || Introduce junit 5 || Add lombok suppoprt

---------

Co-authored-by: Pavel Bortnik <[email protected]>
Co-authored-by: PeeAyBee <[email protected]>
(cherry picked from commit b5769dc)
  • Loading branch information
grabsefx authored Apr 15, 2024
1 parent 24941f3 commit d99e842
Show file tree
Hide file tree
Showing 12 changed files with 264 additions and 946 deletions.
14 changes: 12 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,28 @@ dependencies {
implementation "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}"
implementation "javax.validation:validation-api:${validationApiVersion}"
implementation "org.apache.commons:commons-lang3:${commonsLangVersion}"
implementation group: 'com.google.guava', name: 'guava', version: '28.2-jre'

testImplementation "junit:junit:${junitVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-api:${jupiterVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-params:${jupiterVersion}"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${jupiterVersion}"
testImplementation "org.mockito:mockito-junit-jupiter:${mockitoJunitJupiter}"
testImplementation "org.hibernate.validator:hibernate-validator:${hibernateValidatorVersion}"
testImplementation "javax.el:javax.el-api:${elApiVersion}"
testImplementation "org.glassfish:javax.el:${elApiVersion}"

// add lombok support
compileOnly "org.projectlombok:lombok:${lombokVersion}"
annotationProcessor "org.projectlombok:lombok:${lombokVersion}"
testCompileOnly "org.projectlombok:lombok:${lombokVersion}"
testAnnotationProcessor "org.projectlombok:lombok:${lombokVersion}"
}

dependencyCheck {
formats = [ReportGenerator.Format.HTML, ReportGenerator.Format.XML]
}
}


test {
useJUnitPlatform()
}
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ description=EPAM Report portal. REST Reporting API model
hibernateValidatorVersion=6.1.2.Final
validationApiVersion=2.0.1.Final
junitVersion=4.12
jupiterVersion=5.8.1
elApiVersion=3.0.0
sprindocAnnotationsVersion=1.7.0
commonsLangVersion=3.9
mockitoJunitJupiter=2.23.0
mockitoJunitJupiter=3.4.6
jacksonVersion=2.10.2
lombokVersion=1.18.30
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,40 @@
import static com.epam.ta.reportportal.ws.reporting.ValidationConstraints.MAX_PARAMETERS_LENGTH;

import com.epam.ta.reportportal.ws.annotations.In;
import com.epam.ta.reportportal.ws.reporting.databind.MultiFormatDateDeserializer;
import com.fasterxml.jackson.annotation.JsonAlias;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
import java.util.Date;
import java.time.Instant;
import java.util.Set;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
* Finishes some entity execution in Report Portal<br> May be Launch, TestSuite, Test, TestStep
*
* @author Andrei Varabyeu
*/
@JsonInclude(Include.NON_NULL)
@Getter
@Setter
@ToString
public class FinishExecutionRQ {

@NotNull
@JsonProperty(value = "endTime", required = true)
@JsonAlias({"endTime", "end_time"})
@Schema(requiredMode = RequiredMode.REQUIRED)
private Date endTime;
@JsonDeserialize(using = MultiFormatDateDeserializer.class)
private Instant endTime;

@JsonProperty(value = "status")
@In(allowedValues = {"passed", "failed", "stopped", "skipped", "interrupted", "cancelled", "info",
Expand All @@ -60,44 +69,4 @@ public class FinishExecutionRQ {
@JsonAlias({"attributes", "tags"})
private Set<ItemAttributesRQ> attributes;

public String getDescription() {
return description;
}

public void setDescription(String description) {
this.description = description;
}

public Set<ItemAttributesRQ> getAttributes() {
return attributes;
}

public void setAttributes(Set<ItemAttributesRQ> attributes) {
this.attributes = attributes;
}

public Date getEndTime() {
return endTime;
}

public void setEndTime(Date endTime) {
this.endTime = endTime;
}

public String getStatus() {
return status;
}

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

@Override
public String toString() {
return "FinishExecutionRQ{" + "endTime=" + endTime
+ ", status='" + status + '\''
+ ", description='" + description + '\''
+ ", attributes=" + attributes
+ '}';
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,14 @@
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
import javax.validation.Valid;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

@JsonInclude(Include.NON_NULL)
@Getter
@Setter
@ToString
public class FinishTestItemRQ extends FinishExecutionRQ {

@Valid
Expand All @@ -43,53 +49,4 @@ public class FinishTestItemRQ extends FinishExecutionRQ {
@JsonProperty(value = "retryOf")
private String retryOf;

public Boolean isRetry() {
return retry;
}

public void setRetry(Boolean retry) {
this.retry = retry;
}

public Issue getIssue() {
return issue;
}

public void setIssue(Issue issue) {
this.issue = issue;
}

public String getLaunchUuid() {
return launchUuid;
}

public void setLaunchUuid(String launchUuid) {
this.launchUuid = launchUuid;
}

public String getTestCaseId() {
return testCaseId;
}

public void setTestCaseId(String testCaseId) {
this.testCaseId = testCaseId;
}

public String getRetryOf() {
return retryOf;
}

public void setRetryOf(String retryOf) {
this.retryOf = retryOf;
}

@Override
public String toString() {
return "FinishTestItemRQ{" + "issue=" + issue
+ ", retry=" + retry
+ ", launchUuid='" + launchUuid + '\''
+ ", testCaseId='" + testCaseId + '\''
+ ", retryOf='" + retryOf + '\''
+ '}';
}
}
}
147 changes: 18 additions & 129 deletions src/main/java/com/epam/ta/reportportal/ws/reporting/Issue.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,32 @@

package com.epam.ta.reportportal.ws.reporting;

import com.epam.ta.reportportal.ws.reporting.databind.MultiFormatDateDeserializer;
import com.fasterxml.jackson.annotation.JsonAlias;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.time.Instant;
import java.util.Set;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;

/**
* Test item issue
*
* @author Dzianis Shlychkou
*/
@JsonInclude(Include.NON_NULL)
@Data
@NoArgsConstructor
public class Issue {

@NotBlank
Expand All @@ -55,14 +65,19 @@ public class Issue {
private Set<ExternalSystemIssue> externalSystemIssues;

@JsonInclude(Include.NON_NULL)
@Getter
@Setter
@EqualsAndHashCode
@ToString
public static class ExternalSystemIssue {

@NotBlank
@JsonProperty(value = "ticketId")
private String ticketId;

@JsonProperty(value = "submitDate")
private Long submitDate;
@JsonDeserialize(using = MultiFormatDateDeserializer.class)
private Instant submitDate;

@NotBlank
@JsonProperty(value = "btsUrl")
Expand All @@ -79,132 +94,6 @@ public static class ExternalSystemIssue {
@JsonProperty(value = "pluginName")
private String pluginName;

public void setTicketId(String ticketId) {
this.ticketId = ticketId;
}

public String getTicketId() {
return ticketId;
}

public Long getSubmitDate() {
return submitDate;
}

public void setSubmitDate(Long submitDate) {
this.submitDate = submitDate;
}

public String getBtsUrl() {
return btsUrl;
}

public void setBtsUrl(String btsUrl) {
this.btsUrl = btsUrl;
}

public String getBtsProject() {
return btsProject;
}

public void setBtsProject(String btsProject) {
this.btsProject = btsProject;
}

public void setUrl(String value) {
this.url = value;
}

public String getUrl() {
return url;
}

public String getPluginName() {
return pluginName;
}

public void setPluginName(String pluginName) {
this.pluginName = pluginName;
}

@Override
public String toString() {
return "ExternalSystemIssue{" + "ticketId='" + ticketId + '\'' + ", submitDate=" + submitDate
+ ", btsUrl='" + btsUrl + '\''
+ ", btsProject='" + btsProject + '\'' + ", url='" + url + '\'' + ", pluginName='"
+ pluginName + '\'' + '}';
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ExternalSystemIssue that = (ExternalSystemIssue) o;
return Objects.equals(ticketId, that.ticketId) && Objects.equals(submitDate, that.submitDate)
&& Objects.equals(btsUrl,
that.btsUrl
) && Objects.equals(btsProject, that.btsProject) && Objects.equals(url, that.url)
&& Objects.equals(pluginName,
that.pluginName
);
}

@Override
public int hashCode() {
return Objects.hash(ticketId, submitDate, btsUrl, btsProject, url, pluginName);
}
}

public void setExternalSystemIssues(Set<ExternalSystemIssue> externalSystemIssues) {
this.externalSystemIssues = externalSystemIssues;
}

public Set<ExternalSystemIssue> getExternalSystemIssues() {
return externalSystemIssues;
}

public String getIssueType() {
return issueType;
}

public void setIssueType(String issueType) {
this.issueType = issueType;
}

public String getComment() {
return comment;
}

public void setComment(String comment) {
this.comment = comment;
}

public boolean getAutoAnalyzed() {
return autoAnalyzed;
}

public void setAutoAnalyzed(boolean autoAnalyzed) {
this.autoAnalyzed = autoAnalyzed;
}

public boolean getIgnoreAnalyzer() {
return ignoreAnalyzer;
}

public void setIgnoreAnalyzer(boolean ignoreAnalyzer) {
this.ignoreAnalyzer = ignoreAnalyzer;
}

@Override
public String toString() {
return "Issue{" + "issueType='" + issueType + '\''
+ ", comment='" + comment + '\''
+ ", autoAnalyzed='" + autoAnalyzed + "'"
+ ", externalSystemIssues=" + externalSystemIssues
+ '}';
}
}
}
Loading

0 comments on commit d99e842

Please sign in to comment.