Exemplo n.º 1
0
  public void GeneralCollectionRenameTest() throws RegistryException {

    Resource r1 = registry.newResource();
    r1.setProperty("test", "rename");
    r1.setContent("some text");
    registry.put("/c2/rename3/c1/dummy", r1);

    registry.rename("/c2/rename3", "rename4");

    boolean failed = false;
    try {
      Resource originalR1 = registry.get("/c2/rename3/c1/dummy");
    } catch (RegistryException e) {
      failed = true;
    }
    assertTrue(
        "Resource should not be " + "accessible from the old path after renaming the parent.",
        failed);

    Resource newR1 = registry.get("/c2/rename4/c1/dummy");
    assertEquals(
        "Resource should contain a property with name test and value rename.",
        newR1.getProperty("test"),
        "rename");
  }
Exemplo n.º 2
0
  public void RootLevelResourceRenameTest() throws RegistryException {

    Resource r1 = registry.newResource();
    r1.setProperty("test", "rename");
    r1.setContent("some text");
    registry.put("/rename2", r1);

    registry.rename("/rename2", "/rename4");

    boolean failed = false;
    try {
      registry.get("/rename2");
    } catch (RegistryException e) {
      failed = true;
    }
    assertTrue("Resource should not be accessible from the old path after renaming.", failed);

    Resource newR1 = registry.get("/rename4");
    assertEquals(
        "Resource should contain a property with name test and value rename.",
        newR1.getProperty("test"),
        "rename");
  }