protected void testRestorePageFromTrash(boolean hasExpandoValues) throws Exception {

    WikiPage page = WikiTestUtil.addPage(_group.getGroupId(), _node.getNodeId(), true);

    if (hasExpandoValues) {
      addExpandoValueToPage(page);
    }

    page =
        WikiPageLocalServiceUtil.movePageToTrash(
            TestPropsValues.getUserId(), _node.getNodeId(), page.getTitle());

    WikiPageLocalServiceUtil.restorePageFromTrash(TestPropsValues.getUserId(), page);

    WikiPage restoredPage = WikiPageLocalServiceUtil.getPage(page.getResourcePrimKey());

    Assert.assertNotNull(restoredPage);

    if (hasExpandoValues) {
      ExpandoBridge expandoBridge = page.getExpandoBridge();

      ExpandoBridge restoredExpandoBridge = restoredPage.getExpandoBridge();

      AssertUtils.assertEquals(
          restoredExpandoBridge.getAttributes(), expandoBridge.getAttributes());
    }
  }
  @Test
  public void testSearchAndVerifyDocs() throws Exception {
    ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(_group.getGroupId());

    BookmarksFolder folder =
        BookmarksTestUtil.addFolder(_group.getGroupId(), RandomTestUtil.randomString());

    BookmarksEntry entry = BookmarksTestUtil.addEntry(folder.getFolderId(), true, serviceContext);

    SearchContext searchContext =
        BookmarksTestUtil.getSearchContext(
            entry.getCompanyId(), entry.getGroupId(), entry.getFolderId(), "test");

    Indexer indexer = IndexerRegistryUtil.getIndexer(BookmarksEntry.class);

    Hits hits = indexer.search(searchContext);

    Assert.assertEquals(1, hits.getLength());

    List<Document> results = hits.toList();

    for (Document doc : results) {
      Assert.assertEquals(entry.getCompanyId(), GetterUtil.getLong(doc.get(Field.COMPANY_ID)));
      Assert.assertEquals(BookmarksEntry.class.getName(), doc.get(Field.ENTRY_CLASS_NAME));
      Assert.assertEquals(entry.getEntryId(), GetterUtil.getLong(doc.get(Field.ENTRY_CLASS_PK)));
      AssertUtils.assertEqualsIgnoreCase(entry.getName(), doc.get(Field.TITLE));
      Assert.assertEquals(entry.getUrl(), doc.get(Field.URL));
    }
  }
  protected void checkPopulatedServiceContext(
      ServiceContext serviceContext, WikiPage page, boolean hasExpandoValues) throws Exception {

    long[] assetCategoryIds =
        AssetCategoryLocalServiceUtil.getCategoryIds(
            WikiPage.class.getName(), page.getResourcePrimKey());

    Assert.assertArrayEquals(serviceContext.getAssetCategoryIds(), assetCategoryIds);

    AssetEntry assetEntry =
        AssetEntryLocalServiceUtil.getEntry(WikiPage.class.getName(), page.getResourcePrimKey());

    List<AssetLink> assetLinks = AssetLinkLocalServiceUtil.getLinks(assetEntry.getEntryId());

    long[] assetLinkEntryIds = ListUtil.toLongArray(assetLinks, AssetLink.ENTRY_ID2_ACCESSOR);

    Assert.assertArrayEquals(serviceContext.getAssetLinkEntryIds(), assetLinkEntryIds);

    String[] assetTagNames =
        AssetTagLocalServiceUtil.getTagNames(WikiPage.class.getName(), page.getResourcePrimKey());

    Assert.assertArrayEquals(serviceContext.getAssetTagNames(), assetTagNames);

    if (hasExpandoValues) {
      ExpandoBridge expandoBridge = page.getExpandoBridge();

      AssertUtils.assertEquals(
          expandoBridge.getAttributes(), serviceContext.getExpandoBridgeAttributes());
    }
  }
  @After
  public void tearDown() throws Exception {
    _executorService.shutdownNow();
    _executorService.awaitTermination(120, TimeUnit.SECONDS);

    long expectedTime = 100;
    long actualTime = System.currentTimeMillis() - _startTime;

    AssertUtils.assertLessThan(expectedTime, actualTime);
  }
  @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();

    JournalArticleImage newJournalArticleImage = _persistence.create(pk);

    newJournalArticleImage.setGroupId(RandomTestUtil.nextLong());

    newJournalArticleImage.setArticleId(RandomTestUtil.randomString());

    newJournalArticleImage.setVersion(RandomTestUtil.nextDouble());

    newJournalArticleImage.setElInstanceId(RandomTestUtil.randomString());

    newJournalArticleImage.setElName(RandomTestUtil.randomString());

    newJournalArticleImage.setLanguageId(RandomTestUtil.randomString());

    newJournalArticleImage.setTempImage(RandomTestUtil.randomBoolean());

    _journalArticleImages.add(_persistence.update(newJournalArticleImage));

    JournalArticleImage existingJournalArticleImage =
        _persistence.findByPrimaryKey(newJournalArticleImage.getPrimaryKey());

    Assert.assertEquals(
        existingJournalArticleImage.getArticleImageId(),
        newJournalArticleImage.getArticleImageId());
    Assert.assertEquals(
        existingJournalArticleImage.getGroupId(), newJournalArticleImage.getGroupId());
    Assert.assertEquals(
        existingJournalArticleImage.getArticleId(), newJournalArticleImage.getArticleId());
    AssertUtils.assertEquals(
        existingJournalArticleImage.getVersion(), newJournalArticleImage.getVersion());
    Assert.assertEquals(
        existingJournalArticleImage.getElInstanceId(), newJournalArticleImage.getElInstanceId());
    Assert.assertEquals(
        existingJournalArticleImage.getElName(), newJournalArticleImage.getElName());
    Assert.assertEquals(
        existingJournalArticleImage.getLanguageId(), newJournalArticleImage.getLanguageId());
    Assert.assertEquals(
        existingJournalArticleImage.getTempImage(), newJournalArticleImage.getTempImage());
  }
  @Test
  public void testResetOriginalValues() throws Exception {
    if (!PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
      return;
    }

    JournalArticle newJournalArticle = addJournalArticle();

    _persistence.clearCache();

    JournalArticleModelImpl existingJournalArticleModelImpl =
        (JournalArticleModelImpl) _persistence.findByPrimaryKey(newJournalArticle.getPrimaryKey());

    Assert.assertTrue(
        Validator.equals(
            existingJournalArticleModelImpl.getUuid(),
            existingJournalArticleModelImpl.getOriginalUuid()));
    Assert.assertEquals(
        existingJournalArticleModelImpl.getGroupId(),
        existingJournalArticleModelImpl.getOriginalGroupId());

    Assert.assertEquals(
        existingJournalArticleModelImpl.getGroupId(),
        existingJournalArticleModelImpl.getOriginalGroupId());
    Assert.assertEquals(
        existingJournalArticleModelImpl.getClassNameId(),
        existingJournalArticleModelImpl.getOriginalClassNameId());
    Assert.assertTrue(
        Validator.equals(
            existingJournalArticleModelImpl.getStructureId(),
            existingJournalArticleModelImpl.getOriginalStructureId()));

    Assert.assertEquals(
        existingJournalArticleModelImpl.getGroupId(),
        existingJournalArticleModelImpl.getOriginalGroupId());
    Assert.assertTrue(
        Validator.equals(
            existingJournalArticleModelImpl.getArticleId(),
            existingJournalArticleModelImpl.getOriginalArticleId()));
    AssertUtils.assertEquals(
        existingJournalArticleModelImpl.getVersion(),
        existingJournalArticleModelImpl.getOriginalVersion());
  }
  @Test
  public void testUpdateExisting() throws Exception {
    long pk = RandomTestUtil.nextLong();

    MBMessage newMBMessage = _persistence.create(pk);

    newMBMessage.setUuid(RandomTestUtil.randomString());

    newMBMessage.setGroupId(RandomTestUtil.nextLong());

    newMBMessage.setCompanyId(RandomTestUtil.nextLong());

    newMBMessage.setUserId(RandomTestUtil.nextLong());

    newMBMessage.setUserName(RandomTestUtil.randomString());

    newMBMessage.setCreateDate(RandomTestUtil.nextDate());

    newMBMessage.setModifiedDate(RandomTestUtil.nextDate());

    newMBMessage.setClassNameId(RandomTestUtil.nextLong());

    newMBMessage.setClassPK(RandomTestUtil.nextLong());

    newMBMessage.setCategoryId(RandomTestUtil.nextLong());

    newMBMessage.setThreadId(RandomTestUtil.nextLong());

    newMBMessage.setRootMessageId(RandomTestUtil.nextLong());

    newMBMessage.setParentMessageId(RandomTestUtil.nextLong());

    newMBMessage.setSubject(RandomTestUtil.randomString());

    newMBMessage.setBody(RandomTestUtil.randomString());

    newMBMessage.setFormat(RandomTestUtil.randomString());

    newMBMessage.setAnonymous(RandomTestUtil.randomBoolean());

    newMBMessage.setPriority(RandomTestUtil.nextDouble());

    newMBMessage.setAllowPingbacks(RandomTestUtil.randomBoolean());

    newMBMessage.setAnswer(RandomTestUtil.randomBoolean());

    newMBMessage.setStatus(RandomTestUtil.nextInt());

    newMBMessage.setStatusByUserId(RandomTestUtil.nextLong());

    newMBMessage.setStatusByUserName(RandomTestUtil.randomString());

    newMBMessage.setStatusDate(RandomTestUtil.nextDate());

    _mbMessages.add(_persistence.update(newMBMessage));

    MBMessage existingMBMessage = _persistence.findByPrimaryKey(newMBMessage.getPrimaryKey());

    Assert.assertEquals(existingMBMessage.getUuid(), newMBMessage.getUuid());
    Assert.assertEquals(existingMBMessage.getMessageId(), newMBMessage.getMessageId());
    Assert.assertEquals(existingMBMessage.getGroupId(), newMBMessage.getGroupId());
    Assert.assertEquals(existingMBMessage.getCompanyId(), newMBMessage.getCompanyId());
    Assert.assertEquals(existingMBMessage.getUserId(), newMBMessage.getUserId());
    Assert.assertEquals(existingMBMessage.getUserName(), newMBMessage.getUserName());
    Assert.assertEquals(
        Time.getShortTimestamp(existingMBMessage.getCreateDate()),
        Time.getShortTimestamp(newMBMessage.getCreateDate()));
    Assert.assertEquals(
        Time.getShortTimestamp(existingMBMessage.getModifiedDate()),
        Time.getShortTimestamp(newMBMessage.getModifiedDate()));
    Assert.assertEquals(existingMBMessage.getClassNameId(), newMBMessage.getClassNameId());
    Assert.assertEquals(existingMBMessage.getClassPK(), newMBMessage.getClassPK());
    Assert.assertEquals(existingMBMessage.getCategoryId(), newMBMessage.getCategoryId());
    Assert.assertEquals(existingMBMessage.getThreadId(), newMBMessage.getThreadId());
    Assert.assertEquals(existingMBMessage.getRootMessageId(), newMBMessage.getRootMessageId());
    Assert.assertEquals(existingMBMessage.getParentMessageId(), newMBMessage.getParentMessageId());
    Assert.assertEquals(existingMBMessage.getSubject(), newMBMessage.getSubject());
    Assert.assertEquals(existingMBMessage.getBody(), newMBMessage.getBody());
    Assert.assertEquals(existingMBMessage.getFormat(), newMBMessage.getFormat());
    Assert.assertEquals(existingMBMessage.getAnonymous(), newMBMessage.getAnonymous());
    AssertUtils.assertEquals(existingMBMessage.getPriority(), newMBMessage.getPriority());
    Assert.assertEquals(existingMBMessage.getAllowPingbacks(), newMBMessage.getAllowPingbacks());
    Assert.assertEquals(existingMBMessage.getAnswer(), newMBMessage.getAnswer());
    Assert.assertEquals(existingMBMessage.getStatus(), newMBMessage.getStatus());
    Assert.assertEquals(existingMBMessage.getStatusByUserId(), newMBMessage.getStatusByUserId());
    Assert.assertEquals(
        existingMBMessage.getStatusByUserName(), newMBMessage.getStatusByUserName());
    Assert.assertEquals(
        Time.getShortTimestamp(existingMBMessage.getStatusDate()),
        Time.getShortTimestamp(newMBMessage.getStatusDate()));
  }
  @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());
  }
  @Test
  public void testUpdateExisting() throws Exception {
    long pk = RandomTestUtil.nextLong();

    MBThread newMBThread = _persistence.create(pk);

    newMBThread.setUuid(RandomTestUtil.randomString());

    newMBThread.setGroupId(RandomTestUtil.nextLong());

    newMBThread.setCompanyId(RandomTestUtil.nextLong());

    newMBThread.setUserId(RandomTestUtil.nextLong());

    newMBThread.setUserName(RandomTestUtil.randomString());

    newMBThread.setCreateDate(RandomTestUtil.nextDate());

    newMBThread.setModifiedDate(RandomTestUtil.nextDate());

    newMBThread.setCategoryId(RandomTestUtil.nextLong());

    newMBThread.setRootMessageId(RandomTestUtil.nextLong());

    newMBThread.setRootMessageUserId(RandomTestUtil.nextLong());

    newMBThread.setMessageCount(RandomTestUtil.nextInt());

    newMBThread.setViewCount(RandomTestUtil.nextInt());

    newMBThread.setLastPostByUserId(RandomTestUtil.nextLong());

    newMBThread.setLastPostDate(RandomTestUtil.nextDate());

    newMBThread.setPriority(RandomTestUtil.nextDouble());

    newMBThread.setQuestion(RandomTestUtil.randomBoolean());

    newMBThread.setStatus(RandomTestUtil.nextInt());

    newMBThread.setStatusByUserId(RandomTestUtil.nextLong());

    newMBThread.setStatusByUserName(RandomTestUtil.randomString());

    newMBThread.setStatusDate(RandomTestUtil.nextDate());

    _mbThreads.add(_persistence.update(newMBThread));

    MBThread existingMBThread = _persistence.findByPrimaryKey(newMBThread.getPrimaryKey());

    Assert.assertEquals(existingMBThread.getUuid(), newMBThread.getUuid());
    Assert.assertEquals(existingMBThread.getThreadId(), newMBThread.getThreadId());
    Assert.assertEquals(existingMBThread.getGroupId(), newMBThread.getGroupId());
    Assert.assertEquals(existingMBThread.getCompanyId(), newMBThread.getCompanyId());
    Assert.assertEquals(existingMBThread.getUserId(), newMBThread.getUserId());
    Assert.assertEquals(existingMBThread.getUserName(), newMBThread.getUserName());
    Assert.assertEquals(
        Time.getShortTimestamp(existingMBThread.getCreateDate()),
        Time.getShortTimestamp(newMBThread.getCreateDate()));
    Assert.assertEquals(
        Time.getShortTimestamp(existingMBThread.getModifiedDate()),
        Time.getShortTimestamp(newMBThread.getModifiedDate()));
    Assert.assertEquals(existingMBThread.getCategoryId(), newMBThread.getCategoryId());
    Assert.assertEquals(existingMBThread.getRootMessageId(), newMBThread.getRootMessageId());
    Assert.assertEquals(
        existingMBThread.getRootMessageUserId(), newMBThread.getRootMessageUserId());
    Assert.assertEquals(existingMBThread.getMessageCount(), newMBThread.getMessageCount());
    Assert.assertEquals(existingMBThread.getViewCount(), newMBThread.getViewCount());
    Assert.assertEquals(existingMBThread.getLastPostByUserId(), newMBThread.getLastPostByUserId());
    Assert.assertEquals(
        Time.getShortTimestamp(existingMBThread.getLastPostDate()),
        Time.getShortTimestamp(newMBThread.getLastPostDate()));
    AssertUtils.assertEquals(existingMBThread.getPriority(), newMBThread.getPriority());
    Assert.assertEquals(existingMBThread.getQuestion(), newMBThread.getQuestion());
    Assert.assertEquals(existingMBThread.getStatus(), newMBThread.getStatus());
    Assert.assertEquals(existingMBThread.getStatusByUserId(), newMBThread.getStatusByUserId());
    Assert.assertEquals(existingMBThread.getStatusByUserName(), newMBThread.getStatusByUserName());
    Assert.assertEquals(
        Time.getShortTimestamp(existingMBThread.getStatusDate()),
        Time.getShortTimestamp(newMBThread.getStatusDate()));
  }
  @Test
  public void testUpdateExisting() throws Exception {
    long pk = ServiceTestUtil.nextLong();

    JournalArticle newJournalArticle = _persistence.create(pk);

    newJournalArticle.setUuid(ServiceTestUtil.randomString());

    newJournalArticle.setResourcePrimKey(ServiceTestUtil.nextLong());

    newJournalArticle.setGroupId(ServiceTestUtil.nextLong());

    newJournalArticle.setCompanyId(ServiceTestUtil.nextLong());

    newJournalArticle.setUserId(ServiceTestUtil.nextLong());

    newJournalArticle.setUserName(ServiceTestUtil.randomString());

    newJournalArticle.setCreateDate(ServiceTestUtil.nextDate());

    newJournalArticle.setModifiedDate(ServiceTestUtil.nextDate());

    newJournalArticle.setFolderId(ServiceTestUtil.nextLong());

    newJournalArticle.setClassNameId(ServiceTestUtil.nextLong());

    newJournalArticle.setClassPK(ServiceTestUtil.nextLong());

    newJournalArticle.setTreePath(ServiceTestUtil.randomString());

    newJournalArticle.setArticleId(ServiceTestUtil.randomString());

    newJournalArticle.setVersion(ServiceTestUtil.nextDouble());

    newJournalArticle.setTitle(ServiceTestUtil.randomString());

    newJournalArticle.setUrlTitle(ServiceTestUtil.randomString());

    newJournalArticle.setDescription(ServiceTestUtil.randomString());

    newJournalArticle.setContent(ServiceTestUtil.randomString());

    newJournalArticle.setType(ServiceTestUtil.randomString());

    newJournalArticle.setStructureId(ServiceTestUtil.randomString());

    newJournalArticle.setTemplateId(ServiceTestUtil.randomString());

    newJournalArticle.setLayoutUuid(ServiceTestUtil.randomString());

    newJournalArticle.setDisplayDate(ServiceTestUtil.nextDate());

    newJournalArticle.setExpirationDate(ServiceTestUtil.nextDate());

    newJournalArticle.setReviewDate(ServiceTestUtil.nextDate());

    newJournalArticle.setIndexable(ServiceTestUtil.randomBoolean());

    newJournalArticle.setSmallImage(ServiceTestUtil.randomBoolean());

    newJournalArticle.setSmallImageId(ServiceTestUtil.nextLong());

    newJournalArticle.setSmallImageURL(ServiceTestUtil.randomString());

    newJournalArticle.setStatus(ServiceTestUtil.nextInt());

    newJournalArticle.setStatusByUserId(ServiceTestUtil.nextLong());

    newJournalArticle.setStatusByUserName(ServiceTestUtil.randomString());

    newJournalArticle.setStatusDate(ServiceTestUtil.nextDate());

    _persistence.update(newJournalArticle);

    JournalArticle existingJournalArticle =
        _persistence.findByPrimaryKey(newJournalArticle.getPrimaryKey());

    Assert.assertEquals(existingJournalArticle.getUuid(), newJournalArticle.getUuid());
    Assert.assertEquals(existingJournalArticle.getId(), newJournalArticle.getId());
    Assert.assertEquals(
        existingJournalArticle.getResourcePrimKey(), newJournalArticle.getResourcePrimKey());
    Assert.assertEquals(existingJournalArticle.getGroupId(), newJournalArticle.getGroupId());
    Assert.assertEquals(existingJournalArticle.getCompanyId(), newJournalArticle.getCompanyId());
    Assert.assertEquals(existingJournalArticle.getUserId(), newJournalArticle.getUserId());
    Assert.assertEquals(existingJournalArticle.getUserName(), newJournalArticle.getUserName());
    Assert.assertEquals(
        Time.getShortTimestamp(existingJournalArticle.getCreateDate()),
        Time.getShortTimestamp(newJournalArticle.getCreateDate()));
    Assert.assertEquals(
        Time.getShortTimestamp(existingJournalArticle.getModifiedDate()),
        Time.getShortTimestamp(newJournalArticle.getModifiedDate()));
    Assert.assertEquals(existingJournalArticle.getFolderId(), newJournalArticle.getFolderId());
    Assert.assertEquals(
        existingJournalArticle.getClassNameId(), newJournalArticle.getClassNameId());
    Assert.assertEquals(existingJournalArticle.getClassPK(), newJournalArticle.getClassPK());
    Assert.assertEquals(existingJournalArticle.getTreePath(), newJournalArticle.getTreePath());
    Assert.assertEquals(existingJournalArticle.getArticleId(), newJournalArticle.getArticleId());
    AssertUtils.assertEquals(existingJournalArticle.getVersion(), newJournalArticle.getVersion());
    Assert.assertEquals(existingJournalArticle.getTitle(), newJournalArticle.getTitle());
    Assert.assertEquals(existingJournalArticle.getUrlTitle(), newJournalArticle.getUrlTitle());
    Assert.assertEquals(
        existingJournalArticle.getDescription(), newJournalArticle.getDescription());
    Assert.assertEquals(existingJournalArticle.getContent(), newJournalArticle.getContent());
    Assert.assertEquals(existingJournalArticle.getType(), newJournalArticle.getType());
    Assert.assertEquals(
        existingJournalArticle.getStructureId(), newJournalArticle.getStructureId());
    Assert.assertEquals(existingJournalArticle.getTemplateId(), newJournalArticle.getTemplateId());
    Assert.assertEquals(existingJournalArticle.getLayoutUuid(), newJournalArticle.getLayoutUuid());
    Assert.assertEquals(
        Time.getShortTimestamp(existingJournalArticle.getDisplayDate()),
        Time.getShortTimestamp(newJournalArticle.getDisplayDate()));
    Assert.assertEquals(
        Time.getShortTimestamp(existingJournalArticle.getExpirationDate()),
        Time.getShortTimestamp(newJournalArticle.getExpirationDate()));
    Assert.assertEquals(
        Time.getShortTimestamp(existingJournalArticle.getReviewDate()),
        Time.getShortTimestamp(newJournalArticle.getReviewDate()));
    Assert.assertEquals(existingJournalArticle.getIndexable(), newJournalArticle.getIndexable());
    Assert.assertEquals(existingJournalArticle.getSmallImage(), newJournalArticle.getSmallImage());
    Assert.assertEquals(
        existingJournalArticle.getSmallImageId(), newJournalArticle.getSmallImageId());
    Assert.assertEquals(
        existingJournalArticle.getSmallImageURL(), newJournalArticle.getSmallImageURL());
    Assert.assertEquals(existingJournalArticle.getStatus(), newJournalArticle.getStatus());
    Assert.assertEquals(
        existingJournalArticle.getStatusByUserId(), newJournalArticle.getStatusByUserId());
    Assert.assertEquals(
        existingJournalArticle.getStatusByUserName(), newJournalArticle.getStatusByUserName());
    Assert.assertEquals(
        Time.getShortTimestamp(existingJournalArticle.getStatusDate()),
        Time.getShortTimestamp(newJournalArticle.getStatusDate()));
  }