public void setName(String name) { delegate.setName(name); }
@Test public void testAddWMSStore() throws Exception { testAddWorkspace(); File dir = new File(testData.getDataDirectoryRoot(), "workspaces/acme/demowms"); assertFalse(dir.exists()); WMSStoreInfo wms = catalog.getFactory().createWebMapServer(); wms.setName("demowms"); wms.setWorkspace(catalog.getWorkspaceByName("acme")); catalog.add(wms); assertTrue(dir.exists()); assertTrue(new File(dir, "wmsstore.xml").exists()); }
@Test public void testAddWMSStore() { assertTrue(catalog.getStores(WMSStoreInfo.class).isEmpty()); addWMSStore(); assertEquals(1, catalog.getStores(WMSStoreInfo.class).size()); WMSStoreInfo retrieved = catalog.getStore(wms.getId(), WMSStoreInfo.class); WMSStoreInfo wms2 = catalog.getFactory().createWebMapServer(); wms2.setName("wms2Name"); wms2.setWorkspace(ws); catalog.add(wms2); assertEquals(2, catalog.getStores(WMSStoreInfo.class).size()); }
private WMSStoreInfo buildWmsStore() { Catalog catalog = new CatalogImpl(); CatalogFactory cFactory = catalog.getFactory(); WorkspaceInfo ws = cFactory.createWorkspace(); ws.setName("foo"); WMSStoreInfo wms = cFactory.createWebMapServer(); wms.setName("bar"); wms.setWorkspace(ws); wms.setCapabilitiesURL("http://fake.host/wms?request=GetCapabilities&service=wms"); wms.setUsername("user"); wms.setPassword("password"); return wms; } }
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; }
@Test public void testWMSStore() throws Exception { Catalog catalog = new CatalogImpl(); CatalogFactory cFactory = catalog.getFactory(); WorkspaceInfo ws = cFactory.createWorkspace(); ws.setName("foo"); WMSStoreInfo wms1 = cFactory.createWebMapServer(); wms1.setName("bar"); wms1.setWorkspace(ws); wms1.setCapabilitiesURL("http://fake.host/wms?request=GetCapabilities&service=wms"); ByteArrayOutputStream out = out(); persister.save(wms1, out); WMSStoreInfo wms2 = persister.load(in(out), WMSStoreInfo.class); assertEquals("bar", wms2.getName()); assertEquals(WMSStoreInfoImpl.DEFAULT_MAX_CONNECTIONS, wms2.getMaxConnections()); assertEquals(WMSStoreInfoImpl.DEFAULT_CONNECT_TIMEOUT, wms2.getConnectTimeout()); assertEquals(WMSStoreInfoImpl.DEFAULT_READ_TIMEOUT, wms2.getReadTimeout()); assertNotNull(wms2.getWorkspace()); assertEquals("foo", wms2.getWorkspace().getId()); Document dom = dom(in(out)); assertEquals("wmsStore", dom.getDocumentElement().getNodeName()); }
/** * Check maxConnections, connectTimeout, and readTimeout, stored as metadata properties in a * 2.1.3+ configuration are read back as actual properties. */ @Test public void testWMSStoreBackwardsCompatibility() throws Exception { Catalog catalog = new CatalogImpl(); CatalogFactory cFactory = catalog.getFactory(); WorkspaceInfo ws = cFactory.createWorkspace(); ws.setName("foo"); WMSStoreInfo wms1 = cFactory.createWebMapServer(); wms1.setName("bar"); wms1.setWorkspace(ws); wms1.setCapabilitiesURL("http://fake.host/wms?request=GetCapabilities&service=wms"); wms1.getMetadata().put("maxConnections", Integer.valueOf(18)); wms1.getMetadata().put("connectTimeout", Integer.valueOf(25)); wms1.getMetadata().put("readTimeout", Integer.valueOf(78)); ByteArrayOutputStream out = out(); persister.save(wms1, out); WMSStoreInfo wms2 = persister.load(in(out), WMSStoreInfo.class); assertEquals("bar", wms2.getName()); assertEquals(18, wms2.getMaxConnections()); assertEquals(25, wms2.getConnectTimeout()); assertEquals(78, wms2.getReadTimeout()); assertNull(wms2.getMetadata().get("maxConnections")); assertNull(wms2.getMetadata().get("connectTimeout")); assertNull(wms2.getMetadata().get("readTimeout")); }
wms.setName("foo"); wms.setCapabilitiesURL("http://fake.host/wms?request=getCapabilities"); catalog.add(wms);
@Test public void testWMSStoreReferencedByName() throws Exception { Catalog catalog = new CatalogImpl(); CatalogFactory cFactory = catalog.getFactory(); WorkspaceInfo ws = cFactory.createWorkspace(); ws.setName("foo"); WMSStoreInfo wms1 = cFactory.createWebMapServer(); wms1.setName("bar"); wms1.setWorkspace(ws); wms1.setCapabilitiesURL("http://fake.host/wms?request=GetCapabilities&service=wms"); catalog.detach(wms1); ((WMSStoreInfoImpl) wms1).setId(null); ByteArrayOutputStream out = out(); XStreamPersister persister = new XStreamPersisterFactory().createXMLPersister(); persister.setReferenceByName(true); persister.save(wms1, out); WMSStoreInfo wms2 = persister.load(in(out), WMSStoreInfo.class); assertEquals("bar", wms2.getName()); assertEquals(WMSStoreInfoImpl.DEFAULT_MAX_CONNECTIONS, wms2.getMaxConnections()); assertEquals(WMSStoreInfoImpl.DEFAULT_CONNECT_TIMEOUT, wms2.getConnectTimeout()); assertEquals(WMSStoreInfoImpl.DEFAULT_READ_TIMEOUT, wms2.getReadTimeout()); assertNotNull(wms2.getWorkspace()); assertEquals("foo", wms2.getWorkspace().getId()); Document dom = dom(in(out)); assertEquals("wmsStore", dom.getDocumentElement().getNodeName()); }
wms.setName("wmsName"); wms.setType("WMS"); wms.setCapabilitiesURL("http://fake.url");
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()); }
wmsStore.setName("wmsStore-Name"); wmsStore.setWorkspace(workspace); wmsStore.setType("wmsStore-Type");