/** * Remove Page. * * @throws Exception exception */ @Test(dependsOnMethods = "init") public void removePage() throws Exception { final PageMgmtService pageMgmtService = getPageMgmtService(); final JSONObject requestJSONObject = new JSONObject(); final JSONObject page = new JSONObject(); requestJSONObject.put(Page.PAGE, page); page.put(Page.PAGE_CONTENT, "page2 content"); page.put(Page.PAGE_PERMALINK, "page2 permalink"); page.put(Page.PAGE_TITLE, "page2 title"); page.put(Page.PAGE_COMMENTABLE, true); page.put(Page.PAGE_TYPE, "page"); page.put(Page.PAGE_OPEN_TARGET, "_self"); final String pageId = pageMgmtService.addPage(requestJSONObject); Assert.assertNotNull(pageId); final PageQueryService pageQueryService = getPageQueryService(); JSONObject result = pageQueryService.getPage(pageId); Assert.assertNotNull(result); Assert.assertEquals(result.getJSONObject(Page.PAGE).getString(Page.PAGE_TITLE), "page2 title"); pageMgmtService.removePage(pageId); result = pageQueryService.getPage(pageId); Assert.assertNull(result); }
/** * Change Order. * * @throws Exception exception */ @Test(dependsOnMethods = "addPage") public void changeOrder() throws Exception { final PageMgmtService pageMgmtService = getPageMgmtService(); JSONObject requestJSONObject = new JSONObject(); final JSONObject page = new JSONObject(); requestJSONObject.put(Page.PAGE, page); page.put(Page.PAGE_CONTENT, "page4 content"); page.put(Page.PAGE_PERMALINK, "page4 permalink"); page.put(Page.PAGE_TITLE, "page4 title"); page.put(Page.PAGE_COMMENTABLE, true); page.put(Page.PAGE_TYPE, "page"); page.put(Page.PAGE_OPEN_TARGET, "_self"); final String pageId = pageMgmtService.addPage(requestJSONObject); Assert.assertNotNull(pageId); final int oldOrder = page.getInt(Page.PAGE_ORDER); pageMgmtService.changeOrder(pageId, "up"); final JSONObject result = getPageQueryService().getPage(pageId); Assert.assertNotNull(result); Assert.assertTrue(oldOrder > result.getJSONObject(Page.PAGE).getInt(Page.PAGE_ORDER)); }