protected GeoServerImpl createGeoServer() { GeoServerImpl gs = new GeoServerImpl(); gs.setCatalog(new CatalogImpl()); return gs; }
@Before public void setUp() throws Exception { gs = new GeoServerImpl(); importer = new LegacyLoggingImporter(); importer.imprt(URLs.urlToFile(getClass().getResource("services.xml")).getParentFile()); }
@Before public void setUp() throws Exception { GeoServer gs = new GeoServerImpl(); gs.setFactory(new GeoServerFactoryImpl(gs)); importer = new LegacyConfigurationImporter(gs); importer.imprt(URLs.urlToFile(getClass().getResource("services.xml")).getParentFile()); }
@Before public void init() { factory = new GeoServerImpl().getFactory(); persister = new XStreamPersisterFactory().createXMLPersister(); }
@Test public void testLoadWithoutResaving() throws Exception { GeoServerImpl gs = new GeoServerImpl(); gs.setCatalog(catalog); // this one already calls onto loadService loader.postProcessBeforeInitialization(gs, "geoServer"); // for extra measure, also do a reload loader.reload(); assertFalse("hello.xml should not have been saved during load", helloServiceSaved); } }
@Test public void testServiceOmitGlobal() throws Exception { MyServiceInfo s1 = new MyServiceInfo(); s1.setGeoServer(new GeoServerImpl()); ByteArrayOutputStream out = out(); persister.save(s1, out); MyServiceInfo s2 = persister.load(in(out), MyServiceInfo.class); assertNull(s2.getGeoServer()); }
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); }
protected void setUp() throws Exception { geoServerImpl = new GeoServerImpl(); List<String> operations = new ArrayList<String>(); csw = new Service("csw", new DefaultWebCatalogService(geoServerImpl), new Version("2.0.2"), operations); params = new HashMap<String, String>(); }
@Before public void setUp() throws Exception { geoServerImpl = new GeoServerImpl(); geoServerImpl.add(new WMSInfoImpl()); wms = new WMS(geoServerImpl); params = new HashMap<String, String>(); }
@Before public void setUp() throws Exception { // check if we can run the tests Assume.assumeTrue(GdalTestUtil.isGdalAvailable()); // the coverage response delegate gdalCovRespDelegate = new GdalCoverageResponseDelegate(new GeoServerImpl(), new GdalWrapperFactory()); // add default formats for (Format format : GdalConfigurator.DEFAULT.getFormats()) { gdalCovRespDelegate.addFormat(format); } gdalCovRespDelegate.setExecutable(GdalTestUtil.getGdalTranslate()); gdalCovRespDelegate.setEnvironment(GdalTestUtil.getGdalData()); }
@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(); }
@Override protected void setUp() throws Exception { // the data source we'll use for the tests dataStore = new PropertyDataStore(new File("./src/test/java/org/geoserver/wfs/response")); // the output format (and let's add a few output formats to play with ogr = new Ogr2OgrOutputFormat(new GeoServerImpl()); ogr.addFormat(new OgrFormat("KML", "OGR-KML", ".kml", true, "application/vnd.google-earth.kml")); ogr.addFormat(new OgrFormat("KML", "OGR-KML-ZIP", ".kml", false, "application/vnd.google-earth.kml")); ogr.addFormat(new OgrFormat("CSV", "OGR-CSV", ".csv", true, "text/csv")); ogr.addFormat(new OgrFormat("SHP", "OGR-SHP", ".shp", false, null)); ogr.addFormat(new OgrFormat("MapInfo File", "OGR-MIF", ".mif", false, null, "-dsco", "FORMAT=MIF")); ogr.setOgrExecutable(Ogr2OgrTestUtil.getOgr2Ogr()); ogr.setGdalData(Ogr2OgrTestUtil.getGdalData()); // the EMF objects used to talk with the output format gft = WfsFactory.eINSTANCE.createGetFeatureType(); fct = WfsFactory.eINSTANCE.createFeatureCollectionType(); op = new Operation("GetFeature", new Service("WFS", null, new Version("1.0.0"), Arrays.asList("GetFeature")), null, new Object[] { gft }); }
@Test public void testGetProxyBaseURL() { SettingsInfo settings = new SettingsInfoImpl(); settings.setProxyBaseUrl("https://foo.com/geoserver"); GeoServerInfo info = new GeoServerInfoImpl(); info.setSettings(settings); GeoServer gs = new GeoServerImpl(); gs.setGlobal(info); TestWfsPost servlet = new TestWfsPost() { @Override protected GeoServer getGeoServer() { return gs; } }; assertEquals("https://foo.com/geoserver", servlet.getProxyBaseURL()); }
/** * 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(); }
@Before public void setUp() throws Exception { // check if we can run the tests Assume.assumeTrue(Ogr2OgrTestUtil.isOgrAvailable()); // the data source we'll use for the tests dataStore = new PropertyDataStore(new File("./src/test/java/org/geoserver/wfs/response")); // the output format (and let's add a few output formats to play with ogr = new Ogr2OgrOutputFormat(new GeoServerImpl(), new OGRWrapperFactory()); ogr.addFormat( new OgrFormat("KML", "OGR-KML", ".kml", true, "application/vnd.google-earth.kml")); ogr.addFormat( new OgrFormat( "KML", "OGR-KML-ZIP", ".kml", false, "application/vnd.google-earth.kml")); ogr.addFormat(new OgrFormat("CSV", "OGR-CSV", ".csv", true, "text/csv")); ogr.addFormat(new OgrFormat("SHP", "OGR-SHP", ".shp", false, null)); ogr.addFormat( new OgrFormat( "MapInfo File", "OGR-MIF", ".mif", false, null, "-dsco", "FORMAT=MIF")); ogr.setExecutable(Ogr2OgrTestUtil.getOgr2Ogr()); ogr.setEnvironment(Collections.singletonMap("GDAL_DATA", Ogr2OgrTestUtil.getGdalData())); // the EMF objects used to talk with the output format gft = WfsFactory.eINSTANCE.createGetFeatureType(); fct = WfsFactory.eINSTANCE.createFeatureCollectionType(); op = new Operation( "GetFeature", new Service("WFS", null, new Version("1.0.0"), Arrays.asList("GetFeature")), null, new Object[] {gft}); }
catalog.setResourcePool(resourcePool); mockGeoServer = new GeoServerImpl(); mockGeoServer.setCatalog(catalog);
GeoServerImpl geoServerImpl = new GeoServerImpl(); catalog = new CatalogImpl(); geoServerImpl.setCatalog(catalog);