Examples of Researcher


Examples of edu.drexel.goodwin.cpd.domain.Researcher

    }
   
    @Test
    @Transactional
    public void testCountFindBySkillsAndInterestsDoesNotReturnDeletedResearchers() {
      Researcher randomResearcher = dod.getRandomResearcher();
      assertNotNull("Data on demand for 'Researcher' failed to initialize correctly", dod.getRandomResearcher());
      long count = Researcher.countResearchers();
      assertTrue("Too expensive to perform a find all test for 'Researcher', as there are " + count + " entries; set the findAllMaximum to exceed this value or set findAll=false on the integration test annotation to disable the test", count < 250);
      Set<Skill> skills = randomResearcher.getSkills();
      Set<Interest> interests = randomResearcher.getInterests();
      List<Researcher> result = Researcher.findResearchersBySkillsAndInterests(skills, interests, 0, 10);
      assertNotNull("Find by skills and interests method for 'Researcher' illegally returned null", result);
      assertTrue("Find by skills and interests method for 'Researcher' failed to return any data", result.size() > 0);
      int beforeCount = result.size();
     
      // Delete someone and save
      Researcher firstResearcher = result.get(0);
      firstResearcher.setDeleted(true);
      firstResearcher.merge();
     
      // make sure the deleted researcher did not turn up in the search results
      result = Researcher.findResearchersBySkillsAndInterests(skills, interests, 0, 10);
      assertEquals(beforeCount - 1, result.size());
     
View Full Code Here

Examples of edu.drexel.goodwin.cpd.domain.Researcher

    }
   
    @Test
    @Transactional
  public void testFindBySkillsAndInterestsDoesNotReturnDeletedResearchers() {
    Researcher randomResearcher = dod.getRandomResearcher();
    assertNotNull("Data on demand for 'Researcher' failed to initialize correctly", dod.getRandomResearcher());
    long count = Researcher.countResearchers();
    assertTrue("Too expensive to perform a find all test for 'Researcher', as there are " + count + " entries; set the findAllMaximum to exceed this value or set findAll=false on the integration test annotation to disable the test", count < 250);
    Set<Skill> skills = randomResearcher.getSkills();
    Set<Interest> interests = randomResearcher.getInterests();
    List<Researcher> result = Researcher.findResearchersBySkillsAndInterests(skills, interests, 0, 10);
    assertNotNull("Find by skills and interests method for 'Researcher' illegally returned null", result);
    assertTrue("Find by skills and interests method for 'Researcher' failed to return any data", result.size() > 0);
    int beforeCount = result.size();
   
    // Delete someone and save
    Researcher firstResearcher = result.get(0);
    firstResearcher.setDeleted(true);
    firstResearcher.merge();
   
    // make sure the deleted researcher did not turn up in the search results
    result = Researcher.findResearchersBySkillsAndInterests(skills, interests, 0, 10);
    assertEquals(beforeCount - 1, result.size());
  }
View Full Code Here

Examples of edu.drexel.goodwin.cpd.domain.Researcher

   

  @Test
  @Transactional
  public void testFindBySkillsAndInterests() {
    Researcher randomResearcher = dod.getRandomResearcher();
    assertNotNull("Data on demand for 'Researcher' failed to initialize correctly", randomResearcher);
    long count = Researcher.countResearchers();
    assertTrue("Too expensive to perform a find all test for 'Researcher', as there are " + count + " entries; set the findAllMaximum to exceed this value or set findAll=false on the integration test annotation to disable the test", count < 250);
    Set<Skill> skills = randomResearcher.getSkills();
    Set<Interest> interests = randomResearcher.getInterests();
    List<Researcher> result = Researcher.findResearchersBySkillsAndInterests(skills, interests, 0, 10);
    assertNotNull("Find by skills and interests  method for 'Researcher' illegally returned null", result);
    assertTrue("Find by skills and interests method for 'Researcher' failed to return any data although there should have been at least one", result.size() > 0);
  }
View Full Code Here

