コード例 #1
0
  @Test
  public void testMoveInitialParentPageToTrash() throws Exception {
    int initialBaseModelsCount = getNotInTrashBaseModelsCount(_node);
    int initialTrashEntriesCount = getTrashEntriesCount(group.getGroupId());

    WikiPage[] pages =
        WikiTestUtil.addPageWithChangedParentPage(group.getGroupId(), _node.getNodeId());

    WikiPage page = pages[0];
    WikiPage finalParentPage = pages[1];
    WikiPage initialParentPage = pages[2];

    WikiPageLocalServiceUtil.movePageToTrash(TestPropsValues.getUserId(), initialParentPage);

    page = WikiPageLocalServiceUtil.getPageByPageId(page.getPageId());
    finalParentPage = WikiPageLocalServiceUtil.getPageByPageId(finalParentPage.getPageId());
    initialParentPage = WikiPageLocalServiceUtil.getPageByPageId(initialParentPage.getPageId());

    Assert.assertFalse(page.isInTrash());
    Assert.assertFalse(finalParentPage.isInTrash());
    Assert.assertTrue(initialParentPage.isInTrashExplicitly());
    Assert.assertEquals(finalParentPage.getTitle(), page.getParentTitle());
    Assert.assertEquals(initialBaseModelsCount + 2, getNotInTrashBaseModelsCount(_node));
    Assert.assertEquals(initialTrashEntriesCount + 1, getTrashEntriesCount(group.getGroupId()));
    Assert.assertEquals(page.getParentTitle(), finalParentPage.getTitle());
  }
コード例 #2
0
  @Test
  public void testAddPageWithSameTitleAsImplicitlyDeletedPageVersion() throws Exception {

    WikiPage[] pages =
        WikiTestUtil.addPageWithChangedParentPage(group.getGroupId(), _node.getNodeId());

    WikiPage childPage = pages[0];
    WikiPage parentPage = pages[1];

    String childPageTitle = childPage.getTitle();

    WikiPageLocalServiceUtil.movePageToTrash(TestPropsValues.getUserId(), parentPage);

    WikiPage page =
        WikiTestUtil.addPage(
            TestPropsValues.getUserId(),
            group.getGroupId(),
            _node.getNodeId(),
            childPageTitle,
            true);

    Assert.assertNotNull(page);
  }