use of org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver in project jackrabbit by apache.
the class BatchTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
rs = helper.getRepositoryService();
si = helper.getAdminSessionInfo();
NamespaceResolver nsResolver = new AbstractNamespaceResolver() {
public String getURI(String prefix) {
return ("jcr".equals(prefix)) ? "http://www.jcp.org/jcr/1.0" : prefix;
}
public String getPrefix(String uri) {
return ("http://www.jcp.org/jcr/1.0".equals(uri)) ? "jcr" : uri;
}
};
resolver = new DefaultNamePathResolver(nsResolver);
try {
rs.getNodeInfo(si, getNodeId(testPath));
} catch (RepositoryException e) {
Batch b = rs.createBatch(si, getNodeId("/"));
b.addNode(getNodeId("/"), resolver.getQName("test"), NameConstants.NT_UNSTRUCTURED, null);
rs.submit(b);
}
}
use of org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver in project jackrabbit by apache.
the class FileJournalTest method testClusterInitIncompleteMissingParam.
/**
* Verify that <code>ClusterNode.stop</code> can be invoked even when
* <code>ClusterNode.init</code> throws because the journal can not
* be initialized. Note: this is done by omitting the required argument
* <code>directory</code>.
*
* @throws Exception
*/
public void testClusterInitIncompleteMissingParam() throws Exception {
JournalFactory jf = new JournalFactory() {
public Journal getJournal(NamespaceResolver resolver) throws RepositoryException {
try {
FileJournal journal = new FileJournal();
// no setDirectory() call here
journal.init(CLUSTER_NODE_ID, resolver);
return journal;
} catch (JournalException e) {
throw new RepositoryException("Expected failure", e);
}
}
};
ClusterConfig cc = new ClusterConfig(CLUSTER_NODE_ID, SYNC_DELAY, jf);
SimpleClusterContext context = new SimpleClusterContext(cc);
ClusterNode clusterNode = new ClusterNode();
try {
clusterNode.init(context);
fail("Bad cluster configuration.");
} catch (Exception e) {
}
clusterNode.stop();
}
use of org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver in project jackrabbit by apache.
the class ValueConstraintTest method setUp.
protected void setUp() throws Exception {
super.setUp();
valueFactory = QValueFactoryImpl.getInstance();
resolver = new DefaultNamePathResolver(new NamespaceResolver() {
public String getURI(String prefix) throws NamespaceException {
return prefix;
}
public String getPrefix(String uri) throws NamespaceException {
return uri;
}
});
}
use of org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver in project jackrabbit by apache.
the class RepositoryServiceImpl method getRepositoryDescriptors.
/**
* {@inheritDoc}
*/
public Map<String, QValue[]> getRepositoryDescriptors() throws RepositoryException {
Map<String, QValue[]> descriptors = new HashMap<String, QValue[]>();
for (String key : repository.getDescriptorKeys()) {
if (key.equals(Repository.OPTION_TRANSACTIONS_SUPPORTED)) {
descriptors.put(key, new QValue[] { qValueFactory.create(false) });
} else {
Value[] vs = repository.getDescriptorValues(key);
QValue[] qvs = new QValue[vs.length];
for (int i = 0; i < vs.length; i++) {
// Name and path resolver that uses a dummy namespace resolver
// as Name/Path values are not expected to occur in the
// descriptors. TODO: check again.
NamePathResolver resolver = new DefaultNamePathResolver(new NamespaceResolver() {
public String getURI(String prefix) {
return prefix;
}
public String getPrefix(String uri) {
return uri;
}
});
qvs[i] = ValueFormat.getQValue(vs[i], resolver, qValueFactory);
}
descriptors.put(key, qvs);
}
}
return descriptors;
}
use of org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver in project jackrabbit by apache.
the class ExtensionTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
rs = helper.getRepositoryService();
si = helper.getAdminSessionInfo();
NamespaceResolver nsResolver = new AbstractNamespaceResolver() {
public String getURI(String prefix) {
return ("jcr".equals(prefix)) ? "http://www.jcp.org/jcr/1.0" : prefix;
}
public String getPrefix(String uri) {
return ("http://www.jcp.org/jcr/1.0".equals(uri)) ? "jcr" : uri;
}
};
resolver = new DefaultNamePathResolver(nsResolver);
}
Aggregations