Examples of edu.drexel.goodwin.cpd.domain.Researcher

  }

  @Test
  @Transactional
  public void testCreateFailsIfEmailAddressAlreadyExists() {
    Researcher randomResearcher = dod.getRandomResearcher();

    ResearcherDto dto = new ResearcherDto();
    int rand = random.nextInt();
    dto.setBibliography("biblio" + rand);
    String email = randomResearcher.getEmail();
    dto.setEmail(email);
    dto.setFirstName("firstName" + rand);
    dto.setLastName("lastname" + rand);
    dto.setJobTitle("jobtitle" + rand);
    dto.setOrganization("organization" + rand);
View Full Code Here

Examples of edu.drexel.goodwin.cpd.domain.Researcher

  @Test
  @Transactional
  @ExpectedException(AccessDeniedException.class)
  public void testCannotDeleteResearcherIfNotAdmin() {

    Researcher researcher = dod.getRandomResearcher();

    pretendThisResearcherIsLoggedIn(researcher);

    assertFalse("researcher should start out not deleted", researcher.isDeleted());
    researcherManager.deleteResearcher(researcher.getId());
    assertFalse("researcher should still not be deleted", researcher.isDeleted());
  }
View Full Code Here

Examples of edu.drexel.goodwin.cpd.domain.Researcher

  @Test
  @Transactional
  public void testDeleteResearcherAsAdmin() {

    Researcher researcher = dod.getRandomResearcher();

    pretendThisResearcherIsLoggedInAndIsAdmin(researcher);

    assertFalse("researcher should start out not deleted", researcher.isDeleted());
    researcherManager.deleteResearcher(researcher.getId());
    assertTrue("researcher should have been flagged as deleted", researcher.isDeleted());
  }
View Full Code Here

Examples of edu.drexel.goodwin.cpd.domain.Researcher

  }

  @Test
  @Transactional
  public void testUpdate() {
    Researcher researcher = dod.getRandomResearcher();

    pretendThisResearcherIsLoggedIn(researcher);

    ResearcherDto dto = new ResearcherDto();
    int rand = random.nextInt();
    dto.setBibliography(researcher.getBibliography() + rand);
    String email = "audrey+TEST" + rand + "@mathforum.org";
    dto.setEmail(email);
    dto.setFirstName("firstName" + rand);
    dto.setLastName("lastname" + rand);
    dto.setJobTitle("jobtitle" + rand);
    dto.setOrganization("organization" + rand);
    dto.setPassword("password" + rand);
    dto.setPasswordConfirm("password" + rand);
    dto.setWebsite("http://mathforum.org" + rand);
    dto.setRecaptcha_challenge_field("test");
    dto.setRecaptcha_response_field("test");
    dto.setId(researcher.getId());
    BindingResult bindingResult = new BeanPropertyBindingResult(dto, "researcher");

    String oldPassword = researcher.getPassword();
    researcherManager.update(dto, bindingResult);

    assertFalse("there should NOT have been errors", bindingResult.hasErrors());
    Query queryResult = Researcher.findResearchersByEmailEquals(email);
    assertEquals(1, queryResult.getResultList().size());
View Full Code Here

Examples of edu.drexel.goodwin.cpd.domain.Researcher

  }

  @Test
  @Transactional
  public void testUpdatePasswordFailsIfConfirmDoesNotMatch() {
    Researcher researcher = dod.getRandomResearcher();

    pretendThisResearcherIsLoggedIn(researcher);

    ResearcherDto dto = new ResearcherDto();
    String newPassword = "confirm";
    dto.setId(researcher.getId());
    dto.setPassword(newPassword);
    dto.setPasswordConfirm(newPassword + "FAIL");
    BindingResult bindingResult = new BeanPropertyBindingResult(dto, "researcher");

    String oldPassword = researcher.getPassword();
    researcherManager.updatePassword(dto, bindingResult);

    assertTrue("there should have been errors", bindingResult.hasErrors());
    Query queryResult = Researcher.findResearchersByEmailEquals(researcher.getEmail());
    assertEquals(1, queryResult.getResultList().size());
    assertEquals("password should NOT have changed", oldPassword, ((Researcher) queryResult.getSingleResult()).getPassword());
  }
View Full Code Here

Examples of edu.drexel.goodwin.cpd.domain.Researcher

  }

  @Test
  @Transactional
  public void testUpdatePassword() {
    Researcher researcher = dod.getRandomResearcher();

    pretendThisResearcherIsLoggedIn(researcher);

    ResearcherDto dto = new ResearcherDto();
    String newPassword = "confirm";
    dto.setId(researcher.getId());
    dto.setPassword(newPassword);
    dto.setPasswordConfirm(newPassword);
    BindingResult bindingResult = new BeanPropertyBindingResult(dto, "researcher");

    researcherManager.updatePassword(dto, bindingResult);

    assertFalse("there should NOT have been errors", bindingResult.hasErrors());
    Query queryResult = Researcher.findResearchersByEmailEquals(researcher.getEmail());
    assertEquals(1, queryResult.getResultList().size());

    String encodedNewPassword = passwordEncoder.encodePassword(newPassword, researcher.getSalt());
    assertEquals("password should have changed", encodedNewPassword, ((Researcher) queryResult.getSingleResult()).getPassword());
  }
View Full Code Here

Examples of edu.drexel.goodwin.cpd.domain.Researcher

  }

  @Test
  @Transactional
  public void testCannotUpdatePasswordIfPasswordTooShort() {
    Researcher researcher = dod.getRandomResearcher();

    pretendThisResearcherIsLoggedIn(researcher);

    ResearcherDto dto = new ResearcherDto();
    String newPassword = "1234";
    dto.setId(researcher.getId());
    dto.setPassword(newPassword);
    dto.setPasswordConfirm(newPassword);
    BindingResult bindingResult = new BeanPropertyBindingResult(dto, "researcher");

    String oldPassword = researcher.getPassword();

    researcherManager.updatePassword(dto, bindingResult);

    assertTrue("there should have been errors", bindingResult.hasErrors());
    Query queryResult = Researcher.findResearchersByEmailEquals(researcher.getEmail());
    assertEquals(1, queryResult.getResultList().size());
    assertEquals("password should NOT have changed", oldPassword, ((Researcher) queryResult.getSingleResult()).getPassword());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.