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 159cf68..02b168b 100644 --- a/src/main/java/com/epam/reportportal/extension/azure/AzureExtension.java +++ b/src/main/java/com/epam/reportportal/extension/azure/AzureExtension.java @@ -121,7 +121,7 @@ public class AzureExtension implements ReportPortalExtensionPoint, DisposableBea private static final String PLUGIN_ID = "Azure DevOps"; - private static final String API_VERSION = "6.0"; + private static final String API_VERSION = "5.1"; private static final String EXPAND = "All"; diff --git a/src/main/java/com/epam/reportportal/extension/azure/command/connection/TestConnectionCommand.java b/src/main/java/com/epam/reportportal/extension/azure/command/connection/TestConnectionCommand.java index 659c882..5255a67 100644 --- a/src/main/java/com/epam/reportportal/extension/azure/command/connection/TestConnectionCommand.java +++ b/src/main/java/com/epam/reportportal/extension/azure/command/connection/TestConnectionCommand.java @@ -20,12 +20,15 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.net.MalformedURLException; +import java.net.URL; + public class TestConnectionCommand implements PluginCommand { private final BasicTextEncryptor basicTextEncryptor; private static final Logger LOGGER = LoggerFactory.getLogger(TestConnectionCommand.class); - private static final String API_VERSION = "6.0"; + private static final String API_VERSION = "5.1"; public TestConnectionCommand(BasicTextEncryptor basicTextEncryptor) { this.basicTextEncryptor = basicTextEncryptor; @@ -36,7 +39,17 @@ public Boolean executeCommand(Integration integration, Map param ApiClient defaultClient = Configuration.getDefaultApiClient(); String organizationUrl = params.get(URL).toString(); - String organizationName = organizationUrl.replace(defaultClient.getBasePath(), ""); + URL uriPath; + try { + uriPath = new URL(organizationUrl); + } catch (MalformedURLException e) { + LOGGER.error("Invalid Azure DevOps URL, " + e.getMessage(), e); + throw new ReportPortalException(UNABLE_INTERACT_WITH_INTEGRATION, + String.format("Invalid Azure DevOps URL. Message: %s", e.getMessage()), e); + } + String baseUri = uriPath.getProtocol() + "://" + uriPath.getHost(); + defaultClient.setBasePath(baseUri); + String organizationName = uriPath.getPath().replaceFirst("/", ""); String projectName = params.get(PROJECT).toString(); String personalAccessToken = basicTextEncryptor.decrypt( BtsConstants.OAUTH_ACCESS_KEY.getParam(integration.getParams(), String.class).orElseThrow( diff --git a/src/main/java/com/epam/reportportal/extension/azure/rest/client/JSON.java b/src/main/java/com/epam/reportportal/extension/azure/rest/client/JSON.java index a94d207..4dcd6e6 100644 --- a/src/main/java/com/epam/reportportal/extension/azure/rest/client/JSON.java +++ b/src/main/java/com/epam/reportportal/extension/azure/rest/client/JSON.java @@ -303,6 +303,8 @@ public OffsetDateTime read(JsonReader in) throws IOException { String date = in.nextString(); if (date.endsWith("+0000")) { date = date.substring(0, date.length()-5) + "Z"; + }else if(date.matches(".*:[0-9][0-9]$")) { + date = date + ".000Z"; } return OffsetDateTime.parse(date, formatter); }