Search in sources :

Example 26 with DavPropertyNameSet

use of org.apache.jackrabbit.webdav.property.DavPropertyNameSet in project jackrabbit by apache.

the class DavPropertyTest method testProperty.

public void testProperty() throws Exception {
    String uri = rs.getItemUri(getPropertyId(getNodeId("/test"), resolver.getQName("prop")), si);
    DavPropertyNameSet set = doPropFindNames(uri);
    DavPropertyNameSet expected = new DavPropertyNameSet(BASE_SET);
    expected.addAll(EXISTING_ITEM_BASE_SET);
    expected.addAll(PROPERTY_SET);
    expected.add(JCR_PARENT);
    /*
         Expected property names

        {DAV:}getlastmodified
        {DAV:}workspace
        {http://www.day.com/jcr/webdav/1.0}definition
        {DAV:}comment
        {http://www.day.com/jcr/webdav/1.0}depth
        {http://www.day.com/jcr/webdav/1.0}length
        {http://www.day.com/jcr/webdav/1.0}parent
        {DAV:}displayname
        {DAV:}supportedlock
        {http://www.day.com/jcr/webdav/1.0}workspaceName
        {http://www.day.com/jcr/webdav/1.0}subscriptiondiscovery
        {DAV:}supported-method-set
        {DAV:}iscollection
        {DAV:}creator-displayname
        {DAV:}getcontenttype
        {DAV:}creationdate
        {http://www.day.com/jcr/webdav/1.0}name
        {DAV:}supported-report-set
        {DAV:}current-user-privilege-set
        {http://www.day.com/jcr/webdav/1.0}path
        {DAV:}lockdiscovery
        {DAV:}resourcetype
        {http://www.day.com/jcr/webdav/1.0}type
        {http://www.day.com/jcr/webdav/1.0}value
         */
    assertPropertyNames(expected, set);
    DavPropertyNameSet all = doPropFindAll(uri);
    expected.remove(DeltaVConstants.COMMENT);
    expected.remove(DeltaVConstants.CREATOR_DISPLAYNAME);
    expected.remove(DeltaVConstants.SUPPORTED_METHOD_SET);
    expected.remove(DeltaVConstants.SUPPORTED_REPORT_SET);
    expected.remove(DeltaVConstants.WORKSPACE);
    expected.remove(SecurityConstants.CURRENT_USER_PRIVILEGE_SET);
    expected.remove(ObservationConstants.SUBSCRIPTIONDISCOVERY);
    expected.remove(JCR_DEFINITION);
    expected.remove(JCR_LENGTH);
    /*
        Expected all-props

        {DAV:}getlastmodified
        {http://www.day.com/jcr/webdav/1.0}depth
        {http://www.day.com/jcr/webdav/1.0}parent
        {DAV:}displayname
        {DAV:}supportedlock
        {http://www.day.com/jcr/webdav/1.0}workspaceName
        {DAV:}iscollection
        {DAV:}getcontenttype
        {http://www.day.com/jcr/webdav/1.0}name
        {DAV:}creationdate
        {http://www.day.com/jcr/webdav/1.0}path
        {http://www.day.com/jcr/webdav/1.0}type
        {DAV:}resourcetype
        {DAV:}lockdiscovery
        {http://www.day.com/jcr/webdav/1.0}value
         */
    assertPropertyNames(expected, all);
    DavPropertyNameSet props = new DavPropertyNameSet();
    props.add(DeltaVConstants.COMMENT);
    props.add(DeltaVConstants.CREATOR_DISPLAYNAME);
    props.add(DeltaVConstants.SUPPORTED_METHOD_SET);
    props.add(DeltaVConstants.SUPPORTED_REPORT_SET);
    props.add(DeltaVConstants.WORKSPACE);
    props.add(SecurityConstants.CURRENT_USER_PRIVILEGE_SET);
    props.add(ObservationConstants.SUBSCRIPTIONDISCOVERY);
    props.add(JCR_DEFINITION);
    props.add(JCR_LENGTH);
    DavPropertyNameSet result = doPropFindByProp(uri, props);
    assertPropertyNames(props, result);
}
Also used : DavPropertyNameSet(org.apache.jackrabbit.webdav.property.DavPropertyNameSet)

