Examples of Prop


Examples of org.apache.wink.webdav.model.Prop

    protected static void checkCollectionProperties(Response response, String name) {

        // check it contains all collection properties with OK status
        checkCollectionPropertyNames(response);

        Prop prop = response.getPropstat().get(0).getProp();

        // check name property
        Assert.assertEquals(name, prop.getDisplayname().getValue());

        // check the resource type property
        Assert.assertTrue(prop.getResourcetype().getCollection() != null);
    }
View Full Code Here

Examples of org.apache.wink.webdav.model.Prop

        // check it contains the root collection properties with OK status
        HttpStatus[] rootStatuses = {HttpStatus.OK, HttpStatus.OK, HttpStatus.NOT_FOUND};
        checkProperties(response, PROPERTIES_COLLECTION, rootStatuses);

        Prop prop = response.getPropstat().get(0).getProp();
        // check name property
        String displayName = "";
        if (prop.getDisplayname().getValue() != null) {
            displayName = prop.getDisplayname().getValue();
        }
        Assert.assertEquals(name, displayName);

        // check the resource type property
        Assert.assertTrue(prop.getResourcetype().getCollection() != null);
    }
View Full Code Here

Examples of org.apache.wink.webdav.model.Prop

    protected static void checkDocumentProperties(Response response, String name) {

        // check it contains all document properties with OK status
        checkDocumentPropertyNames(response);

        Prop prop = response.getPropstat().get(0).getProp();
        // check name property
        Assert.assertEquals(name, prop.getDisplayname().getValue());

        // check the resource type property
        Assert.assertFalse(prop.getResourcetype().getCollection() != null);
    }
View Full Code Here

Examples of org.apache.wink.webdav.model.Prop

        Assert.assertEquals(HttpStatus.OK.getCode(), response.getStatus());
        MediaType mediaType = MediaType.valueOf(response.getContentType());
        // we can't clear MediaType params due to UnsupportedOperationException on the collection, so...
        Assert.assertEquals(MediaType.valueOf(MediaType.APPLICATION_XML_TYPE.toString()), mediaType);
        StringReader reader = new StringReader(response.getContentAsString());
        Prop prop =
            WebDAVModelHelper.unmarshal(WebDAVModelHelper.createUnmarshaller(),
                                        reader,
                                        Prop.class,
                                        "prop");
        List<Activelock> activelocks = prop.getLockdiscovery().getActivelock();
        Assert.assertNotNull(activelocks);
        Assert.assertEquals(1, activelocks.size());
        Assert.assertNotNull(activelocks.get(0).getLocktype().getWrite());
        Assert.assertNotNull(activelocks.get(0).getLockscope().getExclusive());
        Assert.assertEquals("0", activelocks.get(0).getDepth());
View Full Code Here

Examples of org.apache.wink.webdav.model.Prop

            // request
            String path = WebDAVCollectionResource.PATH + "/" + i;
            Propfind propfind = new Propfind();
            QName propertyName = new QName("blah");
            Prop prop = new Prop();
            prop.setProperty(propertyName);
            propfind.setProp(prop);
            Multistatus multistatus = propfind(propfind, path, 0);

            // 1 response
            Map<String, Response> responses = multistatus.getResponsesAsMapByHref();
            Assert.assertEquals(1, responses.size());
            Response response = responses.get(path);
            Assert.assertNotNull(response);
            Assert.assertEquals(1, response.getPropstat().size());
            Propstat propstat = response.getPropstat().get(0);
            Assert.assertEquals(HttpStatus.NOT_FOUND.getCode(), propstat.getStatusCode());
            prop = propstat.getProp();
            Assert.assertEquals(1, prop.getAny().size());
            Assert.assertNotNull(prop.getAnyByName(propertyName));
        }
    }
View Full Code Here

Examples of org.apache.wink.webdav.model.Prop

    public void testNonExistingProperty() throws Exception {

        // request with depth 0
        Propfind propfind = new Propfind();
        QName propertyName = new QName("blah");
        Prop prop = new Prop();
        prop.setProperty(propertyName);
        propfind.setProp(prop);
        Multistatus multistatus = propfind(propfind, WebDAVCollectionResource.PATH, 0);

        // 1 response
        Map<String, Response> responses = multistatus.getResponsesAsMapByHref();
        Assert.assertEquals(1, responses.size());
        Response response = responses.get(WebDAVCollectionResource.PATH);
        Assert.assertNotNull(response);
        List<Propstat> propstats = response.getPropstat();
        Assert.assertEquals(1, propstats.size());
        Propstat propstat = propstats.get(0);
        prop = propstat.getProp();
        Assert.assertNotNull(prop.getAnyByName(propertyName));
        Assert.assertEquals(HttpStatus.NOT_FOUND.getCode(), propstat.getStatusCode());
    }
View Full Code Here

