本文整理了Java中org.apache.jackrabbit.oak.api.Root.hasPendingChanges
方法的一些代码示例,展示了Root.hasPendingChanges
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Root.hasPendingChanges
方法的具体详情如下:
包路径:org.apache.jackrabbit.oak.api.Root
类名称:Root
方法名:hasPendingChanges
[英]Determine whether there are changes on this tree
[中]确定此树上是否有更改
代码示例来源:origin: apache/jackrabbit-oak
private IdResolver(@NotNull Root root, @NotNull ContentSession contentSession) {
currentStateIdManager = new IdentifierManager(root);
baseStateIdManager = new IdentifierManager(contentSession.getLatestRoot());
if (!root.hasPendingChanges()) {
importedUUIDs = new HashSet<String>();
} else {
importedUUIDs = null;
}
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testCreateRemoveUser() throws RepositoryException {
User u = mgr.createUser("u", "u");
assertFalse(root.hasPendingChanges());
u.remove();
assertFalse(root.hasPendingChanges());
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testOnCreateGroup() throws Exception {
action.onCreate(gr, root, NamePathMapper.DEFAULT);
assertFalse(root.hasPendingChanges());
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testProcessReferencesIsNoOp() throws Exception {
importer.processReferences();
assertFalse(root.hasPendingChanges());
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testSyncUsersBeforeSaveError() throws Exception {
Root r = preventRootCommit(delegatee);;
String[] result = delegatee.syncUsers(TEST_IDS, false);
assertResultMessages(result, ImmutableMap.of(
TestIdentityProvider.ID_TEST_USER, "nsa",
TestIdentityProvider.ID_SECOND_USER, "nsa",
TestIdentityProvider.ID_WILDCARD_USER, "nsa"));
assertFalse(r.hasPendingChanges());
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testSyncAllExternalUsersSaveError() throws Exception {
Root r = preventRootCommit(delegatee);;
String[] result = delegatee.syncAllExternalUsers();
assertResultMessages(result, ImmutableMap.of(
TestIdentityProvider.ID_TEST_USER, "ERR",
TestIdentityProvider.ID_SECOND_USER, "ERR",
TestIdentityProvider.ID_WILDCARD_USER, "ERR"));
assertFalse(r.hasPendingChanges());
}
代码示例来源:origin: apache/jackrabbit-oak
@Override
public void after() throws Exception {
try {
root.getTree("/test").remove();
if (root.hasPendingChanges()) {
root.commit();
}
} finally {
super.after();
}
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testEndWithoutChildInfo() throws Exception {
init();
importer.start(aclTree);
importer.end(aclTree);
assertTrue(root.hasPendingChanges());
assertFalse(aclTree.getChildren().iterator().hasNext());
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testStartAclTree() throws Exception {
init();
assertTrue(importer.start(aclTree));
assertFalse(root.hasPendingChanges());
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testAddMembers() throws Exception {
User u = mgr.createUser("u", "u");
Group g = mgr.createGroup("g");
assertTrue(g.addMembers(u.getID()).isEmpty());
assertFalse(root.hasPendingChanges());
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testCommitFailedRevertChanges() throws RepositoryException {
User u = mgr.createUser("u", "u");
try {
User u2 = mgr.createUser("u", "u");
fail();
} catch (RepositoryException e) {
// success
assertFalse(root.hasPendingChanges());
}
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testValidAndNullIdModifiesRoot() throws Exception {
try {
testGroup.addMembers(getTestUser().getID(), null);
} catch (ConstraintViolationException e) {
// expected
}
// no modifications expected as testing for null id is done before changes are made
assertFalse(root.hasPendingChanges());
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testImpersonation() throws Exception {
User u = mgr.createUser("u", "u");
Impersonation imp = u.getImpersonation();
Principal p = mgr.getAuthorizable("anonymous").getPrincipal();
assertTrue(imp.grantImpersonation(p));
assertFalse(root.hasPendingChanges());
assertTrue(imp.revokeImpersonation(p));
assertFalse(root.hasPendingChanges());
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testRemoveMembers() throws Exception {
User u = mgr.createUser("u", "u");
Group g = mgr.createGroup("g");
g.addMember(u);
assertTrue(g.removeMembers(u.getID()).isEmpty());
assertFalse(root.hasPendingChanges());
}
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testApplyMembership() throws Exception {
User u = getTestUser();
Group gr = createTestGroup();
syncCtx.applyMembership(u, ImmutableSet.of(gr.getID()));
assertTrue(gr.isDeclaredMember(u));
assertTrue(root.hasPendingChanges());
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testSyncMembershipDepth1() throws Exception {
ExternalUser externalUser = idp.listUsers().next();
Authorizable a = syncCtx.createUser(externalUser);
syncCtx.syncMembership(externalUser, a, 1);
assertTrue(root.hasPendingChanges());
for (ExternalIdentityRef ref : externalUser.getDeclaredGroups()) {
Group g = userManager.getAuthorizable(ref.getId(), Group.class);
assertNotNull(g);
assertTrue(g.isDeclaredMember(a));
}
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testSyncNonExistingExternalUserSaveError() throws Exception {
Root r = preventRootCommit(delegatee);;
String[] result = delegatee.syncExternalUsers(new String[] {new ExternalIdentityRef("nonExisting", idp.getName()).getString()});
assertResultMessages(result, "", "nsi");
assertFalse(r.hasPendingChanges());
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testSyncForeignExternalUserSaveError() throws Exception {
Root r = preventRootCommit(delegatee);;
String[] result = delegatee.syncExternalUsers(new String[] {new ExternalIdentityRef(TestIdentityProvider.ID_TEST_USER, foreignIDP.getName()).getString()});
assertResultMessages(result, TestIdentityProvider.ID_TEST_USER, "for");
assertFalse(r.hasPendingChanges());
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testOnRemoveUserWithMembership() throws Exception {
User u = getTestUser();
gr.addMember(u);
root.commit();
action.onRemove(u, root, NamePathMapper.DEFAULT);
assertTrue(root.hasPendingChanges());
assertFalse(gr.isDeclaredMember(u));
}
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testSyncMembershipForExternalGroup() throws Exception {
ExternalGroup externalGroup = idp.getGroup("a"); // a group that has declaredGroups
SyncContext ctx = new DefaultSyncContext(syncConfig, idp, userManager, valueFactory);
ctx.sync(externalGroup);
ctx.close();
r.commit();
Authorizable gr = userManager.getAuthorizable(externalGroup.getId());
syncContext.syncMembership(externalGroup, gr, 1);
assertFalse(gr.hasProperty(ExternalIdentityConstants.REP_EXTERNAL_PRINCIPAL_NAMES));
assertFalse(r.hasPendingChanges());
}
内容来源于网络,如有侵权,请联系作者删除!