Package org.custommonkey.xmlunit

Examples of org.custommonkey.xmlunit.XpathEngine


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


    public void testMultiLayer() throws Exception {
        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);

        assertEquals(expected, actual);
View Full Code Here

        // check it's a feature collection
        assertXpathEvaluatesTo("1", "count(//wfs:FeatureCollection)", doc);
        // check the collection has non null bounds
        assertXpathEvaluatesTo("1", "count(//wfs:FeatureCollection/gml:boundedBy/gml:Box)", doc);
        // check that each feature has non null bounds
        XpathEngine xpath = XMLUnit.newXpathEngine();
        assertTrue(xpath.getMatchingNodes("//cite:Buildings/gml:boundedBy/gml:Box", doc).getLength() > 0);
       
    }
View Full Code Here

        // check it's a feature collection
        assertXpathEvaluatesTo("1", "count(//wfs:FeatureCollection)", doc);
        // check the collection does not have bounds
        assertXpathEvaluatesTo("0", "count(//wfs:FeatureCollection/gml:boundedBy/gml:Box)", doc);
        // check that each feature has non null bounds
        XpathEngine xpath = XMLUnit.newXpathEngine();
        assertEquals(0, xpath.getMatchingNodes("//cite:Buildings/gml:boundedBy/gml:Box", doc).getLength());
    }
View Full Code Here

        Document doc = getAsDOM("wfs?request=GetFeature&version=1.1.0&service=wfs&typeName="
                + 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

        Document doc = getAsDOM("wfs?request=GetFeature&version=1.1.0&service=wfs&typeName="
                + 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

        setRequestAuth("cite_insertfilter", "cite");
        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.*"));
    }
View Full Code Here

        setRequestAuth("cite_writeatts", "cite");
        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.*"));
    }
View Full Code Here

        // print(dom);

        // 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.*"));
    }
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.