Пример #1
0
 @Test
 public void getAttachmentMetadata() throws IOException, GitAPIException {
   register(globalRepoManager.createProjectCentralRepository(PROJECT, USER));
   register(globalRepoManager.createProjectBranchRepository(PROJECT, BRANCH_1, null));
   saveRandomPage(BRANCH_1, PAGE);
   Page attachment = Page.fromData(new byte[] {1, 2, 3}, "image/png"); // $NON-NLS-1$
   pageStore.saveAttachment(PROJECT, BRANCH_1, PAGE, "test.png", attachment, USER); // $NON-NLS-1$
   PageMetadata metadata =
       pageStore.getAttachmentMetadata(PROJECT, BRANCH_1, PAGE, "test.png"); // $NON-NLS-1$
   assertEquals(USER.getLoginName(), metadata.getLastEditedBy());
   assertSecondsAgo(metadata.getLastEdited(), 5);
 }
Пример #2
0
 @Test
 public void getPageMetadata() throws IOException, GitAPIException {
   register(globalRepoManager.createProjectCentralRepository(PROJECT, USER));
   ILockedRepository repo =
       globalRepoManager.createProjectBranchRepository(PROJECT, BRANCH_1, null);
   register(repo);
   saveRandomPage(BRANCH_1, PAGE);
   File file =
       new File(
           new File(RepositoryUtil.getWorkingDir(repo.r()), "pages"),
           PAGE + ".page"); // $NON-NLS-1$ //$NON-NLS-2$
   long size = file.length();
   PageMetadata metadata = pageStore.getPageMetadata(PROJECT, BRANCH_1, PAGE);
   assertEquals(USER.getLoginName(), metadata.getLastEditedBy());
   assertSecondsAgo(metadata.getLastEdited(), 5);
   assertEquals(size, metadata.getSize());
 }