Example 27 with DavPropertyNameSet

use of org.apache.jackrabbit.webdav.property.DavPropertyNameSet in project jackrabbit by apache.

the class DavPropertyTest method testRootNode.

public void testRootNode() throws Exception {
    String uri = rs.getItemUri(getNodeId("/"), si);
    DavPropertyNameSet set = doPropFindNames(uri);
    DavPropertyNameSet expected = new DavPropertyNameSet(BASE_SET);
    expected.addAll(EXISTING_ITEM_BASE_SET);
    expected.addAll(NODE_SET);
    expected.add(OrderingConstants.ORDERING_TYPE);
    /*
         Expected property names

        {DAV:}getlastmodified
        {DAV:}ordering-type
        {http://www.day.com/jcr/webdav/1.0}definition
        {DAV:}comment
        {http://www.day.com/jcr/webdav/1.0}references
        {DAV:}displayname
        {http://www.day.com/jcr/webdav/1.0}workspaceName
        {http://www.day.com/jcr/webdav/1.0}subscriptiondiscovery
        {http://www.day.com/jcr/webdav/1.0}name
        {DAV:}current-user-privilege-set
        {http://www.day.com/jcr/webdav/1.0}primarynodetype
        {DAV:}resourcetype
        {DAV:}lockdiscovery
        {DAV:}workspace
        {http://www.day.com/jcr/webdav/1.0}depth
        {http://www.day.com/jcr/webdav/1.0}index
        {DAV:}supportedlock
        {DAV:}supported-method-set
        {DAV:}iscollection
        {http://www.day.com/jcr/webdav/1.0}weakreferences
        {DAV:}creator-displayname
        {DAV:}getcontenttype
        {DAV:}creationdate
        {DAV:}supported-report-set
        {http://www.day.com/jcr/webdav/1.0}mixinnodetypes
        {http://www.day.com/jcr/webdav/1.0}path
        */
    assertPropertyNames(expected, set);
    DavPropertyNameSet all = doPropFindAll(uri);
    expected.remove(DeltaVConstants.COMMENT);
    expected.remove(DeltaVConstants.CREATOR_DISPLAYNAME);
    expected.remove(DeltaVConstants.SUPPORTED_METHOD_SET);
    expected.remove(DeltaVConstants.SUPPORTED_REPORT_SET);
    expected.remove(DeltaVConstants.WORKSPACE);
    expected.remove(SecurityConstants.CURRENT_USER_PRIVILEGE_SET);
    expected.remove(ObservationConstants.SUBSCRIPTIONDISCOVERY);
    expected.remove(OrderingConstants.ORDERING_TYPE);
    expected.remove(JCR_DEFINITION);
    expected.remove(JCR_INDEX);
    expected.remove(JCR_REFERENCES);
    expected.remove(JCR_WEAK_REFERENCES);
    /*
        Expected all-props

        {DAV:}getlastmodified
        {http://www.day.com/jcr/webdav/1.0}depth
        {http://www.day.com/jcr/webdav/1.0}workspaceName
        {DAV:}displayname
        {DAV:}supportedlock
        {DAV:}iscollection
        {DAV:}getcontenttype
        {http://www.day.com/jcr/webdav/1.0}name
        {DAV:}creationdate
        {http://www.day.com/jcr/webdav/1.0}mixinnodetypes
        {http://www.day.com/jcr/webdav/1.0}path
        {http://www.day.com/jcr/webdav/1.0}primarynodetype
        {DAV:}lockdiscovery
        {DAV:}resourcetype
         */
    assertPropertyNames(expected, all);
    DavPropertyNameSet props = new DavPropertyNameSet();
    props.add(DeltaVConstants.COMMENT);
    props.add(DeltaVConstants.CREATOR_DISPLAYNAME);
    props.add(DeltaVConstants.SUPPORTED_METHOD_SET);
    props.add(DeltaVConstants.SUPPORTED_REPORT_SET);
    props.add(DeltaVConstants.WORKSPACE);
    props.add(SecurityConstants.CURRENT_USER_PRIVILEGE_SET);
    props.add(ObservationConstants.SUBSCRIPTIONDISCOVERY);
    props.add(OrderingConstants.ORDERING_TYPE);
    props.add(JCR_DEFINITION);
    props.add(JCR_INDEX);
    props.add(JCR_REFERENCES);
    props.add(JCR_WEAK_REFERENCES);
    DavPropertyNameSet result = doPropFindByProp(uri, props);
    assertPropertyNames(props, result);
}
Also used : DavPropertyNameSet(org.apache.jackrabbit.webdav.property.DavPropertyNameSet)

