/** * As for section 7.4.3.7, a missing or incorrectly specified pair of I,J parameters shall issue a * service exception with {@code InvalidPoint} code. * * @throws Exception */ public void testInvalidPoint() throws Exception { String layer = MockData.FORESTS.getPrefix() + ":" + MockData.FORESTS.getLocalPart(); // missing I,J parameters String request = "wms?version=1.3.0&bbox=-0.002,-0.002,0.002,0.002&styles=&format=jpeg&info_format=text/plain&request=GetFeatureInfo&layers=" + layer + "&query_layers=" + layer + "&width=20&height=20"; Document doc = dom(get(request), true); // print(doc); assertXpathEvaluatesTo( "InvalidPoint", "/ogc:ServiceExceptionReport/ogc:ServiceException/@code", doc); // invalid I,J parameters request = "wms?version=1.3.0&bbox=-0.002,-0.002,0.002,0.002&styles=&format=jpeg&info_format=text/plain&request=GetFeatureInfo&layers=" + layer + "&query_layers=" + layer + "&width=20&height=20&i=A&j="; doc = dom(get(request), true); // print(doc); assertXpathEvaluatesTo( "InvalidPoint", "/ogc:ServiceExceptionReport/ogc:ServiceException/@code", doc); }
/** * Check GetFeatureInfo returns an error if the format is not known, instead of returning the text * format as in http://jira.codehaus.org/browse/GEOS-1924 * * @throws Exception */ public void testUknownFormat() throws Exception { String layer = MockData.FORESTS.getPrefix() + ":" + MockData.FORESTS.getLocalPart(); String request = "wms?version=1.3.0&bbox=-0.002,-0.002,0.002,0.002&styles=&format=jpeg&info_format=unknown/format&request=GetFeatureInfo&layers=" + layer + "&query_layers=" + layer + "&width=20&height=20&i=10&j=10"; Document doc = dom(get(request), true); // print(doc); assertXpathEvaluatesTo("1", "count(//ogc:ServiceExceptionReport/ogc:ServiceException)", doc); assertXpathEvaluatesTo( "InvalidFormat", "/ogc:ServiceExceptionReport/ogc:ServiceException/@code", doc); assertXpathEvaluatesTo( "info_format", "/ogc:ServiceExceptionReport/ogc:ServiceException/@locator", doc); }