use of org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver in project jackrabbit by apache.
the class ReadTest 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 ConnectionTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
rs = helper.getRepositoryService();
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);
}
use of org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver in project jackrabbit by apache.
the class CopyTest 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 ConsistencyCheckerImplTest method createClusterNode.
private ClusterNode createClusterNode(String id) throws Exception {
final MemoryJournal journal = new MemoryJournal() {
protected boolean syncAgainOnNewRecords() {
return true;
}
};
JournalFactory jf = new JournalFactory() {
public Journal getJournal(NamespaceResolver resolver) throws RepositoryException {
return journal;
}
};
ClusterConfig cc = new ClusterConfig(id, SYNC_DELAY, jf);
SimpleClusterContext context = new SimpleClusterContext(cc);
journal.setRepositoryHome(context.getRepositoryHome());
journal.init(id, context.getNamespaceResolver());
journal.setRecords(records);
ClusterNode clusterNode = new ClusterNode();
clusterNode.init(context);
return clusterNode;
}
use of org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver in project jackrabbit by apache.
the class ClusterRecordTest method createClusterNode.
/**
* Create a cluster node, with a memory journal referencing a list of records.
*
* @param id cluster node id
* @param records memory journal's list of records
*/
private ClusterNode createClusterNode(String id, ArrayList<MemoryRecord> records) throws Exception {
final MemoryJournal journal = new MemoryJournal();
JournalFactory jf = new JournalFactory() {
public Journal getJournal(NamespaceResolver resolver) throws RepositoryException {
return journal;
}
};
ClusterConfig cc = new ClusterConfig(id, SYNC_DELAY, jf);
SimpleClusterContext context = new SimpleClusterContext(cc);
journal.setRepositoryHome(context.getRepositoryHome());
journal.init(id, context.getNamespaceResolver());
if (records != null) {
journal.setRecords(records);
}
ClusterNode clusterNode = new ClusterNode();
clusterNode.init(context);
return clusterNode;
}
Aggregations