Example 28 with DavPropertyNameSet

use of org.apache.jackrabbit.webdav.property.DavPropertyNameSet in project jackrabbit by apache.

the class DavPropertyTest method testWorkspace.

public void testWorkspace() throws Exception {
    StringBuilder uri = new StringBuilder(repoURI);
    uri.append("/").append(helper.getProperty(RepositoryServiceStub.PROP_PREFIX + "." + RepositoryServiceStub.PROP_WORKSPACE));
    DavPropertyNameSet set = doPropFindNames(uri.toString());
    DavPropertyNameSet expected = new DavPropertyNameSet(BASE_SET);
    expected.addAll(WORKSPACE_SET);
    /*
         Expected property names

        {DAV:}getlastmodified
        {DAV:}workspace
        {DAV:}comment
        {DAV:}displayname
        {DAV:}supportedlock
        {http://www.day.com/jcr/webdav/1.0}workspaceName
        {DAV:}supported-method-set
        {DAV:}iscollection
        {DAV:}creator-displayname
        {DAV:}creationdate
        {DAV:}supported-report-set
        {DAV:}resourcetype
        {DAV:}lockdiscovery
        {http://www.day.com/jcr/webdav/1.0}namespaces
        {http://www.day.com/jcr/webdav/1.0}nodetypes-cnd
        */
    assertPropertyNames(expected, set);
    DavPropertyNameSet all = doPropFindAll(uri.toString());
    expected.remove(DeltaVConstants.COMMENT);
    expected.remove(DeltaVConstants.CREATOR_DISPLAYNAME);
    expected.remove(DeltaVConstants.SUPPORTED_METHOD_SET);
    expected.remove(DeltaVConstants.SUPPORTED_REPORT_SET);
    expected.remove(DeltaVConstants.WORKSPACE);
    expected.remove(JCR_NODETYPES_CND);
    /*
        Expected all-props

        {DAV:}getlastmodified
        {DAV:}creationdate
        {DAV:}displayname
        {DAV:}supportedlock
        {http://www.day.com/jcr/webdav/1.0}workspaceName
        {DAV:}resourcetype
        {DAV:}lockdiscovery
        {DAV:}iscollection
        {http://www.day.com/jcr/webdav/1.0}namespaces
         */
    assertPropertyNames(expected, all);
    DavPropertyNameSet props = new DavPropertyNameSet();
    props.add(DeltaVConstants.COMMENT);
    props.add(DeltaVConstants.CREATOR_DISPLAYNAME);
    props.add(DeltaVConstants.SUPPORTED_METHOD_SET);
    props.add(DeltaVConstants.SUPPORTED_REPORT_SET);
    props.add(DeltaVConstants.WORKSPACE);
    props.add(JCR_NODETYPES_CND);
    DavPropertyNameSet result = doPropFindByProp(uri.toString(), props);
    assertPropertyNames(props, result);
}
Also used : DavPropertyNameSet(org.apache.jackrabbit.webdav.property.DavPropertyNameSet)

Example 29 with DavPropertyNameSet

use of org.apache.jackrabbit.webdav.property.DavPropertyNameSet in project jackrabbit by apache.

the class DavPropertyTest method testCheckedOutVersionableNode.

