01: package org.geoserver.wfs.v1_1;
02:
03: import org.geoserver.wfs.WFSTestSupport;
04: import org.geoserver.wfs.xml.FeatureTypeSchemaBuilder;
05: import org.geoserver.wfs.xml.v1_1_0.WFSConfiguration;
06: import org.geotools.xml.Parser;
07:
08: public class WFSXmlTest extends WFSTestSupport {
09:
10: WFSConfiguration configuration() {
11: return new WFSConfiguration(getCatalog(),
12: new FeatureTypeSchemaBuilder.GML3(getWFS(),
13: getCatalog(), getResourceLoader()));
14: }
15:
16: public void testValid() throws Exception {
17: Parser parser = new Parser(configuration());
18: parser.parse(getClass().getResourceAsStream("GetFeature.xml"));
19:
20: assertEquals(0, parser.getValidationErrors().size());
21: }
22:
23: public void testInvalid() throws Exception {
24: Parser parser = new Parser(configuration());
25: parser.setValidating(true);
26: parser.parse(getClass().getResourceAsStream(
27: "GetFeature-invalid.xml"));
28:
29: assertTrue(parser.getValidationErrors().size() > 0);
30: }
31:
32: }
|