Esempio n. 1
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));
 }
Esempio n. 2
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);
 }
Esempio n. 3
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);
 }