@Test
  public void testChangeChildPageNode() throws Exception {
    WikiNode destinationNode = WikiTestUtil.addNode(_group.getGroupId());

    WikiTestUtil.addPage(
        TestPropsValues.getUserId(), _group.getGroupId(), _node.getNodeId(), "ParentPage", true);

    ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(_group.getGroupId());

    WikiTestUtil.addPage(
        TestPropsValues.getUserId(),
        _node.getNodeId(),
        "ChildPage",
        RandomTestUtil.randomString(),
        "ParentPage",
        true,
        serviceContext);

    WikiPageLocalServiceUtil.changeNode(
        TestPropsValues.getUserId(),
        _node.getNodeId(),
        "ChildPage",
        destinationNode.getNodeId(),
        serviceContext);

    WikiPage parentPage = WikiPageLocalServiceUtil.getPage(_node.getNodeId(), "ParentPage");
    WikiPage childPage = WikiPageLocalServiceUtil.getPage(destinationNode.getNodeId(), "ChildPage");

    Assert.assertEquals(_node.getNodeId(), parentPage.getNodeId());
    Assert.assertEquals(destinationNode.getNodeId(), childPage.getNodeId());
    Assert.assertTrue(Validator.isNull(childPage.getParentTitle()));
  }
  public String getNodePagesRSS(
      long nodeId,
      int max,
      String type,
      double version,
      String displayStyle,
      String feedURL,
      String entryURL)
      throws PortalException, SystemException {

    WikiNodePermission.check(getPermissionChecker(), nodeId, ActionKeys.VIEW);

    WikiNode node = wikiNodePersistence.findByPrimaryKey(nodeId);

    long companyId = node.getCompanyId();
    String name = node.getName();
    String description = node.getDescription();
    List<WikiPage> pages = getNodePages(nodeId, max);
    boolean diff = false;
    Locale locale = null;

    return exportToRSS(
        companyId,
        name,
        description,
        type,
        version,
        displayStyle,
        feedURL,
        entryURL,
        pages,
        diff,
        locale);
  }
  @Test
  public void testChangePageNodeWithRedirectPage() throws Exception {
    WikiNode destinationNode = WikiTestUtil.addNode(_group.getGroupId());

    WikiTestUtil.addPage(
        TestPropsValues.getUserId(),
        _group.getGroupId(),
        _node.getNodeId(),
        "InitialTitlePage",
        true);

    ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(_group.getGroupId());

    WikiPageLocalServiceUtil.renamePage(
        TestPropsValues.getUserId(),
        _node.getNodeId(),
        "InitialTitlePage",
        "RenamedPage",
        serviceContext);

    WikiPageLocalServiceUtil.changeNode(
        TestPropsValues.getUserId(),
        _node.getNodeId(),
        "RenamedPage",
        destinationNode.getNodeId(),
        serviceContext);

    WikiPage page = WikiPageLocalServiceUtil.getPage(destinationNode.getNodeId(), "RenamedPage");
    WikiPage redirectPage =
        WikiPageLocalServiceUtil.getPage(destinationNode.getNodeId(), "InitialTitlePage");

    Assert.assertEquals(destinationNode.getNodeId(), page.getNodeId());
    Assert.assertEquals(destinationNode.getNodeId(), redirectPage.getNodeId());
    Assert.assertEquals("RenamedPage", redirectPage.getRedirectTitle());
  }
  @Test
  public void testChangeRedirectPageNode() throws Exception {
    WikiNode destinationNode = WikiTestUtil.addNode(_group.getGroupId());

    WikiTestUtil.addPage(
        TestPropsValues.getUserId(),
        _group.getGroupId(),
        _node.getNodeId(),
        "InitialTitlePage",
        true);

    ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(_group.getGroupId());

    WikiPageLocalServiceUtil.renamePage(
        TestPropsValues.getUserId(),
        _node.getNodeId(),
        "InitialTitlePage",
        "RenamedPage",
        serviceContext);

    try {
      WikiPageLocalServiceUtil.changeNode(
          TestPropsValues.getUserId(),
          _node.getNodeId(),
          "InitialTitlePage",
          destinationNode.getNodeId(),
          serviceContext);

      Assert.fail();
    } catch (NodeChangeException nce) {
      Assert.assertEquals("InitialTitlePage", nce.getPageTitle());
      Assert.assertEquals(_node.getName(), nce.getNodeName());
      Assert.assertEquals(NodeChangeException.REDIRECT_PAGE, nce.getType());
    }
  }
  @Test
  public void testResetOriginalValues() throws Exception {
    if (!PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
      return;
    }

    WikiNode newWikiNode = addWikiNode();

    _persistence.clearCache();

    WikiNodeModelImpl existingWikiNodeModelImpl =
        (WikiNodeModelImpl) _persistence.findByPrimaryKey(newWikiNode.getPrimaryKey());

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

    Assert.assertEquals(
        existingWikiNodeModelImpl.getGroupId(), existingWikiNodeModelImpl.getOriginalGroupId());
    Assert.assertTrue(
        Validator.equals(
            existingWikiNodeModelImpl.getName(), existingWikiNodeModelImpl.getOriginalName()));
  }
