use of org.apache.jackrabbit.oak.namepath.NamePathMapper in project jackrabbit-oak by apache.
the class AbstractAccessControlListTest method testGetOakPath.
@Test
public void testGetOakPath() {
NamePathMapper npMapper = new NamePathMapperImpl(new LocalNameMapper(singletonMap("oak", "http://jackrabbit.apache.org"), singletonMap("jcr", "http://jackrabbit.apache.org")));
// map of jcr-path to oak path
Map<String, String> paths = new HashMap<String, String>();
paths.put(null, null);
paths.put(getTestPath(), getTestPath());
paths.put("/", "/");
String oakPath = "/oak:testPath";
String jcrPath = "/jcr:testPath";
paths.put(jcrPath, oakPath);
jcrPath = "/{http://jackrabbit.apache.org}testPath";
paths.put(jcrPath, oakPath);
// test if oak-path is properly set.
for (String path : paths.keySet()) {
AbstractAccessControlList acl = createACL(path, Collections.<JackrabbitAccessControlEntry>emptyList(), npMapper);
assertEquals(paths.get(path), acl.getOakPath());
}
}
use of org.apache.jackrabbit.oak.namepath.NamePathMapper in project jackrabbit-oak by apache.
the class PrivilegeBitsProviderTest method testGetBitsFromPrivilegesInvalidMapping.
@Test
public void testGetBitsFromPrivilegesInvalidMapping() {
Privilege p = Mockito.mock(Privilege.class);
when(p.getName()).thenReturn("name");
NamePathMapper mapper = new NamePathMapper.Default() {
@Nonnull
@Override
public String getOakName(@Nonnull String jcrName) throws RepositoryException {
throw new RepositoryException();
}
};
assertSame(PrivilegeBits.EMPTY, bitsProvider.getBits(new Privilege[] { p }, mapper));
}
Aggregations