public void testCheckedOutVersionableNode() throws Exception {
    NodeId nid = getNodeId("/test");
    Batch b = rs.createBatch(si, nid);
    b.setMixins(nid, new Name[] { NameConstants.MIX_VERSIONABLE });
    rs.submit(b);
    String uri = rs.getItemUri(nid, si);
    DavPropertyNameSet set = doPropFindNames(uri);
    DavPropertyNameSet expected = new DavPropertyNameSet(BASE_SET);
    expected.addAll(EXISTING_ITEM_BASE_SET);
    expected.addAll(NODE_SET);
    expected.addAll(VERSIONABLE_SET);
    expected.add(OrderingConstants.ORDERING_TYPE);
    expected.add(JCR_PARENT);
    expected.add(JCR_UUID);
    expected.add(VersionControlledResource.CHECKED_OUT);
    expected.add(VersionControlledResource.PREDECESSOR_SET);
    /*
         Expected property names

        {DAV:}getlastmodified
        {DAV:}ordering-type
        {http://www.day.com/jcr/webdav/1.0}definition
        {DAV:}comment
        {http://www.day.com/jcr/webdav/1.0}references
        {http://www.day.com/jcr/webdav/1.0}parent
        {DAV:}displayname
        {http://www.day.com/jcr/webdav/1.0}workspaceName
        {http://www.day.com/jcr/webdav/1.0}subscriptiondiscovery
        {http://www.day.com/jcr/webdav/1.0}uuid
        {DAV:}predecessor-set
        {http://www.day.com/jcr/webdav/1.0}name
        {DAV:}current-user-privilege-set
        {http://www.day.com/jcr/webdav/1.0}primarynodetype
        {DAV:}version-history
        {DAV:}lockdiscovery
        {DAV:}resourcetype
        {DAV:}workspace
        {http://www.day.com/jcr/webdav/1.0}depth
        {http://www.day.com/jcr/webdav/1.0}index
        {DAV:}supportedlock
        {DAV:}supported-method-set
        {DAV:}iscollection
        {http://www.day.com/jcr/webdav/1.0}weakreferences
        {DAV:}creator-displayname
        {DAV:}getcontenttype
        {DAV:}creationdate
        {DAV:}supported-report-set
        {DAV:}auto-version
        {http://www.day.com/jcr/webdav/1.0}mixinnodetypes
        {http://www.day.com/jcr/webdav/1.0}path
        {DAV:}checked-out
        */
    assertPropertyNames(expected, set);
    DavPropertyNameSet all = doPropFindAll(uri);
    expected.remove(DeltaVConstants.COMMENT);
    expected.remove(DeltaVConstants.CREATOR_DISPLAYNAME);
    expected.remove(DeltaVConstants.SUPPORTED_METHOD_SET);
    expected.remove(DeltaVConstants.SUPPORTED_REPORT_SET);
    expected.remove(DeltaVConstants.WORKSPACE);
    expected.remove(OrderingConstants.ORDERING_TYPE);
    expected.remove(SecurityConstants.CURRENT_USER_PRIVILEGE_SET);
    expected.remove(ObservationConstants.SUBSCRIPTIONDISCOVERY);
    expected.remove(JCR_DEFINITION);
    expected.remove(JCR_INDEX);
    expected.remove(JCR_REFERENCES);
    expected.remove(JCR_WEAK_REFERENCES);
    expected.remove(JCR_UUID);
    expected.remove(VersionControlledResource.CHECKED_OUT);
    expected.remove(VersionControlledResource.VERSION_HISTORY);
    /*
        Expected all-props

        {DAV:}getlastmodified
        {http://www.day.com/jcr/webdav/1.0}depth
        {http://www.day.com/jcr/webdav/1.0}workspaceName
        {DAV:}displayname
        {http://www.day.com/jcr/webdav/1.0}parent
        {DAV:}supportedlock
        {DAV:}iscollection
        {DAV:}getcontenttype
        {DAV:}predecessor-set
        {DAV:}creationdate
        {http://www.day.com/jcr/webdav/1.0}name
        {DAV:}auto-version
        {http://www.day.com/jcr/webdav/1.0}mixinnodetypes
        {http://www.day.com/jcr/webdav/1.0}path
        {http://www.day.com/jcr/webdav/1.0}primarynodetype
        {DAV:}lockdiscovery
        {DAV:}resourcetype
         */
    assertPropertyNames(expected, all);
    DavPropertyNameSet props = new DavPropertyNameSet();
    props.add(DeltaVConstants.COMMENT);
    props.add(DeltaVConstants.CREATOR_DISPLAYNAME);
    props.add(DeltaVConstants.SUPPORTED_METHOD_SET);
    props.add(DeltaVConstants.SUPPORTED_REPORT_SET);
    props.add(DeltaVConstants.WORKSPACE);
    props.add(OrderingConstants.ORDERING_TYPE);
    props.add(SecurityConstants.CURRENT_USER_PRIVILEGE_SET);
    props.add(ObservationConstants.SUBSCRIPTIONDISCOVERY);
    props.add(JCR_DEFINITION);
    props.add(JCR_INDEX);
    props.add(JCR_REFERENCES);
    props.add(JCR_WEAK_REFERENCES);
    props.add(JCR_UUID);
    props.add(VersionControlledResource.CHECKED_OUT);
    props.add(VersionControlledResource.PREDECESSOR_SET);
    props.add(VersionControlledResource.VERSION_HISTORY);
    DavPropertyNameSet result = doPropFindByProp(uri, props);
    assertPropertyNames(props, result);
}
Also used : Batch(org.apache.jackrabbit.spi.Batch) NodeId(org.apache.jackrabbit.spi.NodeId) DavPropertyNameSet(org.apache.jackrabbit.webdav.property.DavPropertyNameSet)

