Search in sources :

Example 6 with CustomTaskState

use of com.intellij.tasks.CustomTaskState in project intellij-community by JetBrains.

the class YouTrackIntegrationTest method testCustomTaskStates.

public void testCustomTaskStates() throws Exception {
    final Task task = myRepository.findTask(REQUEST_WITH_CUSTOM_STATES_ID);
    assertNotNull(task);
    final Set<CustomTaskState> states = myRepository.getAvailableTaskStates(task);
    final List<String> stateNames = ContainerUtil.map(states, CustomTaskState::getPresentableName);
    assertContainsElements(stateNames, "North", "South");
    // IDEA-147006
    assertDoesntContain(stateNames, "Peru State College", "The Evergreen State College");
    // ? -> North
    myRepository.setTaskState(task, NORTH_STATE);
    Element element = myRepository.fetchRequestAsElement(REQUEST_WITH_CUSTOM_STATES_ID);
    assertEquals("North", element.getAttributeValue("state"));
    // North -> Submitted
    myRepository.setTaskState(task, SUBMITTED_STATE);
    element = myRepository.fetchRequestAsElement(REQUEST_WITH_CUSTOM_STATES_ID);
    assertEquals("Submitted", element.getAttributeValue("state"));
}
Also used : Task(com.intellij.tasks.Task) Element(org.jdom.Element) CustomTaskState(com.intellij.tasks.CustomTaskState)

Example 7 with CustomTaskState

use of com.intellij.tasks.CustomTaskState in project intellij-community by JetBrains.

the class TrelloIntegrationTest method testStateUpdates.

public void testStateUpdates() throws Exception {
    TrelloCard card = myRepository.fetchCardById(FEATURE_CARD_ID);
    assertNotNull(card);
    assertEquals(STATE_UPDATES_BOARD_ID, card.getIdBoard());
    assertEquals(BACKLOG_LIST_ID, card.getIdList());
    // Discover "In Progress" list
    TrelloTask task = new TrelloTask(card, myRepository);
    Set<CustomTaskState> states = myRepository.getAvailableTaskStates(task);
    assertEquals(1, states.size());
    final CustomTaskState inProgressState = states.iterator().next();
    assertEquals(IN_PROGRESS_LIST_ID, inProgressState.getId());
    assertEquals("In Progress", inProgressState.getPresentableName());
    // Backlog -> In Progress
    myRepository.setTaskState(task, inProgressState);
    card = myRepository.fetchCardById(FEATURE_CARD_ID);
    assertNotNull(card);
    assertEquals(STATE_UPDATES_BOARD_ID, card.getIdBoard());
    assertEquals(IN_PROGRESS_LIST_ID, card.getIdList());
    // Discover "Backlog" list
    task = new TrelloTask(card, myRepository);
    states = myRepository.getAvailableTaskStates(task);
    assertEquals(1, states.size());
    final CustomTaskState backlogState = states.iterator().next();
    assertEquals(BACKLOG_LIST_ID, backlogState.getId());
    assertEquals("Backlog", backlogState.getPresentableName());
    // In Progress -> Backlog
    myRepository.setTaskState(task, backlogState);
    card = myRepository.fetchCardById(FEATURE_CARD_ID);
    assertNotNull(card);
    assertEquals(STATE_UPDATES_BOARD_ID, card.getIdBoard());
    assertEquals(BACKLOG_LIST_ID, card.getIdList());
}
Also used : TrelloTask(com.intellij.tasks.trello.TrelloTask) CustomTaskState(com.intellij.tasks.CustomTaskState)

Aggregations

CustomTaskState (com.intellij.tasks.CustomTaskState)7 NotNull (org.jetbrains.annotations.NotNull)4 Task (com.intellij.tasks.Task)2 TaskRepository (com.intellij.tasks.TaskRepository)2 HashSet (java.util.HashSet)2 List (java.util.List)2 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 Project (com.intellij.openapi.project.Project)1 LocalTask (com.intellij.tasks.LocalTask)1 TaskManagerTestCase (com.intellij.tasks.TaskManagerTestCase)1 TaskState (com.intellij.tasks.TaskState)1 BugzillaRepository (com.intellij.tasks.bugzilla.BugzillaRepository)1 BugzillaRepositoryType (com.intellij.tasks.bugzilla.BugzillaRepositoryType)1 TaskManagerImpl (com.intellij.tasks.impl.TaskManagerImpl)1 TrelloTask (com.intellij.tasks.trello.TrelloTask)1 TrelloCard (com.intellij.tasks.trello.model.TrelloCard)1 TrelloList (com.intellij.tasks.trello.model.TrelloList)1 Function (com.intellij.util.Function)1 ContainerUtil (com.intellij.util.containers.ContainerUtil)1 Set (java.util.Set)1