Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for Azure Devops Server 2019 and Custom URLs #70

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Boolean> {

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;
Expand All @@ -36,7 +39,17 @@ public Boolean executeCommand(Integration integration, Map<String, Object> 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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down