/** see GEOS-2461 */ @Test public void testDefaultOutputFormat() throws Exception { CapabilitiesTransformer tx = new CapabilitiesTransformer.WFS1_1(getWFS(), getCatalog()); ByteArrayOutputStream output = new ByteArrayOutputStream(); tx.transform(request(), output); Document dom = super.dom(new ByteArrayInputStream(output.toByteArray())); // XpathEngine xpath = XMLUnit.newXpathEngine(); final String expected = "text/xml; subtype=gml/3.1.1"; String xpathExpr = "//wfs:WFS_Capabilities/ows:OperationsMetadata/ows:Operation[@name='DescribeFeatureType']" + "/ows:Parameter[@name='outputFormat']/ows:Value"; assertXpathEvaluatesTo(expected, xpathExpr, dom); xpathExpr = "//wfs:WFS_Capabilities/ows:OperationsMetadata/ows:Operation[@name='GetFeature']" + "/ows:Parameter[@name='outputFormat']/ows:Value"; assertXpathEvaluatesTo(expected, xpathExpr, dom); xpathExpr = "//wfs:WFS_Capabilities/ows:OperationsMetadata/ows:Operation[@name='GetFeatureWithLock']" + "/ows:Parameter[@name='outputFormat']/ows:Value"; assertXpathEvaluatesTo(expected, xpathExpr, dom); xpathExpr = "//wfs:WFS_Capabilities/ows:OperationsMetadata/ows:Operation[@name='Transaction']" + "/ows:Parameter[@name='inputFormat']/ows:Value"; assertXpathEvaluatesTo(expected, xpathExpr, dom); }
@Test public void test() throws Exception { CapabilitiesTransformer tx = new CapabilitiesTransformer.WFS1_1(getWFS(), getCatalog()); ByteArrayOutputStream output = new ByteArrayOutputStream(); tx.transform(request(), output); InputStreamReader reader = new InputStreamReader(new ByteArrayInputStream(output.toByteArray())); File f = new File("../web/src/main/webapp/schemas/wfs/1.1.0/wfs.xsd"); if (!f.exists()) { return; } ErrorHandler handler = new ErrorHandler(logger, Level.WARNING); // use the schema embedded in the web module ReaderUtils.validate( reader, handler, WFS.NAMESPACE, "../web/src/main/webapp/schemas/wfs/1.1.0/wfs.xsd"); assertTrue(handler.errors.isEmpty()); }