Package org.custommonkey.xmlunit

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


        // 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 doc = getAsDOM("/wfs?request=GetFeature&typename=" + getLayerId(SystemTestData.BASIC_POLYGONS)
                + "," + getLayerId(SystemTestData.BRIDGES) + "&version=1.0.0&service=wfs");
        // print(doc);
       
        XpathEngine engine = XMLUnit.newXpathEngine();
        String schemaLocation = engine.evaluate("wfs:FeatureCollection/@xsi:schemaLocation", doc);
        assertNotNull(schemaLocation);
        String[] parsedLocations = schemaLocation.split("\\s+");
        // System.out.println(Arrays.toString(parsedLocations));
        int i = 0;
        for (; i < parsedLocations.length; i+=2) {
View Full Code Here

        Set<String> expected = new HashSet<String>();
        expected.add("http://localhost:8080/geoserver/geosearch/cite%3ABasicPolygons.kml");
        expected.add("http://localhost:8080/geoserver/geosearch/cite%3ABridges.kml");

        XpathEngine xp = XMLUnit.newXpathEngine();
        String kmlUrl1 = xp.evaluate("/sm:urlset/sm:url[1]/sm:loc", sitemap);
        String kmlUrl2 = xp.evaluate("/sm:urlset/sm:url[2]/sm:loc", sitemap);
        Set<String> actual = new HashSet<String>();
        actual.add(kmlUrl1);
        actual.add(kmlUrl2);
View Full Code Here

        expected.add("http://localhost:8080/geoserver/geosearch/cite%3ABasicPolygons.kml");
        expected.add("http://localhost:8080/geoserver/geosearch/cite%3ABridges.kml");

        XpathEngine xp = XMLUnit.newXpathEngine();
        String kmlUrl1 = xp.evaluate("/sm:urlset/sm:url[1]/sm:loc", sitemap);
        String kmlUrl2 = xp.evaluate("/sm:urlset/sm:url[2]/sm:loc", sitemap);
        Set<String> actual = new HashSet<String>();
        actual.add(kmlUrl1);
        actual.add(kmlUrl2);

        assertEquals(expected, actual);
View Full Code Here

                + getLayerId(SystemTestData.BUILDINGS) + "&propertyName=FID,ADDRESS");
        // print(doc);
       
        assertXpathEvaluatesTo("1", "count(//ows:ExceptionReport)", doc);
        XpathEngine xpath = XMLUnit.newXpathEngine();
        String message = xpath.evaluate("//ows:ExceptionText", doc);
        Pattern pattern = Pattern.compile(".*ADDRESS.*not available.*", Pattern.MULTILINE | Pattern.DOTALL);
        assertTrue(pattern.matcher(message).matches());

    }
   
View Full Code Here

                + getLayerId(SystemTestData.BUILDINGS) + "&propertyName=FID,ADDRESS");
        // print(doc);
       
        assertXpathEvaluatesTo("1", "count(//ows:ExceptionReport)", doc);
        XpathEngine xpath = XMLUnit.newXpathEngine();
        String message = xpath.evaluate("//ows:ExceptionText", doc);
        Pattern pattern = Pattern.compile(".*ADDRESS.*not available.*", Pattern.MULTILINE | Pattern.DOTALL);
        assertTrue(pattern.matcher(message).matches());
    }
   
    @Test
View Full Code Here

        Document dom = postAsDOM("wfs", INSERT_RESTRICTED_STREET);
        // print(dom);
        assertXpathEvaluatesTo("1", "count(//wfs:WFS_TransactionResponse)", dom);
        assertXpathEvaluatesTo("1", "count(//wfs:Status/wfs:FAILED)", dom);
        XpathEngine xpath = XMLUnit.newXpathEngine();
        String message = xpath.evaluate("//wfs:Message", dom);
        assertTrue(message.matches(".*write restrictions.*"));
    }
   
    @Test
    public void testInsertAttributeRestricted() throws Exception {
View Full Code Here

        Document dom = postAsDOM("wfs", INSERT_RESTRICTED_STREET);
        print(dom);
        assertXpathEvaluatesTo("1", "count(//wfs:WFS_TransactionResponse)", dom);
        assertXpathEvaluatesTo("1", "count(//wfs:Status/wfs:FAILED)", dom);
        XpathEngine xpath = XMLUnit.newXpathEngine();
        String message = xpath.evaluate("//wfs:Message", dom);
        assertTrue(message.matches(".*write protected.*ADDRESS.*"));
    }
   
    @Test
    public void testUpdateNoLimits() throws Exception {
View Full Code Here

        // not sure why CITE tests make us throw an exception for this one instead of using
        // in transaction reporting...
        assertXpathEvaluatesTo("1", "count(//ows:ExceptionReport)", dom);
        XpathEngine xpath = XMLUnit.newXpathEngine();
        String message = xpath.evaluate("//ows:ExceptionText", dom);
        assertTrue(message.matches(".*write protected.*ADDRESS.*"));
    }
   
    @Test
    public void testDeleteLimitWrite() throws Exception {
View Full Code Here

        assertXpathEvaluatesTo("1.0",
                "kml:kml/kml:Document/kml:NetworkLink[1]/kml:Url/kml:viewBoundScale",
                dom);
        Map<String, Object> expectedKVP = KvpUtils
                .parseQueryString("http://localhost:80/geoserver/wms?format_options=MODE%3Arefresh%3Bautofit%3Atrue%3BKMPLACEMARK%3Afalse%3BKMATTR%3Atrue%3BKMSCORE%3A40%3BSUPEROVERLAY%3Afalse&service=wms&srs=EPSG%3A4326&width=2048&styles=BasicPolygons&height=2048&transparent=false&request=GetMap&layers=cite%3ABasicPolygons&format=application%2Fvnd.google-earth.kml+xml&version=1.1.1");
        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(
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.