コード例 #1
0
  @Test
  public void storePropertySet() {
    PropertySet set = PropertySet.apply(propertySetName);
    set.set("host", "localhost");
    set.set("port", "6969");

    assertSuccess(storage.store(set));

    // assert the paths exist as expected
    try (CloseableZooKeeper zk = connection()) {
      assertSuccess(true, zk.exists(propertySetPath));
      assertSuccess(true, zk.exists(propertySetPath + "/host"));
      assertSuccess(true, zk.exists(propertySetPath + "/port"));
    }
  }
コード例 #2
0
  @Test
  public void storePropertyPath_overwrite() {
    storePropertySet();

    PropertySet set = PropertySet.apply(propertySetName);
    set.set("host", "localhost");

    assertSuccess(storage.store(set));

    // assert the paths exist as expected
    try (CloseableZooKeeper zk = connection()) {
      assertSuccess(true, zk.exists(propertySetPath));
      assertSuccess(true, zk.exists(propertySetPath + "/host"));
      assertSuccess(
          false, zk.exists(propertySetPath + "/port")); // there shall be no port node anymore
    }
  }
コード例 #3
0
  @Test
  public void delete() {
    storePropertySet();
    assertSuccess(storage.delete(propertySetName));

    // assert the paths exist as expected
    try (CloseableZooKeeper zk = connection()) {
      assertSuccess(false, zk.exists(propertySetPath));
    }
  }