Exemplo n.º 1
0
  @Test
  public void testSimpleDelete() {

    metadataStore.write("a/repo", "");
    assertEquals("", metadataStore.read("a/repo").get().getOrigin());

    metadataStore.delete("a/repo");
    assertFalse(metadataStore.read("a/repo").isPresent());
  }
Exemplo n.º 2
0
  @Test
  public void testChangeOriginFromMetedata() {

    metadataStore.write("test/repo", "other/repo");
    assertEquals("test/repo", metadatas.get("/test/repo.metadata").getName());
    assertEquals("other/repo", metadatas.get("/test/repo.metadata").getOrigin());
    assertEquals("other/repo", metadatas.get("/other/repo.metadata").getName());

    metadataStore.write("test/repo", "other/otherOrigin");
    assertEquals("other/otherOrigin", metadatas.get("/test/repo.metadata").getOrigin());
    assertEquals(0, metadatas.get("/other/repo.metadata").getForks().size());
  }
Exemplo n.º 3
0
  @Test
  public void testWriteNewMetadataWithOrigin() {

    metadataStore.write("test/repo", "other/repo");

    assertEquals("test/repo", metadatas.get("/test/repo.metadata").getName());
    assertEquals("other/repo", metadatas.get("/other/repo.metadata").getName());
  }
Exemplo n.º 4
0
  @Test
  public void testWriteTwoForks() {

    metadataStore.write("test/repo", "origin/repo");
    metadataStore.write("fork/repo", "origin/repo");

    assertEquals(3, metadatas.size());
    assertEquals("test/repo", metadatas.get("/test/repo.metadata").getName());
    assertEquals("fork/repo", metadatas.get("/fork/repo.metadata").getName());
    assertEquals("origin/repo", metadatas.get("/origin/repo.metadata").getName());

    assertEquals(2, metadatas.get("/origin/repo.metadata").getForks().size());
  }
Exemplo n.º 5
0
  @Test
  public void testComplexDelete() {

    metadataStore.write("b/repo", "a/repo");
    metadataStore.write("c/repo", "b/repo");
    metadataStore.write("d/repo", "c/repo");

    metadataStore.delete("c/repo");

    assertEquals("", metadataStore.read("d/repo").get().getOrigin());
    assertEquals("a/repo", metadataStore.read("b/repo").get().getOrigin());

    assertEquals("b/repo", metadataStore.read("a/repo").get().getForks().get(0));
    assertEquals(0, metadataStore.read("b/repo").get().getForks().size());
    assertFalse(metadataStore.read("c/repo").isPresent());
  }
Exemplo n.º 6
0
  @Test
  public void testComplexForkTracking() {

    metadataStore.write("b/repo", "a/repo");
    metadataStore.write("c/repo", "b/repo");
    metadataStore.write("d/repo", "c/repo");

    assertEquals("c/repo", metadataStore.read("d/repo").get().getOrigin());
    assertEquals("b/repo", metadataStore.read("c/repo").get().getOrigin());
    assertEquals("a/repo", metadataStore.read("b/repo").get().getOrigin());

    assertEquals("b/repo", metadataStore.read("a/repo").get().getForks().get(0));
    assertEquals("c/repo", metadataStore.read("b/repo").get().getForks().get(0));
    assertEquals("d/repo", metadataStore.read("c/repo").get().getForks().get(0));
  }
Exemplo n.º 7
0
 @Test
 public void testFixRightPathToSave() {
   metadataStore.write("/test/repo", "");
   verify(storage).write(eq("/test/repo.metadata"), anyObject());
 }
Exemplo n.º 8
0
 @Test
 public void testStorageInitialization() {
   metadataStore.init();
   verify(storage).init(eq("default://system/metadata"));
 }
Exemplo n.º 9
0
  @Test
  public void testWriteWithNullOrigin() {

    metadataStore.write("test/repo", null);
    assertEquals("test/repo", metadatas.get("/test/repo.metadata").getName());
  }