Package org.custommonkey.xmlunit

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


    @Test
    public void testProcesseListSorted() throws Exception { // Standard Test A.4.2.1
        Document d = getAsDOM( "wps?service=wps&request=getcapabilities" );
        // print(d);
        XpathEngine xpath = XMLUnit.newXpathEngine();
        int count = Integer.valueOf(xpath.evaluate("count(wps:Process)", d));
        String previous = null;
        for (int i = 1; i <= count; i++) {
            String curr = xpath.evaluate("(//wps:Process)[" + i + "]/ows:Identifier)", d);
            if(previous != null) {
                assertTrue(curr.compareTo(previous) >= 0);
View Full Code Here


        // print(d);
        XpathEngine xpath = XMLUnit.newXpathEngine();
        int count = Integer.valueOf(xpath.evaluate("count(wps:Process)", d));
        String previous = null;
        for (int i = 1; i <= count; i++) {
            String curr = xpath.evaluate("(//wps:Process)[" + i + "]/ows:Identifier)", d);
            if(previous != null) {
                assertTrue(curr.compareTo(previous) >= 0);
            }
            previous = curr;
        }
View Full Code Here

        Document dom = postAsDOM(root(), xml);
        // print(dom);
        assertXpathEvaluatesTo("1", "count(/AggregationResults/*)", dom);
        XpathEngine xpath = XMLUnit.newXpathEngine();
        assertTrue(xpath.evaluate("/AggregationResults/StandardDeviation", dom).matches("442\\.19380.*"));
    }

    @Test
    public void testNonRawOutput() throws Exception {
        String xml = aggregateCall("StdDev", false);
View Full Code Here

        assertXpathEvaluatesTo("-111.0", "/AggregationResults/Sum", dom);
        assertXpathEvaluatesTo("-900.0", "/AggregationResults/Min", dom);
        assertXpathEvaluatesTo("300.0", "/AggregationResults/Max", dom);
        assertXpathEvaluatesTo("-22.2", "/AggregationResults/Average", dom);
        XpathEngine xpath = XMLUnit.newXpathEngine();
        assertTrue(xpath.evaluate("/AggregationResults/StandardDeviation", dom).matches("442\\.19380.*"));
    }
   
    @Test
    public void testAllSinglePass() throws Exception {
        String xml = callAll(true);
View Full Code Here

        assertXpathEvaluatesTo("-111.0", "/AggregationResults/Sum", dom);
        assertXpathEvaluatesTo("-900.0", "/AggregationResults/Min", dom);
        assertXpathEvaluatesTo("300.0", "/AggregationResults/Max", dom);
        assertXpathEvaluatesTo("-22.2", "/AggregationResults/Average", dom);
        XpathEngine xpath = XMLUnit.newXpathEngine();
        assertTrue(xpath.evaluate("/AggregationResults/StandardDeviation", dom).matches("442\\.19380.*"));
    }

    private String callAll(boolean singlePass) {
        return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
        + "<wps:Execute version=\"1.0.0\" service=\"WPS\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://www.opengis.net/wps/1.0.0\" xmlns:wfs=\"http://www.opengis.net/wfs\" xmlns:wps=\"http://www.opengis.net/wps/1.0.0\" xmlns:ows=\"http://www.opengis.net/ows/1.1\" xmlns:gml=\"http://www.opengis.net/gml\" xmlns:ogc=\"http://www.opengis.net/ogc\" xmlns:wcs=\"http://www.opengis.net/wcs/1.1.1\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xsi:schemaLocation=\"http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd\">\n"
View Full Code Here

        assertXpathEvaluatesTo("128", "//kml/Folder/NetworkLink/Region/Lod/minLodPixels", dom);
        assertXpathEvaluatesTo("-1", "//kml/Folder/NetworkLink/Region/Lod/maxLodPixels", dom);

        final Map<String, String> expectedKvp = KMLReflectorTest
                .toKvp("http://geoserver.org:8181/geoserver/wms?format_options=relLinks%3Atrue%3B&service=wms&srs=EPSG%3A4326&width=512&styles=Default+Style&height=256&transparent=false&bbox=-1.0%2C-10.0%2C1.0%2C10.0&request=GetMap&layers=geos%3ATestPoints&format=application/vnd.google-earth.kmz&version=1.1.1");
        final Map<String, String> actualKvp = KMLReflectorTest.toKvp(xpath.evaluate(
                "//kml/Folder/NetworkLink/Link/href", dom));
        KMLReflectorTest.assertMapsEqual(expectedKvp, actualKvp);

        // GR: commenting out the bellow assertion, adding the viewRefreshMode element is commented
        // out in KMLNetworkListTransformer
View Full Code Here

        assertXpathEvaluatesTo("0.0", "//kml/Folder/LookAt/tilt", dom);
        assertXpathEvaluatesTo("0.0", "//kml/Folder/LookAt/heading", dom);
        assertXpathEvaluatesTo("clampToGround", "//kml/Folder/LookAt/altitudeMode", dom);
        // these ones are hard to compute, maybe someone understanding what's going on could add an
        // expected value?
        String value = xpath.evaluate("//kml/Folder/LookAt/altitude", dom);
        assertEquals(1.5768778343115222E7, Double.parseDouble(value), 1E-5);
        assertXpathExists("//kml/Folder/LookAt/range", dom);
    }

    /**
 
View Full Code Here

        assertXpathEvaluatesTo("1", "//kml/Folder/NetworkLink/open", dom);
        assertXpathEvaluatesTo("1", "//kml/Folder/NetworkLink/visibility", dom);

        final Map<String, String> expectedKvp = KMLReflectorTest
                .toKvp("http://geoserver.org:8181/geoserver/wms?format_options=relLinks%3Atrue%3B&service=wms&srs=EPSG%3A4326&width=512&styles=Default+Style&height=256&transparent=false&request=GetMap&layers=geos%3ATestPoints&format=application/vnd.google-earth.kmz&version=1.1.1");
        final Map<String, String> actualKvp = KMLReflectorTest.toKvp(xpath.evaluate(
                "//kml/Folder/NetworkLink/Url/href", dom));
        KMLReflectorTest.assertMapsEqual(expectedKvp, actualKvp);
        assertXpathEvaluatesTo("onStop", "//kml/Folder/NetworkLink/Url/viewRefreshMode", dom);
        assertXpathEvaluatesTo("1", "//kml/Folder/NetworkLink/Url/viewRefreshTime", dom);
View Full Code Here

        assertXpathEvaluatesTo("0.0", "//kml/Folder/LookAt/tilt", dom);
        assertXpathEvaluatesTo("0.0", "//kml/Folder/LookAt/heading", dom);
        assertXpathEvaluatesTo("clampToGround", "//kml/Folder/LookAt/altitudeMode", dom);
        // these ones are hard to compute, maybe someone understanding what's going on could add an
        // expected value?
        String value = xpath.evaluate("//kml/Folder/LookAt/altitude", dom);
        assertEquals(1.5768778343115222E7, Double.parseDouble(value), 1E-5);
        assertXpathExists("//kml/Folder/LookAt/range", dom);
    }

    /**
 
View Full Code Here

        assertXpathEvaluatesTo("1", "count(//wms:Layer[wms:Name='cdf:Fifteen'])", doc);
        assertXpathEvaluatesTo("2", "count(//wms:Layer[wms:Name='cdf:Fifteen']/wms:Style)", doc);

        XpathEngine xpath = newXpathEngine();
        String href = xpath
                .evaluate(
                        "//wms:Layer[wms:Name='cdf:Fifteen']/wms:Style[wms:Name='Default']/wms:LegendURL/wms:OnlineResource/@xlink:href",
                        doc);
        assertTrue(href.contains("GetLegendGraphic"));
        assertTrue(href.contains("layer=Fifteen"));
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.