Search in sources :

Example 1 with MantisProject

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

the class MantisIntegrationTest method testMantis12.

public void testMantis12() throws Exception {
    assertTrue(myRepository.getProjects().size() >= 2);
    final MantisProject mantisProject = myRepository.getProjects().get(1);
    assertEquals(mantisProject.getName(), "Mantis 1.2 project 1");
    myRepository.setCurrentProject(mantisProject);
    assertTrue(mantisProject.getFilters().size() >= 2);
    MantisFilter mantisFilter = null;
    for (MantisFilter filter : mantisProject.getFilters()) {
        if (filter.getName().equals("Mantis 1.2 Filter 1")) {
            mantisFilter = filter;
        }
    }
    assertNotNull(mantisFilter);
    myRepository.setCurrentFilter(mantisFilter);
    final Task[] issues = myRepository.getIssues("", 0, 1, true, new EmptyProgressIndicator());
    assertTrue(issues.length >= 1);
    final Task task = issues[0];
    assertEquals("1", task.getId());
    // not available here, but is defined in practice, after task has been activated and thus updated from server
    //assertEquals("Mantis 1.2 project 1", task.getProject());
    assertEquals("1", task.getNumber());
    assertEquals("M12P1I1", task.getSummary());
    final Task task1 = myRepository.findTask("1");
    assertNotNull(task1);
    assertEquals("1", task1.getId());
    assertEquals("Mantis 1.2 project 1", task1.getProject());
    assertEquals("1", task1.getNumber());
    assertEquals("M12P1I1", task1.getSummary());
    assertEquals(".", task1.getDescription());
    HttpClient client = new HttpClient();
    final GetMethod method = new GetMethod(task1.getIssueUrl());
    client.executeMethod(method);
    assertEquals(method.getStatusCode(), 200);
}
Also used : MantisFilter(com.intellij.tasks.mantis.MantisFilter) Task(com.intellij.tasks.Task) MantisProject(com.intellij.tasks.mantis.MantisProject) EmptyProgressIndicator(com.intellij.openapi.progress.EmptyProgressIndicator) HttpClient(org.apache.commons.httpclient.HttpClient) GetMethod(org.apache.commons.httpclient.methods.GetMethod)

Aggregations

EmptyProgressIndicator (com.intellij.openapi.progress.EmptyProgressIndicator)1 Task (com.intellij.tasks.Task)1 MantisFilter (com.intellij.tasks.mantis.MantisFilter)1 MantisProject (com.intellij.tasks.mantis.MantisProject)1 HttpClient (org.apache.commons.httpclient.HttpClient)1 GetMethod (org.apache.commons.httpclient.methods.GetMethod)1