org.apache.jackrabbit.oak.api.Root.refresh()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(80)

本文整理了Java中org.apache.jackrabbit.oak.api.Root.refresh方法的一些代码示例,展示了Root.refresh的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Root.refresh方法的具体详情如下:
包路径:org.apache.jackrabbit.oak.api.Root
类名称:Root
方法名:refresh

Root.refresh介绍

[英]Reverts all changes made to this root and refreshed to the latest trunk. After a call to this method, trees obtained through #getTree(String)may become non existing.
[中]还原对此根目录所做的所有更改,并刷新到最新的主干。调用此方法后,通过#getTree(String)获得的树可能不存在。

代码示例

代码示例来源:origin: apache/jackrabbit-oak

void autosave() throws RepositoryException {
  if (autosave) {
    try {
      root.commit();
    } catch (CommitFailedException e) {
      throw e.asRepositoryException();
    } finally {
      root.refresh();
    }
  }
}

代码示例来源:origin: apache/jackrabbit-oak

@Test
public void changeUUID() throws Exception {
  try {
    Tree userTree = root.getTree(userPath);
    userTree.setProperty(JcrConstants.JCR_UUID, UUID.randomUUID().toString());
    root.commit();
    fail("changing jcr:uuid should fail if it the uuid valid is invalid");
  } catch (CommitFailedException e) {
    // expected
  } finally {
    root.refresh();
  }
}

代码示例来源:origin: apache/jackrabbit-oak

@Test
  public void testGetProperties() throws Exception {
    setupPermission("/a", testPrincipal, false, PrivilegeConstants.REP_READ_PROPERTIES);

    testRoot.refresh();
    Tree a = testRoot.getTree("/a");
    Iterable<? extends PropertyState> props = a.getProperties();
    assertFalse(props.iterator().hasNext());
  }
}

代码示例来源:origin: apache/jackrabbit-oak

@Test
public void testMissingPrivilegeBits() {
  try {
    createPrivilegeTree("test");
    root.commit();
    fail("Missing privilege bits property must be detected.");
  } catch (CommitFailedException e) {
    // success
    assertTrue(e.isConstraintViolation());
  } finally {
    root.refresh();
  }
}

代码示例来源:origin: apache/jackrabbit-oak

@Test
public void testCreateToken() throws Exception {
  String userId = getTestUser().getID();
  readOnlyRoot.refresh();
  assertNull(readOnlyTp.createToken(userId, ImmutableMap.<String, Object>of()));
}

代码示例来源:origin: org.apache.jackrabbit/oak-core

void autosave() throws RepositoryException {
  if (autosave) {
    try {
      root.commit();
    } catch (CommitFailedException e) {
      throw e.asRepositoryException();
    } finally {
      root.refresh();
    }
  }
}

代码示例来源:origin: apache/jackrabbit-oak

@Test
public void removePrincipalName() throws Exception {
  try {
    Tree userTree = root.getTree(userPath);
    userTree.removeProperty(REP_PRINCIPAL_NAME);
    root.commit();
    fail("removing principal name should fail");
  } catch (CommitFailedException e) {
    // expected
  } finally {
    root.refresh();
  }
}

代码示例来源:origin: apache/jackrabbit-oak

@Test
public void testExistingMemberWithoutAccess() throws Exception {
  Set<String> failed = addExistingMemberWithoutAccess();
  assertTrue(failed.isEmpty());
  root.refresh();
  assertTrue(testGroup.isMember(memberGroup));
}

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

void autosave() throws RepositoryException {
  if (autosave) {
    try {
      root.commit();
    } catch (CommitFailedException e) {
      throw e.asRepositoryException();
    } finally {
      root.refresh();
    }
  }
}

代码示例来源:origin: apache/jackrabbit-oak

@Test
public void changeAuthorizableId() throws Exception {
  try {
    Tree userTree = root.getTree(userPath);
    userTree.setProperty(REP_AUTHORIZABLE_ID, "modified");
    root.commit();
    fail("changing the authorizable id should fail");
  } catch (CommitFailedException e) {
    // expected
  } finally {
    root.refresh();
  }
}

代码示例来源:origin: apache/jackrabbit-oak

@Test
public void testMissingAccessMember() throws Exception {
  Set<String> failed = removeExistingMemberWithoutAccess();
  assertTrue(failed.isEmpty());
  root.refresh();
  assertFalse(testGroup.isMember(memberGroup));
}

代码示例来源:origin: apache/jackrabbit-oak

@Override
public void after() throws Exception {
  try {
    root.refresh();
    impersonator.remove();
    root.commit();
  } finally {
    super.after();
  }
}

代码示例来源:origin: apache/jackrabbit-oak

@Test
public void removePassword() throws Exception {
  try {
    Tree userTree = root.getTree(userPath);
    userTree.removeProperty(REP_PASSWORD);
    root.commit();
    fail("removing password should fail");
  } catch (CommitFailedException e) {
    // expected
  } finally {
    root.refresh();
  }
}

代码示例来源:origin: apache/jackrabbit-oak

@Test
public void testIdConflict() throws RepositoryException, CommitFailedException {
  // EXERCISE: fix this test without changing the ID-parameter of the 2 create-calls.
  User conflictUser = getUserManager(root).createUser(testUser.getID(), null);
  root.refresh();
  Group conflictGroup = getUserManager(root).createGroup(testUser.getID());
  root.refresh();
}

代码示例来源:origin: apache/jackrabbit-oak

@Override
public void after() throws Exception {
  try {
    root.refresh();
    if (testGroup != null) {
      testGroup.remove();
    }
    root.commit();
  } finally {
    super.after();
  }
}

代码示例来源:origin: apache/jackrabbit-oak

@Test
public void changePrincipalName() throws Exception {
  try {
    Tree userTree = root.getTree(userPath);
    userTree.setProperty(REP_PRINCIPAL_NAME, "another");
    root.commit();
    fail("changing the principal name should fail");
  } catch (CommitFailedException e) {
    // expected
  } finally {
    root.refresh();
  }
}

代码示例来源:origin: apache/jackrabbit-oak

@Test
public void testGetPropertyCount() throws Exception {
  setupPermission("/a", testPrincipal, false, PrivilegeConstants.REP_READ_PROPERTIES);
  testRoot.refresh();
  Tree a = testRoot.getTree("/a");
  assertEquals(0, a.getPropertyCount());
}

代码示例来源:origin: apache/jackrabbit-oak

@Override
public void after() throws Exception {
  try {
    root.refresh();
    user2.remove();
    root.commit();
  } finally {
    super.after();
  }
}

代码示例来源:origin: apache/jackrabbit-oak

@Test
public void changePasswordToPlainText() throws Exception {
  try {
    Tree userTree = root.getTree(userPath);
    userTree.setProperty(REP_PASSWORD, "plaintext");
    root.commit();
    fail("storing a plaintext password should fail");
  } catch (CommitFailedException e) {
    // expected
  } finally {
    root.refresh();
  }
}

代码示例来源:origin: apache/jackrabbit-oak

@Test
public void testSyncCreatesRepExternalPrincipals() throws Exception {
  try {
    login(new SimpleCredentials(USER_ID, new char[0])).close();
    root.refresh();
    assertExternalPrincipalNames(getUserManager(root), USER_ID);
  } finally {
    options.clear();
  }
}

相关文章