public String getCapabilitiesURL() { return delegate.getCapabilitiesURL(); }
if (wms == null) { HTTPClient client = getHTTPClient(expandedStore); String capabilitiesURL = expandedStore.getCapabilitiesURL(); URL serverURL = new URL(capabilitiesURL); Map<String, Object> hints = new HashMap<>();
/** * @param source * @param target */ private void setConnectionParameters(final WMSStoreInfo source, WMSStoreInfo target) { target.setCapabilitiesURL(source.getCapabilitiesURL()); target.setUsername(source.getUsername()); target.setPassword(source.getPassword()); target.setUseConnectionPooling(source.isUseConnectionPooling()); target.setMaxConnections(source.getMaxConnections()); target.setConnectTimeout(source.getConnectTimeout()); target.setReadTimeout(source.getReadTimeout()); }
@Test public void testModifyWMSStore() throws Exception { testAddWMSStore(); WMSStoreInfo wms = catalog.getStoreByName("acme", "demowms", WMSStoreInfo.class); assertNull(wms.getCapabilitiesURL()); String capsURL = "http://demo.opengeo.org:8080/geoserver/wms?request=GetCapabilites&service=WMS"; wms.setCapabilitiesURL(capsURL); catalog.save(wms); File f = new File(testData.getDataDirectoryRoot(), "workspaces/acme/demowms/wmsstore.xml"); Document dom = dom(f); assertXpathEvaluatesTo(capsURL, "/wmsStore/capabilitiesURL/text()", dom); }
public WMSStoreInfo clone(final WMSStoreInfo source, boolean allowEnvParametrization) { WMSStoreInfo target; try { target = (WMSStoreInfo) SerializationUtils.clone(source); if (target instanceof StoreInfoImpl && target.getCatalog() == null) { ((StoreInfoImpl) target).setCatalog(catalog); } } catch (Exception e) { target = catalog.getFactory().createWebMapServer(); target.setDescription(source.getDescription()); target.setEnabled(source.isEnabled()); target.setName(source.getName()); target.setType(source.getType()); target.setWorkspace(source.getWorkspace()); } setConnectionParameters(source, target); if (allowEnvParametrization) { // Resolve GeoServer Environment placeholders final GeoServerEnvironment gsEnvironment = GeoServerExtensions.bean(GeoServerEnvironment.class); if (gsEnvironment != null && GeoServerEnvironment.ALLOW_ENV_PARAMETRIZATION) { target.setCapabilitiesURL( (String) gsEnvironment.resolveValue(source.getCapabilitiesURL())); target.setUsername((String) gsEnvironment.resolveValue(source.getUsername())); target.setPassword((String) gsEnvironment.resolveValue(source.getPassword())); } } return target; }
getCatalog().save(savedStore); } catch (RuntimeException e) { LOGGER.log(Level.INFO, "Adding the store for " + info.getCapabilitiesURL(), e); throw new IllegalArgumentException( "The WMS store could not be saved. Failure message: " + e.getMessage()); layerChooserPage = new NewLayerPage(savedStore.getId()); } catch (RuntimeException e) { LOGGER.log(Level.INFO, "Getting list of layers for the WMS store " + info.getCapabilitiesURL(), e);
LOGGER.log(Level.INFO, "Adding the store for " + info.getCapabilitiesURL(), e); throw new IllegalArgumentException( "The WMS store could not be saved. Failure message: " + e.getMessage()); LOGGER.log( Level.INFO, "Getting list of layers for the WMS store " + info.getCapabilitiesURL(), e);
@Override public void visit(WMSStoreInfo wmsStore) { WMSStoreInfo otherWmsStore = otherCatalog.getStore(wmsStore.getId(), WMSStoreInfo.class); if (!(Objects.equals(wmsStore, otherWmsStore) && Objects.equals(wmsStore.getType(), otherWmsStore.getType()) && Objects.equals(wmsStore.getCapabilitiesURL(), otherWmsStore.getCapabilitiesURL()) && Objects.equals(wmsStore.getUsername(), otherWmsStore.getUsername()) && Objects.equals(wmsStore.getPassword(), otherWmsStore.getPassword()) && Objects.equals(wmsStore.getMaxConnections(), otherWmsStore.getMaxConnections()) && Objects.equals(wmsStore.getReadTimeout(), otherWmsStore.getReadTimeout()) && Objects.equals(wmsStore.getConnectTimeout(), otherWmsStore.getConnectTimeout()) && checkEquals(wmsStore.getMetadata(), otherWmsStore.getMetadata()) && checkEquals( wmsStore.getConnectionParameters(), otherWmsStore.getConnectionParameters()))) { differences.add(new InfoDiff(wmsStore, otherWmsStore)); } }
@Test public void testPostAsJSON() throws Exception { removeStore("sf", "newWMSStore"); String json = "{'wmsStore':{" + "'capabilitiesURL': 'http://somehost/wms?'," + "'workspace':'sf'," + "'name':'newWMSStore'," + "}" + "}"; MockHttpServletResponse response = postAsServletResponse( RestBaseController.ROOT_PATH + "/workspaces/sf/wmsstores", json, "text/json"); assertEquals(201, response.getStatus()); assertNotNull(response.getHeader("Location")); assertTrue(response.getHeader("Location").endsWith("/workspaces/sf/wmsstores/newWMSStore")); WMSStoreInfo newStore = catalog.getStoreByName("newWMSStore", WMSStoreInfo.class); assertNotNull(newStore); assertEquals("http://somehost/wms?", newStore.getCapabilitiesURL()); }
protected void clone(final WMSStoreInfo source, WMSStoreInfo target) { target.setDescription(source.getDescription()); target.setEnabled(source.isEnabled()); target.setName(source.getName()); target.setType(source.getType()); target.setCapabilitiesURL(source.getCapabilitiesURL()); target.setWorkspace(source.getWorkspace()); target.setUsername(source.getUsername()); target.setPassword(source.getPassword()); target.setUseConnectionPooling(source.isUseConnectionPooling()); target.setMaxConnections(source.getMaxConnections()); target.setConnectTimeout(source.getConnectTimeout()); target.setReadTimeout(source.getReadTimeout()); }
@Test public void testPostAsXMLNoWorkspace() throws Exception { String xml = "<wmsStore>" + "<name>newWMSStore</name>" + "<capabilitiesURL>http://somehost/wms?</capabilitiesURL>" + "</wmsStore>"; MockHttpServletResponse response = postAsServletResponse( RestBaseController.ROOT_PATH + "/workspaces/sf/wmsstores", xml, "text/xml"); assertThat(response, hasStatus(HttpStatus.CREATED)); assertThat( response, hasHeader("Location", endsWith("/workspaces/sf/wmsstores/newWMSStore"))); WMSStoreInfo newStore = catalog.getStoreByName("newWMSStore", WMSStoreInfo.class); assertNotNull(newStore); assertEquals("http://somehost/wms?", newStore.getCapabilitiesURL()); }
@Test public void testPostAsXML() throws Exception { String xml = "<wmsStore>" + "<name>newWMSStore</name>" + "<capabilitiesURL>http://somehost/wms?</capabilitiesURL>" + "<workspace>sf</workspace>" + "</wmsStore>"; MockHttpServletResponse response = postAsServletResponse( RestBaseController.ROOT_PATH + "/workspaces/sf/wmsstores", xml, "text/xml"); assertThat(response, hasStatus(HttpStatus.CREATED)); assertThat( response, hasHeader("Location", endsWith("/workspaces/sf/wmsstores/newWMSStore"))); WMSStoreInfo newStore = catalog.getStoreByName("newWMSStore", WMSStoreInfo.class); assertNotNull(newStore); assertEquals("http://somehost/wms?", newStore.getCapabilitiesURL()); }