use of com.intellij.tasks.impl.LocalTaskImpl in project intellij-community by JetBrains.
the class TaskBranchesTest method testOpenTaskDialog.
public void testOpenTaskDialog() throws Exception {
initRepository("foo");
String defaultBranchName = getDefaultBranchName();
LocalTaskImpl task = myTaskManager.createLocalTask("foo");
OpenTaskDialog dialog = new OpenTaskDialog(getProject(), task);
Disposer.register(getTestRootDisposable(), dialog.getDisposable());
try {
dialog.createTask();
assertEquals("foo", myTaskManager.getActiveTask().getSummary());
List<BranchInfo> branches = task.getBranches(true);
assertEquals(1, branches.size());
assertEquals(defaultBranchName, branches.get(0).name);
branches = task.getBranches(false);
assertEquals(1, branches.size());
assertEquals("foo", branches.get(0).name);
} finally {
dialog.close(DialogWrapper.OK_EXIT_CODE);
}
UIUtil.dispatchAllInvocationEvents();
}
use of com.intellij.tasks.impl.LocalTaskImpl in project intellij-community by JetBrains.
the class TaskVcsTest method testProjectWithDash.
public void testProjectWithDash() throws Exception {
LocalTaskImpl task = new LocalTaskImpl("foo-bar-001", "summary") {
@Override
public TaskRepository getRepository() {
return myRepository;
}
@Override
public boolean isIssue() {
return true;
}
};
assertEquals("foo-bar", task.getProject());
assertEquals("001", task.getNumber());
String name = myTaskManager.getChangelistName(task);
assertEquals("foo-bar-001 summary", name);
}
use of com.intellij.tasks.impl.LocalTaskImpl 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);
}
use of com.intellij.tasks.impl.LocalTaskImpl in project intellij-community by JetBrains.
the class TaskCompletionTest method testNumberCompletion.
public void testNumberCompletion() throws Exception {
configureFile("TEST-0<caret>");
configureRepository(new LocalTaskImpl("TEST-001", "Test task"), new LocalTaskImpl("TEST-002", "Test task 2"));
LookupElement[] elements = myFixture.complete(CompletionType.BASIC);
assertNotNull(elements);
assertEquals(2, elements.length);
}
use of com.intellij.tasks.impl.LocalTaskImpl in project intellij-community by JetBrains.
the class TaskManagerTest method testPreserveTaskUrl.
public void testPreserveTaskUrl() {
String url = "http://server/foo";
myTaskManager.addTask(new TaskTestUtil.TaskBuilder("foo", "summary", null).withIssueUrl(url));
Element element = XmlSerializer.serialize(myTaskManager.getState());
TaskManagerImpl.Config config = XmlSerializer.deserialize(element, TaskManagerImpl.Config.class);
LocalTaskImpl task = config.tasks.get(1);
assertEquals(url, task.getIssueUrl());
}
Aggregations