public void testResolveLayersForStyleGroup() throws Exception { WMS wms = new WMS(getGeoServer()); GetMapXmlReader reader = new GetMapXmlReader(wms); GetMapRequest request = reader.createRequest(); InputStream resourceStream = getClass().getResource("WMSPostLayerGroupWithStyleGroup.xml").openStream(); BufferedReader input = new BufferedReader(new InputStreamReader(resourceStream)); request = (GetMapRequest) reader.read(request, input, new HashMap()); String layer = MockData.BASIC_POLYGONS.getLocalPart(); assertEquals(1, request.getLayers().size()); assertTrue(request.getLayers().get(0).getName().endsWith(layer)); assertEquals(1, request.getStyles().size()); Style expected = getCatalog().getStyleByName("BasicStyleGroup").getStyle(); Style style = request.getStyles().get(0); assertEquals(expected, style); }
protected void setUpInternal() throws Exception { super.setUpInternal(); dispatcher = (Dispatcher) applicationContext.getBean("dispatcher"); WMS wms = new WMS(getGeoServer()); reader = new GetMapXmlReader(wms); }
public void testAllowDynamicStyles() throws Exception { GetMapRequest request = (GetMapRequest) reader.createRequest(); BufferedReader input = getResourceInputStream("WMSPostLayerGroupNonDefaultStyle.xml"); WMS wms = new WMS(getGeoServer()); WMSInfo oldInfo = wms.getGeoServer().getService(WMSInfo.class); WMSInfo info = new WMSInfoImpl(); info.setDynamicStylingDisabled(Boolean.TRUE); getGeoServer().remove(oldInfo); getGeoServer().add(info); GetMapXmlReader reader = new GetMapXmlReader(wms); boolean error = false; try { request = (GetMapRequest) reader.read(request, input, new HashMap()); } catch (ServiceException e) { error = true; } getGeoServer().remove(info); getGeoServer().add(oldInfo); assertTrue(error); }