@Override public WMSLayerInfo createWMSLayer() { return delegate.createWMSLayer(); }
WMSLayerInfo wli = catalog.getFactory().createWMSLayer();
@Test public void testAddWMSLayer() throws Exception { testAddWMSStore(); File d = new File(testData.getDataDirectoryRoot(), "workspaces/acme/demowms/foo"); assertFalse(d.exists()); NamespaceInfo ns = catalog.getFactory().createNamespace(); ns.setPrefix("bar"); ns.setURI("http://bar"); catalog.add(ns); WMSLayerInfo wms = catalog.getFactory().createWMSLayer(); wms.setName("foo"); wms.setNamespace(ns); wms.setStore(catalog.getStoreByName("acme", "demowms", WMSStoreInfo.class)); catalog.add(wms); assertTrue(d.exists()); assertTrue(new File(d, "wmslayer.xml").exists()); }
/** 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); }
catalog.add(wms); WMSLayerInfo wl = cFactory.createWMSLayer(); wl.setStore(wms); wl.setNamespace(ns);
wms.setWorkspace(ws); wl = factory.createWMSLayer(); wl.setEnabled(true); wl.setName("wmsLayer");
public static WMSLayerInfo localizeWMSLayer(final WMSLayerInfo info, final Catalog catalog) throws IllegalAccessException, InvocationTargetException { if (info==null || catalog==null) throw new NullArgumentException("Arguments may never be null"); final WMSLayerInfo localObject=catalog.getResourceByName(info.getNamespace(),info.getName(),WMSLayerInfo.class); if (localObject !=null){ return localObject; } final WMSLayerInfo createdObject = catalog.getFactory().createWMSLayer(); // let's using the created object (see getGridCoverageReader) BeanUtils.copyProperties(createdObject, info); createdObject.setNamespace(localizeNamespace(info.getNamespace(), catalog)); final StoreInfo store=localizeStore(info.getStore(), catalog); createdObject.setStore(store); // WMSLayerObject.setAttributes(localizeAttributes(...)); TODO(should be already serialized) final CatalogBuilder builder = new CatalogBuilder(catalog); builder.attach(createdObject); return createdObject; }
public static WMSLayerInfo localizeWMSLayer(final WMSLayerInfo info, final Catalog catalog) throws IllegalAccessException, InvocationTargetException { if (info==null || catalog==null) throw new NullArgumentException("Arguments may never be null"); final WMSLayerInfo localObject=catalog.getResourceByName(info.getNamespace(),info.getName(),WMSLayerInfo.class); if (localObject !=null){ return localObject; } final WMSLayerInfo createdObject = catalog.getFactory().createWMSLayer(); // let's using the created object (see getGridCoverageReader) BeanUtils.copyProperties(createdObject, info); createdObject.setNamespace(localizeNamespace(info.getNamespace(), catalog)); final StoreInfo store=localizeStore(info.getStore(), catalog); createdObject.setStore(store); // WMSLayerObject.setAttributes(localizeAttributes(...)); TODO(should be already serialized) final CatalogBuilder builder = new CatalogBuilder(catalog); builder.attach(createdObject); return createdObject; }
@Before public void addStatesWmsLayer() throws Exception { String capabilities = clientMocker.getServer() + "/geoserver/wms?REQUEST=GetCapabilities&VERSION=1.3.0&SERVICE=WMS"; WMSLayerInfo wml = catalog.getResourceByName("sf", "states", WMSLayerInfo.class); if (wml == null) { wml = catalog.getFactory().createWMSLayer(); wml.setName("states"); wml.setNativeName("topp:states"); wml.setStore(catalog.getStoreByName("demo", WMSStoreInfo.class)); wml.setCatalog(catalog); wml.setNamespace(catalog.getNamespaceByPrefix("sf")); wml.setSRS("EPSG:4326"); CoordinateReferenceSystem wgs84 = CRS.decode("EPSG:4326"); wml.setNativeCRS(wgs84); wml.setLatLonBoundingBox(new ReferencedEnvelope(-110, 0, -60, 50, wgs84)); wml.setProjectionPolicy(ProjectionPolicy.FORCE_DECLARED); catalog.add(wml); } MockHttpClient client = new MockHttpClient(); client.expectGet( new URL(capabilities), new MockHttpResponse(getClass().getResource("caps130.xml"), "text/xml")); clientMocker.bind(client, capabilities); }
public void addStatesWmsLayer() throws Exception { WMSLayerInfo wml = catalog.getResourceByName("sf", "states", WMSLayerInfo.class); if (wml == null) { wml = catalog.getFactory().createWMSLayer(); wml.setName("states"); wml.setNativeName("topp:states"); wml.setStore(catalog.getStoreByName("demo", WMSStoreInfo.class)); wml.setCatalog(catalog); wml.setNamespace(catalog.getNamespaceByPrefix("sf")); wml.setSRS("EPSG:4326"); CoordinateReferenceSystem wgs84 = CRS.decode("EPSG:4326"); wml.setNativeCRS(wgs84); wml.setLatLonBoundingBox(new ReferencedEnvelope(-110, 0, -60, 50, wgs84)); wml.setProjectionPolicy(ProjectionPolicy.FORCE_DECLARED); catalog.add(wml); } }