Search in sources :

Example 16 with LocalTaskImpl

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();
}
Also used : OpenTaskDialog(com.intellij.tasks.actions.OpenTaskDialog) LocalTaskImpl(com.intellij.tasks.impl.LocalTaskImpl) BranchInfo(com.intellij.tasks.BranchInfo)

Example 17 with LocalTaskImpl

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);
}
Also used : LocalTaskImpl(com.intellij.tasks.impl.LocalTaskImpl)

Example 18 with LocalTaskImpl

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);
}
Also used : LocalTaskImpl(com.intellij.tasks.impl.LocalTaskImpl) GitlabProject(com.intellij.tasks.gitlab.model.GitlabProject) GitlabTask(com.intellij.tasks.gitlab.GitlabTask) GitlabIssue(com.intellij.tasks.gitlab.model.GitlabIssue)

Example 19 with LocalTaskImpl

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);
}
Also used : LocalTaskImpl(com.intellij.tasks.impl.LocalTaskImpl) LookupElement(com.intellij.codeInsight.lookup.LookupElement)

Example 20 with LocalTaskImpl

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());
}
Also used : LocalTaskImpl(com.intellij.tasks.impl.LocalTaskImpl) Element(org.jdom.Element) TaskManagerImpl(com.intellij.tasks.impl.TaskManagerImpl)

Aggregations

LocalTaskImpl (com.intellij.tasks.impl.LocalTaskImpl)20 LocalTask (com.intellij.tasks.LocalTask)5 Repository (com.intellij.dvcs.repo.Repository)4 BranchInfo (com.intellij.tasks.BranchInfo)2 Gson (com.google.gson.Gson)1 JsonArray (com.google.gson.JsonArray)1 JsonObject (com.google.gson.JsonObject)1 LookupElement (com.intellij.codeInsight.lookup.LookupElement)1 Project (com.intellij.openapi.project.Project)1 Ref (com.intellij.openapi.util.Ref)1 Task (com.intellij.tasks.Task)1 TaskManager (com.intellij.tasks.TaskManager)1 OpenTaskDialog (com.intellij.tasks.actions.OpenTaskDialog)1 GitlabTask (com.intellij.tasks.gitlab.GitlabTask)1 GitlabIssue (com.intellij.tasks.gitlab.model.GitlabIssue)1 GitlabProject (com.intellij.tasks.gitlab.model.GitlabProject)1 TaskManagerImpl (com.intellij.tasks.impl.TaskManagerImpl)1 SimpleActionGroup (com.intellij.tools.SimpleActionGroup)1 HttpClient (org.apache.commons.httpclient.HttpClient)1 GetMethod (org.apache.commons.httpclient.methods.GetMethod)1