Exemplo n.º 6
0
  public static List<WikiNode> orderNodes(List<WikiNode> nodes, String[] visibleNodeNames) {

    if ((visibleNodeNames == null) || (visibleNodeNames.length == 0)) {
      return nodes;
    }

    nodes = ListUtil.copy(nodes);

    List<WikiNode> orderedNodes = new ArrayList<WikiNode>(nodes.size());

    for (String visibleNodeName : visibleNodeNames) {
      for (WikiNode node : nodes) {
        if (node.getName().equals(visibleNodeName)) {
          orderedNodes.add(node);

          nodes.remove(node);

          break;
        }
      }
    }

    orderedNodes.addAll(nodes);

    return orderedNodes;
  }
  protected String[] readAssetTagNames(long userId, WikiNode node, String content)
      throws PortalException {

    Matcher matcher = _categoriesPattern.matcher(content);

    List<String> assetTagNames = new ArrayList<String>();

    while (matcher.find()) {
      String categoryName = matcher.group(1);

      categoryName = normalize(categoryName, 75);

      AssetTag assetTag = null;

      try {
        assetTag = AssetTagLocalServiceUtil.getTag(node.getGroupId(), categoryName);
      } catch (NoSuchTagException nste) {
        ServiceContext serviceContext = new ServiceContext();

        serviceContext.setAddGroupPermissions(true);
        serviceContext.setAddGuestPermissions(true);
        serviceContext.setScopeGroupId(node.getGroupId());

        assetTag = AssetTagLocalServiceUtil.addTag(userId, categoryName, null, serviceContext);
      }

      assetTagNames.add(assetTag.getName());
    }

    if (content.contains(_WORK_IN_PROGRESS)) {
      assetTagNames.add(_WORK_IN_PROGRESS_TAG);
    }

    return assetTagNames.toArray(new String[assetTagNames.size()]);
  }
  @Test
  public void testChangePageNodeWithChildHierarchy() throws Exception {
    WikiNode destinationNode = WikiTestUtil.addNode(_group.getGroupId());

    WikiTestUtil.addPage(
        TestPropsValues.getUserId(), _group.getGroupId(), _node.getNodeId(), "ParentPage", true);

    ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(_group.getGroupId());

    List<WikiPage> childPages = createPageHierarchy("ParentPage", 10, serviceContext);

    WikiPageLocalServiceUtil.changeNode(
        TestPropsValues.getUserId(),
        _node.getNodeId(),
        "ParentPage",
        destinationNode.getNodeId(),
        serviceContext);

    WikiPage page = WikiPageLocalServiceUtil.getPage(destinationNode.getNodeId(), "ParentPage");

    Assert.assertEquals(destinationNode.getNodeId(), page.getNodeId());

    for (WikiPage childPage : childPages) {
      childPage = WikiPageLocalServiceUtil.getPage(childPage.getResourcePrimKey());

      Assert.assertEquals(destinationNode.getNodeId(), childPage.getNodeId());
    }
  }
  @Override
  public String getRestoreLink(PortletRequest portletRequest, long classPK)
      throws PortalException, SystemException {

    String portletId = PortletKeys.WIKI;

    WikiPage page = WikiPageLocalServiceUtil.getPage(classPK);

    long plid = PortalUtil.getPlidFromPortletId(page.getGroupId(), PortletKeys.WIKI);

    if (plid == LayoutConstants.DEFAULT_PLID) {
      plid = PortalUtil.getControlPanelPlid(portletRequest);

      portletId = PortletKeys.WIKI_ADMIN;
    }

    PortletURL portletURL =
        PortletURLFactoryUtil.create(portletRequest, portletId, plid, PortletRequest.RENDER_PHASE);

    WikiNode node = page.getNode();

    portletURL.setParameter("struts_action", "/wiki/view");
    portletURL.setParameter("nodeName", node.getName());
    portletURL.setParameter("title", HtmlUtil.unescape(page.getTitle()));

    return portletURL.toString();
  }
