Search in sources :

Example 66 with NodeId

use of org.apache.jackrabbit.spi.NodeId in project jackrabbit by apache.

the class ReadTest method testReadNonExistingProperty.

public void testReadNonExistingProperty() throws RepositoryException {
    NodeId nid = getNodeId(testPath);
    PropertyId pid = getPropertyId(nid, NameConstants.JCR_CHILDNODEDEFINITION);
    try {
        rs.getPropertyInfo(si, pid);
        fail();
    } catch (ItemNotFoundException e) {
    // ok
    }
}
Also used : NodeId(org.apache.jackrabbit.spi.NodeId) PropertyId(org.apache.jackrabbit.spi.PropertyId) ItemNotFoundException(javax.jcr.ItemNotFoundException)

Example 67 with NodeId

use of org.apache.jackrabbit.spi.NodeId in project jackrabbit by apache.

the class ReadTest method testReadPropertyAsNode.

public void testReadPropertyAsNode() throws RepositoryException {
    NodeId nid = getNodeId(testPath + "/jcr:primaryType");
    try {
        rs.getItemInfos(si, nid);
        fail();
    } catch (ItemNotFoundException e) {
    // ok
    }
}
Also used : NodeId(org.apache.jackrabbit.spi.NodeId) ItemNotFoundException(javax.jcr.ItemNotFoundException)

Example 68 with NodeId

use of org.apache.jackrabbit.spi.NodeId in project jackrabbit by apache.

the class ReadTest method testReadNonExistingNode.

public void testReadNonExistingNode() throws RepositoryException {
    NodeId nid = getNodeId(testPath + "/non-existing");
    try {
        rs.getItemInfos(si, nid);
        fail();
    } catch (ItemNotFoundException e) {
    // ok
    }
}
Also used : NodeId(org.apache.jackrabbit.spi.NodeId) ItemNotFoundException(javax.jcr.ItemNotFoundException)

Example 69 with NodeId

use of org.apache.jackrabbit.spi.NodeId 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);
}
Also used : Batch(org.apache.jackrabbit.spi.Batch) NodeInfo(org.apache.jackrabbit.spi.NodeInfo) NodeId(org.apache.jackrabbit.spi.NodeId)

Example 70 with NodeId

use of org.apache.jackrabbit.spi.NodeId in project jackrabbit by apache.

the class BatchTest method testSetEmptyBinaryValue.

public void testSetEmptyBinaryValue() throws RepositoryException, IOException {
    NodeId nid = getNodeId(testPath);
    Name propName = resolver.getQName("binProp");
    Batch b = rs.createBatch(si, nid);
    b.addProperty(nid, propName, rs.getQValueFactory().create(new byte[0]));
    rs.submit(b);
    PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName));
    assertFalse(pi.isMultiValued());
    InputStream in = pi.getValues()[0].getStream();
    assertTrue(in.read() == -1);
    assertEquals("", pi.getValues()[0].getString());
    assertEquals(PropertyType.BINARY, pi.getType());
    pi = getPropertyInfo(nid, propName);
    assertFalse(pi.isMultiValued());
    in = pi.getValues()[0].getStream();
    assertTrue(in.read() == -1);
    assertEquals("", pi.getValues()[0].getString());
    assertEquals(PropertyType.BINARY, pi.getType());
}
Also used : Batch(org.apache.jackrabbit.spi.Batch) InputStream(java.io.InputStream) NodeId(org.apache.jackrabbit.spi.NodeId) PropertyInfo(org.apache.jackrabbit.spi.PropertyInfo) Name(org.apache.jackrabbit.spi.Name)

Aggregations

NodeId (org.apache.jackrabbit.spi.NodeId)80 Batch (org.apache.jackrabbit.spi.Batch)35 Name (org.apache.jackrabbit.spi.Name)32 PropertyInfo (org.apache.jackrabbit.spi.PropertyInfo)23 RepositoryException (javax.jcr.RepositoryException)21 QValue (org.apache.jackrabbit.spi.QValue)21 PropertyId (org.apache.jackrabbit.spi.PropertyId)13 Path (org.apache.jackrabbit.spi.Path)11 NodeInfo (org.apache.jackrabbit.spi.NodeInfo)10 ArrayList (java.util.ArrayList)9 ItemNotFoundException (javax.jcr.ItemNotFoundException)9 DavPropertyNameSet (org.apache.jackrabbit.webdav.property.DavPropertyNameSet)9 IOException (java.io.IOException)6 Node (javax.jcr.Node)5 HttpResponse (org.apache.http.HttpResponse)5 ItemId (org.apache.jackrabbit.spi.ItemId)5 DavException (org.apache.jackrabbit.webdav.DavException)5 InputStream (java.io.InputStream)4 ChildInfo (org.apache.jackrabbit.spi.ChildInfo)4 PathNotFoundException (javax.jcr.PathNotFoundException)3