Search in sources :

Example 91 with Property

use of javax.jcr.Property in project jackrabbit by apache.

the class GetPropertyTest method testGetExternallyAddedItems.

public void testGetExternallyAddedItems() throws RepositoryException {
    Node node1 = (Node) readOnly.getItem(node1Path);
    Node n2 = testRootNode.getNode(nodeName1).addNode(nodeName2);
    Property p3 = n2.setProperty(propertyName1, "test");
    testRootNode.save();
    node1.refresh(true);
    assertTrue(readOnly.itemExists(n2.getPath()));
    assertTrue(readOnly.itemExists(p3.getPath()));
}
Also used : Node(javax.jcr.Node) Property(javax.jcr.Property)

Example 92 with Property

use of javax.jcr.Property in project jackrabbit by apache.

the class BinaryTest method testBinaryTwiceModifiedProperty.

public void testBinaryTwiceModifiedProperty() throws Exception {
    Node test = testRootNode.addNode("test");
    Property p = test.setProperty("prop", generateValue());
    superuser.save();
    // modify twice
    test.setProperty("prop", generateValue());
    QValue qv1 = getQValue(p);
    test.setProperty("prop", generateValue());
    QValue qv2 = getQValue(p);
    assertFalse(qv1.equals(qv2));
    superuser.save();
    assertEquals(qv2, getQValue(p));
    assertDisposed(qv1);
}
Also used : QValue(org.apache.jackrabbit.spi.QValue) Node(javax.jcr.Node) Property(javax.jcr.Property)

Example 93 with Property

use of javax.jcr.Property in project jackrabbit by apache.

the class BinaryTest method testBinaryTwiceIntermediateSave.

public void testBinaryTwiceIntermediateSave() throws Exception {
    Node test = testRootNode.addNode("test");
    Property p = test.setProperty("prop", generateValue());
    QValue qv1 = getQValue(p);
    superuser.save();
    test.setProperty("prop", generateValue());
    QValue qv2 = getQValue(p);
    assertFalse(qv1.equals(qv2));
    superuser.save();
    assertEquals(qv2, getQValue(p));
    assertDisposed(qv1);
}
Also used : QValue(org.apache.jackrabbit.spi.QValue) Node(javax.jcr.Node) Property(javax.jcr.Property)

Example 94 with Property

use of javax.jcr.Property in project jackrabbit by apache.

the class BinaryTest method testStreamBinary.

public void testStreamBinary() throws Exception {
    Node test = testRootNode.addNode("test");
    Property p = test.setProperty("prop", generateValue());
    // check before save
    checkBinary(p);
    superuser.save();
    // check after save
    checkBinary(p);
    // check from other session
    Session s = getHelper().getReadOnlySession();
    try {
        p = s.getNode(testRoot).getNode("test").getProperty("prop");
        checkBinary(p);
    } finally {
        s.logout();
    }
}
Also used : Node(javax.jcr.Node) Property(javax.jcr.Property) Session(javax.jcr.Session)

Example 95 with Property

use of javax.jcr.Property in project jackrabbit by apache.

the class BinaryTest method testStreamBinary2.

public void testStreamBinary2() throws Exception {
    Node test = testRootNode.addNode("test");
    Property p = test.setProperty("prop", generateValue());
    // check before save
    checkBinary(p);
    superuser.save();
    // check after save
    checkBinary(p);
    // check from other session
    Session s = getHelper().getReadOnlySession();
    try {
        p = s.getProperty(testRoot + "/test/prop");
        checkBinary(p);
    } finally {
        s.logout();
    }
}
Also used : Node(javax.jcr.Node) Property(javax.jcr.Property) Session(javax.jcr.Session)

Aggregations

Property (javax.jcr.Property)445 Node (javax.jcr.Node)252 Value (javax.jcr.Value)99 Test (org.junit.Test)87 Session (javax.jcr.Session)78 PropertyIterator (javax.jcr.PropertyIterator)68 RepositoryException (javax.jcr.RepositoryException)64 NotExecutableException (org.apache.jackrabbit.test.NotExecutableException)47 JackrabbitNode (org.apache.jackrabbit.api.JackrabbitNode)37 ValueFormatException (javax.jcr.ValueFormatException)34 QValue (org.apache.jackrabbit.spi.QValue)29 ArrayList (java.util.ArrayList)24 NodeIterator (javax.jcr.NodeIterator)24 QValueValue (org.apache.jackrabbit.spi.commons.value.QValueValue)23 PropertyDefinition (javax.jcr.nodetype.PropertyDefinition)20 Item (javax.jcr.Item)19 PathNotFoundException (javax.jcr.PathNotFoundException)17 InvalidItemStateException (javax.jcr.InvalidItemStateException)16 Version (javax.jcr.version.Version)16 ConstraintViolationException (javax.jcr.nodetype.ConstraintViolationException)15