Exemplo n.º 10
0
  protected void processSpecialPages(
      long userId, WikiNode node, Element rootElement, List<String> specialNamespaces)
      throws PortalException {

    ProgressTracker progressTracker = ProgressTrackerThreadLocal.getProgressTracker();

    List<Element> pageElements = rootElement.elements("page");

    for (int i = 0; i < pageElements.size(); i++) {
      Element pageElement = pageElements.get(i);

      String title = pageElement.elementText("title");

      if (!title.startsWith("Category:")) {
        if (isSpecialMediaWikiPage(title, specialNamespaces)) {
          rootElement.remove(pageElement);
        }

        continue;
      }

      String categoryName = title.substring("Category:".length());

      categoryName = normalize(categoryName, 75);

      Element revisionElement = pageElement.element("revision");

      String description = revisionElement.elementText("text");

      description = normalizeDescription(description);

      try {
        AssetTag assetTag = null;

        try {
          assetTag = AssetTagLocalServiceUtil.getTag(node.getCompanyId(), categoryName);
        } catch (NoSuchTagException nste) {
          ServiceContext serviceContext = new ServiceContext();

          serviceContext.setAddGroupPermissions(true);
          serviceContext.setAddGuestPermissions(true);
          serviceContext.setScopeGroupId(node.getGroupId());

          assetTag = AssetTagLocalServiceUtil.addTag(userId, categoryName, null, serviceContext);
        }

        if (Validator.isNotNull(description)) {
          AssetTagPropertyLocalServiceUtil.addTagProperty(
              userId, assetTag.getTagId(), "description", description);
        }
      } catch (SystemException se) {
        _log.error(se, se);
      }

      if ((i % 5) == 0) {
        progressTracker.setPercent((i * 10) / pageElements.size());
      }
    }
  }
  @Test
  public void testFetchByPrimaryKeyExisting() throws Exception {
    WikiNode newWikiNode = addWikiNode();

    WikiNode existingWikiNode = _persistence.fetchByPrimaryKey(newWikiNode.getPrimaryKey());

    Assert.assertEquals(existingWikiNode, newWikiNode);
  }
