package org.geoserver.wcs2_0.xml; import static org.custommonkey.xmlunit.XMLAssert.assertXpathEvaluatesTo; import java.io.File; import org.apache.commons.io.FileUtils; import org.geoserver.wcs2_0.WCSTestSupport; import org.junit.Test; import org.w3c.dom.Document; public class GetCapabilitiesTest extends WCSTestSupport { @Test public void testBasicPost() throws Exception { final File xml= new File("./src/test/resources/getcapabilities/getCap.xml"); final String request= FileUtils.readFileToString(xml); Document dom = postAsDOM("wcs", request); // print(dom); checkFullCapabilitiesDocument(dom); } @Test public void testCase() throws Exception { final File xml= new File("./src/test/resources/getcapabilities/getCapWrongCase.xml"); final String request= FileUtils.readFileToString(xml); Document dom = postAsDOM("wcs", request); print(dom); // checkValidationErrors(dom, WCS20_SCHEMA); // todo: check all the layers are here, the profiles, and so on // check that we have the crs extension assertXpathEvaluatesTo("1", "count(//ows:ExceptionReport)", dom); assertXpathEvaluatesTo("1", "count(//ows:ExceptionReport//ows:Exception)", dom); assertXpathEvaluatesTo("1", "count(//ows:ExceptionReport//ows:Exception[@exceptionCode='InvalidParameterValue'])", dom); assertXpathEvaluatesTo("1", "count(//ows:ExceptionReport//ows:Exception[@locator='WcS'])", dom); } }