Package org.custommonkey.xmlunit

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


        Map<String, Object> resultedKVP = KvpUtils.parseQueryString(xpath.evaluate(
                "kml:kml/kml:Document/kml:NetworkLink[1]/kml:Url/kml:href", dom));

        assertMapsEqual(expectedKVP, resultedKVP);

        String href = xpath.evaluate(
                "kml:kml/kml:Document/kml:NetworkLink/kml:Link/kml:href", dom);
        Pattern badPattern = Pattern.compile("&bbox=", Pattern.CASE_INSENSITIVE);
        assertFalse(badPattern.matcher(href).matches());
    }
   
View Full Code Here


        assertXpathEvaluatesTo(layerName,
                "kml:kml/kml:Document/kml:NetworkLink[2]/kml:name", dom);

        XpathEngine xpath = XMLUnit.newXpathEngine();

        String url1 = xpath.evaluate(
                "/kml:kml/kml:Document/kml:NetworkLink[1]/kml:Url/kml:href", dom);
        String url2 = xpath.evaluate(
                "/kml:kml/kml:Document/kml:NetworkLink[2]/kml:Url/kml:href", dom);

        assertNotNull(url1);
View Full Code Here

        XpathEngine xpath = XMLUnit.newXpathEngine();

        String url1 = xpath.evaluate(
                "/kml:kml/kml:Document/kml:NetworkLink[1]/kml:Url/kml:href", dom);
        String url2 = xpath.evaluate(
                "/kml:kml/kml:Document/kml:NetworkLink[2]/kml:Url/kml:href", dom);

        assertNotNull(url1);
        assertNotNull(url2);
View Full Code Here

        Document dom = getAsDOM(requestUrl);
        XpathEngine xpath = XMLUnit.newXpathEngine();

        // print(dom);
        // all the kvp parameters (which should be set as format_options now are correctly parsed)
        String result = xpath.evaluate("//kml:NetworkLink/kml:Link/kml:href", dom);
        Map<String, Object> kvp = KvpUtils.parseQueryString(result);
        List<String> formatOptions = Arrays.asList(((String) kvp.get("format_options")).split(";"));
        assertEquals(9, formatOptions.size());
        assertTrue(formatOptions.contains("LEGEND:true"));
        assertTrue(formatOptions.contains("SUPEROVERLAY:true"));
View Full Code Here

        assertEquals("kml", doc.getDocumentElement().getNodeName());
       
        // the icon itself
        XpathEngine xpath = XMLUnit.newXpathEngine();
        String href = xpath.evaluate("//kml:ScreenOverlay/kml:Icon/kml:href", doc);
        assertTrue(href.contains("request=GetLegendGraphic"));
        assertTrue(href.contains("layer=cite%3ABasicPolygons"));
        assertTrue(href.contains("style=polygon"));
        assertTrue(href.contains("LEGEND_OPTIONS=fontStyle%3Abold%3BfontColor%3Aff0000%3BfontSize%3A18"));
       
View Full Code Here

        }
    }

    private void assertXPathCoordinates( String message, String expectedText, String xpath, Document doc ) throws XpathException {
      XpathEngine engine = XMLUnit.newXpathEngine();
        String text = engine.evaluate(xpath, doc);
        if( equalsRegardingNull( expectedText, text ) ){
          return;
        }
        if( expectedText != null && text != null ){
          String expectedCoordinates[] = expectedText.split("(\\s|,)");
View Full Code Here

                .getLength() > 1);
        assertTrue(engine.getMatchingNodes("//Layer/Name[starts-with(text(), 'cite:')]", doc)
                .getLength() > 1);

        // check the authentication key has been propagated
        String url = engine.evaluate("//GetMap/DCPType/HTTP/Get/OnlineResource/@xlink:href", doc);
        assertTrue(url.contains("&authkey=" + adminKey));
    }

    @Test
    public void testCiteCapabilities() throws Exception {
View Full Code Here

                .getLength() > 1);
        assertEquals(0, engine.getMatchingNodes("//Layer/Name[starts-with(text(), 'cdf:')]", doc)
                .getLength());

        // check the authentication key has been propagated
        String url = engine.evaluate("//GetMap/DCPType/HTTP/Get/OnlineResource/@xlink:href", doc);
        assertTrue(url.contains("&authkey=" + citeKey));
    }

    @Test
    public void testAnonymousGetFeature() throws Exception {
View Full Code Here

                + getLayerId(MockData.PONDS) + "&authkey=" + adminKey);
        // print(doc);
        assertXpathEvaluatesTo("1", "count(//wfs:FeatureCollection)", doc);

        XpathEngine engine = XMLUnit.newXpathEngine();
        String url = engine.evaluate("//wfs:FeatureCollection/@xsi:schemaLocation", doc);
        assertTrue(url.contains("&authkey=" + adminKey));
    }

    @Test
    public void testCiteGetFeature() throws Exception {
View Full Code Here

                + getLayerId(MockData.PONDS) + "&authkey=" + citeKey);
        // print(doc);
        assertXpathEvaluatesTo("1", "count(//wfs:FeatureCollection)", doc);

        XpathEngine engine = XMLUnit.newXpathEngine();
        String url = engine.evaluate("//wfs:FeatureCollection/@xsi:schemaLocation", doc);
        assertTrue(url.contains("&authkey=" + citeKey));
    }
}
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.