Examples of org.apache.wink.webdav.model.Prop

    public void testNonExistingProperty() throws Exception {

        // request with depth 0
        Propfind propfind = new Propfind();
        QName propertyName = new QName("blah");
        Prop prop = new Prop();
        prop.setProperty(propertyName);
        propfind.setProp(prop);
        Multistatus multistatus = propfind(propfind, "/", 0);

        // 1 response - '/'
        Map<String, Response> responses = multistatus.getResponsesAsMapByHref();
        Assert.assertEquals(1, responses.size());
        Response response = responses.get("/");
        Assert.assertNotNull(response);
        Assert.assertEquals(1, response.getPropstat().size());
        Propstat propstat = response.getPropstat().get(0);
        Assert.assertEquals(HttpStatus.NOT_FOUND.getCode(), propstat.getStatusCode());
        prop = propstat.getProp();
        Assert.assertEquals(1, prop.getAny().size());
        Assert.assertNotNull(prop.getAnyByName(propertyName));
    }
View Full Code Here

Examples of org.apache.wink.webdav.model.Prop

    public void testNonExistingProperty() throws Exception {

        // request with depth 0
        Propfind propfind = new Propfind();
        QName propertyName = new QName("blah");
        Prop prop = new Prop();
        prop.setProperty(propertyName);
        propfind.setProp(prop);
        Multistatus multistatus = propfind(propfind, "/", 0);

        // 1 response - '/'
        Map<String, Response> responses = multistatus.getResponsesAsMapByHref();
        Assert.assertEquals(1, responses.size());
        Response response = responses.get("/");
        Assert.assertNotNull(response);
        Assert.assertEquals(1, response.getPropstat().size());
        Propstat propstat = response.getPropstat().get(0);
        Assert.assertEquals(HttpStatus.NOT_FOUND.getCode(), propstat.getStatusCode());
        prop = propstat.getProp();
        Assert.assertEquals(1, prop.getAny().size());
        Assert.assertNotNull(prop.getAnyByName(propertyName));
    }
View Full Code Here

Examples of org.apache.wink.webdav.model.Prop

        // the request is for all property names
        if (propfind.getPropname() != null) {
            Propstat propstat =
                response.getOrCreatePropstat(Response.Status.OK.getStatusCode(), null, null);
            Prop prop = propstat.getProp();
            // call the abstract method to allow the handler to fill in the
            // property names
            handler.setAllPropertyNames(this, prop, synd);
            // ensure that all property values are empty
            ensurePropertiesAreEmpty(prop);
        } else {
            Prop prop = null;
            // the request is for all properties
            if (propfind.getAllprop() != null) {
                prop = new Prop();
                handler.setAllPropertyNames(this, prop, synd);
            } else {
                // the request is for specific properties
                prop = propfind.getProp();
            }
View Full Code Here

Examples of org.apache.wink.webdav.model.Prop

        List<Propstat> propstats = response.getPropstat();
        Assert.assertEquals(propstats.size(), 2);

        Propstat propstat = propstats.get(0);
        Assert.assertEquals(propstat.getStatusCode(), 200);
        Prop prop = propstat.getProp();
        Element element = prop.getAnyByName(RESP1_PROPS[0]);
        Assert.assertNotNull(element);
        Assert.assertEquals(element.getLocalName(), RESP1_PROPS[0].getLocalPart());
        Assert.assertEquals(element.getNamespaceURI(), RESP1_PROPS[0].getNamespaceURI());
        element = prop.getAnyByName(RESP1_PROPS[1]);
        Assert.assertNotNull(element);
        Assert.assertEquals(element.getLocalName(), RESP1_PROPS[1].getLocalPart());
        Assert.assertEquals(element.getNamespaceURI(), RESP1_PROPS[1].getNamespaceURI());

        propstat = propstats.get(1);
        Assert.assertEquals(propstat.getStatusCode(), 403);
        Assert.assertEquals(propstat.getResponsedescription(), RESP1_PROPS_DESC);
        prop = propstat.getProp();
        element = prop.getAnyByName(RESP1_PROPS[2]);
        Assert.assertNotNull(element);
        Assert.assertEquals(element.getLocalName(), RESP1_PROPS[2].getLocalPart());
        Assert.assertEquals(element.getNamespaceURI(), RESP1_PROPS[2].getNamespaceURI());
        element = prop.getAnyByName(RESP1_PROPS[3]);
        Assert.assertNotNull(element);
        Assert.assertEquals(element.getLocalName(), RESP1_PROPS[3].getLocalPart());
        Assert.assertEquals(element.getNamespaceURI(), RESP1_PROPS[3].getNamespaceURI());

        // test write
        String write = write(multistatus);
        Diff diff = new Diff(input, write);
        Assert.assertTrue(diff.toString(), diff.similar());

        // test runtime creation
        multistatus = new Multistatus();
        multistatus.setResponsedescription(RESP1_DESC);
        response = new Response(RESP1_HREF);
        multistatus.getResponse().add(response);
        propstat = response.getOrCreatePropstat(200, null, null);
        prop = propstat.getProp();
        prop.setProperty(RESP1_PROPS[0], WebDAVModelHelper.createElement(NS1,
                                                                         "R:BoxType",
                                                                         "Box type A"));
        prop.setProperty(RESP1_PROPS[1], WebDAVModelHelper.createElement(NS1,
                                                                         "R:Name",
                                                                         "J.J. Johnson"));
        propstat = response.getOrCreatePropstat(403, RESP1_PROPS_DESC, null);
        prop = propstat.getProp();
        prop.setProperty(RESP1_PROPS[2]);
        prop.setProperty(RESP1_PROPS[3]);

        write = write(multistatus);
        diff = new Diff(input, write);
        Assert.assertTrue(diff.toString(), diff.similar());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.