Ejemplo n.º 1
0
 @Test
 public void getTeamsForUser() {
   userDao.save(insertedUser);
   projectDao.save(insertedProject);
   teamDao.save(insertedTeam);
   List<Team> teams = teamDao.getTeamsForUser(insertedUser);
   assertEquals("List of teams for particular user should not be empty", 1, teams.size());
   Team selectedTeam = teamDao.getTeamsForUser(insertedUser).get(0);
   assertEquals("Selected team is not equal to expected one", insertedTeam, selectedTeam);
 }
Ejemplo n.º 2
0
 @Test
 public void getTeamByIdTest() {
   userDao.save(insertedUser);
   projectDao.save(insertedProject);
   teamDao.save(insertedTeam);
   teamDao.flushSession();
   long insertedTeamId = insertedTeam.getIdTeam();
   Team selectedTeam = teamDao.getTeam(insertedTeamId);
   assertEquals("Selected teams are not equal", selectedTeam, insertedTeam);
 }
Ejemplo n.º 3
0
 @Test
 public void loadTeamByIdTest() {
   userDao.save(insertedUser);
   projectDao.save(insertedProject);
   teamDao.save(insertedTeam);
   teamDao.flushSession();
   long teamId = insertedTeam.getIdTeam();
   Team loadedTeam = teamDao.loadTeam(teamId);
   assertEquals("Loaded object is not equal", loadedTeam.getAlias(), insertedTeam.getAlias());
   assertEquals("Loaded object is not equal", loadedTeam.getName(), insertedTeam.getName());
 }
Ejemplo n.º 4
0
 @Test
 public void getTeamsByProject() {
   userDao.save(insertedUser);
   projectDao.save(insertedProject);
   teamDao.save(insertedTeam);
   teamDao.flushSession();
   List<Team> teams = teamDao.getTeamsForProject(insertedProject);
   if (teams.size() != 1) {
     fail("List should have one related team");
   }
   assertEquals("Selected team is not equal", teams.get(0), insertedTeam);
 }
Ejemplo n.º 5
0
 @Test
 public void getTeamId() {
   userDao.save(insertedUser);
   projectDao.save(insertedProject);
   teamDao.save(insertedTeam);
   teamDao.flushSession();
   long teamId = teamDao.getTeamId(insertedTeam.getAlias());
   assertEquals(
       "Team's selected id is not equal to expected one",
       insertedTeam.getIdTeam(),
       new Long(teamId));
 }
Ejemplo n.º 6
0
 @Test
 public void saveTest() {
   userDao.save(insertedUser);
   projectDao.save(insertedProject);
   int rowsBeforeSave = super.countRowsInTable("Teams");
   teamDao.save(insertedTeam);
   teamDao.flushSession();
   int rowsAfterSave = super.countRowsInTable("Teams");
   assertEquals("Number of rows has not increased", rowsBeforeSave + 1, rowsAfterSave);
   long insertedTeamId = insertedTeam.getIdTeam();
   assertEquals("Teams are not equal", teamDao.getTeam(insertedTeamId), insertedTeam);
 }
Ejemplo n.º 7
0
 @Test
 public void countTeamsForSprintTest() {
   userDao.save(insertedUser);
   projectDao.save(insertedProject);
   pbiDao.save(insertedPBI);
   sprintDao.save(insertedSprint);
   teamDao.save(insertedTeam);
   workItemDao.save(insertedWorkItem);
   teamDao.flushSession();
   assertEquals("Count number is not valid", 1, teamDao.countTeamsForSprint(insertedSprint));
   workItemDao.delete(insertedWorkItem);
   teamDao.delete(insertedTeam);
   teamDao.flushSession();
   assertEquals("Count number is not valid", 0, teamDao.countTeamsForSprint(insertedSprint));
 }
Ejemplo n.º 8
0
 @Test
 public void deleteByIdTest() {
   userDao.save(insertedUser);
   projectDao.save(insertedProject);
   int rowsBeforeInsert = super.countRowsInTable("Teams");
   teamDao.save(insertedTeam);
   teamDao.flushSession();
   long teamId = insertedTeam.getIdTeam();
   teamDao.delete(teamId);
   teamDao.flushSession();
   int rowsAfterDelete = super.countRowsInTable("Teams");
   assertEquals(
       "JDBC query must return the same number of teams", rowsBeforeInsert, rowsAfterDelete);
   Team selectedTeam = teamDao.getTeam(teamId);
   assertNull("Selected team after delete should be null", selectedTeam);
 }
Ejemplo n.º 9
0
 @Test
 public void getTeamsTest() {
   userDao.save(insertedUser);
   projectDao.save(insertedProject);
   teamDao.save(insertedTeam);
   teamDao.flushSession();
   List<Team> teams = teamDao.getTeams();
   if (teams.isEmpty()) {
     fail("List of teams cannot be empty after insert");
   }
   assertEquals(
       "JDBC query must show the same number of teams",
       super.countRowsInTable("Teams"),
       teams.size());
   Team team = teams.get(teams.size() - 1);
   assertEquals("Selected team is not equal", team.getAlias(), "ZZ");
   assertEquals("Selected team is not equal", team.getName(), "Test Testowy");
 }
Ejemplo n.º 10
0
 @Test
 public void deleteWithWorkItemsTest() {
   userDao.save(insertedUser);
   projectDao.save(insertedProject);
   pbiDao.save(insertedPBI);
   sprintDao.save(insertedSprint);
   teamDao.save(insertedTeam);
   workItemDao.save(insertedWorkItem);
   insertedTeam.addWorkItem(insertedWorkItem);
   insertedWorkItem.setTeam(insertedTeam);
   teamDao.flushSession();
   long idTeam = insertedTeam.getIdTeam();
   teamDao.delete(insertedTeam);
   teamDao.flushSession();
   int counter =
       super.simpleJdbcTemplate.queryForInt(
           "select count(*) from Teams where idTeam=?", new Object[] {idTeam});
   assertEquals("JDBC query must return no teams with this id", 0, counter);
   counter =
       super.simpleJdbcTemplate.queryForInt(
           "select count(*) from WorkItems where idTeam=?", new Object[] {idTeam});
   assertEquals("JDBC query must return no workItems with this id", 0, counter);
 }