public WMSLayerInfo buildWMSLayer(String layerName) throws IOException { return buildWMSLayer(this.store, layerName); }
WMSLayerInfo rebuilt = buildWMSLayer(rinfo.getStore(), rinfo.getNativeName()); bounds = rebuilt.getNativeBoundingBox();
@Test public void testWMSLayer130crs84() throws Exception { TestHttpClientProvider.startTest(); try { String baseURL = TestHttpClientProvider.MOCKSERVER + "/wms13"; MockHttpClient client = new MockHttpClient(); URL capsURL = new URL(baseURL + "?service=WMS&request=GetCapabilities&version=1.3.0"); client.expectGet( capsURL, new MockHttpResponse(getClass().getResource("caps130_crs84.xml"), "text/xml")); TestHttpClientProvider.bind(client, capsURL); CatalogBuilder cb = new CatalogBuilder(getCatalog()); WMSStoreInfo store = cb.buildWMSStore("test-store"); store.setCapabilitiesURL(capsURL.toExternalForm()); cb.setStore(store); WMSLayerInfo layer = cb.buildWMSLayer("world4326"); // check the bbox has the proper axis order assertEquals("EPSG:4326", layer.getSRS()); ReferencedEnvelope bbox = layer.getLatLonBoundingBox(); assertEquals(-180, bbox.getMinX(), 0d); assertEquals(-90, bbox.getMinY(), 0d); assertEquals(180, bbox.getMaxX(), 0d); assertEquals(90, bbox.getMaxY(), 0d); } finally { TestHttpClientProvider.endTest(); } }
@Test public void testWMSLayer111() throws Exception { TestHttpClientProvider.startTest(); try { String baseURL = TestHttpClientProvider.MOCKSERVER + "/wms11"; MockHttpClient client = new MockHttpClient(); URL capsURL = new URL(baseURL + "?service=WMS&request=GetCapabilities&version=1.1.0"); client.expectGet( capsURL, new MockHttpResponse(getClass().getResource("caps111.xml"), "text/xml")); TestHttpClientProvider.bind(client, capsURL); CatalogBuilder cb = new CatalogBuilder(getCatalog()); WMSStoreInfo store = cb.buildWMSStore("test-store"); store.setCapabilitiesURL(capsURL.toExternalForm()); cb.setStore(store); WMSLayerInfo layer = cb.buildWMSLayer("world4326"); // check the bbox has the proper axis order assertEquals("EPSG:4326", layer.getSRS()); ReferencedEnvelope bbox = layer.getLatLonBoundingBox(); assertEquals(-180, bbox.getMinX(), 0d); assertEquals(-90, bbox.getMinY(), 0d); assertEquals(180, bbox.getMaxX(), 0d); assertEquals(90, bbox.getMaxY(), 0d); } finally { TestHttpClientProvider.endTest(); } }
@Test public void testWMSLayer130() throws Exception { TestHttpClientProvider.startTest(); try { String baseURL = TestHttpClientProvider.MOCKSERVER + "/wms13"; MockHttpClient client = new MockHttpClient(); URL capsURL = new URL(baseURL + "?service=WMS&request=GetCapabilities&version=1.3.0"); client.expectGet( capsURL, new MockHttpResponse(getClass().getResource("caps130.xml"), "text/xml")); TestHttpClientProvider.bind(client, capsURL); CatalogBuilder cb = new CatalogBuilder(getCatalog()); WMSStoreInfo store = cb.buildWMSStore("test-store"); store.setCapabilitiesURL(capsURL.toExternalForm()); cb.setStore(store); WMSLayerInfo layer = cb.buildWMSLayer("world4326"); // check the bbox has the proper axis order assertEquals("EPSG:4326", layer.getSRS()); ReferencedEnvelope bbox = layer.getLatLonBoundingBox(); assertEquals(-180, bbox.getMinX(), 0d); assertEquals(-90, bbox.getMinY(), 0d); assertEquals(180, bbox.getMaxX(), 0d); assertEquals(90, bbox.getMaxY(), 0d); } finally { TestHttpClientProvider.endTest(); } }
WMSLayerInfo full = buildWMSLayer(store, wmsLayer.getNativeName());
/** Tests we can build properly the WMS store and the WMS layer */ @Test public void testWMS() throws Exception { if (!RemoteOWSTestSupport.isRemoteWMSStatesAvailable(LOGGER)) { LOGGER.warning("Remote OWS tests disabled, skipping catalog builder wms tests"); return; } Catalog cat = getCatalog(); CatalogBuilder cb = new CatalogBuilder(cat); WMSStoreInfo wms = cb.buildWMSStore("demo"); wms.setCapabilitiesURL( RemoteOWSTestSupport.WMS_SERVER_URL + "service=WMS&request=GetCapabilities&version=1.1.0"); cb.setStore(wms); WMSLayerInfo wmsLayer = cb.buildWMSLayer("topp:states"); assertWMSLayer(wmsLayer); LayerInfo layer = cb.buildLayer(wmsLayer); assertEquals(PublishedType.WMS, layer.getType()); wmsLayer = cat.getFactory().createWMSLayer(); wmsLayer.setName("states"); wmsLayer.setNativeName("topp:states"); cb.initWMSLayer(wmsLayer); assertWMSLayer(wmsLayer); }
LayerInfo buildLayerInfo(LayerResource resource) { Catalog catalog = getCatalog(); StoreInfo store = catalog.getStore(storeId, StoreInfo.class); try { CatalogBuilder builder = new CatalogBuilder(catalog); builder.setStore(store); WMSLayerInfo wli = builder.buildWMSLayer(resource.getLocalName()); return builder.buildLayer(wli); } catch (Exception e) { throw new RuntimeException( "Error occurred while building the resources for the configuration page", e); } }
LayerInfo buildLayerInfo(LayerResource resource) { Catalog catalog = getCatalog(); StoreInfo store = catalog.getStore(storeId, StoreInfo.class); try { CatalogBuilder builder = new CatalogBuilder(catalog); builder.setStore(store); WMSLayerInfo wli = builder.buildWMSLayer(resource.getLocalName()); return builder.buildLayer(wli); } catch (Exception e) { throw new RuntimeException( "Error occurred while building the resources for the configuration page", e); } }
return builder.buildLayer(fti); } else if (store instanceof WMSStoreInfo) { WMSLayerInfo wli = builder.buildWMSLayer(resource.getLocalName()); return builder.buildLayer(wli);
LayerInfo li; try { wli = builder.buildWMSLayer(layer.getLocalName()); li = builder.buildLayer(wli); } catch (IOException e) {
LayerInfo li; try { wli = builder.buildWMSLayer(layer.getLocalName()); li = builder.buildLayer(wli); } catch (IOException e) {
private void setupWMS110Layer() throws MalformedURLException, IOException { // prepare the WMS 1.1 mock client wms11Client = new MockHttpClient(); wms11BaseURL = new URL(TestHttpClientProvider.MOCKSERVER + "/wms11"); URL capsDocument = WMSTestSupport.class.getResource("caps111.xml"); wms11Client.expectGet( new URL(wms11BaseURL + "?service=WMS&request=GetCapabilities&version=1.1.1"), new MockHttpResponse(capsDocument, "text/xml")); URL pngImage = WMSTestSupport.class.getResource("world.png"); // we expect a getmap request with flipped coordinates wms11Client.expectGet( new URL( wms11BaseURL + "?service=WMS&version=1.1.1&request=GetMap&layers=world4326" + "&styles&bbox=-180.0,-90.0,180.0,90.0&srs=EPSG:4326&bgcolor=0xFFFFFF&transparent=FALSE&format=image/png&width=180&height=90"), new MockHttpResponse(pngImage, "image/png")); String caps = wms11BaseURL + "?service=WMS&request=GetCapabilities&version=1.1.1"; TestHttpClientProvider.bind(wms11Client, caps); // setup the WMS layer CatalogBuilder cb = new CatalogBuilder(getCatalog()); WMSStoreInfo store = cb.buildWMSStore("mock-wms-store-110"); getCatalog().add(store); cb.setStore(store); store.setCapabilitiesURL(caps); WMSLayerInfo wmsLayer = cb.buildWMSLayer("world4326"); wmsLayer.setName(WORLD4326_110); getCatalog().add(wmsLayer); LayerInfo gsLayer = cb.buildLayer(wmsLayer); getCatalog().add(gsLayer); }
return builder.buildLayer(wli); } else if (expandedStore instanceof WMSStoreInfo) { WMSLayerInfo wli = builder.buildWMSLayer(resource.getLocalName()); return builder.buildLayer(wli);
private void setupWMS130Layer() throws MalformedURLException, IOException { // prepare the WMS 1.3 mock client wms13Client = new MockHttpClient(); wms13BaseURL = new URL(TestHttpClientProvider.MOCKSERVER + "/wms13"); URL capsDocument = WMSTestSupport.class.getResource("caps130.xml"); wms13Client.expectGet( new URL(wms13BaseURL + "?service=WMS&request=GetCapabilities&version=1.3.0"), new MockHttpResponse(capsDocument, "text/xml")); URL pngImage = WMSTestSupport.class.getResource("world.png"); // we expect a getmap request with flipped coordinates wms13Client.expectGet( new URL( wms13BaseURL + "?service=WMS&version=1.3.0&request=GetMap&layers=world4326" + "&styles&bbox=-90.0,-180.0,90.0,180.0&crs=EPSG:4326&bgcolor=0xFFFFFF&transparent=FALSE&format=image/png&width=180&height=90"), new MockHttpResponse(pngImage, "image/png")); String caps = wms13BaseURL + "?service=WMS&request=GetCapabilities&version=1.3.0"; TestHttpClientProvider.bind(wms13Client, caps); // setup the WMS layer CatalogBuilder cb = new CatalogBuilder(getCatalog()); WMSStoreInfo store = cb.buildWMSStore("mock-wms-store-130"); getCatalog().add(store); cb.setStore(store); store.setCapabilitiesURL(caps); WMSLayerInfo wmsLayer = cb.buildWMSLayer("world4326"); wmsLayer.setName(WORLD4326_130); getCatalog().add(wmsLayer); LayerInfo gsLayer = cb.buildLayer(wmsLayer); getCatalog().add(gsLayer); }
@Override protected void onSetUp(SystemTestData testData) throws Exception { super.onSetUp(testData); // we need to add a wms store CatalogBuilder cb = new CatalogBuilder(catalog); cb.setWorkspace(catalog.getWorkspaceByName("sf")); WMSStoreInfo wms = cb.buildWMSStore("demo"); wms.setCapabilitiesURL(capabilities); catalog.add(wms); cb.setStore(wms); WMSLayerInfo layer = cb.buildWMSLayer("world4326"); catalog.add(layer); }
private void setupWMS110NfiLayer() throws MalformedURLException, IOException { // prepare the WMS 1.1 mock client wms11ClientNfi = new MockHttpClient(); wms11BaseNfiURL = new URL(TestHttpClientProvider.MOCKSERVER + "/wms11_nfi"); URL capsDocument = WMSTestSupport.class.getResource("caps111_no_feature_info.xml"); wms11ClientNfi.expectGet( new URL(wms11BaseNfiURL + "?service=WMS&request=GetCapabilities&version=1.1.1"), new MockHttpResponse(capsDocument, "text/xml")); String caps = wms11BaseNfiURL + "?service=WMS&request=GetCapabilities&version=1.1.1"; TestHttpClientProvider.bind(wms11ClientNfi, caps); // setup the WMS layer CatalogBuilder cb = new CatalogBuilder(getCatalog()); WMSStoreInfo store = cb.buildWMSStore("mock-wms-store-110-nfi"); getCatalog().add(store); cb.setStore(store); store.setCapabilitiesURL(caps); WMSLayerInfo wmsLayer = cb.buildWMSLayer("world4326"); wmsLayer.setName(WORLD4326_110_NFI); getCatalog().add(wmsLayer); LayerInfo gsLayer = cb.buildLayer(wmsLayer); getCatalog().add(gsLayer); } }
getCatalog().save(wms); cb.setStore(wms); WMSLayerInfo states = cb.buildWMSLayer("topp:states"); states.setName("rstates"); getCatalog().add(states);
catalog.save(wms); cb.setStore(wms); WMSLayerInfo states = cb.buildWMSLayer("topp:states"); states.setName("rstates"); catalog.add(states);