Package es.udc.tfg.journals.model.user

Examples of es.udc.tfg.journals.model.user.User


  }

  @Test
  public void testCreateReviewAndFindAndDelete()
      throws DuplicateInstanceException, InstanceNotFoundException {
    User user1 = userService.registerUser("userPassword", new UserDetails(
        "name", "lastName", "user1@udc.es", "user1"));

    reviewService.createReviewType("global");
    reviewService.createReviewType("quality");
    ReviewRatingDto rvdto1 = new ReviewRatingDto("global", 2);
    ReviewRatingDto rvdto2 = new ReviewRatingDto("quality", 5);
    List<ReviewRatingDto> reviewRatingsDto = new ArrayList<ReviewRatingDto>();
    reviewRatingsDto.add(rvdto1);
    reviewRatingsDto.add(rvdto2);
    Review r1 = reviewService.createReview("review 1", user.getUserId(),
        journal.getJournalId(), reviewRatingsDto);

    try {
      reviewService.createReview("review 1", user.getUserId(),
          journal.getJournalId(), reviewRatingsDto);
    } catch (DuplicateInstanceException e) {
    }

    Review r2 = reviewService.createReview("review 2", user1.getUserId(),
        journal.getJournalId(), reviewRatingsDto);

    Block<Review> reviewsBlock = reviewService.findReviewsByJournal(
        journal.getJournalId(), 0, 10);
    assertEquals(2, reviewsBlock.getList().size());
View Full Code Here


  }

  @Test
  public void testCreateKeywordWeightJournalAndFindKewyword()
      throws DuplicateInstanceException, InstanceNotFoundException {
    User user = userService.registerUser("userPassword", new UserDetails(
        "name", "lastName", "user@udc.es", "user"));

    Journal j = new Journal("journal test", "jo tes", "http://url.test",
        50, 20);
    journalService.createJournal(j);
View Full Code Here

  }

  @Test
  public void testFindJournalsByKeywords() throws DuplicateInstanceException {
    User user = userService.registerUser("userPassword", new UserDetails(
        "name", "lastName", "user@udc.es", "user"));

    Journal j1 = new Journal("journal test 1", "jo tes",
        "http://url.test1", 50, 20);
    Journal j2 = new Journal("journal test 2", "jo tes",
View Full Code Here

  }

  @Test
  public void testFindKeywordsByJournal() throws DuplicateInstanceException {
    User user = userService.registerUser("userPassword", new UserDetails(
        "name", "lastName", "user@udc.es", "user"));

    Journal j1 = new Journal("journal test 1", "jo tes",
        "http://url.test1", 50, 20);
    journalService.createJournal(j1);
View Full Code Here

  }

  @Test
  public void testCreateListOfKeywords() throws DuplicateInstanceException,
      InstanceNotFoundException {
    User user = userService.registerUser("userPassword", new UserDetails(
        "name", "lastName", "user@udc.es", "user"));

    Journal j1 = new Journal("journal test 1", "jo tes",
        "http://url.test1", 50, 20);
    journalService.createJournal(j1);

    String[] keys = "medicine, real time, left ventricular ".split(",");

    keywordService.createListOfKeywords(keys, user.getUserId(),
        j1.getJournalId(), 1);

  }
View Full Code Here

  @Test
  public void testRegisterUserAndFindUser()
      throws DuplicateInstanceException, InstanceNotFoundException {

    /* Register user and find profile. */
    User user = userService.registerUser("userPassword", new UserDetails(
        "name", "lastName", "user@udc.es", "user"));

    User user2 = userService.findUser(user.getUserId());

    /* Check data. */
    assertEquals(user, user2);
  }
View Full Code Here

  @Test
  public void testLoginClearPassword() throws IncorrectPasswordException,
      InstanceNotFoundException {

    String clearPassword = "userPassword";
    User user = registerUser("user@udc.ess", clearPassword);

    User user2 = userService.login(user.getLogin(), clearPassword, false);

    assertEquals(user, user2);
  }
View Full Code Here

  @Test
  public void testLoginEncryptedPassword() throws IncorrectPasswordException,
      InstanceNotFoundException {

    User user = registerUser("user@udc.es", "clearPassword");

    User user2 = userService.login(user.getLogin(),
        user.getEncryptedPassword(), true);

    assertEquals(user, user2);
  }
View Full Code Here

  @Test(expected = IncorrectPasswordException.class)
  public void testLoginIncorrectPasword() throws IncorrectPasswordException,
      InstanceNotFoundException {

    String clearPassword = "userPassword";
    User user = registerUser("user@udc.es", clearPassword);

    userService.login(user.getLogin(), 'X' + clearPassword, false);
  }
View Full Code Here

    Transaction tx = HibernateUtil.getSessionFactory().getCurrentSession()
        .beginTransaction();
    try {

      // Register user.
      User userProfile = new User("user@udc.es",
          PasswordEncrypter.crypt("userPassword"), "name",
          "lastName", "user");
      userProfileDao.save(userProfile);
      Long userId = userProfile.getUserId();
      System.out.println("User with userId '" + userId
          + "' has been created");
      System.out.println(userProfile);

      // Find user.
View Full Code Here

TOP

Related Classes of es.udc.tfg.journals.model.user.User

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.