use of org.apache.jackrabbit.spi.NodeInfo in project jackrabbit by apache.
the class CopyTest method testCopyAcrossWorkspaces.
public void testCopyAcrossWorkspaces() throws RepositoryException {
// todo: retrieve second wsp-name from config
sInfo = rs.obtain(si, "test");
NodeId srcId = getNodeId(testPath);
NodeId destParentId = getNodeId("/");
rs.copy(sInfo, si.getWorkspaceName(), srcId, destParentId, resolver.getQName("destname"));
copiedId = getNodeId("/destname");
NodeInfo nInfo = rs.getNodeInfo(sInfo, copiedId);
Iterator<? extends ItemInfo> it = rs.getItemInfos(sInfo, copiedId);
assertTrue(it.hasNext());
NodeInfo nInfo2 = (NodeInfo) it.next();
assertEquals(nInfo.getId(), nInfo2.getId());
assertEquals(nInfo.getNodetype(), nInfo2.getNodetype());
}
use of org.apache.jackrabbit.spi.NodeInfo in project jackrabbit by apache.
the class BatchTest method testSetReferenceValue.
public void testSetReferenceValue() throws RepositoryException {
NodeId nid = getNodeId(testPath);
NodeInfo nInfo = rs.getNodeInfo(si, nid);
if (!Arrays.asList(nInfo.getMixins()).contains(NameConstants.MIX_REFERENCEABLE)) {
Batch b = rs.createBatch(si, nid);
b.setMixins(nid, new Name[] { NameConstants.MIX_REFERENCEABLE });
rs.submit(b);
}
String ref = rs.getNodeInfo(si, nid).getId().getUniqueID();
Name propName = resolver.getQName("refProp");
QValue v = rs.getQValueFactory().create(ref, PropertyType.REFERENCE);
Batch b = rs.createBatch(si, nid);
b.addProperty(nid, propName, v);
rs.submit(b);
PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName));
assertFalse(pi.isMultiValued());
assertEquals(v, pi.getValues()[0]);
assertEquals(PropertyType.REFERENCE, pi.getType());
pi = getPropertyInfo(nid, propName);
assertEquals(v, pi.getValues()[0]);
assertEquals(PropertyType.REFERENCE, pi.getType());
}
use of org.apache.jackrabbit.spi.NodeInfo in project jackrabbit by apache.
the class ExtensionTest method testIndex.
public void testIndex() throws RepositoryException {
Name testName = resolver.getQName("test");
testPath = "/test";
createTestNode("/test");
createTestNode("/test");
NodeInfo nInfo = rs.getNodeInfo(si, getNodeId("/test[2]"));
//System.out.println("NodeInfo: " + nInfo.getPath().getNameElement().getName());
assertEquals(testName, nInfo.getPath().getName());
Iterator<? extends ItemInfo> it = rs.getItemInfos(si, getNodeId("/test[2]"));
assertTrue(it.hasNext());
nInfo = (NodeInfo) it.next();
//System.out.println("ItemInfo: " + nInfo.getPath().getNameElement().getName());
assertEquals(testName, nInfo.getPath().getName());
removeTestNode("/test[2]");
}
use of org.apache.jackrabbit.spi.NodeInfo in project jackrabbit by apache.
the class BatchTest method testSetMixin.
public void testSetMixin() throws RepositoryException {
NodeId nid = getNodeId(testPath);
Batch b = rs.createBatch(si, nid);
b.addNode(nid, resolver.getQName("anyNode"), NameConstants.NT_UNSTRUCTURED, null);
NodeId id = getNodeId(testPath + "/anyNode");
b.setMixins(id, new Name[] { NameConstants.MIX_LOCKABLE });
rs.submit(b);
b = rs.createBatch(si, id);
b.setMixins(id, new Name[0]);
rs.submit(b);
NodeInfo nInfo = rs.getNodeInfo(si, id);
assertEquals(0, nInfo.getMixins().length);
}
use of org.apache.jackrabbit.spi.NodeInfo in project jackrabbit by apache.
the class BatchTest method testSetWeakReferenceValue.
public void testSetWeakReferenceValue() throws RepositoryException {
NodeId nid = getNodeId(testPath);
NodeInfo nInfo = rs.getNodeInfo(si, nid);
if (!Arrays.asList(nInfo.getMixins()).contains(NameConstants.MIX_REFERENCEABLE)) {
Batch b = rs.createBatch(si, nid);
b.setMixins(nid, new Name[] { NameConstants.MIX_REFERENCEABLE });
rs.submit(b);
}
String ref = rs.getNodeInfo(si, nid).getId().getUniqueID();
Name propName = resolver.getQName("weakRefProp");
QValue v = rs.getQValueFactory().create(ref, PropertyType.WEAKREFERENCE);
Batch b = rs.createBatch(si, nid);
b.addProperty(nid, propName, v);
rs.submit(b);
PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName));
assertFalse(pi.isMultiValued());
assertEquals(v, pi.getValues()[0]);
assertEquals(PropertyType.WEAKREFERENCE, pi.getType());
pi = getPropertyInfo(nid, propName);
assertEquals(v, pi.getValues()[0]);
assertEquals(PropertyType.WEAKREFERENCE, pi.getType());
}
Aggregations