private void assertGMLTimestamp(String timeStamp) throws Exception { assertNotNull(timeStamp); Calendar cal = new XmlConverterFactory() .createConverter(String.class, Calendar.class, null).convert(timeStamp, Calendar.class); assertNotNull(cal); assertEquals(TimeZone.getTimeZone("GMT"), cal.getTimeZone()); }
private void assertReturnedCapabilitiesComplete(GetCapabilitiesType caps) { assertNotNull(caps); EList versions = caps.getAcceptVersions().getVersion(); assertEquals(3, versions.size()); assertEquals("2.0.2", versions.get(0)); assertEquals("2.0.0", versions.get(1)); assertEquals("0.7.2", versions.get(2)); EList sections = caps.getSections().getSection(); assertEquals(2, sections.size()); assertEquals("OperationsMetadata", sections.get(0)); assertEquals("foo", sections.get(1)); EList outputFormats = caps.getAcceptFormats().getOutputFormat(); assertEquals(2, outputFormats.size()); assertEquals("application/xml", outputFormats.get(0)); assertEquals("text/plain", outputFormats.get(1)); }
@Test public void testPostAsXMLInlineStore() throws Exception { Document dom = getAsDOM("wfs?request=getfeature&typename=sf:pdsa"); assertEquals("ows:ExceptionReport", dom.getDocumentElement().getNodeName()); addPropertyDataStore(false); String xml = "<featureType>" + "<name>pdsa</name>" + "<nativeName>pdsa</nativeName>" + "<srs>EPSG:4326</srs>" + "<nativeCRS>EPSG:4326</nativeCRS>" + "<nativeBoundingBox>" + "<minx>0.0</minx>" + "<maxx>1.0</maxx>" + "<miny>0.0</miny>" + "<maxy>1.0</maxy>" + "<crs>EPSG:4326</crs>" + "</nativeBoundingBox>" + "<store>pds</store>" + "</featureType>"; MockHttpServletResponse response = postAsServletResponse(BASEPATH + "/workspaces/gs/featuretypes/", xml, "text/xml"); assertEquals(201, response.getStatus()); assertNotNull(response.getHeader("Location")); assertTrue(response.getHeader("Location").endsWith("/workspaces/gs/featuretypes/pdsa")); dom = getAsDOM("wfs?request=getfeature&typename=gs:pdsa"); assertEquals("wfs:FeatureCollection", dom.getDocumentElement().getNodeName()); assertEquals(2, dom.getElementsByTagName("gs:pdsa").getLength()); }
@Test public void testPostGeometrylessFeatureType() throws Exception { addGeomlessPropertyDataStore(false); String xml = "<featureType>" + "<name>ngpdsa</name>" + "</featureType>"; MockHttpServletResponse response = postAsServletResponse( BASEPATH + "/workspaces/gs/datastores/ngpds/featuretypes", xml, "text/xml"); assertEquals(201, response.getStatus()); assertNotNull(response.getHeader("Location")); assertTrue( response.getHeader("Location") .endsWith("/workspaces/gs/datastores/ngpds/featuretypes/ngpdsa")); }
assertNotNull(response.getHeader("Location")); assertTrue( response.getHeader("Location")
@Test public void testGetAsJSON() throws Exception { JSON json = getAsJSON(BASEPATH + "/workspaces/sf/featuretypes/PrimitiveGeoFeature.json"); JSONObject featureType = ((JSONObject) json).getJSONObject("featureType"); assertNotNull(featureType); assertEquals("PrimitiveGeoFeature", featureType.get("name")); assertEquals(CRS.decode("EPSG:4326").toWKT(), featureType.get("nativeCRS")); assertEquals("EPSG:4326", featureType.get("srs")); }
assertNotNull(response.getHeader("Location")); assertTrue( response.getHeader("Location")
assertEquals("application/xml", gr.getOutputFormat()); assertEquals("http://www.opengis.net/cat/csw/2.0.2", gr.getOutputSchema()); assertNotNull(gr.getDistributedSearch()); assertEquals(new Integer(10), gr.getDistributedSearch().getHopCount()); assertEquals("http://www.geoserver.org", gr.getResponseHandler());
@Test public void testDeleteRecursive() throws Exception { assertNotNull(catalog.getFeatureTypeByName("sf", "PrimitiveGeoFeature")); assertNotNull(catalog.getLayerByName("sf:PrimitiveGeoFeature")); assertEquals( 403, deleteAsServletResponse( BASEPATH + "/workspaces/sf/datastores/sf/featuretypes/PrimitiveGeoFeature") .getStatus()); assertEquals( 200, deleteAsServletResponse( BASEPATH + "/workspaces/sf/datastores/sf/featuretypes/PrimitiveGeoFeature?recurse=true") .getStatus()); assertNull(catalog.getFeatureTypeByName("sf", "PrimitiveGeoFeature")); assertNull(catalog.getLayerByName("sf:PrimitiveGeoFeature")); }
@Test public void testDeleteWithoutStore() throws Exception { FeatureTypeInfo featureType = catalog.getFeatureTypeByName("sf", "PrimitiveGeoFeature"); String featureTypeId = featureType.getId(); String dataStoreId = featureType.getStore().getId(); Name name = featureType.getFeatureType().getName(); assertNotNull("PrmitiveGeoFeature available", featureType); for (LayerInfo l : catalog.getLayers(featureType)) { catalog.remove(l); } assertEquals( 200, deleteAsServletResponse( BASEPATH + "/workspaces/sf/featuretypes/PrimitiveGeoFeature") .getStatus()); assertNull(catalog.getFeatureTypeByName("sf", "PrimitiveGeoFeature")); if (catalog.getResourcePool().getFeatureTypeAttributeCache().containsKey(featureTypeId)) { List<AttributeTypeInfo> attributesList = catalog.getResourcePool().getFeatureTypeAttributeCache().get(featureTypeId); assertNull("attributes cleared", attributesList); } if (catalog.getResourcePool().getDataStoreCache().containsKey(dataStoreId)) { DataAccess dataStore = catalog.getResourcePool().getDataStoreCache().get(dataStoreId); List<Name> names = dataStore.getNames(); assertTrue(names.contains(name)); } }
"text/xml"); assertEquals(201, response.getStatus()); assertNotNull(response.getHeader("Location")); assertTrue( response.getHeader("Location") assertNotNull(ft); FeatureType schema = ft.getFeatureType(); assertEquals("states", schema.getName().getLocalPart()); catalog.getNamespaceByPrefix("cite").getURI(), schema.getName().getNamespaceURI()); assertEquals(3, schema.getDescriptors().size()); assertNotNull(schema.getDescriptor("the_geom")); assertEquals(MultiPolygon.class, schema.getDescriptor("the_geom").getType().getBinding()); assertNotNull(schema.getDescriptor("LAND_KM")); assertEquals(Double.class, schema.getDescriptor("LAND_KM").getType().getBinding());
@Test public void testDelete() throws Exception { FeatureTypeInfo featureType = catalog.getFeatureTypeByName("sf", "PrimitiveGeoFeature"); String featureTypeId = featureType.getId(); String dataStoreId = featureType.getStore().getId(); Name name = featureType.getFeatureType().getName(); assertNotNull("PrmitiveGeoFeature available", featureType); for (LayerInfo l : catalog.getLayers(featureType)) { catalog.remove(l); } assertEquals( 200, deleteAsServletResponse( BASEPATH + "/workspaces/sf/datastores/sf/featuretypes/PrimitiveGeoFeature") .getStatus()); assertNull(catalog.getFeatureTypeByName("sf", "PrimitiveGeoFeature")); if (catalog.getResourcePool().getFeatureTypeAttributeCache().containsKey(featureTypeId)) { List<AttributeTypeInfo> attributesList = catalog.getResourcePool().getFeatureTypeAttributeCache().get(featureTypeId); assertNull("attributes cleared", attributesList); } if (catalog.getResourcePool().getDataStoreCache().containsKey(dataStoreId)) { DataAccess dataStore = catalog.getResourcePool().getDataStoreCache().get(dataStoreId); List<Name> names = dataStore.getNames(); assertTrue(names.contains(name)); } }