コード例 #1
0
  protected User addUser() throws Exception {
    long pk = nextLong();

    User user = _persistence.create(pk);

    user.setUuid(randomString());
    user.setCompanyId(nextLong());
    user.setCreateDate(nextDate());
    user.setModifiedDate(nextDate());
    user.setDefaultUser(randomBoolean());
    user.setContactId(nextLong());
    user.setPassword(randomString());
    user.setPasswordEncrypted(randomBoolean());
    user.setPasswordReset(randomBoolean());
    user.setPasswordModifiedDate(nextDate());
    user.setDigest(randomString());
    user.setReminderQueryQuestion(randomString());
    user.setReminderQueryAnswer(randomString());
    user.setGraceLoginCount(nextInt());
    user.setScreenName(randomString());
    user.setEmailAddress(randomString());
    user.setFacebookId(nextLong());
    user.setOpenId(randomString());
    user.setPortraitId(nextLong());
    user.setLanguageId(randomString());
    user.setTimeZoneId(randomString());
    user.setGreeting(randomString());
    user.setComments(randomString());
    user.setFirstName(randomString());
    user.setMiddleName(randomString());
    user.setLastName(randomString());
    user.setJobTitle(randomString());
    user.setLoginDate(nextDate());
    user.setLoginIP(randomString());
    user.setLastLoginDate(nextDate());
    user.setLastLoginIP(randomString());
    user.setLastFailedLoginDate(nextDate());
    user.setFailedLoginAttempts(nextInt());
    user.setLockout(randomBoolean());
    user.setLockoutDate(nextDate());
    user.setAgreedToTermsOfUse(randomBoolean());
    user.setStatus(nextInt());

    _persistence.update(user, false);

    return user;
  }
コード例 #2
0
  /**
   * Converts the soap model instance into a normal model instance.
   *
   * @param soapModel the soap model instance to convert
   * @return the normal model instance
   */
  public static User toModel(UserSoap soapModel) {
    User model = new UserImpl();

    model.setUuid(soapModel.getUuid());
    model.setUserId(soapModel.getUserId());
    model.setCompanyId(soapModel.getCompanyId());
    model.setCreateDate(soapModel.getCreateDate());
    model.setModifiedDate(soapModel.getModifiedDate());
    model.setDefaultUser(soapModel.getDefaultUser());
    model.setContactId(soapModel.getContactId());
    model.setPassword(soapModel.getPassword());
    model.setPasswordEncrypted(soapModel.getPasswordEncrypted());
    model.setPasswordReset(soapModel.getPasswordReset());
    model.setPasswordModifiedDate(soapModel.getPasswordModifiedDate());
    model.setDigest(soapModel.getDigest());
    model.setReminderQueryQuestion(soapModel.getReminderQueryQuestion());
    model.setReminderQueryAnswer(soapModel.getReminderQueryAnswer());
    model.setGraceLoginCount(soapModel.getGraceLoginCount());
    model.setScreenName(soapModel.getScreenName());
    model.setEmailAddress(soapModel.getEmailAddress());
    model.setFacebookId(soapModel.getFacebookId());
    model.setOpenId(soapModel.getOpenId());
    model.setPortraitId(soapModel.getPortraitId());
    model.setLanguageId(soapModel.getLanguageId());
    model.setTimeZoneId(soapModel.getTimeZoneId());
    model.setGreeting(soapModel.getGreeting());
    model.setComments(soapModel.getComments());
    model.setFirstName(soapModel.getFirstName());
    model.setMiddleName(soapModel.getMiddleName());
    model.setLastName(soapModel.getLastName());
    model.setJobTitle(soapModel.getJobTitle());
    model.setLoginDate(soapModel.getLoginDate());
    model.setLoginIP(soapModel.getLoginIP());
    model.setLastLoginDate(soapModel.getLastLoginDate());
    model.setLastLoginIP(soapModel.getLastLoginIP());
    model.setLastFailedLoginDate(soapModel.getLastFailedLoginDate());
    model.setFailedLoginAttempts(soapModel.getFailedLoginAttempts());
    model.setLockout(soapModel.getLockout());
    model.setLockoutDate(soapModel.getLockoutDate());
    model.setAgreedToTermsOfUse(soapModel.getAgreedToTermsOfUse());
    model.setEmailAddressVerified(soapModel.getEmailAddressVerified());
    model.setStatus(soapModel.getStatus());

    return model;
  }
