コード例 #1
0
  /** TEST FORCE DELETING */
  @Test
  public void testForceDelete() {
    Story story = new Story();
    story.setId(1);

    Story child = new Story();
    child.setParent(story);
    story.setChildren(new ArrayList<Story>(Arrays.asList(child)));

    story.setTasks(new HashSet<Task>(Arrays.asList(new Task(), new Task())));
    story.setHourEntries(
        new HashSet<StoryHourEntry>(
            Arrays.asList(new StoryHourEntry(), new StoryHourEntry(), new StoryHourEntry())));

    taskBusiness.delete(EasyMock.isA(Task.class), EasyMock.same(HourEntryHandlingChoice.DELETE));
    expectLastCall().times(2);

    hourEntryBusiness.deleteAll(story.getHourEntries());

    storyDAO.remove(1);

    replayAll();
    storyBusiness.forceDelete(story);
    verifyAll();

    assertNull("Child story's parent not null", child.getParent());
    assertEquals("Parent story's children not empty", 0, story.getChildren().size());
  }
コード例 #2
0
 @Test
 public void testGetTasksWithRankBetween_storyEmptyCollection() {
   story.setId(1);
   executeClassSql();
   Collection<Task> actual = taskDAO.getTasksWithRankBetween(2, 1, null, story);
   assertEquals(0, actual.size());
 }
コード例 #3
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();
  }
コード例 #4
0
 @Test
 public void testGetTasksWithRankBetween_storyBottom() {
   story.setId(3);
   executeClassSql();
   Collection<Task> actual = taskDAO.getTasksWithRankBetween(1, 5, null, story);
   assertEquals(1, actual.size());
 }
コード例 #5
0
 @Test
 public void testGetLastTaskInRank_story() {
   story.setId(55);
   executeClassSql();
   Task actual = taskDAO.getLastTaskInRank(story, null);
   assertEquals(22, actual.getId());
   assertEquals(666, actual.getRank());
 }
コード例 #6
0
 @Test
 public void testGetNextTaskInRank_story() {
   story.setId(55);
   executeClassSql();
   Task actual = taskDAO.getNextTaskInRank(0, null, story);
   assertEquals(1, actual.getRank());
   assertEquals(21, actual.getId());
 }
コード例 #7
0
  @Test
  public void testGetNextTaskInRank_story_largeCap() {
    story.setId(55);
    executeClassSql();
    Task actual = taskDAO.getNextTaskInRank(25, null, story);

    assertEquals(22, actual.getId());
    assertEquals(666, actual.getRank());
  }
コード例 #8
0
  @Before
  public void setUp() {
    backlog = new Product();
    iteration = new Iteration();
    iteration.setId(5834);
    story1 = new Story();
    story1.setId(666);
    story2 = new Story();

    storyPriorityUpdated = false;
    storyBacklogUpdated = false;
  }
コード例 #9
0
  @Before
  public void setUpStorysProjectResponsiblesData() {
    Iteration iter = new Iteration();
    Project proj = new Project();
    Product prod = new Product();
    iter.setParent(proj);
    proj.setParent(prod);

    assignedUser = new User();
    assignedUser.setId(2233);

    storyInIteration = new Story();
    storyInProject = new Story();
    storyInProduct = new Story();

    storyInIteration.setId(868);
    storyInProduct.setId(951);
    storyInProject.setId(3);

    storyInIteration.setIteration(iter);
    storyInIteration.setBacklog(proj);
    storyInProject.setBacklog(proj);
    storyInProduct.setBacklog(prod);
  }
コード例 #10
0
  @Before
  public void createModels() {
    story = new Story();
    story.setId(1);

    firstIteration = new Iteration();
    firstIteration.setId(1);

    secondIteration = new Iteration();
    secondIteration.setId(2);

    firstProject = new Project();
    firstProject.setId(3);

    secondProject = new Project();
    secondProject.setId(4);

    firstProduct = new Product();
    firstProduct.setId(5);
  }
コード例 #11
0
 @Test
 public void testGetNextTaskInRank_story_notFound() {
   story.setId(55);
   executeClassSql();
   assertNull(taskDAO.getNextTaskInRank(999, null, story));
 }