From 38b0bb031a50147f95b8cc483d007112972622c8 Mon Sep 17 00:00:00 2001 From: siarhei_hrabko Date: Wed, 3 Apr 2024 12:17:04 +0300 Subject: [PATCH 1/2] EPMRPP-90180 update dependencies (Instant time) --- build.gradle | 4 ++-- .../com/epam/reportportal/extension/azure/AzureExtension.java | 4 +++- .../azure/event/handler/plugin/PluginLoadedEventHandler.java | 3 ++- .../epam/reportportal/extension/azure/AzureExtensionTest.java | 3 ++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 4282594..308475c 100644 --- a/build.gradle +++ b/build.gradle @@ -35,8 +35,8 @@ dependencies { implementation 'com.epam.reportportal:plugin-api' annotationProcessor 'com.epam.reportportal:plugin-api' } else { - implementation 'com.github.reportportal:plugin-api:cc3c5c8e' - annotationProcessor 'com.github.reportportal:plugin-api:cc3c5c8e' + implementation 'com.github.reportportal:plugin-api:eec4267' + annotationProcessor 'com.github.reportportal:plugin-api:eec4267' } compile 'com.squareup.okhttp:okhttp:2.7.5' diff --git a/src/main/java/com/epam/reportportal/extension/azure/AzureExtension.java b/src/main/java/com/epam/reportportal/extension/azure/AzureExtension.java index 7cc6b5e..9d850ab 100644 --- a/src/main/java/com/epam/reportportal/extension/azure/AzureExtension.java +++ b/src/main/java/com/epam/reportportal/extension/azure/AzureExtension.java @@ -63,6 +63,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.time.ZoneOffset; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Collections; @@ -751,7 +752,8 @@ private List uploadAttachmentToAzure(PostTicketRQ ticketRQ) { private String getFormattedMessage(Log log) { StringBuilder messageBuilder = new StringBuilder(); ofNullable(log.getLogTime()).ifPresent(logTime -> messageBuilder.append("Time: ") - .append(logTime.format(DateTimeFormatter.ofPattern("MM/dd/yyyy HH:mm:ss"))).append(", ")); + .append(logTime.atOffset(ZoneOffset.UTC).toLocalDateTime() + .format(DateTimeFormatter.ofPattern("MM/dd/yyyy HH:mm:ss"))).append(", ")); ofNullable(log.getLogLevel()).ifPresent( logLevel -> messageBuilder.append("Level: ").append(logLevel).append(", ")); messageBuilder.append("
").append("Log: ").append(log.getLogMessage()); diff --git a/src/main/java/com/epam/reportportal/extension/azure/event/handler/plugin/PluginLoadedEventHandler.java b/src/main/java/com/epam/reportportal/extension/azure/event/handler/plugin/PluginLoadedEventHandler.java index 62eb83f..8018546 100644 --- a/src/main/java/com/epam/reportportal/extension/azure/event/handler/plugin/PluginLoadedEventHandler.java +++ b/src/main/java/com/epam/reportportal/extension/azure/event/handler/plugin/PluginLoadedEventHandler.java @@ -9,6 +9,7 @@ import com.epam.ta.reportportal.entity.integration.IntegrationParams; import com.epam.ta.reportportal.entity.integration.IntegrationType; +import java.time.Instant; import java.time.LocalDateTime; import java.util.HashMap; import java.util.List; @@ -43,7 +44,7 @@ private void createIntegration(String name, IntegrationType integrationType) { Integration integration = new Integration(); integration.setName(name); integration.setType(integrationType); - integration.setCreationDate(LocalDateTime.now()); + integration.setCreationDate(Instant.now()); integration.setEnabled(true); integration.setCreator("SYSTEM"); integration.setParams(new IntegrationParams(new HashMap<>())); diff --git a/src/test/java/com/epam/reportportal/extension/azure/AzureExtensionTest.java b/src/test/java/com/epam/reportportal/extension/azure/AzureExtensionTest.java index bcee68b..d97b46c 100644 --- a/src/test/java/com/epam/reportportal/extension/azure/AzureExtensionTest.java +++ b/src/test/java/com/epam/reportportal/extension/azure/AzureExtensionTest.java @@ -20,6 +20,7 @@ import com.epam.ta.reportportal.ws.model.externalsystem.PostFormField; import com.epam.ta.reportportal.ws.model.externalsystem.PostTicketRQ; import com.epam.ta.reportportal.ws.model.externalsystem.Ticket; +import java.time.Instant; import org.jasypt.util.text.BasicTextEncryptor; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -99,7 +100,7 @@ public void init(){ params.put("oauthAccessKey", "token"); IntegrationParams integrationParams = new IntegrationParams(params); integration = new Integration(1L, new Project(1L, "ProjectName"), new IntegrationType(), - integrationParams, LocalDateTime.now()); + integrationParams, Instant.now()); workItem = new WorkItem(); workItem.setId(23); workItem.setUrl("https://dev.azure.com/some/some/_workitems/edit/23"); From 199be01aa96f1e67012a93d693664766705643ed Mon Sep 17 00:00:00 2001 From: siarhei_hrabko Date: Mon, 15 Apr 2024 14:20:24 +0300 Subject: [PATCH 2/2] EPMRPP-90180 update dependencies (Instant time) --- build.gradle | 9 +++-- .../extension/azure/AzureExtensionTest.java | 40 ++++++++++++++----- 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/build.gradle b/build.gradle index 0c267bd..fb7b0e0 100644 --- a/build.gradle +++ b/build.gradle @@ -36,10 +36,11 @@ dependencies { implementation 'com.epam.reportportal:plugin-api' annotationProcessor 'com.epam.reportportal:plugin-api' } else { - implementation 'com.github.reportportal:commons-dao:a0f2b0e' - implementation 'com.github.reportportal:plugin-api:4c94ca4' - annotationProcessor 'com.github.reportportal:plugin-api:4c94ca4' + implementation 'com.github.reportportal:commons-dao:0703b75' + implementation 'com.github.reportportal:plugin-api:3ecb915657' + annotationProcessor 'com.github.reportportal:plugin-api:3ecb915657' } + implementation 'org.hibernate:hibernate-core:5.6.15.Final' compile 'com.squareup.okhttp:okhttp:2.7.5' compile 'com.squareup.okhttp:logging-interceptor:2.7.5' @@ -51,7 +52,7 @@ dependencies { implementation group: 'org.glassfish', name: 'javax.el', version: '3.0.0' implementation group: 'javax.el', name: 'javax.el-api', version: '3.0.0' implementation group: 'org.jooq', name: 'jooq', version: '3.14.4' - jooqRuntime 'org.postgresql:postgresql:42.2.13' + jooqRuntime 'org.postgresql:postgresql:42.7.3' testImplementation 'org.junit.jupiter:junit-jupiter:5.6.0' testImplementation 'org.mockito:mockito-junit-jupiter:3.12.4' diff --git a/src/test/java/com/epam/reportportal/extension/azure/AzureExtensionTest.java b/src/test/java/com/epam/reportportal/extension/azure/AzureExtensionTest.java index f30d942..53e891b 100644 --- a/src/test/java/com/epam/reportportal/extension/azure/AzureExtensionTest.java +++ b/src/test/java/com/epam/reportportal/extension/azure/AzureExtensionTest.java @@ -1,17 +1,35 @@ package com.epam.reportportal.extension.azure; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.when; + import com.epam.reportportal.extension.IntegrationGroupEnum; import com.epam.reportportal.extension.PluginCommand; import com.epam.reportportal.extension.azure.command.connection.TestConnectionCommand; import com.epam.reportportal.extension.azure.rest.client.ApiException; -import com.epam.reportportal.extension.azure.rest.client.api.*; -import com.epam.reportportal.extension.azure.rest.client.model.workitem.*; +import com.epam.reportportal.extension.azure.rest.client.api.ClassificationNodesApi; +import com.epam.reportportal.extension.azure.rest.client.api.FieldsApi; +import com.epam.reportportal.extension.azure.rest.client.api.WorkItemTypesApi; +import com.epam.reportportal.extension.azure.rest.client.api.WorkItemTypesFieldApi; +import com.epam.reportportal.extension.azure.rest.client.api.WorkItemsApi; +import com.epam.reportportal.extension.azure.rest.client.model.workitem.WorkItem; +import com.epam.reportportal.extension.azure.rest.client.model.workitem.WorkItemClassificationNode; +import com.epam.reportportal.extension.azure.rest.client.model.workitem.WorkItemField; +import com.epam.reportportal.extension.azure.rest.client.model.workitem.WorkItemType; +import com.epam.reportportal.extension.azure.rest.client.model.workitem.WorkItemTypeFieldWithReferences; import com.epam.reportportal.model.externalsystem.AllowedValue; import com.epam.reportportal.model.externalsystem.PostFormField; import com.epam.reportportal.model.externalsystem.PostTicketRQ; import com.epam.reportportal.model.externalsystem.Ticket; import com.epam.ta.reportportal.binary.impl.AttachmentDataStoreService; -import com.epam.ta.reportportal.dao.*; +import com.epam.ta.reportportal.dao.IntegrationRepository; +import com.epam.ta.reportportal.dao.IntegrationTypeRepository; +import com.epam.ta.reportportal.dao.LaunchRepository; +import com.epam.ta.reportportal.dao.LogRepository; +import com.epam.ta.reportportal.dao.TestItemRepository; import com.epam.ta.reportportal.entity.integration.Integration; import com.epam.ta.reportportal.entity.integration.IntegrationParams; import com.epam.ta.reportportal.entity.integration.IntegrationType; @@ -20,6 +38,14 @@ import com.epam.ta.reportportal.entity.item.issue.IssueEntity; import com.epam.ta.reportportal.entity.project.Project; import com.epam.ta.reportportal.filesystem.DataEncoder; +import java.time.Instant; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import javax.sql.DataSource; import org.jasypt.util.text.BasicTextEncryptor; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -29,14 +55,6 @@ import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.context.ApplicationContext; -import javax.sql.DataSource; -import java.time.LocalDateTime; -import java.util.*; - -import static org.junit.jupiter.api.Assertions.*; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.when; - @ExtendWith(MockitoExtension.class) class AzureExtensionTest {