Package net.sf.pmr.core.domain.project

Examples of net.sf.pmr.core.domain.project.Project


    }
   
    public final void testEquals() {

        Project basicProject1 = new ProjectImpl();
        Project basicProject2 = new ProjectImpl();

        assertTrue(basicProject1.equals(basicProject2));

        basicProject2.setCode("YUT");

        assertFalse(basicProject1.equals(basicProject2));

    }
View Full Code Here


    }
   

    public final void testHashCode() {

        Project basicProject1 = new ProjectImpl();
        Project basicProject2 = new ProjectImpl();

        assertTrue(basicProject1.hashCode() == basicProject2.hashCode());

        basicProject2.setCode("YUT");

        assertFalse(basicProject1.hashCode() == basicProject2.hashCode());

    }
View Full Code Here

  public ActionForward memberList(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception {

    // find basic project
    Project project = findProjectByPersistanceId(request);

    // if basicProject is found
    if (project != null) {

      // set the member list in request for display in the page
      request.setAttribute("memberList", project.getMembers());
    }

    // populate the summary
    Summary.populate(request);
View Full Code Here

   */
  public ActionForward detail(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception {

    Project project = findProjectByPersistanceId(request);

    // if a basicProject is found
    if (project != null) {

      // populate the form
      BasicProjectForm basicProjectForm = (BasicProjectForm) form;
      basicProjectForm.setCode(project.getCode());
      basicProjectForm.setName(project.getName());
      basicProjectForm.setPersistanceId(project.getPersistanceId());
      basicProjectForm.setPersistanceVersion(project
          .getPersistanceVersion());

    }

    // populate the summary
View Full Code Here

     * @see ProjectService#add(String, String, int)
     */
    public Errors add(final String code, final String name, final int defaultMemberPersistanceId) {

      // First call for a project instance
      Project basicProject = CoreObjectFactory.getProject();

      // populate the instance
      basicProject.setCode(code);
      basicProject.setName(name);

      // then find the default member in the user repository
      User user = userRepository.findUserByPersistanceId(defaultMemberPersistanceId);

      // add the user to the set of members
      Set<User> members = new HashSet<User>();
      members.add(user);
      basicProject.setMembers(members);

      // validation of the basicProject
      Errors errors = projectValidator.validate(basicProject);

      if (!errors.hasErrors()) {
View Full Code Here

   

    public Errors update(final int persistanceId, final String code, final String name, final long persistanceVersion) {

        // First call for a project instance
        Project basicProject = CoreObjectFactory.getProject();

        // populate the instance
        basicProject.setPersistanceId(persistanceId);
        basicProject.setCode(code);
        basicProject.setName(name);
        basicProject.setPersistanceVersion(persistanceVersion);

        // validation of the basicProject
        Errors errors = projectValidator.validate(basicProject);

        if (!errors.hasErrors()) {
View Full Code Here

    }

    public final void testfindByIdWithBasicProjectFound() {
     
        Project basicProject = (Project) basicProjectMapper.findById(1);
       
        Assert.assertEquals("id", new Integer(1), new Integer(basicProject.getPersistanceId()));
        Assert.assertEquals("code", "PR1", basicProject.getCode());
        Assert.assertEquals("name", "PM Project", basicProject.getName());
        Assert.assertEquals("members", 0, basicProject.getMembers().size());
        Assert.assertEquals("version", new Long(1).longValue(), basicProject.getPersistanceVersion());

      }
View Full Code Here

   * @throws Exception
   */
  public final void testAddWithAProject() throws Exception {
   
    User user = new UserImpl();
    Project basicProject = new ProjectImpl();
   
    user.setLogin("sdoo");
    user.setPassword("password");
    user.setFirstName("scooby");
    user.setLastName("doo");
    user.setEmail("scooby@worldCompany.com");
 
   
    basicProject.setPersistanceId(1);
    basicProject.setCode("PR1");
    basicProject.setName("PM Project");
    basicProject.setPersistanceVersion(1);
   
    user.setProjects(new HashSet<Project>());
    user.getProjects().add(basicProject);

    // add
View Full Code Here

      }
   
    public final void testfindByIdWithoutBasicProjectFound() {

        Project basicProject = (Project) basicProjectMapper.findById(198);

        Assert.assertEquals("basicProject", null, basicProject);

  }
View Full Code Here

   
  public final void testAddWithoutConcurrencyFailureException()
            throws Exception {

       // get a new Project
       Project basicProject = CoreObjectFactory.getProject();
               
       basicProject.setCode("SP");
       basicProject.setName("Super Project");
      
       // default member
       User user = new UserImpl();
       user.setPersistanceId(1);
       user.setLogin("ponfel");
       user.setPassword("password");
       user.setFirstName("Pon");
       user.setLastName("Fel");
       user.setEmail("ponfel@worldcompany.com");
       user.setPersistanceVersion(2);

       basicProject.getMembers().add(user);
      
       // Project is a proxy, so we need to get the target
       TargetSource targetSource = ((Advised) basicProject).getTargetSource();       
       Object target = ((SingletonTargetSource) targetSource).getTarget();
      
View Full Code Here

TOP

Related Classes of net.sf.pmr.core.domain.project.Project

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.