mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-04 23:39:07 +07:00
Add better diagnostic for an inaccessible JIRA server in tests
IJ-CR-19336 GitOrigin-RevId: 976790777fea33a20686f91077ed66b9e138fbe4
This commit is contained in:
committed by
intellij-monorepo-bot
parent
32f5abfd37
commit
b9b6d25edb
@@ -18,7 +18,9 @@ package com.intellij.tasks.integration;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.Couple;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.tasks.*;
|
||||
import com.intellij.tasks.config.TaskSettings;
|
||||
import com.intellij.tasks.impl.LocalTaskImpl;
|
||||
@@ -63,6 +65,8 @@ public class JiraIntegrationTest extends TaskManagerTestCase {
|
||||
*/
|
||||
@NonNls private static final String JIRA_5_TEST_SERVER_URL = "http://trackers-tests.labs.intellij.net:8015";
|
||||
|
||||
private static final Logger LOG = Logger.getInstance(JiraIntegrationTest.class);
|
||||
|
||||
private JiraRepository myRepository;
|
||||
|
||||
public void testGerman() throws Exception {
|
||||
@@ -262,12 +266,29 @@ public class JiraIntegrationTest extends TaskManagerTestCase {
|
||||
}
|
||||
|
||||
private void assumeServerAccessible(@NotNull String baseUrl) {
|
||||
GetMethod method = new GetMethod(baseUrl + "/rest/api/latest/serverInfo");
|
||||
boolean accessible = false;
|
||||
try {
|
||||
int statusCode = myRepository.getHttpClient().executeMethod(new GetMethod(baseUrl + "/rest/api/latest/serverInfo"));
|
||||
Assume.assumeTrue("Server '" + myRepository.getUrl() + "' is inaccessible", statusCode == 200);
|
||||
accessible = myRepository.getHttpClient().executeMethod(method) == 200;
|
||||
Assume.assumeTrue("Server '" + myRepository.getUrl() + "' is inaccessible", accessible);
|
||||
}
|
||||
catch (IOException e) {
|
||||
Assume.assumeNoException(e);
|
||||
}
|
||||
finally {
|
||||
if (!accessible) {
|
||||
try {
|
||||
LOG.warn(
|
||||
"Response from " + method.getURI() + ":\n" +
|
||||
method.getStatusCode() + " " + method.getStatusText() + "\n" +
|
||||
StringUtil.join(Arrays.asList(method.getResponseHeaders()), "") + "\n" +
|
||||
method.getResponseBodyAsString()
|
||||
);
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOG.warn("Failed to log response", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user