Search in sources :

Example 96 with PropertyIterator

use of javax.jcr.PropertyIterator in project sling by apache.

the class MockNodeTest method testGetProperties.

@Test
public void testGetProperties() throws RepositoryException {
    PropertyIterator properties = this.node1.getProperties();
    Map<String, Property> props = propertiesToMap(properties);
    assertEquals(2, properties.getSize());
    assertEquals(this.prop1, props.get("prop1"));
    assertTrue(this.node1.hasProperties());
    assertTrue(this.node11.hasProperties());
    properties = this.node1.getProperties("^prop.*$");
    assertEquals(1, properties.getSize());
    assertEquals(this.prop1, properties.next());
    properties = this.node1.getProperties("unknown?");
    assertEquals(0, properties.getSize());
}
Also used : PropertyIterator(javax.jcr.PropertyIterator) Property(javax.jcr.Property) Test(org.junit.Test)

Aggregations

PropertyIterator (javax.jcr.PropertyIterator)96 Property (javax.jcr.Property)68 Node (javax.jcr.Node)57 NodeIterator (javax.jcr.NodeIterator)28 Value (javax.jcr.Value)23 Test (org.junit.Test)16 RepositoryException (javax.jcr.RepositoryException)15 Session (javax.jcr.Session)15 ArrayList (java.util.ArrayList)14 HashSet (java.util.HashSet)10 PathNotFoundException (javax.jcr.PathNotFoundException)8 HashMap (java.util.HashMap)5 JackrabbitNode (org.apache.jackrabbit.api.JackrabbitNode)5 NodeImpl (org.apache.jackrabbit.core.NodeImpl)5 PropertyImpl (org.apache.jackrabbit.core.PropertyImpl)5 NoSuchElementException (java.util.NoSuchElementException)3 AccessDeniedException (javax.jcr.AccessDeniedException)3 InvalidItemStateException (javax.jcr.InvalidItemStateException)3 ValueFormatException (javax.jcr.ValueFormatException)3 ConstraintViolationException (javax.jcr.nodetype.ConstraintViolationException)3