use of org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver in project jackrabbit by apache.
the class CloneTest 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) throws NamespaceException {
return ("jcr".equals(prefix)) ? "http://www.jcp.org/jcr/1.0" : prefix;
}
public String getPrefix(String uri) throws NamespaceException {
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);
}
// todo: retrieve second wsp-name from config
sInfo = rs.obtain(si, "test");
}
use of org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver in project jackrabbit by apache.
the class CreateFileTest 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);
}
lastModified = rs.getQValueFactory().create(Calendar.getInstance());
mimeType = rs.getQValueFactory().create("text/plain", PropertyType.STRING);
enc = rs.getQValueFactory().create("utf-8", PropertyType.STRING);
}
use of org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver in project jackrabbit-oak by apache.
the class RepositoryTest method addAlienBinaryProperty.
@Test
public void addAlienBinaryProperty() throws RepositoryException, IOException {
Session session = getAdminSession();
QValue qValue = QValueFactoryImpl.getInstance().create("binaryValue".getBytes());
Value value = new QValueValue(qValue, new DefaultNamePathResolver(session));
getNode(TEST_PATH).setProperty("binary", value);
session.save();
Value valueAgain = getNode(TEST_PATH).getProperty("binary").getValue();
assertEqualStream(value.getBinary().getStream(), valueAgain.getBinary().getStream());
}
Aggregations