@Test public void testGlobal() throws Exception { GeoServerInfo global = geoServer.getFactory().createGlobal(); geoServer.setGlobal(global); assertEquals(global, geoServer.getGlobal()); // GEOS-7890 GeoServerInfo global1 = geoServer.getFactory().createGlobal(); GeoServerInfo global2 = geoServer.getFactory().createGlobal(); global1.setGlobalServices(Boolean.valueOf(true)); global1.setXmlExternalEntitiesEnabled(Boolean.valueOf(false)); global1.setVerbose(Boolean.valueOf(false)); global1.setVerboseExceptions(Boolean.valueOf(false)); global2.setGlobalServices(Boolean.valueOf(true)); global2.setXmlExternalEntitiesEnabled(Boolean.valueOf(false)); global2.setVerbose(Boolean.valueOf(false)); global2.setVerboseExceptions(Boolean.valueOf(false)); assertEquals(global1, global2); }
@Test public void testGlobalEvents() throws Exception { TestListener tl = new TestListener(); geoServer.addListener(tl); GeoServerInfo global = geoServer.getFactory().createGlobal(); geoServer.setGlobal(global); global = geoServer.getGlobal(); global.setAdminPassword("foo"); global.setOnlineResource("bar"); assertEquals(0, tl.gPropertyNames.size()); geoServer.save(global); assertEquals(2, tl.gPropertyNames.size()); assertTrue(tl.gPropertyNames.contains("adminPassword")); assertTrue(tl.gPropertyNames.contains("onlineResource")); }
@Test public void testModifyGlobal() throws Exception { GeoServerInfo global = geoServer.getFactory().createGlobal(); geoServer.setGlobal(global); GeoServerInfo g1 = geoServer.getGlobal(); g1.setAdminPassword("newAdminPassword"); GeoServerInfo g2 = geoServer.getGlobal(); assertNull(g2.getAdminPassword()); geoServer.save(g1); g2 = geoServer.getGlobal(); assertEquals("newAdminPassword", g2.getAdminPassword()); }
protected void createConfig() { GeoServerImpl geoServer = new GeoServerImpl(); geoServer.addListener( new GeoServerConfigPersister( new GeoServerResourceLoader(data), createXStreamPersister())); catalog.addListener(new GeoServerResourcePersister(catalog.getResourceLoader())); GeoServerInfo global = geoServer.getFactory().createGlobal(); geoServer.setGlobal(global); addSettings(null, geoServer); LoggingInfo logging = geoServer.getFactory().createLogging(); geoServer.setLogging(logging); }
@Test public void testGetSettings() throws Exception { GeoServerInfo global = geoServer.getFactory().createGlobal(); geoServer.setGlobal(global); SettingsInfo s = geoServer.getSettings(); assertNotNull(s); assertEquals(4, s.getNumDecimals()); WorkspaceInfo ws = geoServer.getCatalog().getFactory().createWorkspace(); ws.setName("acme"); geoServer.getCatalog().add(ws); SettingsInfo t = geoServer.getFactory().createSettings(); t.setNumDecimals(7); t.setWorkspace(ws); geoServer.add(t); assertNotNull(geoServer.getSettings(ws)); assertEquals(7, geoServer.getSettings(ws).getNumDecimals()); assertEquals(4, geoServer.getSettings().getNumDecimals()); LocalWorkspace.set(ws); try { assertNotNull(geoServer.getSettings()); assertEquals(7, geoServer.getSettings().getNumDecimals()); } finally { LocalWorkspace.remove(); } }
@Before public void internalSetUp() throws IOException { this.catalog = getCatalog(); geosConfig = new GeoServerImpl(); geosInfo = new GeoServerInfoImpl(geosConfig); geosInfo.setContact(new ContactInfoImpl()); geosConfig.setGlobal(geosInfo); wmsInfo = new WMSInfoImpl(); geosConfig.add(wmsInfo); geosConfig.setCatalog(catalog); wmsConfig = new WMS(geosConfig); wmsConfig.setApplicationContext(applicationContext); req = new GetCapabilitiesRequest(); req.setBaseUrl(baseUrl); getTestData() .copyTo( getClass().getResourceAsStream("/legendURL/BasicPolygons.png"), LegendSampleImpl.LEGEND_SAMPLES_FOLDER + "/BasicPolygons.png"); getTestData() .copyTo( getClass().getResourceAsStream("/legendURL/Bridges.png"), LegendSampleImpl.LEGEND_SAMPLES_FOLDER + "/Bridges.png"); Map<String, String> namespaces = new HashMap<String, String>(); namespaces.put("xlink", "http://www.w3.org/1999/xlink"); namespaces.put("wms", "http://www.opengis.net/wms"); namespaces.put("ows", "http://www.opengis.net/ows"); XMLUnit.setXpathNamespaceContext(new SimpleNamespaceContext(namespaces)); XPATH = XMLUnit.newXpathEngine(); }
/** * Sets up the configuration objects with default values. Since they're live, specific tests can * modify their state before running the assertions */ @Before public void setUp() throws Exception { geosConfig = new GeoServerImpl(); geosInfo = new GeoServerInfoImpl(geosConfig); geosInfo.setContact(new ContactInfoImpl()); geosConfig.setGlobal(geosInfo); wmsInfo = new WMSInfoImpl(); geosConfig.add(wmsInfo); catalog = new CatalogImpl(); geosConfig.setCatalog(catalog); wmsConfig = new WMS(geosConfig); req = new GetCapabilitiesRequest(); req.setBaseUrl(baseUrl); Map<String, String> namespaces = new HashMap<String, String>(); namespaces.put("xlink", "http://www.w3.org/1999/xlink"); XMLUnit.setXpathNamespaceContext(new SimpleNamespaceContext(namespaces)); XPATH = XMLUnit.newXpathEngine(); }