use of com.intellij.tasks.gitlab.model.GitlabIssue in project intellij-community by JetBrains.
the class GitlabRepository method fetchIssue.
/**
* @param issueId global issue's ID (<tt>id</tt> field, not <tt>iid</tt>)
*/
@Nullable
public GitlabIssue fetchIssue(int projectId, int issueId) throws Exception {
ensureProjectsDiscovered();
final HttpGet request = new HttpGet(getRestApiUrl("projects", projectId, "issues", issueId));
final ResponseHandler<GitlabIssue> handler = new GsonSingleObjectDeserializer<>(GSON, GitlabIssue.class, true);
return getHttpClient().execute(request, handler);
}
use of com.intellij.tasks.gitlab.model.GitlabIssue in project intellij-community by JetBrains.
the class GitlabIntegrationTest method testPresentableId.
// IDEA-136499
public void testPresentableId() throws Exception {
final GitlabIssue issue = myRepository.fetchIssue(5, /* ID Formatting Tests */
10);
assertNotNull(issue);
assertEquals(10, issue.getId());
assertEquals(1, issue.getLocalId());
assertEquals(5, issue.getProjectId());
final GitlabTask task = new GitlabTask(myRepository, issue);
assertEquals("#1", task.getPresentableId());
assertEquals("1", task.getNumber());
assertEquals("ID Formatting Tests", task.getProject());
assertEquals("10", task.getId());
assertEquals("#1: First issue with iid = 1", task.toString());
myRepository.setShouldFormatCommitMessage(true);
assertEquals("#1 First issue with iid = 1", myRepository.getTaskComment(task));
}
use of com.intellij.tasks.gitlab.model.GitlabIssue in project intellij-community by JetBrains.
the class GitlabIntegrationTest method testCommitMessageFormat.
public void testCommitMessageFormat() throws Exception {
String issueJson = "{\n" + " \"id\": 1,\n" + " \"iid\": 2,\n" + " \"project_id\": 3,\n" + " \"title\": \"Sample title\",\n" + " \"state\": \"opened\",\n" + " \"updated_at\": \"2013-11-14T12:30:39Z\",\n" + " \"created_at\": \"2013-11-14T12:30:39Z\"\n" + "}";
String projectJson = "{\n" + " \"id\": 3,\n" + " \"name\": \"project-1\"\n" + "}";
GitlabIssue issue = GSON.fromJson(issueJson, GitlabIssue.class);
GitlabProject project = GSON.fromJson(projectJson, GitlabProject.class);
myRepository.setProjects(Collections.singletonList(project));
myRepository.setShouldFormatCommitMessage(true);
myRepository.setCommitMessageFormat("{project} {number} {id} {summary}");
LocalTaskImpl localTask = new LocalTaskImpl(new GitlabTask(myRepository, issue));
String changeListComment = TaskUtil.getChangeListComment(localTask);
assertEquals("project-1 2 #2 Sample title", changeListComment);
myRepository.setProjects(Collections.<GitlabProject>emptyList());
localTask = new LocalTaskImpl(new GitlabTask(myRepository, issue));
changeListComment = TaskUtil.getChangeListComment(localTask);
// Project is unknown, so "" is substituted instead
assertEquals(" 2 #2 Sample title", changeListComment);
}
Aggregations