use of org.apache.jackrabbit.oak.api.PropertyState in project jackrabbit-oak by apache.
the class TreeUtilTest method testJcrCreatedByNullUserId.
@Test
public void testJcrCreatedByNullUserId() throws Exception {
Tree tree = TreeUtil.addChild(root.getTree("/"), "test", JcrConstants.NT_FOLDER, root.getTree(NodeTypeConstants.NODE_TYPES_PATH), null);
PropertyState ps = tree.getProperty(NodeTypeConstants.JCR_CREATEDBY);
assertNotNull(ps);
assertEquals("", ps.getValue(Type.STRING));
}
use of org.apache.jackrabbit.oak.api.PropertyState in project jackrabbit-oak by apache.
the class PropertyStatesTest method pathPropertyFromPathValue.
@Test
public void pathPropertyFromPathValue() throws RepositoryException {
PropertyState pathProperty = PropertyStates.createProperty("path", "oak-prefix:a/oak-prefix:b", PropertyType.PATH);
Value nameValue = ValueFactoryImpl.createValue(pathProperty, namePathMapper);
PropertyState namePropertyFromValue = PropertyStates.createProperty("path", nameValue);
assertEquals(pathProperty, namePropertyFromValue);
}
use of org.apache.jackrabbit.oak.api.PropertyState in project jackrabbit-oak by apache.
the class CugContext method definesLocation.
@Override
public boolean definesLocation(@Nonnull TreeLocation location) {
PropertyState p = location.getProperty();
Tree tree = (p == null) ? location.getTree() : location.getParent().getTree();
if (tree != null) {
return (p == null) ? definesTree(tree) : definesProperty(tree, p);
} else {
String path = location.getPath();
return REP_CUG_POLICY.equals(Text.getName(path)) || path.endsWith(REP_CUG_POLICY + '/' + REP_PRINCIPAL_NAMES);
}
}
use of org.apache.jackrabbit.oak.api.PropertyState in project jackrabbit-oak by apache.
the class TopLevelPaths method contains.
boolean contains(@Nonnull String path) {
if (!hasAny()) {
return false;
}
if (PathUtils.denotesRoot(path)) {
return true;
}
if (cnt == null) {
Tree rootTree = root.getTree(PathUtils.ROOT_PATH);
PropertyState hiddenTopCnt = rootTree.getProperty(HIDDEN_TOP_CUG_CNT);
if (hiddenTopCnt != null) {
cnt = hiddenTopCnt.getValue(Type.LONG);
if (cnt <= MAX_CNT) {
PropertyState hidden = root.getTree(PathUtils.ROOT_PATH).getProperty(HIDDEN_NESTED_CUGS);
paths = (hidden == null) ? new String[0] : Iterables.toArray(hidden.getValue(Type.STRINGS), String.class);
} else {
paths = null;
}
} else {
cnt = NONE;
}
}
if (cnt == NONE) {
return false;
}
if (cnt > MAX_CNT) {
return true;
} else if (paths != null) {
for (String p : paths) {
if (Text.isDescendantOrEqual(path, p)) {
return true;
}
}
}
return false;
}
use of org.apache.jackrabbit.oak.api.PropertyState in project jackrabbit-oak by apache.
the class DynamicSyncContextTest method testSyncExternalUserDepth1.
@Test
public void testSyncExternalUserDepth1() throws Exception {
syncConfig.user().setMembershipNestingDepth(1);
ExternalUser externalUser = idp.getUser(USER_ID);
sync(externalUser, SyncResult.Status.ADD);
Tree tree = r.getTree(userManager.getAuthorizable(USER_ID).getPath());
PropertyState extPrincipalNames = tree.getProperty(ExternalIdentityConstants.REP_EXTERNAL_PRINCIPAL_NAMES);
assertNotNull(extPrincipalNames);
Set<String> pNames = Sets.newHashSet(extPrincipalNames.getValue(Type.STRINGS));
for (ExternalIdentityRef ref : externalUser.getDeclaredGroups()) {
assertTrue(pNames.remove(idp.getIdentity(ref).getPrincipalName()));
}
assertTrue(pNames.isEmpty());
}
Aggregations