Example 30 with DavPropertyNameSet

use of org.apache.jackrabbit.webdav.property.DavPropertyNameSet in project jackrabbit by apache.

the class DavPropertyTest method testVersionHistory.

public void testVersionHistory() throws Exception {
    NodeId nid = getNodeId("/test");
    Batch b = rs.createBatch(si, nid);
    b.setMixins(nid, new Name[] { NameConstants.MIX_VERSIONABLE });
    rs.submit(b);
    NodeId vID = rs.checkin(si, nid);
    String uri = Text.getRelativeParent(rs.getItemUri(vID, si), 1);
    DavPropertyNameSet set = doPropFindNames(uri);
    DavPropertyNameSet expected = new DavPropertyNameSet(BASE_SET);
    expected.addAll(EXISTING_ITEM_BASE_SET);
    expected.addAll(NODE_SET);
    expected.addAll(VERSIONHISTORY_SET);
    expected.add(JCR_PARENT);
    expected.add(JCR_UUID);
    /*
         Expected property names

        {DAV:}getlastmodified
        {DAV:}root-version
        {DAV:}version-set
        {http://www.day.com/jcr/webdav/1.0}definition
        {DAV:}comment
        {http://www.day.com/jcr/webdav/1.0}references
        {http://www.day.com/jcr/webdav/1.0}parent
        {DAV:}displayname
        {http://www.day.com/jcr/webdav/1.0}workspaceName
        {http://www.day.com/jcr/webdav/1.0}subscriptiondiscovery
        {http://www.day.com/jcr/webdav/1.0}uuid
        {http://www.day.com/jcr/webdav/1.0}name
        {DAV:}current-user-privilege-set
        {http://www.day.com/jcr/webdav/1.0}primarynodetype
        {DAV:}lockdiscovery
        {DAV:}resourcetype
        {DAV:}workspace
        {http://www.day.com/jcr/webdav/1.0}depth
        {http://www.day.com/jcr/webdav/1.0}index
        {DAV:}supportedlock
        {http://www.day.com/jcr/webdav/1.0}versionableuuid
        {DAV:}supported-method-set
        {DAV:}iscollection
        {http://www.day.com/jcr/webdav/1.0}weakreferences
        {DAV:}creator-displayname
        {DAV:}getcontenttype
        {DAV:}creationdate
        {DAV:}supported-report-set
        {http://www.day.com/jcr/webdav/1.0}mixinnodetypes
        {http://www.day.com/jcr/webdav/1.0}path
        */
    assertPropertyNames(expected, set);
    DavPropertyNameSet all = doPropFindAll(uri);
    expected.remove(DeltaVConstants.COMMENT);
    expected.remove(DeltaVConstants.CREATOR_DISPLAYNAME);
    expected.remove(DeltaVConstants.SUPPORTED_METHOD_SET);
    expected.remove(DeltaVConstants.SUPPORTED_REPORT_SET);
    expected.remove(DeltaVConstants.WORKSPACE);
    expected.remove(SecurityConstants.CURRENT_USER_PRIVILEGE_SET);
    expected.remove(ObservationConstants.SUBSCRIPTIONDISCOVERY);
    expected.remove(JCR_DEFINITION);
    expected.remove(JCR_INDEX);
    expected.remove(JCR_REFERENCES);
    expected.remove(JCR_WEAK_REFERENCES);
    expected.remove(JCR_UUID);
    expected.remove(VersionHistoryResource.ROOT_VERSION);
    expected.remove(VersionHistoryResource.VERSION_SET);
    /*
        Expected all-props

        {DAV:}getlastmodified
        {http://www.day.com/jcr/webdav/1.0}depth
        {http://www.day.com/jcr/webdav/1.0}workspaceName
        {DAV:}displayname
        {http://www.day.com/jcr/webdav/1.0}parent
        {DAV:}supportedlock
        {http://www.day.com/jcr/webdav/1.0}versionableuuid
        {DAV:}iscollection
        {DAV:}getcontenttype
        {DAV:}creationdate
        {http://www.day.com/jcr/webdav/1.0}name
        {http://www.day.com/jcr/webdav/1.0}mixinnodetypes
        {http://www.day.com/jcr/webdav/1.0}path
        {http://www.day.com/jcr/webdav/1.0}primarynodetype
        {DAV:}lockdiscovery
        {DAV:}resourcetype
         */
    assertPropertyNames(expected, all);
    DavPropertyNameSet props = new DavPropertyNameSet();
    props.add(DeltaVConstants.COMMENT);
    props.add(DeltaVConstants.CREATOR_DISPLAYNAME);
    props.add(DeltaVConstants.SUPPORTED_METHOD_SET);
    props.add(DeltaVConstants.SUPPORTED_REPORT_SET);
    props.add(DeltaVConstants.WORKSPACE);
    props.add(SecurityConstants.CURRENT_USER_PRIVILEGE_SET);
    props.add(ObservationConstants.SUBSCRIPTIONDISCOVERY);
    props.add(JCR_DEFINITION);
    props.add(JCR_INDEX);
    props.add(JCR_REFERENCES);
    props.add(JCR_WEAK_REFERENCES);
    props.add(JCR_UUID);
    props.add(VersionHistoryResource.ROOT_VERSION);
    props.add(VersionHistoryResource.VERSION_SET);
    DavPropertyNameSet result = doPropFindByProp(uri, props);
    assertPropertyNames(props, result);
}
Also used : Batch(org.apache.jackrabbit.spi.Batch) NodeId(org.apache.jackrabbit.spi.NodeId) DavPropertyNameSet(org.apache.jackrabbit.webdav.property.DavPropertyNameSet)