コード例 #3
0
  public void testUpdateExisting() throws Exception {
    long pk = nextLong();

    User newUser = _persistence.create(pk);

    newUser.setUuid(randomString());
    newUser.setCompanyId(nextLong());
    newUser.setCreateDate(nextDate());
    newUser.setModifiedDate(nextDate());
    newUser.setDefaultUser(randomBoolean());
    newUser.setContactId(nextLong());
    newUser.setPassword(randomString());
    newUser.setPasswordEncrypted(randomBoolean());
    newUser.setPasswordReset(randomBoolean());
    newUser.setPasswordModifiedDate(nextDate());
    newUser.setDigest(randomString());
    newUser.setReminderQueryQuestion(randomString());
    newUser.setReminderQueryAnswer(randomString());
    newUser.setGraceLoginCount(nextInt());
    newUser.setScreenName(randomString());
    newUser.setEmailAddress(randomString());
    newUser.setFacebookId(nextLong());
    newUser.setOpenId(randomString());
    newUser.setPortraitId(nextLong());
    newUser.setLanguageId(randomString());
    newUser.setTimeZoneId(randomString());
    newUser.setGreeting(randomString());
    newUser.setComments(randomString());
    newUser.setFirstName(randomString());
    newUser.setMiddleName(randomString());
    newUser.setLastName(randomString());
    newUser.setJobTitle(randomString());
    newUser.setLoginDate(nextDate());
    newUser.setLoginIP(randomString());
    newUser.setLastLoginDate(nextDate());
    newUser.setLastLoginIP(randomString());
    newUser.setLastFailedLoginDate(nextDate());
    newUser.setFailedLoginAttempts(nextInt());
    newUser.setLockout(randomBoolean());
    newUser.setLockoutDate(nextDate());
    newUser.setAgreedToTermsOfUse(randomBoolean());
    newUser.setStatus(nextInt());

    _persistence.update(newUser, false);

    User existingUser = _persistence.findByPrimaryKey(newUser.getPrimaryKey());

    assertEquals(existingUser.getUuid(), newUser.getUuid());
    assertEquals(existingUser.getUserId(), newUser.getUserId());
    assertEquals(existingUser.getCompanyId(), newUser.getCompanyId());
    assertEquals(
        Time.getShortTimestamp(existingUser.getCreateDate()),
        Time.getShortTimestamp(newUser.getCreateDate()));
    assertEquals(
        Time.getShortTimestamp(existingUser.getModifiedDate()),
        Time.getShortTimestamp(newUser.getModifiedDate()));
    assertEquals(existingUser.getDefaultUser(), newUser.getDefaultUser());
    assertEquals(existingUser.getContactId(), newUser.getContactId());
    assertEquals(existingUser.getPassword(), newUser.getPassword());
    assertEquals(existingUser.getPasswordEncrypted(), newUser.getPasswordEncrypted());
    assertEquals(existingUser.getPasswordReset(), newUser.getPasswordReset());
    assertEquals(
        Time.getShortTimestamp(existingUser.getPasswordModifiedDate()),
        Time.getShortTimestamp(newUser.getPasswordModifiedDate()));
    assertEquals(existingUser.getDigest(), newUser.getDigest());
    assertEquals(existingUser.getReminderQueryQuestion(), newUser.getReminderQueryQuestion());
    assertEquals(existingUser.getReminderQueryAnswer(), newUser.getReminderQueryAnswer());
    assertEquals(existingUser.getGraceLoginCount(), newUser.getGraceLoginCount());
    assertEquals(existingUser.getScreenName(), newUser.getScreenName());
    assertEquals(existingUser.getEmailAddress(), newUser.getEmailAddress());
    assertEquals(existingUser.getFacebookId(), newUser.getFacebookId());
    assertEquals(existingUser.getOpenId(), newUser.getOpenId());
    assertEquals(existingUser.getPortraitId(), newUser.getPortraitId());
    assertEquals(existingUser.getLanguageId(), newUser.getLanguageId());
    assertEquals(existingUser.getTimeZoneId(), newUser.getTimeZoneId());
    assertEquals(existingUser.getGreeting(), newUser.getGreeting());
    assertEquals(existingUser.getComments(), newUser.getComments());
    assertEquals(existingUser.getFirstName(), newUser.getFirstName());
    assertEquals(existingUser.getMiddleName(), newUser.getMiddleName());
    assertEquals(existingUser.getLastName(), newUser.getLastName());
    assertEquals(existingUser.getJobTitle(), newUser.getJobTitle());
    assertEquals(
        Time.getShortTimestamp(existingUser.getLoginDate()),
        Time.getShortTimestamp(newUser.getLoginDate()));
    assertEquals(existingUser.getLoginIP(), newUser.getLoginIP());
    assertEquals(
        Time.getShortTimestamp(existingUser.getLastLoginDate()),
        Time.getShortTimestamp(newUser.getLastLoginDate()));
    assertEquals(existingUser.getLastLoginIP(), newUser.getLastLoginIP());
    assertEquals(
        Time.getShortTimestamp(existingUser.getLastFailedLoginDate()),
        Time.getShortTimestamp(newUser.getLastFailedLoginDate()));
    assertEquals(existingUser.getFailedLoginAttempts(), newUser.getFailedLoginAttempts());
    assertEquals(existingUser.getLockout(), newUser.getLockout());
    assertEquals(
        Time.getShortTimestamp(existingUser.getLockoutDate()),
        Time.getShortTimestamp(newUser.getLockoutDate()));
    assertEquals(existingUser.getAgreedToTermsOfUse(), newUser.getAgreedToTermsOfUse());
    assertEquals(existingUser.getStatus(), newUser.getStatus());
  }