Refine search
if (workspace != null) { ws = catalog.getWorkspaceByName(workspace); old = geoServer.getService(ws, serviceClass); } else { old = geoServer.getService(serviceClass); geoServer.save(old); } else {
@Test public void testReplaceOnTransactionalLevel() throws Exception { GeoServer gs = getGeoServer(); WFSInfo wfs = gs.getService(WFSInfo.class); wfs.setServiceLevel(WFSInfo.ServiceLevel.TRANSACTIONAL); gs.save(wfs); try { testReplace(); } finally { wfs.setServiceLevel(WFSInfo.ServiceLevel.COMPLETE); gs.save(wfs); } }
@Test public void testEnabledServiceResponse() throws Exception { WCSInfo wcs = getGeoServer().getService(WCSInfo.class); wcs.setEnabled(true); getGeoServer().save(wcs); Document doc = getAsDOM("wcs?service=WCS&request=getCapabilities"); assertEquals("wcs:Capabilities", doc.getDocumentElement().getNodeName()); } }
@Test public void testModifyGlobal() throws Exception { GeoServerInfo global = getGeoServer().getGlobal(); global.setAdminUsername("roadRunner"); global.setTitle("ACME"); getGeoServer().save(global); File f = new File(testData.getDataDirectoryRoot(), "global.xml"); Document dom = dom(f); assertXpathEvaluatesTo("roadRunner", "/global/adminUsername", dom); assertXpathEvaluatesTo("ACME", "/global/settings/title", dom); }
/** * Before using {@code gwc-gs.xml} to hold the integrated GWC configuration, the only property * configured was whether the direct WMS integration option was enabled, and it was saved as * part of the {@link WMSInfo} metadata map under the {@code GWC_WMS_Integration} key. This * method removes that key from WMSInfo if present and sets its value to the {@code gwcConfig} * instead. */ private void upgradeWMSIntegrationConfig(final GeoServer geoServer, final GWCConfig gwcConfig) throws IOException { // Check whether we're using the old way of storing this information, and get rid of it WMSInfo service = geoServer.getService(WMSInfo.class); if (service != null) { MetadataMap metadata = service.getMetadata(); if (service != null && metadata != null) { Boolean storedValue = metadata.get(WMS_INTEGRATION_ENABLED_KEY, Boolean.class); if (storedValue != null) { boolean enabled = storedValue.booleanValue(); gwcConfig.setDirectWMSIntegrationEnabled(enabled); metadata.remove(WMS_INTEGRATION_ENABLED_KEY); geoServer.save(service); } } } }
@Test public void testEnabledServiceResponse() throws Exception { WMSInfo wms = getGeoServer().getService(WMSInfo.class); wms.setEnabled(true); getGeoServer().save(wms); Document doc = getAsDOM("wms?service=WMS&version=1.1.1&request=getCapabilities"); assertEquals("WMT_MS_Capabilities", doc.getDocumentElement().getNodeName()); } }
@Test public void testConfigureFeatureTypeCacheSize() { GeoServer gs = getGeoServer(); GeoServerInfo global = gs.getGlobal(); global.setFeatureTypeCacheSize(200); gs.save(global); Catalog catalog = getCatalog(); // we actually keep two versions of the feature type in the cache, so we need it // twice as big assertEquals( 400, ((SoftValueHashMap) catalog.getResourcePool().getFeatureTypeCache()) .getHardReferencesCount()); }
public void serviceSettingsPut(ServiceInfo info, String workspaceName) { WorkspaceInfo ws = null; if (workspaceName != null) ws = geoServer.getCatalog().getWorkspaceByName(workspaceName); ServiceInfo originalInfo; if (ws != null) { originalInfo = geoServer.getService(ws, clazz); } else { originalInfo = geoServer.getService(clazz); } if (originalInfo != null) { OwsUtils.copy(info, originalInfo, clazz); geoServer.save(originalInfo); } else { if (ws != null) { info.setWorkspace(ws); } geoServer.add(info); } }
@Test public void testEnabledServiceResponse() throws Exception { WFSInfo wfs = getGeoServer().getService(WFSInfo.class); wfs.setEnabled(true); getGeoServer().save(wfs); Document doc = getAsDOM("wfs?service=WFS&version=1.1.0&request=getCapabilities"); assertEquals("wfs:WFS_Capabilities", doc.getDocumentElement().getNodeName()); } }
@Test public void testServiceUpdates() { GeoServerInfo global = getGeoServer().getGlobal(); long updateSequence = global.getUpdateSequence(); // change a flag in the config global.setVerbose(true); getGeoServer().save(global); long newUpdateSequence = getGeoServer().getGlobal().getUpdateSequence(); assertTrue(newUpdateSequence > updateSequence); } }
private void setupESRIFormatByDefault(GeoServer geoServer, Boolean value) throws IOException { WFSInfo wfsInfo = geoServer.getService(WFSInfo.class); MetadataMap metadata = wfsInfo.getMetadata(); metadata.put(ShapeZipOutputFormat.SHAPE_ZIP_DEFAULT_PRJ_IS_ESRI, value); geoServer.save(wfsInfo); }
@Test public void testDisabledServiceResponse() throws Exception { WCSInfo wcs = getGeoServer().getService(WCSInfo.class); wcs.setEnabled(false); getGeoServer().save(wcs); Document doc = getAsDOM("wcs?service=WCS&request=getCapabilities"); assertEquals("ows:ExceptionReport", doc.getDocumentElement().getNodeName()); }
@Test public void testModifySettings() throws Exception { testAddSettings(); WorkspaceInfo ws = catalog.getWorkspaceByName("acme"); SettingsInfo settings = getGeoServer().getSettings(ws); settings.setTitle("FOO"); getGeoServer().save(settings); File f = catalog.getResourceLoader().find("workspaces", ws.getName(), "settings.xml"); assertNotNull(f); Document dom = dom(f); assertXpathEvaluatesTo("FOO", "/settings/title", dom); }
protected void setOutputLimit(int kbytes) { GeoServer gs = getGeoServer(); WCSInfo info = gs.getService(WCSInfo.class); info.setMaxOutputMemory(kbytes); gs.save(info); }
@Test public void testDisabledServiceResponse() throws Exception { Logging.getLogger("org.geoserver.ows").setLevel(Level.OFF); WMSInfo wms = getGeoServer().getService(WMSInfo.class); wms.setEnabled(false); getGeoServer().save(wms); Document doc = getAsDOM("wms?service=WMS&version=1.1.1&request=getCapabilities"); assertEquals("ows:ExceptionReport", doc.getDocumentElement().getNodeName()); }
@Test public void testModifySettingsChangeWorkspace() throws Exception { testAddSettings(); WorkspaceInfo ws1 = catalog.getWorkspaceByName("acme"); WorkspaceInfo ws2 = catalog.getFactory().createWorkspace(); ws2.setName("foo"); catalog.add(ws2); SettingsInfo settings = getGeoServer().getSettings(ws1); settings.setWorkspace(ws2); getGeoServer().save(settings); File f = catalog.getResourceLoader().find("workspaces", ws1.getName(), "settings.xml"); assertNull(f); f = catalog.getResourceLoader().find("workspaces", ws2.getName(), "settings.xml"); assertNotNull(f); Document dom = dom(f); assertXpathEvaluatesTo(ws2.getId(), "/settings/workspace/id", dom); }
protected void setInputLimit(int kbytes) { GeoServer gs = getGeoServer(); WCSInfo info = gs.getService(WCSInfo.class); info.setMaxInputMemory(kbytes); gs.save(info); }
@Test public void testDisabledServiceResponse() throws Exception { WFSInfo wfs = getGeoServer().getService(WFSInfo.class); wfs.setEnabled(false); getGeoServer().save(wfs); Document doc = getAsDOM("wfs?service=WFS&version=1.0.0&request=getCapabilities"); assertEquals("ows:ExceptionReport", doc.getDocumentElement().getNodeName()); }
@Test public void testGetFeatureReproject11() throws Exception { WFSInfo wfs = getWFS(); wfs.setFeatureBounding(true); getGeoServer().save(wfs); Document doc = getAsDOM( "wfs?request=GetFeature&typename=cite:Geometryless&version=1.1.0&service=wfs&srsName=EPSG:900913"); assertEquals("wfs:FeatureCollection", doc.getDocumentElement().getNodeName()); NodeList featureMembers = doc.getElementsByTagName("gml:featureMembers"); assertFalse(featureMembers.getLength() == 0); NodeList features = doc.getElementsByTagName("cite:Geometryless"); assertEquals(3, features.getLength()); }