예제 #1
0
  @Test
  public void testDelete_deleteChoices_withChildren_deleteChildren() {
    Story child = new Story();
    child.setBacklog(storyInIteration.getBacklog());
    child.setIteration(iteration);
    child.setId(2333);
    child.setParent(storyInIteration);
    storyInIteration.getChildren().add(child);
    storyInIteration.setIteration(null);

    blheBusiness.updateHistory(child.getBacklog().getId());
    iheBusiness.updateIterationHistory(iteration.getId());

    hourEntryBusiness.deleteAll(child.getHourEntries());
    hourEntryBusiness.deleteAll(storyInIteration.getHourEntries());

    //        storyRankBusiness.removeStoryRanks(child);
    //        storyRankBusiness.removeStoryRanks(storyInIteration);

    //        expect(storyDAO.get(2333)).andReturn(child);

    storyDAO.remove(child.getId());
    storyDAO.remove(storyInIteration);

    replayAll();
    storyBusiness.delete(
        storyInIteration,
        TaskHandlingChoice.DELETE,
        HourEntryHandlingChoice.DELETE,
        HourEntryHandlingChoice.DELETE,
        ChildHandlingChoice.DELETE);
    //        assertNull(child.getParent());
    assertTrue(storyInIteration.getChildren().isEmpty());
    verifyAll();
  }
예제 #2
0
  @Test
  public void testDeleteAndUpdateHistory() {
    expect(storyDAO.get(storyInIteration.getId())).andReturn(storyInIteration);
    //        storyRankBusiness.removeStoryRanks(storyInIteration);
    storyDAO.remove(storyInIteration);
    blheBusiness.updateHistory(storyInIteration.getBacklog().getId());
    iheBusiness.updateIterationHistory(storyInIteration.getIteration().getId());
    replayAll();

    storyBusiness.deleteAndUpdateHistory(storyInIteration.getId(), null, null, null, null);
    verifyAll();
  }
예제 #3
0
  @Test
  public void testStore_tasksToDone() {
    Task task1 = new Task();
    task1.setId(11);
    task1.setState(TaskState.BLOCKED);

    Task task2 = new Task();
    task2.setId(12);
    task2.setState(TaskState.PENDING);

    story1.setIteration(iteration);
    story1.setTasks(new HashSet<Task>(Arrays.asList(task1, task2)));

    expect(storyDAO.get(story1.getId())).andReturn(story1);
    storyDAO.store(story1);

    taskBusiness.setTaskToDone(task1);
    taskBusiness.setTaskToDone(task2);
    iheBusiness.updateIterationHistory(story1.getIteration().getId());

    replayAll();
    storyBusiness.store(story1.getId(), story1, null, null, true);
    verifyAll();
  }