use of org.apache.jackrabbit.oak.plugins.tree.TreeLocation in project jackrabbit-oak by apache.
the class UserContextTest method testNonExistingTreeDefinesLocation2.
@Test
public void testNonExistingTreeDefinesLocation2() {
for (String name : Iterables.concat(USER_PROPERTY_NAMES, GROUP_PROPERTY_NAMES)) {
String path = "/some/path/endingWith/reservedName/" + name;
for (String ntName : NT_NAMES) {
Tree t = mockTree("anyName", ntName);
TreeLocation location = Mockito.mock(TreeLocation.class);
when(location.getTree()).thenReturn(t);
when(location.exists()).thenReturn(false);
when(location.getPath()).thenReturn(path);
assertTrue(ctx.definesLocation(location));
}
}
}
use of org.apache.jackrabbit.oak.plugins.tree.TreeLocation in project jackrabbit-oak by apache.
the class PrivilegeContextTest method testDefinesLocation.
@Test
public void testDefinesLocation() {
List<String> paths = ImmutableList.of(PrivilegeConstants.PRIVILEGES_PATH, PrivilegeConstants.PRIVILEGES_PATH + "/child", PrivilegeConstants.PRIVILEGES_PATH + "/another/child");
for (String path : paths) {
TreeLocation location = Mockito.mock(TreeLocation.class);
when(location.getPath()).thenReturn(path);
assertTrue(path, ctx.definesLocation(location));
}
}
use of org.apache.jackrabbit.oak.plugins.tree.TreeLocation in project jackrabbit-oak by apache.
the class PrivilegeContextTest method testNotDefinesLocation.
@Test
public void testNotDefinesLocation() {
List<String> paths = ImmutableList.of(PathUtils.ROOT_PATH, PrivilegeConstants.PRIVILEGES_PATH + "sibling", "/some/other/path", "");
for (String path : paths) {
TreeLocation location = Mockito.mock(TreeLocation.class);
when(location.getPath()).thenReturn(path);
assertFalse(path, ctx.definesLocation(location));
}
}
use of org.apache.jackrabbit.oak.plugins.tree.TreeLocation in project jackrabbit-oak by apache.
the class UserContextTest method testDefinesLocation.
@Test
public void testDefinesLocation() {
for (String ntName : NT_NAMES) {
Tree t = mockTree("anyName", ntName);
TreeLocation location = Mockito.mock(TreeLocation.class);
when(location.getTree()).thenReturn(t);
when(location.exists()).thenReturn(true);
assertTrue(ctx.definesLocation(location));
}
}
use of org.apache.jackrabbit.oak.plugins.tree.TreeLocation in project jackrabbit-oak by apache.
the class UserContextTest method testNoTreeDefinesLocation.
@Test
public void testNoTreeDefinesLocation() {
for (String name : Iterables.concat(USER_PROPERTY_NAMES, GROUP_PROPERTY_NAMES)) {
String path = "/some/path/endingWith/reservedName/" + name;
TreeLocation location = Mockito.mock(TreeLocation.class);
when(location.getPath()).thenReturn(path);
assertTrue(path, ctx.definesLocation(location));
}
}
Aggregations