use of org.apache.jackrabbit.spi.NodeId in project jackrabbit by apache.
the class BatchTest method testSetDoubleValue.
public void testSetDoubleValue() throws RepositoryException {
NodeId nid = getNodeId(testPath);
Name propName = resolver.getQName("doubleProp");
QValue v = rs.getQValueFactory().create((double) 12);
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(v.getString(), pi.getValues()[0].getString());
assertEquals(PropertyType.DOUBLE, pi.getType());
pi = getPropertyInfo(nid, propName);
assertEquals(v, pi.getValues()[0]);
assertEquals(v.getString(), pi.getValues()[0].getString());
assertEquals(PropertyType.DOUBLE, pi.getType());
}
use of org.apache.jackrabbit.spi.NodeId in project jackrabbit by apache.
the class BatchTest method testImport.
public void testImport() throws RepositoryException {
NodeId nid = getNodeId(testPath);
Batch b = rs.createBatch(si, nid);
String uuid = UUID.randomUUID().toString();
b.addNode(nid, resolver.getQName("testUUIDNode"), NameConstants.NT_UNSTRUCTURED, uuid);
NodeId id = getNodeId(testPath + "/testUUIDNode");
b.setMixins(id, new Name[] { NameConstants.MIX_REFERENCEABLE });
rs.submit(b);
NodeInfo nInfo = rs.getNodeInfo(si, id);
assertEquals(uuid, nInfo.getId().getUniqueID());
Name[] mixins = nInfo.getMixins();
assertEquals(1, mixins.length);
assertEquals(NameConstants.MIX_REFERENCEABLE, mixins[0]);
b = rs.createBatch(si, nid);
b.remove(rs.getIdFactory().createNodeId(uuid));
rs.submit(b);
try {
rs.getItemInfos(si, id);
fail();
} catch (RepositoryException e) {
// success
}
try {
rs.getItemInfos(si, rs.getIdFactory().createNodeId(uuid));
fail();
} catch (RepositoryException e) {
// success
}
}
use of org.apache.jackrabbit.spi.NodeId in project jackrabbit by apache.
the class CloneTest method testClone.
public void testClone() throws RepositoryException {
NodeId srcId = getNodeId(testPath);
NodeId destParentId = getNodeId("/");
rs.clone(sInfo, si.getWorkspaceName(), srcId, destParentId, resolver.getQName("destname"), true);
clonedId = getNodeId("/destname");
NodeInfo nInfo = rs.getNodeInfo(sInfo, clonedId);
Iterator<? extends ItemInfo> it = rs.getItemInfos(sInfo, clonedId);
assertTrue(it.hasNext());
NodeInfo nInfo2 = (NodeInfo) it.next();
assertEquals(nInfo.getId(), nInfo2.getId());
assertEquals(nInfo.getNodetype(), nInfo2.getNodetype());
}
use of org.apache.jackrabbit.spi.NodeId 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.NodeId in project jackrabbit by apache.
the class CreateFileTest method testPropertiesWithNonLatinCharacters.
public void testPropertiesWithNonLatinCharacters() throws RepositoryException, IOException {
Name fileName = resolver.getQName("سش.txt");
createFile(fileName);
NodeId nid = getNodeId(testPath + "/سش.txt/jcr:content");
PropertyInfo pi = rs.getPropertyInfo(si, rs.getIdFactory().createPropertyId(nid, NameConstants.JCR_LASTMODIFIED));
assertEquals(lastModified, pi.getValues()[0]);
pi = rs.getPropertyInfo(si, rs.getIdFactory().createPropertyId(nid, NameConstants.JCR_MIMETYPE));
assertEquals(mimeType, pi.getValues()[0]);
pi = rs.getPropertyInfo(si, rs.getIdFactory().createPropertyId(nid, NameConstants.JCR_ENCODING));
assertEquals(enc, pi.getValues()[0]);
pi = rs.getPropertyInfo(si, rs.getIdFactory().createPropertyId(nid, NameConstants.JCR_DATA));
assertEquals("سش", pi.getValues()[0].getString());
}
Aggregations