Esempio n. 1
0
  @Test
  public void testGetById() throws DAOException {

    createProjectWithMembers();
    Project testProject = projectService.getById(project.getId());
    deleteProjectWithMembers();

    assertNotNull(testProject);
    assertTrue((project.getMembers() != null) && (project.getMembers().size() > 0));
  }
Esempio n. 2
0
  private void createProjectWithMembers() throws DAOException {

    for (Member member : members) {
      memberService.create(member);
    }
    project.setMembers(members);

    Long idProject = projectService.create(project);
    project.setId(idProject);
  }
Esempio n. 3
0
  public void testGetSimpleProject() throws DAOException {

    projectService.create(project);
    Project projectTest = projectService.getSimpleProject(project.getId());
    projectService.delete(project);

    assertNotNull(projectTest);
  }
Esempio n. 4
0
  @Test
  public void testGetAll() throws DAOException {

    boolean memberExist = false;
    List<Project> projectsTest = projectService.getAll();

    assertNotNull(projectsTest);
    assertTrue(projectsTest.size() > 0);

    for (Project project : projectsTest) {
      if ((project.getMembers() != null) && (project.getMembers().size() > 0)) {
        memberExist = true;
        break;
      }
    }

    assertTrue(memberExist);
  }
Esempio n. 5
0
  @Test
  public void testDelete() throws DAOException {

    createProjectWithMembers();
    deleteProjectWithMembers();
    Project testDeleteProject = projectService.getById(project.getId());

    assertEquals(testDeleteProject, null);
  }
Esempio n. 6
0
  private static void getProject() {

    project.setProjectName("TESTPROJECT");
    project.setCreationDate(new Date(2013 - 01 - 01));
    project.setEstimatedCompletionDate(new Date(2013 - 02 - 02));
    project.setCompletionDate(new Date(2013 - 05 - 05));
    project.setDescription("For testing");
    project.setCustomer("Lenovo");
    project.setStatus(ProjectStatus.OPEN);
  }
Esempio n. 7
0
  @Test
  public void testUpdate() throws DAOException {

    createProjectWithMembers();
    Project oldProject = projectService.getById(project.getId());
    Project newProject = projectService.getById(project.getId());
    newProject.setProjectName("UPDAREPROJECT");
    projectService.update(oldProject, newProject);
    Project superNewProject = projectService.getById(newProject.getId());
    deleteProjectWithMembers();

    assertEquals(superNewProject.getProjectName(), "UPDAREPROJECT");
  }