@Test public void getPageViewRestrictionRole() throws IOException, GitAPIException { register(globalRepoManager.createProjectCentralRepository(PROJECT, USER)); register(globalRepoManager.createProjectBranchRepository(PROJECT, BRANCH_1, null)); Page page = Page.fromText("title", "text"); // $NON-NLS-1$ //$NON-NLS-2$ page.setViewRestrictionRole("viewRole"); // $NON-NLS-1$ pageStore.savePage(PROJECT, BRANCH_1, "home/page", page, null, USER); // $NON-NLS-1$ String role = pageStore.getViewRestrictionRole(PROJECT, BRANCH_1, "home/page"); // $NON-NLS-1$ assertEquals(page.getViewRestrictionRole(), role); }
@Test public void savePageWithViewRestrictionRole() throws IOException, GitAPIException { register(globalRepoManager.createProjectCentralRepository(PROJECT, USER)); ILockedRepository repo = globalRepoManager.createProjectBranchRepository(PROJECT, BRANCH_1, null); register(repo); Page page = Page.fromText("title", "text"); // $NON-NLS-1$ //$NON-NLS-2$ page.setViewRestrictionRole("viewRole"); // $NON-NLS-1$ pageStore.savePage(PROJECT, BRANCH_1, "home/foo", page, null, USER); // $NON-NLS-1$ Page result = pageStore.getPage(PROJECT, BRANCH_1, "home/foo", true); // $NON-NLS-1$ assertEquals(page.getTitle(), result.getTitle()); assertEquals( ((PageTextData) page.getData()).getText(), ((PageTextData) result.getData()).getText()); assertEquals(page.getContentType(), result.getContentType()); assertEquals(page.getViewRestrictionRole(), result.getViewRestrictionRole()); assertEquals("home", result.getParentPagePath()); // $NON-NLS-1$ assertClean(repo.r()); }