コード例 #1
0
ファイル: TeamDAOTest.java プロジェクト: scrumzu/scrumzu
 @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));
 }
コード例 #2
0
ファイル: TeamDAOTest.java プロジェクト: scrumzu/scrumzu
 @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);
 }
コード例 #3
0
ファイル: TeamDAOTest.java プロジェクト: scrumzu/scrumzu
 @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);
 }
コード例 #4
0
ファイル: TeamDAOTest.java プロジェクト: scrumzu/scrumzu
 @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());
 }
コード例 #5
0
ファイル: TeamDAOTest.java プロジェクト: scrumzu/scrumzu
 @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);
 }
コード例 #6
0
ファイル: TeamDAOTest.java プロジェクト: scrumzu/scrumzu
 @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));
 }
コード例 #7
0
ファイル: TeamDAOTest.java プロジェクト: scrumzu/scrumzu
 @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);
 }
コード例 #8
0
ファイル: TeamDAOTest.java プロジェクト: scrumzu/scrumzu
 @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);
 }
コード例 #9
0
ファイル: TeamDAOTest.java プロジェクト: scrumzu/scrumzu
 @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");
 }