Пример #1
0
  @Test
  public void saveAndGetPage() throws IOException, GitAPIException {
    register(globalRepoManager.createProjectCentralRepository(PROJECT, USER));
    ILockedRepository repo =
        globalRepoManager.createProjectBranchRepository(PROJECT, BRANCH_1, null);
    register(repo);
    Page page = saveRandomPage(BRANCH_1, "home/foo"); // $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("home", result.getParentPagePath()); // $NON-NLS-1$
    assertNull(result.getViewRestrictionRole());

    verify(eventBus).post(new PageChangedEvent(PROJECT, BRANCH_1, "home/foo")); // $NON-NLS-1$

    assertClean(repo.r());
  }
Пример #2
0
  @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());
  }