Package org.custommonkey.xmlunit

Examples of org.custommonkey.xmlunit.XpathEngine


    public void testFilteredCapabilitiesCite() throws Exception {
        Document dom = dom(get("wms?request=getCapabilities&version=1.3.0&namespace=cite"), true);
        Element e = dom.getDocumentElement();
        assertEquals("WMS_Capabilities", e.getLocalName());
        XpathEngine xpath = XMLUnit.newXpathEngine();
        assertTrue(xpath.getMatchingNodes("//wms:Layer/wms:Name[starts-with(., cite)]", dom)
                .getLength() > 0);
        assertEquals(0,
                xpath.getMatchingNodes("//wms:Layer/wms:Name[not(starts-with(., cite))]", dom)
                        .getLength());
    }
View Full Code Here


            }
        }

        Document dom = dom(get("wms?request=GetCapabilities&version=1.3.0"), true);

        XpathEngine xpath = XMLUnit.newXpathEngine();
        NodeList nodeLayers = xpath.getMatchingNodes(
                "/wms:WMS_Capabilities/wms:Capability/wms:Layer/wms:Layer", dom);

        assertEquals(layers.size(), nodeLayers.getLength());
    }
View Full Code Here

    public void testWorkspaceQualified() throws Exception {
        Document dom = dom(get("cite/wms?request=getCapabilities&version=1.3.0"), true);
        Element e = dom.getDocumentElement();
        assertEquals("WMS_Capabilities", e.getLocalName());
        XpathEngine xpath = XMLUnit.newXpathEngine();
        assertTrue(xpath.getMatchingNodes("//wms:Layer/wms:Name[starts-with(., cite)]", dom)
                .getLength() > 0);
        assertEquals(0,
                xpath.getMatchingNodes("//wms:Layer/wms:Name[not(starts-with(., cite))]", dom)
                        .getLength());

        NodeList nodes = xpath.getMatchingNodes("//wms:Layer//wms:OnlineResource", dom);
        assertTrue(nodes.getLength() > 0);
        for (int i = 0; i < nodes.getLength(); i++) {
            e = (Element) nodes.item(i);
            String attribute = e.getAttribute("xlink:href");
            assertTrue(attribute.contains("geoserver/cite/ows"));
View Full Code Here

    public void testLayerQualified() throws Exception {
        Document dom = dom(get("cite/Forests/wms?request=getCapabilities&version=1.3.0"), true);
        Element e = dom.getDocumentElement();
        assertEquals("WMS_Capabilities", e.getLocalName());
        XpathEngine xpath = XMLUnit.newXpathEngine();
        assertTrue(xpath
                .getMatchingNodes("//wms:Layer/wms:Name[starts-with(., cite:Forests)]", dom)
                .getLength() == 1);
        assertEquals(1, xpath.getMatchingNodes("//wms:Layer/wms:Layer", dom).getLength());

        NodeList nodes = xpath.getMatchingNodes("//wms:Layer//wms:OnlineResource", dom);
        assertTrue(nodes.getLength() > 0);
        for (int i = 0; i < nodes.getLength(); i++) {
            e = (Element) nodes.item(i);
            String attribute = e.getAttribute("xlink:href");
            assertTrue(attribute.contains("geoserver/cite/Forests/ows"));
View Full Code Here

        // print(doc);

        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"));
        assertFalse(href.contains("style"));
        href = xpath
                .evaluate(
                        "//wms:Layer[wms:Name='cdf:Fifteen']/wms:Style[wms:Name='point']/wms:LegendURL/wms:OnlineResource/@xlink:href",
                        doc);
        assertTrue(href.contains("GetLegendGraphic"));
        assertTrue(href.contains("layer=Fifteen"));
View Full Code Here

        String xml = aggregateCall("StdDev");

        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.*"));
    }
View Full Code Here

        assertXpathEvaluatesTo("5", "count(/AggregationResults/*)", dom);
        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.*"));
    }
View Full Code Here

        assertXpathEvaluatesTo("5", "count(/AggregationResults/*)", dom);
        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.*"));
    }
View Full Code Here

    }
   
    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);
            }
            previous = curr;
        }
View Full Code Here

        wfs.setHitsIgnoreMaxFeatures(true);
        getGeoServer().save( wfs );
       
        Document doc = getAsDOM("wfs?request=GetFeature&typename=cdf:Fifteen" +
            "&version=1.1.0&service=wfs&resultType=hits");
        XpathEngine xpath = XMLUnit.newXpathEngine();
        assertEquals("15",
                xpath.getMatchingNodes("//wfs:FeatureCollection/@numberOfFeatures", doc)
                    .item(0)
                        .getNodeValue());
       
    }
View Full Code Here

TOP

Related Classes of org.custommonkey.xmlunit.XpathEngine

Copyright © 2018 www.massapicom. 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.