use of javax.jcr.ValueFactory in project jackrabbit by apache.
the class GarbageCollectorTest method testTransientObjects.
public void testTransientObjects() throws Exception {
Node root = testRootNode;
Session session = root.getSession();
deleteMyNodes();
Credentials cred = getHelper().getSuperuserCredentials();
Session s2 = getHelper().getRepository().login(cred);
root = s2.getRootNode();
Node node2 = root.addNode("node3");
Node n = node2.addNode("nodeWithBlob");
ValueFactory vf = session.getValueFactory();
n.setProperty("test", vf.createBinary(new RandomInputStream(10, 1000)));
runGC(session, false);
s2.save();
InputStream in = n.getProperty("test").getBinary().getStream();
InputStream in2 = new RandomInputStream(10, 1000);
verifyInputStream(in, in2);
deleteMyNodes();
s2.logout();
}
use of javax.jcr.ValueFactory in project jackrabbit by apache.
the class PathTest method testCreatePathValue.
public void testCreatePathValue() throws RepositoryException {
ValueFactory vf = superuser.getValueFactory();
Value pathValue = vf.createValue("[" + identifier + "]", PropertyType.PATH);
assertEquals(PropertyType.PATH, pathValue.getType());
assertEquals("[" + identifier + "]", pathValue.getString());
assertFalse(pathValue.equals(vf.createValue(testRootNode.getPath(), PropertyType.PATH)));
}
use of javax.jcr.ValueFactory in project jackrabbit by apache.
the class PathTest method testCreateMultiplePathValue.
public void testCreateMultiplePathValue() throws RepositoryException {
ValueFactory vf = superuser.getValueFactory();
Value vID1 = vf.createValue("[" + identifier + "]", PropertyType.PATH);
Value v = vf.createValue(testRootNode.getPath(), PropertyType.PATH);
Value vID2 = vf.createValue("[" + identifier + "]", PropertyType.PATH);
Value v2 = vf.createValue(testRootNode.getPath(), PropertyType.PATH);
assertEquals(vID1, vID2);
assertEquals(v, v2);
assertFalse(v.equals(vID1));
assertFalse(v.equals(vID2));
}
use of javax.jcr.ValueFactory in project jackrabbit by apache.
the class PathTest method testIdentifierBasedPropertyValue.
public void testIdentifierBasedPropertyValue() throws RepositoryException {
ValueFactory vf = superuser.getValueFactory();
Value pathValue = vf.createValue("[" + identifier + "]", PropertyType.PATH);
Property p = testRootNode.setProperty(propertyName1, pathValue);
assertEquals(PropertyType.PATH, p.getType());
assertEquals(pathValue.getString(), p.getValue().getString());
assertEquals(pathValue, p.getValue());
}
use of javax.jcr.ValueFactory in project jackrabbit by apache.
the class PathTest method testExtendedNameBasedPathValue.
public void testExtendedNameBasedPathValue() throws RepositoryException {
ValueFactory vf = superuser.getValueFactory();
Value pathValue = vf.createValue(Workspace.PATH_VERSION_STORAGE_NODE, PropertyType.PATH);
Property p = testRootNode.setProperty(propertyName1, pathValue);
assertEquals("/jcr:system/jcr:versionStorage", p.getString());
String path = Workspace.PATH_VERSION_STORAGE_NODE + "/a/b/c/jcr:frozenNode";
pathValue = vf.createValue(path, PropertyType.PATH);
p = testRootNode.setProperty(propertyName1, pathValue);
assertEquals("/jcr:system/jcr:versionStorage/a/b/c/jcr:frozenNode", p.getString());
}
Aggregations