protected WikiPageResource addWikiPageResource() throws Exception {
    long pk = nextLong();

    WikiPageResource wikiPageResource = _persistence.create(pk);

    wikiPageResource.setUuid(randomString());

    wikiPageResource.setNodeId(nextLong());

    wikiPageResource.setTitle(randomString());

    _persistence.update(wikiPageResource, false);

    return wikiPageResource;
  }
  @Override
  public void updateTitle(long classPK, String name) throws PortalException, SystemException {

    WikiPage page = WikiPageLocalServiceUtil.getPage(classPK);

    page.setTitle(name);

    WikiPageLocalServiceUtil.updateWikiPage(page);

    WikiPageResource pageResource =
        WikiPageResourceLocalServiceUtil.getPageResource(page.getResourcePrimKey());

    pageResource.setTitle(name);

    WikiPageResourceLocalServiceUtil.updateWikiPageResource(pageResource);
  }
  public void testUpdateExisting() throws Exception {
    long pk = nextLong();

    WikiPageResource newWikiPageResource = _persistence.create(pk);

    newWikiPageResource.setUuid(randomString());

    newWikiPageResource.setNodeId(nextLong());

    newWikiPageResource.setTitle(randomString());

    _persistence.update(newWikiPageResource, false);

    WikiPageResource existingWikiPageResource =
        _persistence.findByPrimaryKey(newWikiPageResource.getPrimaryKey());

    assertEquals(existingWikiPageResource.getUuid(), newWikiPageResource.getUuid());
    assertEquals(
        existingWikiPageResource.getResourcePrimKey(), newWikiPageResource.getResourcePrimKey());
    assertEquals(existingWikiPageResource.getNodeId(), newWikiPageResource.getNodeId());
    assertEquals(existingWikiPageResource.getTitle(), newWikiPageResource.getTitle());
  }