示例#1
0
  private void removingMultivaluedProperties() {
    String path = "/props/t2/r1";
    Resource r1 = registry.newResource();
    try {
      r1.setContent("r1 content");

      r1.addProperty("p1", "v1");
      r1.addProperty("p1", "v2");
      registry.put(path, r1);

      Resource r1e1 = registry.get(path);
      r1e1.setContent("r1 content updated");
      r1e1.removePropertyValue("p1", "v1");
      registry.put(path, r1e1);

      Resource r1e2 = registry.get(path);
      assertFalse("Property is not removed.", r1e2.getPropertyValues("p1").contains("v1"));
      assertTrue("Wrong property is removed.", r1e2.getPropertyValues("p1").contains("v2"));

      deleteResources("/props");
      log.info("removingMultivaluedProperties - Passed");
    } catch (RegistryException e) {

      log.error("removingMultivaluedProperties RegistryException thrown :" + e.getMessage());
      Assert.fail("removingMultivaluedProperties RegistryException thrown :" + e.getMessage());
    }
  }