示例#1
0
  @Test
  public void test_basic_draft_use() throws InterruptedException {
    cleanup();

    assertEquals(0, draftService.getDrafts(USER1, PROJ1).size());

    // save some drafts
    draftService.saveDraft(USER1, PROJ1, "/foo.txt", "hello");
    Thread.sleep(10L);
    draftService.saveDraft(USER1, PROJ1, "/bar.txt", "world");
    Thread.sleep(10L);
    draftService.saveDraft(USER1, PROJ1, "/foo.txt", "hello");
    Thread.sleep(10L);
    draftService.saveDraft(USER1, PROJ1, "/foo.txt", "hello2");
    Thread.sleep(10L);

    // get the drafts, verify they are correct
    List<DraftResult> drafts = draftService.getDrafts(USER1, PROJ1);

    assertEquals(3, drafts.size());

    assertDraft("/foo.txt", "hello2", drafts.get(0));
    assertDraft("/bar.txt", "world", drafts.get(1));
    assertDraft("/foo.txt", "hello", drafts.get(2));
  }
示例#2
0
 private void cleanup() {
   draftService.clearDrafts(USER1, PROJ1);
   draftService.clearDrafts(USER2, PROJ1);
   draftService.clearDrafts(USER1, PROJ2);
   draftService.clearDrafts(USER2, PROJ2);
 }
示例#3
0
 private void assertDraft(String expectedUri, String expectedText, DraftResult d) {
   assertEquals(expectedText, draftService.getDraft(d.username, d.proj, d.uri, d.date));
   assertEquals(expectedUri, d.uri);
 }