use of org.apache.commons.httpclient.methods.GetMethod in project intellij-community by JetBrains.
the class YouTrackIntegrationTest method checkSpentTime.
private void checkSpentTime(@NotNull HttpClient client, @NotNull String issueId, @NotNull String expectedTime) throws IOException, JDOMException {
// Endpoint /rest/issue/BTYT4TT-8/timetracking/workitem/ doesn't work on this instance of YouTrack for some reason
final GetMethod method = new GetMethod(myRepository.getUrl() + "/rest/issue/" + issueId);
final int statusCode = client.executeMethod(method);
assertEquals(HttpStatus.SC_OK, statusCode);
final Element root = JDOMUtil.load(method.getResponseBodyAsStream());
for (Element field : root.getChildren("field")) {
if ("Spent time".equals(field.getAttributeValue("name"))) {
final Element value = field.getChild("value");
assertNotNull(value);
assertEquals(expectedTime, value.getText().trim());
return;
}
}
fail("Field 'Spent time' not found in issue " + issueId);
}
use of org.apache.commons.httpclient.methods.GetMethod in project intellij-community by JetBrains.
the class GenericRepository method getHttpMethod.
private HttpMethod getHttpMethod(String requestUrl, HTTPMethod type) {
HttpMethod method = type == HTTPMethod.GET ? new GetMethod(requestUrl) : GenericRepositoryUtil.getPostMethodFromURL(requestUrl);
configureHttpMethod(method);
return method;
}
use of org.apache.commons.httpclient.methods.GetMethod in project intellij-community by JetBrains.
the class JiraRestApi method findTasks.
@Override
@NotNull
public final List<Task> findTasks(@NotNull String jql, int max) throws Exception {
GetMethod method = getMultipleIssuesSearchMethod(jql, max);
String response = myRepository.executeMethod(method);
List<JiraIssue> issues = parseIssues(response);
return ContainerUtil.map(issues, issue -> new JiraRestTask(issue, myRepository));
}
use of org.apache.commons.httpclient.methods.GetMethod in project intellij-community by JetBrains.
the class JiraRestApi2 method getAvailableTaskStates.
@NotNull
@Override
public Set<CustomTaskState> getAvailableTaskStates(@NotNull Task task) throws Exception {
final GetMethod method = new GetMethod(myRepository.getRestUrl("issue", task.getId(), "transitions"));
method.setQueryString("expand=transitions.fields");
final String response = myRepository.executeMethod(method);
final JiraTransitionsWrapperApi2 wrapper = JiraRepository.GSON.fromJson(response, JiraTransitionsWrapperApi2.class);
return wrapper.getTransitions();
}
use of org.apache.commons.httpclient.methods.GetMethod in project intellij-community by JetBrains.
the class JiraRestApi2 method getMultipleIssuesSearchMethod.
@NotNull
@Override
protected GetMethod getMultipleIssuesSearchMethod(String jql, int max) {
GetMethod method = super.getMultipleIssuesSearchMethod(jql, max);
method.setQueryString(method.getQueryString() + "&fields=" + JiraIssueApi2.REQUIRED_RESPONSE_FIELDS);
return method;
}
Aggregations