use of org.apache.jackrabbit.spi.commons.conversion.NameResolver in project jackrabbit by apache.
the class EntryTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
if (superuser instanceof NameResolver) {
NameResolver resolver = (NameResolver) superuser;
nodePath = resolver.getJCRName(ACLTemplate.P_NODE_PATH);
glob = resolver.getJCRName(ACLTemplate.P_GLOB);
} else {
throw new NotExecutableException();
}
restrictions = new HashMap<String, Value>(2);
restrictions.put(nodePath, superuser.getValueFactory().createValue("/a/b/c/d", PropertyType.PATH));
restrictions.put(glob, superuser.getValueFactory().createValue("*"));
acl = new ACLTemplate(testPrincipal, testPath, (SessionImpl) superuser, superuser.getValueFactory());
}
use of org.apache.jackrabbit.spi.commons.conversion.NameResolver in project jackrabbit by apache.
the class NamePathResolverImpl method create.
public static NamePathResolver create(NamespaceMappings nsMappings) {
NameResolver nResolver = new NameResolverImpl(nsMappings);
PathResolver pResolver = new ParsingPathResolver(PATH_FACTORY, nResolver);
return new NamePathResolverImpl(nResolver, pResolver);
}
use of org.apache.jackrabbit.spi.commons.conversion.NameResolver in project jackrabbit by apache.
the class AdministratorTest method testAdminNodeCollidingWithRandomNode.
/**
* Test for collisions that would prevent from recreate the admin user.
* - a colliding node somewhere else with the same jcr:uuid.
*
* Test if creation of the administrator user forces the removal of some
* other node in the repository that by change happens to have the same
* jcr:uuid and thus inhibits the creation of the admininstrator user.
*/
public void testAdminNodeCollidingWithRandomNode() throws RepositoryException, NotExecutableException {
Authorizable admin = userMgr.getAuthorizable(adminId);
if (admin == null || !(admin instanceof AuthorizableImpl)) {
throw new NotExecutableException();
}
// access the node corresponding to the admin user and remove it
NodeImpl adminNode = ((AuthorizableImpl) admin).getNode();
NodeId nid = adminNode.getNodeId();
Session s = adminNode.getSession();
adminNode.remove();
// use session obtained from the node as usermgr may point to a dedicated
// system workspace different from the superusers workspace.
s.save();
Session s2 = null;
String collidingPath = null;
try {
// create a colliding node outside of the user tree
NameResolver nr = (SessionImpl) s;
// NOTE: testRootNode will not be present if users are stored in a distinct wsp.
// therefore use root node as start...
NodeImpl tr = (NodeImpl) s.getRootNode();
Node n = tr.addNode(nr.getQName("tmpNode"), nr.getQName(testNodeType), nid);
collidingPath = n.getPath();
s.save();
// force recreation of admin user.
s2 = getHelper().getSuperuserSession();
admin = userMgr.getAuthorizable(adminId);
assertNotNull(admin);
// the colliding node must have been removed.
assertFalse(s2.nodeExists(collidingPath));
} finally {
if (s2 != null) {
s2.logout();
}
if (collidingPath != null && s.nodeExists(collidingPath)) {
s.getNode(collidingPath).remove();
s.save();
}
}
}
use of org.apache.jackrabbit.spi.commons.conversion.NameResolver in project jackrabbit by apache.
the class ValueFormatTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
idResolver = new IdentifierResolver() {
public Path getPath(String identifier) throws MalformedPathException {
throw new UnsupportedOperationException();
}
public void checkFormat(String identifier) throws MalformedPathException {
// nop
}
};
NameResolver nResolver = new ParsingNameResolver(NameFactoryImpl.getInstance(), new DummyNamespaceResolver());
PathResolver pResolver = new ParsingPathResolver(PathFactoryImpl.getInstance(), nResolver, idResolver);
resolver = new DefaultNamePathResolver(nResolver, pResolver);
qvFactory = QValueFactoryImpl.getInstance();
vFactory = new ValueFactoryQImpl(qvFactory, resolver);
}
use of org.apache.jackrabbit.spi.commons.conversion.NameResolver in project jackrabbit by apache.
the class UserManagerImplTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
if (!(userMgr instanceof UserManagerImpl)) {
throw new NotExecutableException("UserManagerImpl expected -> cannot perform test.");
}
NameResolver resolver = (SessionImpl) superuser;
pPrincipalName = resolver.getJCRName(UserConstants.P_PRINCIPAL_NAME);
}
Aggregations