public void testChangeParentId() throws Exception
{
// Find two pages where the second page isn't a child of the first page.
List<XWikiPageSummary> pages = this.rpc.getPages(TestConstants.TEST_SPACE);
XWikiPageSummary pageSummary1 = pages.get(0);
XWikiPageSummary pageSummary2 = null;
for (XWikiPageSummary ps : pages) {
if (!pageSummary1.getParentId().equals(ps.getId())) {
pageSummary2 = ps;
}
}
TestUtils.banner("TEST: changeParentId()");
System.out.format("Setting page '%s' parent id to '%s'. Now: '%s'\n", pageSummary1.getId(),
pageSummary2.getId(), pageSummary1.getParentId());
XWikiPage page = this.rpc.getPage(pageSummary1.getId());
assertNotSame(pageSummary2.getId(), page.getParentId());
page.setParentId(pageSummary2.getId());
page = this.rpc.storePage(page);
System.out.format("New page: %s\n", page);
assertEquals(pageSummary2.getId(), page.getParentId());
}