Exemplo n.º 12
0
  public static List<String> getNodeNames(List<WikiNode> nodes) {
    List<String> nodeNames = new ArrayList<String>(nodes.size());

    for (WikiNode node : nodes) {
      nodeNames.add(node.getName());
    }

    return nodeNames;
  }
  @Test
  public void testRemove() throws Exception {
    WikiNode newWikiNode = addWikiNode();

    _persistence.remove(newWikiNode);

    WikiNode existingWikiNode = _persistence.fetchByPrimaryKey(newWikiNode.getPrimaryKey());

    Assert.assertNull(existingWikiNode);
  }
  @Test
  public void testCreate() throws Exception {
    long pk = RandomTestUtil.nextLong();

    WikiNode wikiNode = _persistence.create(pk);

    Assert.assertNotNull(wikiNode);

    Assert.assertEquals(wikiNode.getPrimaryKey(), pk);
  }
  @Override
  protected void doImportMissingReference(
      PortletDataContext portletDataContext, String uuid, long groupId, long nodeId)
      throws Exception {

    WikiNode existingNode = WikiNodeLocalServiceUtil.fetchNodeByUuidAndGroupId(uuid, groupId);

    Map<Long, Long> nodeIds =
        (Map<Long, Long>) portletDataContext.getNewPrimaryKeysMap(WikiNode.class);

    nodeIds.put(nodeId, existingNode.getNodeId());
  }
  @Test
  public void testFetchByPrimaryKeysWithOnePrimaryKey() throws Exception {
    WikiNode newWikiNode = addWikiNode();

    Set<Serializable> primaryKeys = new HashSet<Serializable>();

    primaryKeys.add(newWikiNode.getPrimaryKey());

    Map<Serializable, WikiNode> wikiNodes = _persistence.fetchByPrimaryKeys(primaryKeys);

    Assert.assertEquals(1, wikiNodes.size());
    Assert.assertEquals(newWikiNode, wikiNodes.get(newWikiNode.getPrimaryKey()));
  }
  @Override
  protected PortletPreferences doProcessExportPortletPreferences(
      PortletDataContext portletDataContext,
      String portletId,
      PortletPreferences portletPreferences)
      throws Exception {

    long nodeId = GetterUtil.getLong(portletPreferences.getValue("nodeId", StringPool.BLANK));

    if (nodeId <= 0) {
      if (_log.isWarnEnabled()) {
        _log.warn("No node id found in preferences of portlet " + portletId);
      }

      return portletPreferences;
    }

    String title = portletPreferences.getValue("title", null);

    if (title == null) {
      if (_log.isWarnEnabled()) {
        _log.warn("No title found in preferences of portlet " + portletId);
      }

      return portletPreferences;
    }

    WikiNode node = WikiNodeUtil.fetchByPrimaryKey(nodeId);

    if (node == null) {
      if (_log.isWarnEnabled()) {
        _log.warn("Unable to find wiki node");
      }

      return portletPreferences;
    }

    portletDataContext.addPortletPermissions(WikiPermission.RESOURCE_NAME);

    StagedModelDataHandlerUtil.exportReferenceStagedModel(portletDataContext, portletId, node);

    ActionableDynamicQuery actionableDynamicQuery =
        getPageActionableDynamicQuery(portletDataContext, node.getNodeId(), portletId);

    actionableDynamicQuery.performActions();

    return portletPreferences;
  }
  @Test
  public void testDynamicQueryByPrimaryKeyExisting() throws Exception {
    WikiNode newWikiNode = addWikiNode();

    DynamicQuery dynamicQuery =
        DynamicQueryFactoryUtil.forClass(WikiNode.class, WikiNode.class.getClassLoader());

    dynamicQuery.add(RestrictionsFactoryUtil.eq("nodeId", newWikiNode.getNodeId()));

    List<WikiNode> result = _persistence.findWithDynamicQuery(dynamicQuery);

    Assert.assertEquals(1, result.size());

    WikiNode existingWikiNode = result.get(0);

    Assert.assertEquals(existingWikiNode, newWikiNode);
  }
  @Test
  public void testChangePageNode() throws Exception {
    WikiNode destinationNode = WikiTestUtil.addNode(_group.getGroupId());

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

    ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(_group.getGroupId());

    WikiPageLocalServiceUtil.changeNode(
        TestPropsValues.getUserId(),
        _node.getNodeId(),
        page.getTitle(),
        destinationNode.getNodeId(),
        serviceContext);

    WikiPageLocalServiceUtil.getPage(destinationNode.getNodeId(), page.getTitle());
  }
  @Test
  public void testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereSomePrimaryKeysExist()
      throws Exception {
    WikiNode newWikiNode = addWikiNode();

    long pk = RandomTestUtil.nextLong();

    Set<Serializable> primaryKeys = new HashSet<Serializable>();

    primaryKeys.add(newWikiNode.getPrimaryKey());
    primaryKeys.add(pk);

    Map<Serializable, WikiNode> wikiNodes = _persistence.fetchByPrimaryKeys(primaryKeys);

    Assert.assertEquals(1, wikiNodes.size());
    Assert.assertEquals(newWikiNode, wikiNodes.get(newWikiNode.getPrimaryKey()));
  }
  @Test
  public void testChangePageNodeWithChildPageNameDuplication() throws Exception {

    WikiNode destinationNode = WikiTestUtil.addNode(_group.getGroupId());

    WikiTestUtil.addPage(
        TestPropsValues.getUserId(), _group.getGroupId(), _node.getNodeId(), "ParentPage", true);

    ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(_group.getGroupId());

    WikiTestUtil.addPage(
        TestPropsValues.getUserId(),
        _node.getNodeId(),
        "DuplicatedTitlePage",
        RandomTestUtil.randomString(),
        "ParentPage",
        true,
        serviceContext);

    WikiTestUtil.addPage(
        TestPropsValues.getUserId(),
        _group.getGroupId(),
        destinationNode.getNodeId(),
        "DuplicatedTitlePage",
        true);

    try {
      WikiPageLocalServiceUtil.changeNode(
          TestPropsValues.getUserId(),
          _node.getNodeId(),
          "ParentPage",
          destinationNode.getNodeId(),
          serviceContext);

      Assert.fail();
    } catch (NodeChangeException nce) {
      Assert.assertEquals("DuplicatedTitlePage", nce.getPageTitle());
      Assert.assertEquals(destinationNode.getName(), nce.getNodeName());
      Assert.assertEquals(NodeChangeException.DUPLICATE_PAGE, nce.getType());
    }
  }
  @Test
  public void testDynamicQueryByProjectionExisting() throws Exception {
    WikiNode newWikiNode = addWikiNode();

    DynamicQuery dynamicQuery =
        DynamicQueryFactoryUtil.forClass(WikiNode.class, WikiNode.class.getClassLoader());

    dynamicQuery.setProjection(ProjectionFactoryUtil.property("nodeId"));

    Object newNodeId = newWikiNode.getNodeId();

    dynamicQuery.add(RestrictionsFactoryUtil.in("nodeId", new Object[] {newNodeId}));

    List<Object> result = _persistence.findWithDynamicQuery(dynamicQuery);

    Assert.assertEquals(1, result.size());

    Object existingNodeId = result.get(0);

    Assert.assertEquals(existingNodeId, newNodeId);
  }
