コード例 #1
0
 public void testDeleteRepositoryTask() {
   String repositoryUrl = "http://somewhere.com";
   MockTask task = new MockTask(repositoryUrl, "1");
   taskList.addTask(task, taskList.getDefaultCategory());
   MockRepositoryQuery query = new MockRepositoryQuery("query");
   taskList.addQuery(query);
   taskList.addTask(task, query);
   assertEquals(1, taskList.getAllTasks().size());
   assertEquals(1, taskList.getDefaultCategory().getChildren().size());
   taskList.deleteTask(task);
   assertEquals(0, taskList.getAllTasks().size());
   assertEquals(0, taskList.getDefaultCategory().getChildren().size());
 }
コード例 #2
0
 public void testDeleteRootTask() {
   AbstractTask task = new LocalTask("1", "label");
   taskList.addTask(task);
   taskList.deleteTask(task);
   assertEquals(0, taskList.getAllTasks().size());
   assertEquals(0, taskList.getDefaultCategory().getChildren().size());
 }
コード例 #3
0
  public void testGetRepositoryTasks() {
    String repositoryUrl = "https://bugs.eclipse.org/bugs";
    String bugNumber = "106939";
    MockTask task1 = new MockTask(repositoryUrl, bugNumber);
    taskList.addTask(task1);
    MockTask task2 = new MockTask("https://unresolved", bugNumber);
    taskList.addTask(task2);

    assertEquals(2, taskList.getAllTasks().size());
    Set<ITask> tasksReturned = taskList.getTasks(repositoryUrl);
    assertNotNull(tasksReturned);
    assertEquals(1, tasksReturned.size());
    assertTrue(tasksReturned.contains(task1));
  }
コード例 #4
0
  public void testDeleteFromCategory() {
    assertEquals(0, taskList.getAllTasks().size());
    assertEquals(0, taskList.getDefaultCategory().getChildren().size());
    // assertEquals(0, taskList.getArchiveContainer().getChildren().size());
    assertEquals(1, taskList.getCategories().size());

    AbstractTask task = new LocalTask("1", "label");
    TaskCategory category = new TaskCategory("handleAndDescription");
    taskList.addTask(task);
    assertEquals(1, taskList.getDefaultCategory().getChildren().size());

    taskList.addCategory(category);
    taskList.addTask(task, category);
    assertEquals(2, taskList.getCategories().size());
    assertEquals(1, category.getChildren().size());
    assertEquals(0, taskList.getDefaultCategory().getChildren().size());
    assertEquals(1, taskList.getAllTasks().size());

    taskList.deleteTask(task);
    assertEquals(0, taskList.getAllTasks().size());
    assertEquals(0, taskList.getDefaultCategory().getChildren().size());
    assertEquals(0, category.getChildren().size());
  }
コード例 #5
0
  public void testLocalSubTaskAddCycle() {
    LocalTask task = new LocalTask("1", "summary");
    LocalTask subTask = new LocalTask("2", "subTask");

    taskList.addTask(task);
    taskList.addTask(subTask, task);
    taskList.addTask(task, subTask);

    assertEquals(2, taskList.getAllTasks().size());
    assertEquals(1, taskList.getCategories().size());
    assertEquals(1, taskList.getCategories().iterator().next().getChildren().size());
    assertEquals(1, task.getChildren().size());
    assertEquals(0, subTask.getChildren().size());
    assertEquals(subTask, task.getChildren().iterator().next());
  }
コード例 #6
0
  public void testLocalSubTaskAddDeepCycle() {
    LocalTask task = new LocalTask("1", "summary");
    LocalTask subTask1 = new LocalTask("2", "subTask");
    LocalTask subTask2 = new LocalTask("3", "subTask");
    LocalTask subTask3 = new LocalTask("4", "subTask");
    LocalTask subTask4 = new LocalTask("5", "subTask");
    LocalTask subTask5 = new LocalTask("6", "subTask");
    LocalTask subTask6 = new LocalTask("7", "subTask");
    LocalTask subTask7 = new LocalTask("8", "subTask");
    LocalTask subTask8 = new LocalTask("9", "subTask");
    LocalTask subTask9 = new LocalTask("10", "subTask");
    LocalTask subTask10 = new LocalTask("11", "subTask");

    taskList.addTask(task);
    taskList.addTask(subTask1, task);
    taskList.addTask(subTask2, subTask1);
    taskList.addTask(subTask3, subTask2);
    taskList.addTask(subTask4, subTask3);
    taskList.addTask(subTask5, subTask4);
    taskList.addTask(subTask6, subTask5);
    taskList.addTask(subTask7, subTask6);
    taskList.addTask(subTask8, subTask7);
    taskList.addTask(subTask9, subTask8);
    taskList.addTask(subTask10, subTask9);

    taskList.addTask(task, subTask10);

    assertEquals(11, taskList.getAllTasks().size());
    assertEquals(1, taskList.getCategories().size());
    assertEquals(1, taskList.getCategories().iterator().next().getChildren().size());
    assertEquals(1, task.getChildren().size());
    assertEquals(subTask1, task.getChildren().iterator().next());

    assertEquals(1, subTask1.getChildren().size());
    assertEquals(subTask2, subTask1.getChildren().iterator().next());

    assertEquals(1, subTask2.getChildren().size());
    assertEquals(subTask3, subTask2.getChildren().iterator().next());

    assertEquals(1, subTask3.getChildren().size());
    assertEquals(subTask4, subTask3.getChildren().iterator().next());

    assertEquals(1, subTask4.getChildren().size());
    assertEquals(subTask5, subTask4.getChildren().iterator().next());

    assertEquals(1, subTask5.getChildren().size());
    assertEquals(subTask6, subTask5.getChildren().iterator().next());

    assertEquals(1, subTask6.getChildren().size());
    assertEquals(subTask7, subTask6.getChildren().iterator().next());

    assertEquals(1, subTask7.getChildren().size());
    assertEquals(subTask8, subTask7.getChildren().iterator().next());

    assertEquals(1, subTask8.getChildren().size());
    assertEquals(subTask9, subTask8.getChildren().iterator().next());

    assertEquals(1, subTask9.getChildren().size());
    assertEquals(subTask10, subTask9.getChildren().iterator().next());

    assertEquals(0, subTask10.getChildren().size());
  }