Aggregations

DavPropertyNameSet (org.apache.jackrabbit.webdav.property.DavPropertyNameSet)34 HttpResponse (org.apache.http.HttpResponse)19 RepositoryException (javax.jcr.RepositoryException)16 DavException (org.apache.jackrabbit.webdav.DavException)15 MultiStatusResponse (org.apache.jackrabbit.webdav.MultiStatusResponse)15 HttpPropfind (org.apache.jackrabbit.webdav.client.methods.HttpPropfind)15 IOException (java.io.IOException)14 DavPropertySet (org.apache.jackrabbit.webdav.property.DavPropertySet)13 NodeId (org.apache.jackrabbit.spi.NodeId)9 ItemNotFoundException (javax.jcr.ItemNotFoundException)8 Batch (org.apache.jackrabbit.spi.Batch)6 MultiStatus (org.apache.jackrabbit.webdav.MultiStatus)4 Element (org.w3c.dom.Element)4 Name (org.apache.jackrabbit.spi.Name)3 HttpProppatch (org.apache.jackrabbit.webdav.client.methods.HttpProppatch)3 DavPropertyName (org.apache.jackrabbit.webdav.property.DavPropertyName)3 HrefProperty (org.apache.jackrabbit.webdav.property.HrefProperty)3 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 PathNotFoundException (javax.jcr.PathNotFoundException)2