Exemplo n.º 23
0
  protected long getUserId(
      long userId, WikiNode node, String author, Map<String, String> usersMap) {

    User user = null;

    String emailAddress = usersMap.get(author);

    if (Validator.isNotNull(emailAddress)) {
      user = UserLocalServiceUtil.fetchUserByEmailAddress(node.getCompanyId(), emailAddress);
    } else {
      user =
          UserLocalServiceUtil.fetchUserByScreenName(
              node.getCompanyId(), StringUtil.toLowerCase(author));
    }

    if (user != null) {
      return user.getUserId();
    }

    return userId;
  }
Exemplo n.º 24
0
  public static List<WikiNode> getNodes(
      List<WikiNode> nodes, String[] hiddenNodes, PermissionChecker permissionChecker) {

    nodes = ListUtil.copy(nodes);

    Arrays.sort(hiddenNodes);

    Iterator<WikiNode> itr = nodes.iterator();

    while (itr.hasNext()) {
      WikiNode node = itr.next();

      if (!(Arrays.binarySearch(hiddenNodes, node.getName()) < 0)
          || !WikiNodePermission.contains(permissionChecker, node, ActionKeys.VIEW)) {

        itr.remove();
      }
    }

    return nodes;
  }
  public static String getTitleText(Locale locale, String className, long classPK, String title)
      throws PortalException, SystemException {

    if (Validator.isNotNull(title)) {
      return title;
    }

    if (className.equals(BlogsEntry.class.getName())) {
      title = "Blog at ";
    } else if (className.equals(BookmarksFolder.class.getName())) {
      BookmarksFolder bookmarksFolder = BookmarksFolderLocalServiceUtil.getBookmarksFolder(classPK);

      return bookmarksFolder.getName();
    } else if (className.equals(Layout.class.getName())) {
      Layout layout = LayoutLocalServiceUtil.getLayout(classPK);

      return layout.getName(locale);
    } else if (className.equals(MBCategory.class.getName())) {
      title = "Message Board at ";
    } else if (className.equals(WikiNode.class.getName())) {
      WikiNode wikiNode = WikiNodeLocalServiceUtil.getWikiNode(classPK);

      return wikiNode.getName();
    }

    try {
      Group group = GroupLocalServiceUtil.getGroup(classPK);

      title += group.getDescriptiveName(locale);
    } catch (Exception e) {
    }

    if (Validator.isNull(title)) {
      title = String.valueOf(classPK);
    }

    return title;
  }
