protected Website addWebsite() throws Exception {
    long pk = RandomTestUtil.nextLong();

    Website website = _persistence.create(pk);

    website.setMvccVersion(RandomTestUtil.nextLong());

    website.setUuid(RandomTestUtil.randomString());

    website.setCompanyId(RandomTestUtil.nextLong());

    website.setUserId(RandomTestUtil.nextLong());

    website.setUserName(RandomTestUtil.randomString());

    website.setCreateDate(RandomTestUtil.nextDate());

    website.setModifiedDate(RandomTestUtil.nextDate());

    website.setClassNameId(RandomTestUtil.nextLong());

    website.setClassPK(RandomTestUtil.nextLong());

    website.setUrl(RandomTestUtil.randomString());

    website.setTypeId(RandomTestUtil.nextLong());

    website.setPrimary(RandomTestUtil.randomBoolean());

    website.setLastPublishDate(RandomTestUtil.nextDate());

    _websites.add(_persistence.update(website));

    return website;
  }
  protected MBDiscussion addMBDiscussion() throws Exception {
    long pk = RandomTestUtil.nextLong();

    MBDiscussion mbDiscussion = _persistence.create(pk);

    mbDiscussion.setUuid(RandomTestUtil.randomString());

    mbDiscussion.setGroupId(RandomTestUtil.nextLong());

    mbDiscussion.setCompanyId(RandomTestUtil.nextLong());

    mbDiscussion.setUserId(RandomTestUtil.nextLong());

    mbDiscussion.setUserName(RandomTestUtil.randomString());

    mbDiscussion.setCreateDate(RandomTestUtil.nextDate());

    mbDiscussion.setModifiedDate(RandomTestUtil.nextDate());

    mbDiscussion.setClassNameId(RandomTestUtil.nextLong());

    mbDiscussion.setClassPK(RandomTestUtil.nextLong());

    mbDiscussion.setThreadId(RandomTestUtil.nextLong());

    mbDiscussion.setLastPublishDate(RandomTestUtil.nextDate());

    _mbDiscussions.add(_persistence.update(mbDiscussion));

    return mbDiscussion;
  }
  @Test
  public void testUpdateExisting() throws Exception {
    long pk = RandomTestUtil.nextLong();

    RosterMember newRosterMember = _persistence.create(pk);

    newRosterMember.setUuid(RandomTestUtil.randomString());

    newRosterMember.setCreateDate(RandomTestUtil.nextDate());

    newRosterMember.setModifiedDate(RandomTestUtil.nextDate());

    newRosterMember.setRosterId(RandomTestUtil.nextLong());

    newRosterMember.setContactId(RandomTestUtil.nextLong());

    _rosterMembers.add(_persistence.update(newRosterMember));

    RosterMember existingRosterMember =
        _persistence.findByPrimaryKey(newRosterMember.getPrimaryKey());

    Assert.assertEquals(existingRosterMember.getUuid(), newRosterMember.getUuid());
    Assert.assertEquals(
        existingRosterMember.getRosterMemberId(), newRosterMember.getRosterMemberId());
    Assert.assertEquals(
        Time.getShortTimestamp(existingRosterMember.getCreateDate()),
        Time.getShortTimestamp(newRosterMember.getCreateDate()));
    Assert.assertEquals(
        Time.getShortTimestamp(existingRosterMember.getModifiedDate()),
        Time.getShortTimestamp(newRosterMember.getModifiedDate()));
    Assert.assertEquals(existingRosterMember.getRosterId(), newRosterMember.getRosterId());
    Assert.assertEquals(existingRosterMember.getContactId(), newRosterMember.getContactId());
  }
  protected RatingsEntry addRatingsEntry() throws Exception {
    long pk = RandomTestUtil.nextLong();

    RatingsEntry ratingsEntry = _persistence.create(pk);

    ratingsEntry.setUuid(RandomTestUtil.randomString());

    ratingsEntry.setCompanyId(RandomTestUtil.nextLong());

    ratingsEntry.setUserId(RandomTestUtil.nextLong());

    ratingsEntry.setUserName(RandomTestUtil.randomString());

    ratingsEntry.setCreateDate(RandomTestUtil.nextDate());

    ratingsEntry.setModifiedDate(RandomTestUtil.nextDate());

    ratingsEntry.setClassNameId(RandomTestUtil.nextLong());

    ratingsEntry.setClassPK(RandomTestUtil.nextLong());

    ratingsEntry.setScore(RandomTestUtil.nextDouble());

    ratingsEntry.setLastPublishDate(RandomTestUtil.nextDate());

    _ratingsEntries.add(_persistence.update(ratingsEntry));

    return ratingsEntry;
  }
  protected MeetupsRegistration addMeetupsRegistration() throws Exception {
    long pk = RandomTestUtil.nextLong();

    MeetupsRegistration meetupsRegistration = _persistence.create(pk);

    meetupsRegistration.setCompanyId(RandomTestUtil.nextLong());

    meetupsRegistration.setUserId(RandomTestUtil.nextLong());

    meetupsRegistration.setUserName(RandomTestUtil.randomString());

    meetupsRegistration.setCreateDate(RandomTestUtil.nextDate());

    meetupsRegistration.setModifiedDate(RandomTestUtil.nextDate());

    meetupsRegistration.setMeetupsEntryId(RandomTestUtil.nextLong());

    meetupsRegistration.setStatus(RandomTestUtil.nextInt());

    meetupsRegistration.setComments(RandomTestUtil.randomString());

    _meetupsRegistrations.add(_persistence.update(meetupsRegistration));

    return meetupsRegistration;
  }
  protected Team addTeam() throws Exception {
    long pk = RandomTestUtil.nextLong();

    Team team = _persistence.create(pk);

    team.setMvccVersion(RandomTestUtil.nextLong());

    team.setUuid(RandomTestUtil.randomString());

    team.setCompanyId(RandomTestUtil.nextLong());

    team.setUserId(RandomTestUtil.nextLong());

    team.setUserName(RandomTestUtil.randomString());

    team.setCreateDate(RandomTestUtil.nextDate());

    team.setModifiedDate(RandomTestUtil.nextDate());

    team.setGroupId(RandomTestUtil.nextLong());

    team.setName(RandomTestUtil.randomString());

    team.setDescription(RandomTestUtil.randomString());

    team.setLastPublishDate(RandomTestUtil.nextDate());

    _teams.add(_persistence.update(team));

    return team;
  }
  protected MBMailingList addMBMailingList() throws Exception {
    long pk = RandomTestUtil.nextLong();

    MBMailingList mbMailingList = _persistence.create(pk);

    mbMailingList.setUuid(RandomTestUtil.randomString());

    mbMailingList.setGroupId(RandomTestUtil.nextLong());

    mbMailingList.setCompanyId(RandomTestUtil.nextLong());

    mbMailingList.setUserId(RandomTestUtil.nextLong());

    mbMailingList.setUserName(RandomTestUtil.randomString());

    mbMailingList.setCreateDate(RandomTestUtil.nextDate());

    mbMailingList.setModifiedDate(RandomTestUtil.nextDate());

    mbMailingList.setCategoryId(RandomTestUtil.nextLong());

    mbMailingList.setEmailAddress(RandomTestUtil.randomString());

    mbMailingList.setInProtocol(RandomTestUtil.randomString());

    mbMailingList.setInServerName(RandomTestUtil.randomString());

    mbMailingList.setInServerPort(RandomTestUtil.nextInt());

    mbMailingList.setInUseSSL(RandomTestUtil.randomBoolean());

    mbMailingList.setInUserName(RandomTestUtil.randomString());

    mbMailingList.setInPassword(RandomTestUtil.randomString());

    mbMailingList.setInReadInterval(RandomTestUtil.nextInt());

    mbMailingList.setOutEmailAddress(RandomTestUtil.randomString());

    mbMailingList.setOutCustom(RandomTestUtil.randomBoolean());

    mbMailingList.setOutServerName(RandomTestUtil.randomString());

    mbMailingList.setOutServerPort(RandomTestUtil.nextInt());

    mbMailingList.setOutUseSSL(RandomTestUtil.randomBoolean());

    mbMailingList.setOutUserName(RandomTestUtil.randomString());

    mbMailingList.setOutPassword(RandomTestUtil.randomString());

    mbMailingList.setAllowAnonymous(RandomTestUtil.randomBoolean());

    mbMailingList.setActive(RandomTestUtil.randomBoolean());

    _mbMailingLists.add(_persistence.update(mbMailingList));

    return mbMailingList;
  }
  @Test
  public void testUpdateExisting() throws Exception {
    long pk = RandomTestUtil.nextLong();

    Website newWebsite = _persistence.create(pk);

    newWebsite.setMvccVersion(RandomTestUtil.nextLong());

    newWebsite.setUuid(RandomTestUtil.randomString());

    newWebsite.setCompanyId(RandomTestUtil.nextLong());

    newWebsite.setUserId(RandomTestUtil.nextLong());

    newWebsite.setUserName(RandomTestUtil.randomString());

    newWebsite.setCreateDate(RandomTestUtil.nextDate());

    newWebsite.setModifiedDate(RandomTestUtil.nextDate());

    newWebsite.setClassNameId(RandomTestUtil.nextLong());

    newWebsite.setClassPK(RandomTestUtil.nextLong());

    newWebsite.setUrl(RandomTestUtil.randomString());

    newWebsite.setTypeId(RandomTestUtil.nextLong());

    newWebsite.setPrimary(RandomTestUtil.randomBoolean());

    newWebsite.setLastPublishDate(RandomTestUtil.nextDate());

    _websites.add(_persistence.update(newWebsite));

    Website existingWebsite = _persistence.findByPrimaryKey(newWebsite.getPrimaryKey());

    Assert.assertEquals(existingWebsite.getMvccVersion(), newWebsite.getMvccVersion());
    Assert.assertEquals(existingWebsite.getUuid(), newWebsite.getUuid());
    Assert.assertEquals(existingWebsite.getWebsiteId(), newWebsite.getWebsiteId());
    Assert.assertEquals(existingWebsite.getCompanyId(), newWebsite.getCompanyId());
    Assert.assertEquals(existingWebsite.getUserId(), newWebsite.getUserId());
    Assert.assertEquals(existingWebsite.getUserName(), newWebsite.getUserName());
    Assert.assertEquals(
        Time.getShortTimestamp(existingWebsite.getCreateDate()),
        Time.getShortTimestamp(newWebsite.getCreateDate()));
    Assert.assertEquals(
        Time.getShortTimestamp(existingWebsite.getModifiedDate()),
        Time.getShortTimestamp(newWebsite.getModifiedDate()));
    Assert.assertEquals(existingWebsite.getClassNameId(), newWebsite.getClassNameId());
    Assert.assertEquals(existingWebsite.getClassPK(), newWebsite.getClassPK());
    Assert.assertEquals(existingWebsite.getUrl(), newWebsite.getUrl());
    Assert.assertEquals(existingWebsite.getTypeId(), newWebsite.getTypeId());
    Assert.assertEquals(existingWebsite.getPrimary(), newWebsite.getPrimary());
    Assert.assertEquals(
        Time.getShortTimestamp(existingWebsite.getLastPublishDate()),
        Time.getShortTimestamp(newWebsite.getLastPublishDate()));
  }
  @Test
  public void testUpdateExisting() throws Exception {
    long pk = RandomTestUtil.nextLong();

    MBDiscussion newMBDiscussion = _persistence.create(pk);

    newMBDiscussion.setUuid(RandomTestUtil.randomString());

    newMBDiscussion.setGroupId(RandomTestUtil.nextLong());

    newMBDiscussion.setCompanyId(RandomTestUtil.nextLong());

    newMBDiscussion.setUserId(RandomTestUtil.nextLong());

    newMBDiscussion.setUserName(RandomTestUtil.randomString());

    newMBDiscussion.setCreateDate(RandomTestUtil.nextDate());

    newMBDiscussion.setModifiedDate(RandomTestUtil.nextDate());

    newMBDiscussion.setClassNameId(RandomTestUtil.nextLong());

    newMBDiscussion.setClassPK(RandomTestUtil.nextLong());

    newMBDiscussion.setThreadId(RandomTestUtil.nextLong());

    newMBDiscussion.setLastPublishDate(RandomTestUtil.nextDate());

    _mbDiscussions.add(_persistence.update(newMBDiscussion));

    MBDiscussion existingMBDiscussion =
        _persistence.findByPrimaryKey(newMBDiscussion.getPrimaryKey());

    Assert.assertEquals(existingMBDiscussion.getUuid(), newMBDiscussion.getUuid());
    Assert.assertEquals(existingMBDiscussion.getDiscussionId(), newMBDiscussion.getDiscussionId());
    Assert.assertEquals(existingMBDiscussion.getGroupId(), newMBDiscussion.getGroupId());
    Assert.assertEquals(existingMBDiscussion.getCompanyId(), newMBDiscussion.getCompanyId());
    Assert.assertEquals(existingMBDiscussion.getUserId(), newMBDiscussion.getUserId());
    Assert.assertEquals(existingMBDiscussion.getUserName(), newMBDiscussion.getUserName());
    Assert.assertEquals(
        Time.getShortTimestamp(existingMBDiscussion.getCreateDate()),
        Time.getShortTimestamp(newMBDiscussion.getCreateDate()));
    Assert.assertEquals(
        Time.getShortTimestamp(existingMBDiscussion.getModifiedDate()),
        Time.getShortTimestamp(newMBDiscussion.getModifiedDate()));
    Assert.assertEquals(existingMBDiscussion.getClassNameId(), newMBDiscussion.getClassNameId());
    Assert.assertEquals(existingMBDiscussion.getClassPK(), newMBDiscussion.getClassPK());
    Assert.assertEquals(existingMBDiscussion.getThreadId(), newMBDiscussion.getThreadId());
    Assert.assertEquals(
        Time.getShortTimestamp(existingMBDiscussion.getLastPublishDate()),
        Time.getShortTimestamp(newMBDiscussion.getLastPublishDate()));
  }
  @Test
  public void testUpdateExisting() throws Exception {
    long pk = RandomTestUtil.nextLong();

    Team newTeam = _persistence.create(pk);

    newTeam.setMvccVersion(RandomTestUtil.nextLong());

    newTeam.setUuid(RandomTestUtil.randomString());

    newTeam.setCompanyId(RandomTestUtil.nextLong());

    newTeam.setUserId(RandomTestUtil.nextLong());

    newTeam.setUserName(RandomTestUtil.randomString());

    newTeam.setCreateDate(RandomTestUtil.nextDate());

    newTeam.setModifiedDate(RandomTestUtil.nextDate());

    newTeam.setGroupId(RandomTestUtil.nextLong());

    newTeam.setName(RandomTestUtil.randomString());

    newTeam.setDescription(RandomTestUtil.randomString());

    newTeam.setLastPublishDate(RandomTestUtil.nextDate());

    _teams.add(_persistence.update(newTeam));

    Team existingTeam = _persistence.findByPrimaryKey(newTeam.getPrimaryKey());

    Assert.assertEquals(existingTeam.getMvccVersion(), newTeam.getMvccVersion());
    Assert.assertEquals(existingTeam.getUuid(), newTeam.getUuid());
    Assert.assertEquals(existingTeam.getTeamId(), newTeam.getTeamId());
    Assert.assertEquals(existingTeam.getCompanyId(), newTeam.getCompanyId());
    Assert.assertEquals(existingTeam.getUserId(), newTeam.getUserId());
    Assert.assertEquals(existingTeam.getUserName(), newTeam.getUserName());
    Assert.assertEquals(
        Time.getShortTimestamp(existingTeam.getCreateDate()),
        Time.getShortTimestamp(newTeam.getCreateDate()));
    Assert.assertEquals(
        Time.getShortTimestamp(existingTeam.getModifiedDate()),
        Time.getShortTimestamp(newTeam.getModifiedDate()));
    Assert.assertEquals(existingTeam.getGroupId(), newTeam.getGroupId());
    Assert.assertEquals(existingTeam.getName(), newTeam.getName());
    Assert.assertEquals(existingTeam.getDescription(), newTeam.getDescription());
    Assert.assertEquals(
        Time.getShortTimestamp(existingTeam.getLastPublishDate()),
        Time.getShortTimestamp(newTeam.getLastPublishDate()));
  }
  @Test
  public void testUpdateExisting() throws Exception {
    long pk = RandomTestUtil.nextLong();

    MeetupsRegistration newMeetupsRegistration = _persistence.create(pk);

    newMeetupsRegistration.setCompanyId(RandomTestUtil.nextLong());

    newMeetupsRegistration.setUserId(RandomTestUtil.nextLong());

    newMeetupsRegistration.setUserName(RandomTestUtil.randomString());

    newMeetupsRegistration.setCreateDate(RandomTestUtil.nextDate());

    newMeetupsRegistration.setModifiedDate(RandomTestUtil.nextDate());

    newMeetupsRegistration.setMeetupsEntryId(RandomTestUtil.nextLong());

    newMeetupsRegistration.setStatus(RandomTestUtil.nextInt());

    newMeetupsRegistration.setComments(RandomTestUtil.randomString());

    _meetupsRegistrations.add(_persistence.update(newMeetupsRegistration));

    MeetupsRegistration existingMeetupsRegistration =
        _persistence.findByPrimaryKey(newMeetupsRegistration.getPrimaryKey());

    Assert.assertEquals(
        existingMeetupsRegistration.getMeetupsRegistrationId(),
        newMeetupsRegistration.getMeetupsRegistrationId());
    Assert.assertEquals(
        existingMeetupsRegistration.getCompanyId(), newMeetupsRegistration.getCompanyId());
    Assert.assertEquals(
        existingMeetupsRegistration.getUserId(), newMeetupsRegistration.getUserId());
    Assert.assertEquals(
        existingMeetupsRegistration.getUserName(), newMeetupsRegistration.getUserName());
    Assert.assertEquals(
        Time.getShortTimestamp(existingMeetupsRegistration.getCreateDate()),
        Time.getShortTimestamp(newMeetupsRegistration.getCreateDate()));
    Assert.assertEquals(
        Time.getShortTimestamp(existingMeetupsRegistration.getModifiedDate()),
        Time.getShortTimestamp(newMeetupsRegistration.getModifiedDate()));
    Assert.assertEquals(
        existingMeetupsRegistration.getMeetupsEntryId(),
        newMeetupsRegistration.getMeetupsEntryId());
    Assert.assertEquals(
        existingMeetupsRegistration.getStatus(), newMeetupsRegistration.getStatus());
    Assert.assertEquals(
        existingMeetupsRegistration.getComments(), newMeetupsRegistration.getComments());
  }
  protected Address addAddress() throws Exception {
    long pk = RandomTestUtil.nextLong();

    Address address = _persistence.create(pk);

    address.setMvccVersion(RandomTestUtil.nextLong());

    address.setUuid(RandomTestUtil.randomString());

    address.setCompanyId(RandomTestUtil.nextLong());

    address.setUserId(RandomTestUtil.nextLong());

    address.setUserName(RandomTestUtil.randomString());

    address.setCreateDate(RandomTestUtil.nextDate());

    address.setModifiedDate(RandomTestUtil.nextDate());

    address.setClassNameId(RandomTestUtil.nextLong());

    address.setClassPK(RandomTestUtil.nextLong());

    address.setStreet1(RandomTestUtil.randomString());

    address.setStreet2(RandomTestUtil.randomString());

    address.setStreet3(RandomTestUtil.randomString());

    address.setCity(RandomTestUtil.randomString());

    address.setZip(RandomTestUtil.randomString());

    address.setRegionId(RandomTestUtil.nextLong());

    address.setCountryId(RandomTestUtil.nextLong());

    address.setTypeId(RandomTestUtil.nextLong());

    address.setMailing(RandomTestUtil.randomBoolean());

    address.setPrimary(RandomTestUtil.randomBoolean());

    address.setLastPublishDate(RandomTestUtil.nextDate());

    _addresses.add(_persistence.update(address));

    return address;
  }
  @Test
  public void testUpdateExisting() throws Exception {
    long pk = RandomTestUtil.nextLong();

    RatingsEntry newRatingsEntry = _persistence.create(pk);

    newRatingsEntry.setUuid(RandomTestUtil.randomString());

    newRatingsEntry.setCompanyId(RandomTestUtil.nextLong());

    newRatingsEntry.setUserId(RandomTestUtil.nextLong());

    newRatingsEntry.setUserName(RandomTestUtil.randomString());

    newRatingsEntry.setCreateDate(RandomTestUtil.nextDate());

    newRatingsEntry.setModifiedDate(RandomTestUtil.nextDate());

    newRatingsEntry.setClassNameId(RandomTestUtil.nextLong());

    newRatingsEntry.setClassPK(RandomTestUtil.nextLong());

    newRatingsEntry.setScore(RandomTestUtil.nextDouble());

    newRatingsEntry.setLastPublishDate(RandomTestUtil.nextDate());

    _ratingsEntries.add(_persistence.update(newRatingsEntry));

    RatingsEntry existingRatingsEntry =
        _persistence.findByPrimaryKey(newRatingsEntry.getPrimaryKey());

    Assert.assertEquals(existingRatingsEntry.getUuid(), newRatingsEntry.getUuid());
    Assert.assertEquals(existingRatingsEntry.getEntryId(), newRatingsEntry.getEntryId());
    Assert.assertEquals(existingRatingsEntry.getCompanyId(), newRatingsEntry.getCompanyId());
    Assert.assertEquals(existingRatingsEntry.getUserId(), newRatingsEntry.getUserId());
    Assert.assertEquals(existingRatingsEntry.getUserName(), newRatingsEntry.getUserName());
    Assert.assertEquals(
        Time.getShortTimestamp(existingRatingsEntry.getCreateDate()),
        Time.getShortTimestamp(newRatingsEntry.getCreateDate()));
    Assert.assertEquals(
        Time.getShortTimestamp(existingRatingsEntry.getModifiedDate()),
        Time.getShortTimestamp(newRatingsEntry.getModifiedDate()));
    Assert.assertEquals(existingRatingsEntry.getClassNameId(), newRatingsEntry.getClassNameId());
    Assert.assertEquals(existingRatingsEntry.getClassPK(), newRatingsEntry.getClassPK());
    AssertUtils.assertEquals(existingRatingsEntry.getScore(), newRatingsEntry.getScore());
    Assert.assertEquals(
        Time.getShortTimestamp(existingRatingsEntry.getLastPublishDate()),
        Time.getShortTimestamp(newRatingsEntry.getLastPublishDate()));
  }
  @Test
  public void testUpdateExisting() throws Exception {
    long pk = RandomTestUtil.nextLong();

    PasswordTracker newPasswordTracker = _persistence.create(pk);

    newPasswordTracker.setMvccVersion(RandomTestUtil.nextLong());

    newPasswordTracker.setCompanyId(RandomTestUtil.nextLong());

    newPasswordTracker.setUserId(RandomTestUtil.nextLong());

    newPasswordTracker.setCreateDate(RandomTestUtil.nextDate());

    newPasswordTracker.setPassword(RandomTestUtil.randomString());

    _passwordTrackers.add(_persistence.update(newPasswordTracker));

    PasswordTracker existingPasswordTracker =
        _persistence.findByPrimaryKey(newPasswordTracker.getPrimaryKey());

    Assert.assertEquals(
        existingPasswordTracker.getMvccVersion(), newPasswordTracker.getMvccVersion());
    Assert.assertEquals(
        existingPasswordTracker.getPasswordTrackerId(), newPasswordTracker.getPasswordTrackerId());
    Assert.assertEquals(existingPasswordTracker.getCompanyId(), newPasswordTracker.getCompanyId());
    Assert.assertEquals(existingPasswordTracker.getUserId(), newPasswordTracker.getUserId());
    Assert.assertEquals(
        Time.getShortTimestamp(existingPasswordTracker.getCreateDate()),
        Time.getShortTimestamp(newPasswordTracker.getCreateDate()));
    Assert.assertEquals(existingPasswordTracker.getPassword(), newPasswordTracker.getPassword());
  }
  @Test
  public void testUpdateExisting() throws Exception {
    long pk = RandomTestUtil.nextLong();

    SystemEvent newSystemEvent = _persistence.create(pk);

    newSystemEvent.setMvccVersion(RandomTestUtil.nextLong());

    newSystemEvent.setGroupId(RandomTestUtil.nextLong());

    newSystemEvent.setCompanyId(RandomTestUtil.nextLong());

    newSystemEvent.setUserId(RandomTestUtil.nextLong());

    newSystemEvent.setUserName(RandomTestUtil.randomString());

    newSystemEvent.setCreateDate(RandomTestUtil.nextDate());

    newSystemEvent.setClassNameId(RandomTestUtil.nextLong());

    newSystemEvent.setClassPK(RandomTestUtil.nextLong());

    newSystemEvent.setClassUuid(RandomTestUtil.randomString());

    newSystemEvent.setReferrerClassNameId(RandomTestUtil.nextLong());

    newSystemEvent.setParentSystemEventId(RandomTestUtil.nextLong());

    newSystemEvent.setSystemEventSetKey(RandomTestUtil.nextLong());

    newSystemEvent.setType(RandomTestUtil.nextInt());

    newSystemEvent.setExtraData(RandomTestUtil.randomString());

    _systemEvents.add(_persistence.update(newSystemEvent));

    SystemEvent existingSystemEvent = _persistence.findByPrimaryKey(newSystemEvent.getPrimaryKey());

    Assert.assertEquals(existingSystemEvent.getMvccVersion(), newSystemEvent.getMvccVersion());
    Assert.assertEquals(existingSystemEvent.getSystemEventId(), newSystemEvent.getSystemEventId());
    Assert.assertEquals(existingSystemEvent.getGroupId(), newSystemEvent.getGroupId());
    Assert.assertEquals(existingSystemEvent.getCompanyId(), newSystemEvent.getCompanyId());
    Assert.assertEquals(existingSystemEvent.getUserId(), newSystemEvent.getUserId());
    Assert.assertEquals(existingSystemEvent.getUserName(), newSystemEvent.getUserName());
    Assert.assertEquals(
        Time.getShortTimestamp(existingSystemEvent.getCreateDate()),
        Time.getShortTimestamp(newSystemEvent.getCreateDate()));
    Assert.assertEquals(existingSystemEvent.getClassNameId(), newSystemEvent.getClassNameId());
    Assert.assertEquals(existingSystemEvent.getClassPK(), newSystemEvent.getClassPK());
    Assert.assertEquals(existingSystemEvent.getClassUuid(), newSystemEvent.getClassUuid());
    Assert.assertEquals(
        existingSystemEvent.getReferrerClassNameId(), newSystemEvent.getReferrerClassNameId());
    Assert.assertEquals(
        existingSystemEvent.getParentSystemEventId(), newSystemEvent.getParentSystemEventId());
    Assert.assertEquals(
        existingSystemEvent.getSystemEventSetKey(), newSystemEvent.getSystemEventSetKey());
    Assert.assertEquals(existingSystemEvent.getType(), newSystemEvent.getType());
    Assert.assertEquals(existingSystemEvent.getExtraData(), newSystemEvent.getExtraData());
  }
  protected KaleoTaskInstanceToken addKaleoTaskInstanceToken() throws Exception {
    long pk = RandomTestUtil.nextLong();

    KaleoTaskInstanceToken kaleoTaskInstanceToken = _persistence.create(pk);

    kaleoTaskInstanceToken.setGroupId(RandomTestUtil.nextLong());

    kaleoTaskInstanceToken.setCompanyId(RandomTestUtil.nextLong());

    kaleoTaskInstanceToken.setUserId(RandomTestUtil.nextLong());

    kaleoTaskInstanceToken.setUserName(RandomTestUtil.randomString());

    kaleoTaskInstanceToken.setCreateDate(RandomTestUtil.nextDate());

    kaleoTaskInstanceToken.setModifiedDate(RandomTestUtil.nextDate());

    kaleoTaskInstanceToken.setKaleoDefinitionId(RandomTestUtil.nextLong());

    kaleoTaskInstanceToken.setKaleoInstanceId(RandomTestUtil.nextLong());

    kaleoTaskInstanceToken.setKaleoInstanceTokenId(RandomTestUtil.nextLong());

    kaleoTaskInstanceToken.setKaleoTaskId(RandomTestUtil.nextLong());

    kaleoTaskInstanceToken.setKaleoTaskName(RandomTestUtil.randomString());

    kaleoTaskInstanceToken.setClassName(RandomTestUtil.randomString());

    kaleoTaskInstanceToken.setClassPK(RandomTestUtil.nextLong());

    kaleoTaskInstanceToken.setCompletionUserId(RandomTestUtil.nextLong());

    kaleoTaskInstanceToken.setCompleted(RandomTestUtil.randomBoolean());

    kaleoTaskInstanceToken.setCompletionDate(RandomTestUtil.nextDate());

    kaleoTaskInstanceToken.setDueDate(RandomTestUtil.nextDate());

    kaleoTaskInstanceToken.setWorkflowContext(RandomTestUtil.randomString());

    _kaleoTaskInstanceTokens.add(_persistence.update(kaleoTaskInstanceToken));

    return kaleoTaskInstanceToken;
  }
  protected Calendar addCalendar() throws Exception {
    long pk = RandomTestUtil.nextLong();

    Calendar calendar = _persistence.create(pk);

    calendar.setUuid(RandomTestUtil.randomString());

    calendar.setGroupId(RandomTestUtil.nextLong());

    calendar.setCompanyId(RandomTestUtil.nextLong());

    calendar.setUserId(RandomTestUtil.nextLong());

    calendar.setUserName(RandomTestUtil.randomString());

    calendar.setCreateDate(RandomTestUtil.nextDate());

    calendar.setModifiedDate(RandomTestUtil.nextDate());

    calendar.setResourceBlockId(RandomTestUtil.nextLong());

    calendar.setCalendarResourceId(RandomTestUtil.nextLong());

    calendar.setName(RandomTestUtil.randomString());

    calendar.setDescription(RandomTestUtil.randomString());

    calendar.setTimeZoneId(RandomTestUtil.randomString());

    calendar.setColor(RandomTestUtil.nextInt());

    calendar.setDefaultCalendar(RandomTestUtil.randomBoolean());

    calendar.setEnableComments(RandomTestUtil.randomBoolean());

    calendar.setEnableRatings(RandomTestUtil.randomBoolean());

    calendar.setLastPublishDate(RandomTestUtil.nextDate());

    _calendars.add(_persistence.update(calendar));

    return calendar;
  }
  protected RosterMember addRosterMember() throws Exception {
    long pk = RandomTestUtil.nextLong();

    RosterMember rosterMember = _persistence.create(pk);

    rosterMember.setUuid(RandomTestUtil.randomString());

    rosterMember.setCreateDate(RandomTestUtil.nextDate());

    rosterMember.setModifiedDate(RandomTestUtil.nextDate());

    rosterMember.setRosterId(RandomTestUtil.nextLong());

    rosterMember.setContactId(RandomTestUtil.nextLong());

    _rosterMembers.add(_persistence.update(rosterMember));

    return rosterMember;
  }
  protected LayoutSet addLayoutSet() throws Exception {
    long pk = RandomTestUtil.nextLong();

    LayoutSet layoutSet = _persistence.create(pk);

    layoutSet.setMvccVersion(RandomTestUtil.nextLong());

    layoutSet.setGroupId(RandomTestUtil.nextLong());

    layoutSet.setCompanyId(RandomTestUtil.nextLong());

    layoutSet.setCreateDate(RandomTestUtil.nextDate());

    layoutSet.setModifiedDate(RandomTestUtil.nextDate());

    layoutSet.setPrivateLayout(RandomTestUtil.randomBoolean());

    layoutSet.setLogoId(RandomTestUtil.nextLong());

    layoutSet.setThemeId(RandomTestUtil.randomString());

    layoutSet.setColorSchemeId(RandomTestUtil.randomString());

    layoutSet.setWapThemeId(RandomTestUtil.randomString());

    layoutSet.setWapColorSchemeId(RandomTestUtil.randomString());

    layoutSet.setCss(RandomTestUtil.randomString());

    layoutSet.setPageCount(RandomTestUtil.nextInt());

    layoutSet.setSettings(RandomTestUtil.randomString());

    layoutSet.setLayoutSetPrototypeUuid(RandomTestUtil.randomString());

    layoutSet.setLayoutSetPrototypeLinkEnabled(RandomTestUtil.randomBoolean());

    _layoutSets.add(_persistence.update(layoutSet));

    return layoutSet;
  }
  protected CalendarResource addCalendarResource() throws Exception {
    long pk = RandomTestUtil.nextLong();

    CalendarResource calendarResource = _persistence.create(pk);

    calendarResource.setUuid(RandomTestUtil.randomString());

    calendarResource.setGroupId(RandomTestUtil.nextLong());

    calendarResource.setCompanyId(RandomTestUtil.nextLong());

    calendarResource.setUserId(RandomTestUtil.nextLong());

    calendarResource.setUserName(RandomTestUtil.randomString());

    calendarResource.setCreateDate(RandomTestUtil.nextDate());

    calendarResource.setModifiedDate(RandomTestUtil.nextDate());

    calendarResource.setResourceBlockId(RandomTestUtil.nextLong());

    calendarResource.setClassNameId(RandomTestUtil.nextLong());

    calendarResource.setClassPK(RandomTestUtil.nextLong());

    calendarResource.setClassUuid(RandomTestUtil.randomString());

    calendarResource.setCode(RandomTestUtil.randomString());

    calendarResource.setName(RandomTestUtil.randomString());

    calendarResource.setDescription(RandomTestUtil.randomString());

    calendarResource.setActive(RandomTestUtil.randomBoolean());

    calendarResource.setLastPublishDate(RandomTestUtil.nextDate());

    _calendarResources.add(_persistence.update(calendarResource));

    return calendarResource;
  }
  protected KaleoNotificationRecipient addKaleoNotificationRecipient() throws Exception {
    long pk = RandomTestUtil.nextLong();

    KaleoNotificationRecipient kaleoNotificationRecipient = _persistence.create(pk);

    kaleoNotificationRecipient.setGroupId(RandomTestUtil.nextLong());

    kaleoNotificationRecipient.setCompanyId(RandomTestUtil.nextLong());

    kaleoNotificationRecipient.setUserId(RandomTestUtil.nextLong());

    kaleoNotificationRecipient.setUserName(RandomTestUtil.randomString());

    kaleoNotificationRecipient.setCreateDate(RandomTestUtil.nextDate());

    kaleoNotificationRecipient.setModifiedDate(RandomTestUtil.nextDate());

    kaleoNotificationRecipient.setKaleoDefinitionId(RandomTestUtil.nextLong());

    kaleoNotificationRecipient.setKaleoNotificationId(RandomTestUtil.nextLong());

    kaleoNotificationRecipient.setRecipientClassName(RandomTestUtil.randomString());

    kaleoNotificationRecipient.setRecipientClassPK(RandomTestUtil.nextLong());

    kaleoNotificationRecipient.setRecipientRoleType(RandomTestUtil.nextInt());

    kaleoNotificationRecipient.setRecipientScript(RandomTestUtil.randomString());

    kaleoNotificationRecipient.setRecipientScriptLanguage(RandomTestUtil.randomString());

    kaleoNotificationRecipient.setRecipientScriptContexts(RandomTestUtil.randomString());

    kaleoNotificationRecipient.setAddress(RandomTestUtil.randomString());

    kaleoNotificationRecipient.setNotificationReceptionType(RandomTestUtil.randomString(3));

    _kaleoNotificationRecipients.add(_persistence.update(kaleoNotificationRecipient));

    return kaleoNotificationRecipient;
  }
  protected DDLRecordVersion addDDLRecordVersion() throws Exception {
    long pk = RandomTestUtil.nextLong();

    DDLRecordVersion ddlRecordVersion = _persistence.create(pk);

    ddlRecordVersion.setGroupId(RandomTestUtil.nextLong());

    ddlRecordVersion.setCompanyId(RandomTestUtil.nextLong());

    ddlRecordVersion.setUserId(RandomTestUtil.nextLong());

    ddlRecordVersion.setUserName(RandomTestUtil.randomString());

    ddlRecordVersion.setCreateDate(RandomTestUtil.nextDate());

    ddlRecordVersion.setDDMStorageId(RandomTestUtil.nextLong());

    ddlRecordVersion.setRecordSetId(RandomTestUtil.nextLong());

    ddlRecordVersion.setRecordId(RandomTestUtil.nextLong());

    ddlRecordVersion.setVersion(RandomTestUtil.randomString());

    ddlRecordVersion.setDisplayIndex(RandomTestUtil.nextInt());

    ddlRecordVersion.setStatus(RandomTestUtil.nextInt());

    ddlRecordVersion.setStatusByUserId(RandomTestUtil.nextLong());

    ddlRecordVersion.setStatusByUserName(RandomTestUtil.randomString());

    ddlRecordVersion.setStatusDate(RandomTestUtil.nextDate());

    _ddlRecordVersions.add(_persistence.update(ddlRecordVersion));

    return ddlRecordVersion;
  }
  protected PasswordTracker addPasswordTracker() throws Exception {
    long pk = RandomTestUtil.nextLong();

    PasswordTracker passwordTracker = _persistence.create(pk);

    passwordTracker.setMvccVersion(RandomTestUtil.nextLong());

    passwordTracker.setCompanyId(RandomTestUtil.nextLong());

    passwordTracker.setUserId(RandomTestUtil.nextLong());

    passwordTracker.setCreateDate(RandomTestUtil.nextDate());

    passwordTracker.setPassword(RandomTestUtil.randomString());

    _passwordTrackers.add(_persistence.update(passwordTracker));

    return passwordTracker;
  }
  protected SystemEvent addSystemEvent() throws Exception {
    long pk = RandomTestUtil.nextLong();

    SystemEvent systemEvent = _persistence.create(pk);

    systemEvent.setMvccVersion(RandomTestUtil.nextLong());

    systemEvent.setGroupId(RandomTestUtil.nextLong());

    systemEvent.setCompanyId(RandomTestUtil.nextLong());

    systemEvent.setUserId(RandomTestUtil.nextLong());

    systemEvent.setUserName(RandomTestUtil.randomString());

    systemEvent.setCreateDate(RandomTestUtil.nextDate());

    systemEvent.setClassNameId(RandomTestUtil.nextLong());

    systemEvent.setClassPK(RandomTestUtil.nextLong());

    systemEvent.setClassUuid(RandomTestUtil.randomString());

    systemEvent.setReferrerClassNameId(RandomTestUtil.nextLong());

    systemEvent.setParentSystemEventId(RandomTestUtil.nextLong());

    systemEvent.setSystemEventSetKey(RandomTestUtil.nextLong());

    systemEvent.setType(RandomTestUtil.nextInt());

    systemEvent.setExtraData(RandomTestUtil.randomString());

    _systemEvents.add(_persistence.update(systemEvent));

    return systemEvent;
  }
  @Test
  public void testUpdateExisting() throws Exception {
    long pk = RandomTestUtil.nextLong();

    CalendarResource newCalendarResource = _persistence.create(pk);

    newCalendarResource.setUuid(RandomTestUtil.randomString());

    newCalendarResource.setGroupId(RandomTestUtil.nextLong());

    newCalendarResource.setCompanyId(RandomTestUtil.nextLong());

    newCalendarResource.setUserId(RandomTestUtil.nextLong());

    newCalendarResource.setUserName(RandomTestUtil.randomString());

    newCalendarResource.setCreateDate(RandomTestUtil.nextDate());

    newCalendarResource.setModifiedDate(RandomTestUtil.nextDate());

    newCalendarResource.setResourceBlockId(RandomTestUtil.nextLong());

    newCalendarResource.setClassNameId(RandomTestUtil.nextLong());

    newCalendarResource.setClassPK(RandomTestUtil.nextLong());

    newCalendarResource.setClassUuid(RandomTestUtil.randomString());

    newCalendarResource.setCode(RandomTestUtil.randomString());

    newCalendarResource.setName(RandomTestUtil.randomString());

    newCalendarResource.setDescription(RandomTestUtil.randomString());

    newCalendarResource.setActive(RandomTestUtil.randomBoolean());

    newCalendarResource.setLastPublishDate(RandomTestUtil.nextDate());

    _calendarResources.add(_persistence.update(newCalendarResource));

    CalendarResource existingCalendarResource =
        _persistence.findByPrimaryKey(newCalendarResource.getPrimaryKey());

    Assert.assertEquals(existingCalendarResource.getUuid(), newCalendarResource.getUuid());
    Assert.assertEquals(
        existingCalendarResource.getCalendarResourceId(),
        newCalendarResource.getCalendarResourceId());
    Assert.assertEquals(existingCalendarResource.getGroupId(), newCalendarResource.getGroupId());
    Assert.assertEquals(
        existingCalendarResource.getCompanyId(), newCalendarResource.getCompanyId());
    Assert.assertEquals(existingCalendarResource.getUserId(), newCalendarResource.getUserId());
    Assert.assertEquals(existingCalendarResource.getUserName(), newCalendarResource.getUserName());
    Assert.assertEquals(
        Time.getShortTimestamp(existingCalendarResource.getCreateDate()),
        Time.getShortTimestamp(newCalendarResource.getCreateDate()));
    Assert.assertEquals(
        Time.getShortTimestamp(existingCalendarResource.getModifiedDate()),
        Time.getShortTimestamp(newCalendarResource.getModifiedDate()));
    Assert.assertEquals(
        existingCalendarResource.getResourceBlockId(), newCalendarResource.getResourceBlockId());
    Assert.assertEquals(
        existingCalendarResource.getClassNameId(), newCalendarResource.getClassNameId());
    Assert.assertEquals(existingCalendarResource.getClassPK(), newCalendarResource.getClassPK());
    Assert.assertEquals(
        existingCalendarResource.getClassUuid(), newCalendarResource.getClassUuid());
    Assert.assertEquals(existingCalendarResource.getCode(), newCalendarResource.getCode());
    Assert.assertEquals(existingCalendarResource.getName(), newCalendarResource.getName());
    Assert.assertEquals(
        existingCalendarResource.getDescription(), newCalendarResource.getDescription());
    Assert.assertEquals(existingCalendarResource.getActive(), newCalendarResource.getActive());
    Assert.assertEquals(
        Time.getShortTimestamp(existingCalendarResource.getLastPublishDate()),
        Time.getShortTimestamp(newCalendarResource.getLastPublishDate()));
  }
  @Test
  public void testUpdateExisting() throws Exception {
    long pk = RandomTestUtil.nextLong();

    DLFileEntry newDLFileEntry = _persistence.create(pk);

    newDLFileEntry.setUuid(RandomTestUtil.randomString());

    newDLFileEntry.setGroupId(RandomTestUtil.nextLong());

    newDLFileEntry.setCompanyId(RandomTestUtil.nextLong());

    newDLFileEntry.setUserId(RandomTestUtil.nextLong());

    newDLFileEntry.setUserName(RandomTestUtil.randomString());

    newDLFileEntry.setCreateDate(RandomTestUtil.nextDate());

    newDLFileEntry.setModifiedDate(RandomTestUtil.nextDate());

    newDLFileEntry.setClassNameId(RandomTestUtil.nextLong());

    newDLFileEntry.setClassPK(RandomTestUtil.nextLong());

    newDLFileEntry.setRepositoryId(RandomTestUtil.nextLong());

    newDLFileEntry.setFolderId(RandomTestUtil.nextLong());

    newDLFileEntry.setTreePath(RandomTestUtil.randomString());

    newDLFileEntry.setName(RandomTestUtil.randomString());

    newDLFileEntry.setFileName(RandomTestUtil.randomString());

    newDLFileEntry.setExtension(RandomTestUtil.randomString());

    newDLFileEntry.setMimeType(RandomTestUtil.randomString());

    newDLFileEntry.setTitle(RandomTestUtil.randomString());

    newDLFileEntry.setDescription(RandomTestUtil.randomString());

    newDLFileEntry.setExtraSettings(RandomTestUtil.randomString());

    newDLFileEntry.setFileEntryTypeId(RandomTestUtil.nextLong());

    newDLFileEntry.setVersion(RandomTestUtil.randomString());

    newDLFileEntry.setSize(RandomTestUtil.nextLong());

    newDLFileEntry.setReadCount(RandomTestUtil.nextInt());

    newDLFileEntry.setSmallImageId(RandomTestUtil.nextLong());

    newDLFileEntry.setLargeImageId(RandomTestUtil.nextLong());

    newDLFileEntry.setCustom1ImageId(RandomTestUtil.nextLong());

    newDLFileEntry.setCustom2ImageId(RandomTestUtil.nextLong());

    newDLFileEntry.setManualCheckInRequired(RandomTestUtil.randomBoolean());

    newDLFileEntry.setLastPublishDate(RandomTestUtil.nextDate());

    _dlFileEntries.add(_persistence.update(newDLFileEntry));

    DLFileEntry existingDLFileEntry = _persistence.findByPrimaryKey(newDLFileEntry.getPrimaryKey());

    Assert.assertEquals(existingDLFileEntry.getUuid(), newDLFileEntry.getUuid());
    Assert.assertEquals(existingDLFileEntry.getFileEntryId(), newDLFileEntry.getFileEntryId());
    Assert.assertEquals(existingDLFileEntry.getGroupId(), newDLFileEntry.getGroupId());
    Assert.assertEquals(existingDLFileEntry.getCompanyId(), newDLFileEntry.getCompanyId());
    Assert.assertEquals(existingDLFileEntry.getUserId(), newDLFileEntry.getUserId());
    Assert.assertEquals(existingDLFileEntry.getUserName(), newDLFileEntry.getUserName());
    Assert.assertEquals(
        Time.getShortTimestamp(existingDLFileEntry.getCreateDate()),
        Time.getShortTimestamp(newDLFileEntry.getCreateDate()));
    Assert.assertEquals(
        Time.getShortTimestamp(existingDLFileEntry.getModifiedDate()),
        Time.getShortTimestamp(newDLFileEntry.getModifiedDate()));
    Assert.assertEquals(existingDLFileEntry.getClassNameId(), newDLFileEntry.getClassNameId());
    Assert.assertEquals(existingDLFileEntry.getClassPK(), newDLFileEntry.getClassPK());
    Assert.assertEquals(existingDLFileEntry.getRepositoryId(), newDLFileEntry.getRepositoryId());
    Assert.assertEquals(existingDLFileEntry.getFolderId(), newDLFileEntry.getFolderId());
    Assert.assertEquals(existingDLFileEntry.getTreePath(), newDLFileEntry.getTreePath());
    Assert.assertEquals(existingDLFileEntry.getName(), newDLFileEntry.getName());
    Assert.assertEquals(existingDLFileEntry.getFileName(), newDLFileEntry.getFileName());
    Assert.assertEquals(existingDLFileEntry.getExtension(), newDLFileEntry.getExtension());
    Assert.assertEquals(existingDLFileEntry.getMimeType(), newDLFileEntry.getMimeType());
    Assert.assertEquals(existingDLFileEntry.getTitle(), newDLFileEntry.getTitle());
    Assert.assertEquals(existingDLFileEntry.getDescription(), newDLFileEntry.getDescription());
    Assert.assertEquals(existingDLFileEntry.getExtraSettings(), newDLFileEntry.getExtraSettings());
    Assert.assertEquals(
        existingDLFileEntry.getFileEntryTypeId(), newDLFileEntry.getFileEntryTypeId());
    Assert.assertEquals(existingDLFileEntry.getVersion(), newDLFileEntry.getVersion());
    Assert.assertEquals(existingDLFileEntry.getSize(), newDLFileEntry.getSize());
    Assert.assertEquals(existingDLFileEntry.getReadCount(), newDLFileEntry.getReadCount());
    Assert.assertEquals(existingDLFileEntry.getSmallImageId(), newDLFileEntry.getSmallImageId());
    Assert.assertEquals(existingDLFileEntry.getLargeImageId(), newDLFileEntry.getLargeImageId());
    Assert.assertEquals(
        existingDLFileEntry.getCustom1ImageId(), newDLFileEntry.getCustom1ImageId());
    Assert.assertEquals(
        existingDLFileEntry.getCustom2ImageId(), newDLFileEntry.getCustom2ImageId());
    Assert.assertEquals(
        existingDLFileEntry.getManualCheckInRequired(), newDLFileEntry.getManualCheckInRequired());
    Assert.assertEquals(
        Time.getShortTimestamp(existingDLFileEntry.getLastPublishDate()),
        Time.getShortTimestamp(newDLFileEntry.getLastPublishDate()));
  }
  protected ShoppingOrder addShoppingOrder() throws Exception {
    long pk = RandomTestUtil.nextLong();

    ShoppingOrder shoppingOrder = _persistence.create(pk);

    shoppingOrder.setGroupId(RandomTestUtil.nextLong());

    shoppingOrder.setCompanyId(RandomTestUtil.nextLong());

    shoppingOrder.setUserId(RandomTestUtil.nextLong());

    shoppingOrder.setUserName(RandomTestUtil.randomString());

    shoppingOrder.setCreateDate(RandomTestUtil.nextDate());

    shoppingOrder.setModifiedDate(RandomTestUtil.nextDate());

    shoppingOrder.setNumber(RandomTestUtil.randomString());

    shoppingOrder.setTax(RandomTestUtil.nextDouble());

    shoppingOrder.setShipping(RandomTestUtil.nextDouble());

    shoppingOrder.setAltShipping(RandomTestUtil.randomString());

    shoppingOrder.setRequiresShipping(RandomTestUtil.randomBoolean());

    shoppingOrder.setInsure(RandomTestUtil.randomBoolean());

    shoppingOrder.setInsurance(RandomTestUtil.nextDouble());

    shoppingOrder.setCouponCodes(RandomTestUtil.randomString());

    shoppingOrder.setCouponDiscount(RandomTestUtil.nextDouble());

    shoppingOrder.setBillingFirstName(RandomTestUtil.randomString());

    shoppingOrder.setBillingLastName(RandomTestUtil.randomString());

    shoppingOrder.setBillingEmailAddress(RandomTestUtil.randomString());

    shoppingOrder.setBillingCompany(RandomTestUtil.randomString());

    shoppingOrder.setBillingStreet(RandomTestUtil.randomString());

    shoppingOrder.setBillingCity(RandomTestUtil.randomString());

    shoppingOrder.setBillingState(RandomTestUtil.randomString());

    shoppingOrder.setBillingZip(RandomTestUtil.randomString());

    shoppingOrder.setBillingCountry(RandomTestUtil.randomString());

    shoppingOrder.setBillingPhone(RandomTestUtil.randomString());

    shoppingOrder.setShipToBilling(RandomTestUtil.randomBoolean());

    shoppingOrder.setShippingFirstName(RandomTestUtil.randomString());

    shoppingOrder.setShippingLastName(RandomTestUtil.randomString());

    shoppingOrder.setShippingEmailAddress(RandomTestUtil.randomString());

    shoppingOrder.setShippingCompany(RandomTestUtil.randomString());

    shoppingOrder.setShippingStreet(RandomTestUtil.randomString());

    shoppingOrder.setShippingCity(RandomTestUtil.randomString());

    shoppingOrder.setShippingState(RandomTestUtil.randomString());

    shoppingOrder.setShippingZip(RandomTestUtil.randomString());

    shoppingOrder.setShippingCountry(RandomTestUtil.randomString());

    shoppingOrder.setShippingPhone(RandomTestUtil.randomString());

    shoppingOrder.setCcName(RandomTestUtil.randomString());

    shoppingOrder.setCcType(RandomTestUtil.randomString());

    shoppingOrder.setCcNumber(RandomTestUtil.randomString());

    shoppingOrder.setCcExpMonth(RandomTestUtil.nextInt());

    shoppingOrder.setCcExpYear(RandomTestUtil.nextInt());

    shoppingOrder.setCcVerNumber(RandomTestUtil.randomString());

    shoppingOrder.setComments(RandomTestUtil.randomString());

    shoppingOrder.setPpTxnId(RandomTestUtil.randomString());

    shoppingOrder.setPpPaymentStatus(RandomTestUtil.randomString());

    shoppingOrder.setPpPaymentGross(RandomTestUtil.nextDouble());

    shoppingOrder.setPpReceiverEmail(RandomTestUtil.randomString());

    shoppingOrder.setPpPayerEmail(RandomTestUtil.randomString());

    shoppingOrder.setSendOrderEmail(RandomTestUtil.randomBoolean());

    shoppingOrder.setSendShippingEmail(RandomTestUtil.randomBoolean());

    _shoppingOrders.add(_persistence.update(shoppingOrder));

    return shoppingOrder;
  }
  @Test
  public void testUpdateExisting() throws Exception {
    long pk = RandomTestUtil.nextLong();

    ShoppingOrder newShoppingOrder = _persistence.create(pk);

    newShoppingOrder.setGroupId(RandomTestUtil.nextLong());

    newShoppingOrder.setCompanyId(RandomTestUtil.nextLong());

    newShoppingOrder.setUserId(RandomTestUtil.nextLong());

    newShoppingOrder.setUserName(RandomTestUtil.randomString());

    newShoppingOrder.setCreateDate(RandomTestUtil.nextDate());

    newShoppingOrder.setModifiedDate(RandomTestUtil.nextDate());

    newShoppingOrder.setNumber(RandomTestUtil.randomString());

    newShoppingOrder.setTax(RandomTestUtil.nextDouble());

    newShoppingOrder.setShipping(RandomTestUtil.nextDouble());

    newShoppingOrder.setAltShipping(RandomTestUtil.randomString());

    newShoppingOrder.setRequiresShipping(RandomTestUtil.randomBoolean());

    newShoppingOrder.setInsure(RandomTestUtil.randomBoolean());

    newShoppingOrder.setInsurance(RandomTestUtil.nextDouble());

    newShoppingOrder.setCouponCodes(RandomTestUtil.randomString());

    newShoppingOrder.setCouponDiscount(RandomTestUtil.nextDouble());

    newShoppingOrder.setBillingFirstName(RandomTestUtil.randomString());

    newShoppingOrder.setBillingLastName(RandomTestUtil.randomString());

    newShoppingOrder.setBillingEmailAddress(RandomTestUtil.randomString());

    newShoppingOrder.setBillingCompany(RandomTestUtil.randomString());

    newShoppingOrder.setBillingStreet(RandomTestUtil.randomString());

    newShoppingOrder.setBillingCity(RandomTestUtil.randomString());

    newShoppingOrder.setBillingState(RandomTestUtil.randomString());

    newShoppingOrder.setBillingZip(RandomTestUtil.randomString());

    newShoppingOrder.setBillingCountry(RandomTestUtil.randomString());

    newShoppingOrder.setBillingPhone(RandomTestUtil.randomString());

    newShoppingOrder.setShipToBilling(RandomTestUtil.randomBoolean());

    newShoppingOrder.setShippingFirstName(RandomTestUtil.randomString());

    newShoppingOrder.setShippingLastName(RandomTestUtil.randomString());

    newShoppingOrder.setShippingEmailAddress(RandomTestUtil.randomString());

    newShoppingOrder.setShippingCompany(RandomTestUtil.randomString());

    newShoppingOrder.setShippingStreet(RandomTestUtil.randomString());

    newShoppingOrder.setShippingCity(RandomTestUtil.randomString());

    newShoppingOrder.setShippingState(RandomTestUtil.randomString());

    newShoppingOrder.setShippingZip(RandomTestUtil.randomString());

    newShoppingOrder.setShippingCountry(RandomTestUtil.randomString());

    newShoppingOrder.setShippingPhone(RandomTestUtil.randomString());

    newShoppingOrder.setCcName(RandomTestUtil.randomString());

    newShoppingOrder.setCcType(RandomTestUtil.randomString());

    newShoppingOrder.setCcNumber(RandomTestUtil.randomString());

    newShoppingOrder.setCcExpMonth(RandomTestUtil.nextInt());

    newShoppingOrder.setCcExpYear(RandomTestUtil.nextInt());

    newShoppingOrder.setCcVerNumber(RandomTestUtil.randomString());

    newShoppingOrder.setComments(RandomTestUtil.randomString());

    newShoppingOrder.setPpTxnId(RandomTestUtil.randomString());

    newShoppingOrder.setPpPaymentStatus(RandomTestUtil.randomString());

    newShoppingOrder.setPpPaymentGross(RandomTestUtil.nextDouble());

    newShoppingOrder.setPpReceiverEmail(RandomTestUtil.randomString());

    newShoppingOrder.setPpPayerEmail(RandomTestUtil.randomString());

    newShoppingOrder.setSendOrderEmail(RandomTestUtil.randomBoolean());

    newShoppingOrder.setSendShippingEmail(RandomTestUtil.randomBoolean());

    _shoppingOrders.add(_persistence.update(newShoppingOrder));

    ShoppingOrder existingShoppingOrder =
        _persistence.findByPrimaryKey(newShoppingOrder.getPrimaryKey());

    Assert.assertEquals(existingShoppingOrder.getOrderId(), newShoppingOrder.getOrderId());
    Assert.assertEquals(existingShoppingOrder.getGroupId(), newShoppingOrder.getGroupId());
    Assert.assertEquals(existingShoppingOrder.getCompanyId(), newShoppingOrder.getCompanyId());
    Assert.assertEquals(existingShoppingOrder.getUserId(), newShoppingOrder.getUserId());
    Assert.assertEquals(existingShoppingOrder.getUserName(), newShoppingOrder.getUserName());
    Assert.assertEquals(
        Time.getShortTimestamp(existingShoppingOrder.getCreateDate()),
        Time.getShortTimestamp(newShoppingOrder.getCreateDate()));
    Assert.assertEquals(
        Time.getShortTimestamp(existingShoppingOrder.getModifiedDate()),
        Time.getShortTimestamp(newShoppingOrder.getModifiedDate()));
    Assert.assertEquals(existingShoppingOrder.getNumber(), newShoppingOrder.getNumber());
    AssertUtils.assertEquals(existingShoppingOrder.getTax(), newShoppingOrder.getTax());
    AssertUtils.assertEquals(existingShoppingOrder.getShipping(), newShoppingOrder.getShipping());
    Assert.assertEquals(existingShoppingOrder.getAltShipping(), newShoppingOrder.getAltShipping());
    Assert.assertEquals(
        existingShoppingOrder.getRequiresShipping(), newShoppingOrder.getRequiresShipping());
    Assert.assertEquals(existingShoppingOrder.getInsure(), newShoppingOrder.getInsure());
    AssertUtils.assertEquals(existingShoppingOrder.getInsurance(), newShoppingOrder.getInsurance());
    Assert.assertEquals(existingShoppingOrder.getCouponCodes(), newShoppingOrder.getCouponCodes());
    AssertUtils.assertEquals(
        existingShoppingOrder.getCouponDiscount(), newShoppingOrder.getCouponDiscount());
    Assert.assertEquals(
        existingShoppingOrder.getBillingFirstName(), newShoppingOrder.getBillingFirstName());
    Assert.assertEquals(
        existingShoppingOrder.getBillingLastName(), newShoppingOrder.getBillingLastName());
    Assert.assertEquals(
        existingShoppingOrder.getBillingEmailAddress(), newShoppingOrder.getBillingEmailAddress());
    Assert.assertEquals(
        existingShoppingOrder.getBillingCompany(), newShoppingOrder.getBillingCompany());
    Assert.assertEquals(
        existingShoppingOrder.getBillingStreet(), newShoppingOrder.getBillingStreet());
    Assert.assertEquals(existingShoppingOrder.getBillingCity(), newShoppingOrder.getBillingCity());
    Assert.assertEquals(
        existingShoppingOrder.getBillingState(), newShoppingOrder.getBillingState());
    Assert.assertEquals(existingShoppingOrder.getBillingZip(), newShoppingOrder.getBillingZip());
    Assert.assertEquals(
        existingShoppingOrder.getBillingCountry(), newShoppingOrder.getBillingCountry());
    Assert.assertEquals(
        existingShoppingOrder.getBillingPhone(), newShoppingOrder.getBillingPhone());
    Assert.assertEquals(
        existingShoppingOrder.getShipToBilling(), newShoppingOrder.getShipToBilling());
    Assert.assertEquals(
        existingShoppingOrder.getShippingFirstName(), newShoppingOrder.getShippingFirstName());
    Assert.assertEquals(
        existingShoppingOrder.getShippingLastName(), newShoppingOrder.getShippingLastName());
    Assert.assertEquals(
        existingShoppingOrder.getShippingEmailAddress(),
        newShoppingOrder.getShippingEmailAddress());
    Assert.assertEquals(
        existingShoppingOrder.getShippingCompany(), newShoppingOrder.getShippingCompany());
    Assert.assertEquals(
        existingShoppingOrder.getShippingStreet(), newShoppingOrder.getShippingStreet());
    Assert.assertEquals(
        existingShoppingOrder.getShippingCity(), newShoppingOrder.getShippingCity());
    Assert.assertEquals(
        existingShoppingOrder.getShippingState(), newShoppingOrder.getShippingState());
    Assert.assertEquals(existingShoppingOrder.getShippingZip(), newShoppingOrder.getShippingZip());
    Assert.assertEquals(
        existingShoppingOrder.getShippingCountry(), newShoppingOrder.getShippingCountry());
    Assert.assertEquals(
        existingShoppingOrder.getShippingPhone(), newShoppingOrder.getShippingPhone());
    Assert.assertEquals(existingShoppingOrder.getCcName(), newShoppingOrder.getCcName());
    Assert.assertEquals(existingShoppingOrder.getCcType(), newShoppingOrder.getCcType());
    Assert.assertEquals(existingShoppingOrder.getCcNumber(), newShoppingOrder.getCcNumber());
    Assert.assertEquals(existingShoppingOrder.getCcExpMonth(), newShoppingOrder.getCcExpMonth());
    Assert.assertEquals(existingShoppingOrder.getCcExpYear(), newShoppingOrder.getCcExpYear());
    Assert.assertEquals(existingShoppingOrder.getCcVerNumber(), newShoppingOrder.getCcVerNumber());
    Assert.assertEquals(existingShoppingOrder.getComments(), newShoppingOrder.getComments());
    Assert.assertEquals(existingShoppingOrder.getPpTxnId(), newShoppingOrder.getPpTxnId());
    Assert.assertEquals(
        existingShoppingOrder.getPpPaymentStatus(), newShoppingOrder.getPpPaymentStatus());
    AssertUtils.assertEquals(
        existingShoppingOrder.getPpPaymentGross(), newShoppingOrder.getPpPaymentGross());
    Assert.assertEquals(
        existingShoppingOrder.getPpReceiverEmail(), newShoppingOrder.getPpReceiverEmail());
    Assert.assertEquals(
        existingShoppingOrder.getPpPayerEmail(), newShoppingOrder.getPpPayerEmail());
    Assert.assertEquals(
        existingShoppingOrder.getSendOrderEmail(), newShoppingOrder.getSendOrderEmail());
    Assert.assertEquals(
        existingShoppingOrder.getSendShippingEmail(), newShoppingOrder.getSendShippingEmail());
  }
  protected DLFileEntry addDLFileEntry() throws Exception {
    long pk = RandomTestUtil.nextLong();

    DLFileEntry dlFileEntry = _persistence.create(pk);

    dlFileEntry.setUuid(RandomTestUtil.randomString());

    dlFileEntry.setGroupId(RandomTestUtil.nextLong());

    dlFileEntry.setCompanyId(RandomTestUtil.nextLong());

    dlFileEntry.setUserId(RandomTestUtil.nextLong());

    dlFileEntry.setUserName(RandomTestUtil.randomString());

    dlFileEntry.setCreateDate(RandomTestUtil.nextDate());

    dlFileEntry.setModifiedDate(RandomTestUtil.nextDate());

    dlFileEntry.setClassNameId(RandomTestUtil.nextLong());

    dlFileEntry.setClassPK(RandomTestUtil.nextLong());

    dlFileEntry.setRepositoryId(RandomTestUtil.nextLong());

    dlFileEntry.setFolderId(RandomTestUtil.nextLong());

    dlFileEntry.setTreePath(RandomTestUtil.randomString());

    dlFileEntry.setName(RandomTestUtil.randomString());

    dlFileEntry.setFileName(RandomTestUtil.randomString());

    dlFileEntry.setExtension(RandomTestUtil.randomString());

    dlFileEntry.setMimeType(RandomTestUtil.randomString());

    dlFileEntry.setTitle(RandomTestUtil.randomString());

    dlFileEntry.setDescription(RandomTestUtil.randomString());

    dlFileEntry.setExtraSettings(RandomTestUtil.randomString());

    dlFileEntry.setFileEntryTypeId(RandomTestUtil.nextLong());

    dlFileEntry.setVersion(RandomTestUtil.randomString());

    dlFileEntry.setSize(RandomTestUtil.nextLong());

    dlFileEntry.setReadCount(RandomTestUtil.nextInt());

    dlFileEntry.setSmallImageId(RandomTestUtil.nextLong());

    dlFileEntry.setLargeImageId(RandomTestUtil.nextLong());

    dlFileEntry.setCustom1ImageId(RandomTestUtil.nextLong());

    dlFileEntry.setCustom2ImageId(RandomTestUtil.nextLong());

    dlFileEntry.setManualCheckInRequired(RandomTestUtil.randomBoolean());

    dlFileEntry.setLastPublishDate(RandomTestUtil.nextDate());

    _dlFileEntries.add(_persistence.update(dlFileEntry));

    return dlFileEntry;
  }
  @Test
  public void testUpdateExisting() throws Exception {
    long pk = RandomTestUtil.nextLong();

    KaleoTaskInstanceToken newKaleoTaskInstanceToken = _persistence.create(pk);

    newKaleoTaskInstanceToken.setGroupId(RandomTestUtil.nextLong());

    newKaleoTaskInstanceToken.setCompanyId(RandomTestUtil.nextLong());

    newKaleoTaskInstanceToken.setUserId(RandomTestUtil.nextLong());

    newKaleoTaskInstanceToken.setUserName(RandomTestUtil.randomString());

    newKaleoTaskInstanceToken.setCreateDate(RandomTestUtil.nextDate());

    newKaleoTaskInstanceToken.setModifiedDate(RandomTestUtil.nextDate());

    newKaleoTaskInstanceToken.setKaleoDefinitionId(RandomTestUtil.nextLong());

    newKaleoTaskInstanceToken.setKaleoInstanceId(RandomTestUtil.nextLong());

    newKaleoTaskInstanceToken.setKaleoInstanceTokenId(RandomTestUtil.nextLong());

    newKaleoTaskInstanceToken.setKaleoTaskId(RandomTestUtil.nextLong());

    newKaleoTaskInstanceToken.setKaleoTaskName(RandomTestUtil.randomString());

    newKaleoTaskInstanceToken.setClassName(RandomTestUtil.randomString());

    newKaleoTaskInstanceToken.setClassPK(RandomTestUtil.nextLong());

    newKaleoTaskInstanceToken.setCompletionUserId(RandomTestUtil.nextLong());

    newKaleoTaskInstanceToken.setCompleted(RandomTestUtil.randomBoolean());

    newKaleoTaskInstanceToken.setCompletionDate(RandomTestUtil.nextDate());

    newKaleoTaskInstanceToken.setDueDate(RandomTestUtil.nextDate());

    newKaleoTaskInstanceToken.setWorkflowContext(RandomTestUtil.randomString());

    _kaleoTaskInstanceTokens.add(_persistence.update(newKaleoTaskInstanceToken));

    KaleoTaskInstanceToken existingKaleoTaskInstanceToken =
        _persistence.findByPrimaryKey(newKaleoTaskInstanceToken.getPrimaryKey());

    Assert.assertEquals(
        existingKaleoTaskInstanceToken.getKaleoTaskInstanceTokenId(),
        newKaleoTaskInstanceToken.getKaleoTaskInstanceTokenId());
    Assert.assertEquals(
        existingKaleoTaskInstanceToken.getGroupId(), newKaleoTaskInstanceToken.getGroupId());
    Assert.assertEquals(
        existingKaleoTaskInstanceToken.getCompanyId(), newKaleoTaskInstanceToken.getCompanyId());
    Assert.assertEquals(
        existingKaleoTaskInstanceToken.getUserId(), newKaleoTaskInstanceToken.getUserId());
    Assert.assertEquals(
        existingKaleoTaskInstanceToken.getUserName(), newKaleoTaskInstanceToken.getUserName());
    Assert.assertEquals(
        Time.getShortTimestamp(existingKaleoTaskInstanceToken.getCreateDate()),
        Time.getShortTimestamp(newKaleoTaskInstanceToken.getCreateDate()));
    Assert.assertEquals(
        Time.getShortTimestamp(existingKaleoTaskInstanceToken.getModifiedDate()),
        Time.getShortTimestamp(newKaleoTaskInstanceToken.getModifiedDate()));
    Assert.assertEquals(
        existingKaleoTaskInstanceToken.getKaleoDefinitionId(),
        newKaleoTaskInstanceToken.getKaleoDefinitionId());
    Assert.assertEquals(
        existingKaleoTaskInstanceToken.getKaleoInstanceId(),
        newKaleoTaskInstanceToken.getKaleoInstanceId());
    Assert.assertEquals(
        existingKaleoTaskInstanceToken.getKaleoInstanceTokenId(),
        newKaleoTaskInstanceToken.getKaleoInstanceTokenId());
    Assert.assertEquals(
        existingKaleoTaskInstanceToken.getKaleoTaskId(),
        newKaleoTaskInstanceToken.getKaleoTaskId());
    Assert.assertEquals(
        existingKaleoTaskInstanceToken.getKaleoTaskName(),
        newKaleoTaskInstanceToken.getKaleoTaskName());
    Assert.assertEquals(
        existingKaleoTaskInstanceToken.getClassName(), newKaleoTaskInstanceToken.getClassName());
    Assert.assertEquals(
        existingKaleoTaskInstanceToken.getClassPK(), newKaleoTaskInstanceToken.getClassPK());
    Assert.assertEquals(
        existingKaleoTaskInstanceToken.getCompletionUserId(),
        newKaleoTaskInstanceToken.getCompletionUserId());
    Assert.assertEquals(
        existingKaleoTaskInstanceToken.getCompleted(), newKaleoTaskInstanceToken.getCompleted());
    Assert.assertEquals(
        Time.getShortTimestamp(existingKaleoTaskInstanceToken.getCompletionDate()),
        Time.getShortTimestamp(newKaleoTaskInstanceToken.getCompletionDate()));
    Assert.assertEquals(
        Time.getShortTimestamp(existingKaleoTaskInstanceToken.getDueDate()),
        Time.getShortTimestamp(newKaleoTaskInstanceToken.getDueDate()));
    Assert.assertEquals(
        existingKaleoTaskInstanceToken.getWorkflowContext(),
        newKaleoTaskInstanceToken.getWorkflowContext());
  }