예제 #1
0
 @Test
 public void testGetTasksWithRankBetween_storyEmptyCollection() {
   story.setId(1);
   executeClassSql();
   Collection<Task> actual = taskDAO.getTasksWithRankBetween(2, 1, null, story);
   assertEquals(0, actual.size());
 }
예제 #2
0
 @Test
 public void testGetTasksWithRankBetween_iterationEmptyCollection() {
   iter.setId(1);
   executeClassSql();
   Collection<Task> actual = taskDAO.getTasksWithRankBetween(2, 0, iter, null);
   assertEquals(0, actual.size());
 }
예제 #3
0
 @Test
 public void testGetTasksWithRankBetween_storyBottom() {
   story.setId(3);
   executeClassSql();
   Collection<Task> actual = taskDAO.getTasksWithRankBetween(1, 5, null, story);
   assertEquals(1, actual.size());
 }
예제 #4
0
 @Test
 public void testSearchByName() {
   String search = "full";
   executeClassSql();
   List<User> users = userDAO.searchByName(search);
   assertEquals(1, users.size());
 }
예제 #5
0
 @Test
 public void testSearchByName_notFound() {
   String search = "not found string";
   executeClassSql();
   List<User> users = userDAO.searchByName(search);
   assertEquals(0, users.size());
 }
예제 #6
0
 @Test
 public void testGetNextTaskInRank_iteration() {
   iter.setId(1);
   executeClassSql();
   Task actual = taskDAO.getNextTaskInRank(0, iter, null);
   assertEquals(1, actual.getRank());
 }
예제 #7
0
 @Test
 public void testGetNextTaskInRank_iteration_largeCap() {
   iter.setId(3);
   executeClassSql();
   Task actual = taskDAO.getNextTaskInRank(25, iter, null);
   assertEquals(17, actual.getId());
   assertEquals(1500, actual.getRank());
 }
예제 #8
0
 @Test
 public void testGetLastTaskInRank_iteration() {
   iter.setId(3);
   executeClassSql();
   Task actual = taskDAO.getLastTaskInRank(null, iter);
   assertEquals(17, actual.getId());
   assertEquals(1500, actual.getRank());
 }
예제 #9
0
 @Test
 public void testGetLastTaskInRank_story() {
   story.setId(55);
   executeClassSql();
   Task actual = taskDAO.getLastTaskInRank(story, null);
   assertEquals(22, actual.getId());
   assertEquals(666, actual.getRank());
 }
예제 #10
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());
 }
예제 #11
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());
  }
예제 #12
0
 @Test
 public void testGetStoryTasksWithEffortLeft_notInTimeframe() {
   executeClassSql();
   DateTime start = new DateTime(2008, 6, 10, 1, 0, 0, 0);
   User user = new User();
   user.setId(1);
   Interval interval = new Interval(start, start.plusDays(5));
   List<Task> actual = this.taskDAO.getStoryTasksWithEffortLeft(user, interval);
   assertEquals(0, actual.size());
 }
예제 #13
0
 @Test
 public void testGetUnassignedStoryTasksWithEffortLeftWithNullEffortSpent() {
   executeClassSql();
   DateTime start = new DateTime(2009, 6, 10, 1, 0, 0, 0);
   User user = new User();
   user.setId(3);
   Interval interval = new Interval(start, start.plusDays(5));
   List<UnassignedLoadTO> actual =
       this.taskDAO.getUnassignedStoryTasksWithEffortLeft(user, interval);
   assertTrue(actual.isEmpty());
 }
예제 #14
0
 @Test
 public void testListUsersByEnabledStatus_disabled() {
   executeClassSql();
   List<User> users = userDAO.listUsersByEnabledStatus(false);
   assertEquals(1, users.size());
   List<Integer> foundIds = new ArrayList<Integer>();
   for (User user : users) {
     foundIds.add(user.getId());
   }
   assertTrue(foundIds.contains(3));
 }
예제 #15
0
 @Test
 public void testGetNumOfResponsiblesByTask() {
   executeClassSql();
   Set<Integer> taskIds = new HashSet<Integer>(Arrays.asList(1, 2, 3, 4, 5));
   Map<Integer, Integer> actual = this.taskDAO.getNumOfResponsiblesByTask(taskIds);
   assertEquals(1, (int) actual.get(1));
   assertEquals(2, (int) actual.get(2));
   assertEquals(1, (int) actual.get(3));
   assertEquals(2, (int) actual.get(4));
   assertEquals(1, (int) actual.get(5));
 }
예제 #16
0
  @Test
  public void testGetAllIterationAndStoryTasks_user_hasNoAssigned() {
    executeClassSql();
    DateTime start = new DateTime(2009, 6, 10, 1, 0, 0, 0);
    Interval interval = new Interval(start, start.plusDays(5));
    User user = new User();
    user.setId(4);

    List<Task> actual = this.taskDAO.getAllIterationAndStoryTasks(user, interval);
    assertEquals(0, actual.size());
  }
예제 #17
0
 @Test
 public void testGetUnassignedIterationTasksWithEffortLeft() {
   executeClassSql();
   DateTime start = new DateTime(2009, 6, 10, 1, 0, 0, 0);
   User user = new User();
   user.setId(1);
   Interval interval = new Interval(start, start.plusDays(5));
   List<UnassignedLoadTO> actual =
       this.taskDAO.getUnassignedIterationTasksWithEffortLeft(user, interval);
   assertEquals(2, actual.size());
   assertEquals(970, actual.get(0).effortLeft.intValue());
   assertEquals(100, actual.get(0).availability);
   assertEquals(1, actual.get(0).iterationId);
 }
예제 #18
0
  @Test
  public void testGetAllIterationAndStoryTasks() {
    executeClassSql();
    DateTime start = new DateTime(2009, 6, 10, 1, 0, 0, 0);
    Interval interval = new Interval(start, start.plusDays(5));
    User user = new User();
    user.setId(1);
    List<Task> actual = this.taskDAO.getAllIterationAndStoryTasks(user, interval);

    HashSet<Integer> actualIds = new HashSet<Integer>();
    for (Task t : actual) {
      actualIds.add(t.getId());
    }

    HashSet<Integer> expectedIds = new HashSet<Integer>(Arrays.asList(2, 3, 4));
    assertEquals(expectedIds, actualIds);
  }
예제 #19
0
 @Test
 public void testGetByLoginName() {
   executeClassSql();
   assertEquals(4, userDAO.getByLoginName("user4").getId());
 }
예제 #20
0
 @Test
 public void testGetByLoginNameIgnoreCase_caseInsensitive() {
   executeClassSql();
   assertEquals(4, userDAO.getByLoginNameIgnoreCase("User4").getId());
 }
예제 #21
0
 @Test
 public void testGetByLoginNameIgnoreCase_notFound() {
   executeClassSql();
   assertNull(userDAO.getByLoginNameIgnoreCase("usernotfound"));
 }
예제 #22
0
 @Test
 public void testGetNextTaskInRank_story_notFound() {
   story.setId(55);
   executeClassSql();
   assertNull(taskDAO.getNextTaskInRank(999, null, story));
 }
예제 #23
0
 @Test
 public void testGetByLoginName_ignoreCase() {
   executeClassSql();
   assertNull(userDAO.getByLoginName("User4"));
 }
예제 #24
0
 @Test
 public void testGetNextTaskInRank_iteration_notFound() {
   iter.setId(1);
   executeClassSql();
   assertNull(taskDAO.getNextTaskInRank(999, iter, null));
 }