Exemplo n.º 26
0
  protected void moveFrontPage(long userId, WikiNode node, Map<String, String[]> options) {

    String frontPageTitle = MapUtil.getString(options, WikiImporterKeys.OPTIONS_FRONT_PAGE);

    if (Validator.isNotNull(frontPageTitle)) {
      frontPageTitle = normalizeTitle(frontPageTitle);

      try {
        if (WikiPageLocalServiceUtil.getPagesCount(node.getNodeId(), frontPageTitle, true) > 0) {

          ServiceContext serviceContext = new ServiceContext();

          serviceContext.setAddGroupPermissions(true);
          serviceContext.setAddGuestPermissions(true);

          WikiPageLocalServiceUtil.movePage(
              userId,
              node.getNodeId(),
              frontPageTitle,
              WikiPageConstants.FRONT_PAGE,
              false,
              serviceContext);
        }
      } catch (Exception e) {
        if (_log.isWarnEnabled()) {
          StringBundler sb = new StringBundler(4);

          sb.append("Could not move ");
          sb.append(WikiPageConstants.FRONT_PAGE);
          sb.append(" to the title provided: ");
          sb.append(frontPageTitle);

          _log.warn(sb.toString(), e);
        }
      }
    }
  }
Exemplo n.º 27
0
  public static WikiNode getFirstNode(PortletRequest portletRequest)
      throws PortalException, SystemException {

    ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);
    long groupId = themeDisplay.getScopeGroupId();
    PermissionChecker permissionChecker = themeDisplay.getPermissionChecker();

    List<WikiNode> nodes = WikiNodeLocalServiceUtil.getNodes(groupId);

    PortletPreferences preferences = portletRequest.getPreferences();
    String[] visibleNodeNames = StringUtil.split(preferences.getValue("visibleNodes", null));
    nodes = orderNodes(nodes, visibleNodeNames);

    String[] hiddenNodes = StringUtil.split(preferences.getValue("hiddenNodes", StringPool.BLANK));
    Arrays.sort(hiddenNodes);

    for (WikiNode node : nodes) {
      if ((Arrays.binarySearch(hiddenNodes, node.getName()) < 0)
          && (WikiNodePermission.contains(permissionChecker, node, ActionKeys.VIEW))) {
        return node;
      }
    }
    return null;
  }
  protected String getNodeName(
      PortletDataContext portletDataContext, WikiNode node, String name, int count)
      throws Exception {

    WikiNode existingNode =
        WikiNodeLocalServiceUtil.fetchNode(portletDataContext.getScopeGroupId(), name);

    if (existingNode == null) {
      return name;
    }

    String nodeName = node.getName();

    return getNodeName(
        portletDataContext,
        node,
        nodeName.concat(StringPool.SPACE).concat(String.valueOf(count)),
        ++count);
  }
  @Override
  protected void doRestoreStagedModel(PortletDataContext portletDataContext, WikiNode node)
      throws Exception {

    long userId = portletDataContext.getUserId(node.getUserUuid());

    WikiNode existingNode =
        WikiNodeLocalServiceUtil.fetchNodeByUuidAndGroupId(
            node.getUuid(), portletDataContext.getScopeGroupId());

    if ((existingNode == null) || !existingNode.isInTrash()) {
      return;
    }

    TrashHandler trashHandler = existingNode.getTrashHandler();

    if (trashHandler.isRestorable(existingNode.getNodeId())) {
      trashHandler.restoreTrashEntry(userId, existingNode.getNodeId());
    }
  }
  @Test
  public void testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereAllPrimaryKeysExist()
      throws Exception {
    WikiNode newWikiNode1 = addWikiNode();
    WikiNode newWikiNode2 = addWikiNode();

    Set<Serializable> primaryKeys = new HashSet<Serializable>();

    primaryKeys.add(newWikiNode1.getPrimaryKey());
    primaryKeys.add(newWikiNode2.getPrimaryKey());

    Map<Serializable, WikiNode> wikiNodes = _persistence.fetchByPrimaryKeys(primaryKeys);

    Assert.assertEquals(2, wikiNodes.size());
    Assert.assertEquals(newWikiNode1, wikiNodes.get(newWikiNode1.getPrimaryKey()));
    Assert.assertEquals(newWikiNode2, wikiNodes.get(newWikiNode2.getPrimaryKey()));
  }