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

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


  public void testUpdate() throws InstanceNotFoundException,
      IncorrectPasswordException, DuplicateInstanceException {

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

    UserDetails newUserDetails = new UserDetails('X' + user.getFirstName(),
        'X' + user.getLastName(), 'X' + user.getEmail(), 'X' + "user");

    userService.updateUserDetails(user.getUserId(), newUserDetails);

    /* Check changes. */
    userService.login(user.getLogin(), clearPassword, false);
    User user2 = userService.findUser(user.getUserId());

    assertEquals(newUserDetails.getFirstName(), user2.getFirstName());
    assertEquals(newUserDetails.getLastName(), user2.getLastName());
    assertEquals(newUserDetails.getEmail(), user2.getEmail());
  }
View Full Code Here


  public void testChangePassword() throws InstanceNotFoundException,
      IncorrectPasswordException {

    /* Change password. */
    String clearPassword = "userPassword";
    User user = registerUser("user@udc.es", clearPassword);
    String newClearPassword = 'X' + clearPassword;

    userService.changePassword(user.getUserId(), clearPassword,
        newClearPassword);

    /* Check new password. */
    userService.login(user.getLogin(), newClearPassword, false);
  }
View Full Code Here

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

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

    userService.changePassword(user.getUserId(), 'X' + clearPassword,
        'Y' + clearPassword);
  }
View Full Code Here

  @Test(expected = InstanceNotFoundException.class)
  public void testDeleteAccount() throws DuplicateInstanceException,
      InstanceNotFoundException, IncorrectPasswordException {
    /* Register and delete user. */
    User user = userService.registerUser("userPassword", new UserDetails(
        "name", "lastName", "user@udc.es", "user"));

    userService.deleteAccount(user.getUserId(), "userPassword");

    /* Check that doesn't exists. */
    userService.findUser(user.getUserId());
  }
 
View Full Code Here

    Transaction tx = null;
    try {
      tx = session.beginTransaction();

      // Register user.
      User userProfile = new User("user@udc.es",
          PasswordEncrypter.crypt("userPassword"), "name",
          "lastName", "user");
      session.saveOrUpdate(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

        new String[] { SPRING_CONFIG_FILE, SPRING_CONFIG_TEST_FILE });
    UserService userService = ctx.getBean(UserService.class);

    try {
      // Register user.
      User userProfile = userService.registerUser("userPassword",
          new UserDetails("name", "lastName", "user@udc.es", "user"));
      System.out.println("User with userId '" + userProfile.getUserId()
          + "' has been created");
      System.out.println(userProfile);

      // Find user.
      userProfile = userService.login("serviceUser", "userPassword",
          false);
      System.out.println("User with userId '" + userProfile.getUserId()
          + "' has been retrieved");
      System.out.println(userProfile);

      // ... proceed in the same way for other entities / methods / use
      // cases
View Full Code Here

            .getEncryptedPassword(cookies);
        if (encryptedPassword != null) {

          try {

            User userProfile = userService.login(loginName,
                encryptedPassword, true);
            UserSession userSession = new UserSession();
            userSession.setUserId(userProfile.getUserId());
            userSession.setFirstName(userProfile.getFirstName());
            userSession.setRole(userProfile.getRole());
            applicationStateManager.set(UserSession.class,
                userSession);

          } catch (InstanceNotFoundException e) {
            CookiesManager.removeCookies(cookies);
View Full Code Here

  }

  public void createListOfKeywords(String[] keys, long userId,
      long journalId, int weight) throws InstanceNotFoundException,
      DuplicateInstanceException {
    User user = userDao.find(userId);
    Journal journal = journalDao.find(journalId);
    createListOfKeywords(keys, user, journal, weight);
  }
View Full Code Here

    keywordWeightJournalDao.remove(kwjId);
  }

  public void deleteKeywordOfUser(long kwId, long userId)
      throws InstanceNotFoundException {
    User user = userDao.find(userId);
    KeywordWeight kw = keywordWeightDao.find(kwId);
    List<KeywordWeight> kwlist = keywordWeightDao
        .findKeywordsWeightByUserAndKeyword(userId, kw.getKeyword()
            .getKeywordId());
    for (KeywordWeight keywordWeight : kwlist) {
View Full Code Here

  @InjectPage
  private NotFound notFound;

  void onPrepareForRender() throws InstanceNotFoundException {
    User user;
    user = userService.findUser(userSession.getUserId());
    firstName = user.getFirstName();
    lastName = user.getLastName();
    email = user.getEmail();
    login = user.getLogin();
    updated = false;
    updatedPassword = false;
  }
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.