Package org.custommonkey.xmlunit

Examples of org.custommonkey.xmlunit.XpathEngine.evaluate()


    @Test
    public void testRequestUpdateSequence() throws Exception {
        Document dom = getAsDOM("ows?service=WMS&request=GetCapabilities&version=1.3.0");
        final XpathEngine xpath = XMLUnit.newXpathEngine();
        final String locationPath = "/wms:WMS_Capabilities/@updateSequence";
        final String updateSeq = xpath.evaluate(locationPath, dom);

        final int currUpdateSeq = Integer.parseInt(updateSeq);

        /*
         * Client: none, Server: any, response: current
View Full Code Here


        checkValidationErrors(d);
        assertEquals( "wps:ExecuteResponse", d.getDocumentElement().getNodeName() );
        assertXpathExists("/wps:ExecuteResponse/wps:Status/wps:ProcessSucceeded", d);
        assertXpathExists("/wps:ExecuteResponse/wps:ProcessOutputs/wps:Output/wps:Reference", d);
        XpathEngine xpath = XMLUnit.newXpathEngine();
        String fullLocation = xpath.evaluate("/wps:ExecuteResponse/wps:ProcessOutputs/wps:Output/wps:Reference/@href", d);
        String resourceLocation = fullLocation.substring(fullLocation.indexOf('?') - 3);
        d = getAsDOM(resourceLocation);
        assertXpathExists("wfs:FeatureCollection", d);
    }
   
View Full Code Here

        checkValidationErrors(d);
        assertEquals( "wps:ExecuteResponse", d.getDocumentElement().getNodeName() );
        assertXpathExists("/wps:ExecuteResponse/wps:Status/wps:ProcessSucceeded", d);
        assertXpathExists("/wps:ExecuteResponse/wps:ProcessOutputs/wps:Output/wps:Reference", d);
        XpathEngine xpath = XMLUnit.newXpathEngine();
        String fullLocation = xpath.evaluate("/wps:ExecuteResponse/wps:ProcessOutputs/wps:Output/wps:Reference/@href", d);
        String resourceLocation = fullLocation.substring(fullLocation.indexOf('?') - 3);
        MockHttpServletResponse response = getAsServletResponse(resourceLocation);
        assertEquals("text/xml; subtype=wfs-collection/1.0", response.getContentType());
        d = dom(new ByteArrayInputStream( response.getOutputStreamContent().getBytes()));
        assertXpathExists("wfs:FeatureCollection", d);
View Full Code Here

        // submit asynch request with no updates
        String request = "wps?service=WPS&version=1.0.0&request=Execute&Identifier=gs:Monkey&storeExecuteResponse=true&DataInputs=" + urlEncode("id=x2");
        Document dom = getAsDOM(request);
        assertXpathExists("//wps:ProcessAccepted", dom);
        XpathEngine xpath = XMLUnit.newXpathEngine();
        String fullStatusLocation = xpath.evaluate("//wps:ExecuteResponse/@statusLocation", dom);
        String statusLocation = fullStatusLocation.substring(fullStatusLocation.indexOf('?') - 3);
       
        // we move the clock forward, but we asked no status, nothing should change
        MonkeyProcess.progress("x2", 50f, true);
        dom = getAsDOM(statusLocation);
View Full Code Here

    private String submitMonkey(String id) throws Exception, XpathException {
        String request = "wps?service=WPS&version=1.0.0&request=Execute&Identifier=gs:Monkey&storeExecuteResponse=true&status=true&DataInputs=" + urlEncode("id=" + id);
        Document dom = getAsDOM(request);
        assertXpathExists("//wps:ProcessAccepted", dom);
        XpathEngine xpath = XMLUnit.newXpathEngine();
        String fullStatusLocation = xpath.evaluate("//wps:ExecuteResponse/@statusLocation", dom);
        String statusLocation = fullStatusLocation.substring(fullStatusLocation.indexOf('?') - 3);
        return statusLocation;
    }
   
   
View Full Code Here

        // check we have a timestamp that is a valid XML date, and it's GMT (we don't
        // test parts of the date since we are bound to fail even the year if the test is run
        // across midnight of
        String timestampPath = "/csw:GetRecordsResponse/csw:SearchStatus/@timestamp";
        String timeStamp = xpath.evaluate(timestampPath, d);
        assertGMLTimestamp(timeStamp);
       
        // check we have the expected results
        assertXpathEvaluatesTo("summary", "//csw:SearchResults/@elementSet", d);
        assertXpathEvaluatesTo("12", "//csw:SearchResults/@numberOfRecordsMatched", d);
View Full Code Here

       
        // extract the identifiers and verify they are sorted
        List<String> identifiers = new ArrayList<String>();
        XpathEngine xpath = XMLUnit.newXpathEngine();
        for (int i = 1; i < 11; i++) {
            String id = xpath.evaluate("//csw:SummaryRecord[" + i + "]/dc:identifier", d);
            identifiers.add(id);
        }
        List<String> sorted = new ArrayList<String>(identifiers);
        Collections.sort(sorted);
        assertEquals(sorted, identifiers);
View Full Code Here

       
        // extract the identifiers and verify they are sorted
        List<String> dates = new ArrayList<String>();
        XpathEngine xpath = XMLUnit.newXpathEngine();
        for (int i = 1; i < 11; i++) {
            String id = xpath.evaluate("//csw:Record[" + i + "]/dc:date", d);
            dates.add(id);
        }
        List<String> sorted = new ArrayList<String>(dates);
        Collections.sort(sorted);
        assertEquals(sorted, dates);
View Full Code Here

        // print(d);
       
        XpathEngine xpath = XMLUnit.newXpathEngine();
        assertXpathEvaluatesTo("http://localhost:8080/geoserver/" + request, "/csw:Acknowledgement/csw:EchoedRequest/ows:Get/@xlink:href", d);
       
        String timeStamp = xpath.evaluate("/csw:Acknowledgement/@timeStamp", d);
        assertGMLTimestamp(timeStamp);
    }
   
    @Test
    public void testValidatePost() throws Exception {
View Full Code Here

        Document d = postAsDOM("csw", request);
        checkValidationErrors(d, new CSWConfiguration());
        // print(d);
       
        XpathEngine xpath = XMLUnit.newXpathEngine();
        String timeStamp = xpath.evaluate("/csw:Acknowledgement/@timeStamp", d);
        assertGMLTimestamp(timeStamp);
       
        assertXpathEvaluatesTo("*lorem*", "/csw:Acknowledgement/csw:EchoedRequest/csw:GetRecords/csw:Query/" +
            "csw:Constraint/ogc:Filter/ogc:PropertyIsLike/ogc:Literal", d);
    }
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.