Search in sources :

Example 1 with RESTFeatureType

use of it.geosolutions.geoserver.rest.decoder.RESTFeatureType in project geo-platform by geosdi.

the class GeoserverConnectorLayersTest method m_getFeatureType.

@Test
public void m_getFeatureType() throws Exception {
    GeoserverLoadWorkspaceLayerRequest geoserverLoadWorkspaceLayerRequest = this.geoserverConnectorStore.loadWorkspaceLayerRequest().withQuietOnNotFound(FALSE).withLayerName("poi").withWorkspaceName("tiger");
    Boolean result = geoserverLoadWorkspaceLayerRequest.exist();
    logger.info("################{}\n", result);
    GeoserverLayer geoserverLayer = geoserverLoadWorkspaceLayerRequest.getResponse();
    logger.info("################{}\n", geoserverLayer);
    GPGeoserverFeatureTypeInfo gpGeoserverFeatureTypeInfo = this.geoserverConnectorStore.loadFeatureTypeWithUrl().withUrl(geoserverLayer.getLayerResource().getHref()).getResponse();
    RESTLayer restLayer = this.restReader.getLayer("tiger", "poi");
    RESTFeatureType featureType = this.restReader.getFeatureType(restLayer);
    assertTrue("#################", gpGeoserverFeatureTypeInfo.getNativeBoundingBox().getMaxx() == featureType.getNativeBoundingBox().getMaxX());
    assertTrue("#################", gpGeoserverFeatureTypeInfo.getNativeBoundingBox().getMaxy() == featureType.getNativeBoundingBox().getMaxY());
    assertTrue("#################", gpGeoserverFeatureTypeInfo.getNativeBoundingBox().getMinx() == featureType.getNativeBoundingBox().getMinX());
    assertTrue("#################", gpGeoserverFeatureTypeInfo.getNativeBoundingBox().getMiny() == featureType.getNativeBoundingBox().getMinY());
    assertTrue("#################", gpGeoserverFeatureTypeInfo.getNativeBoundingBox().getCrs().equals(featureType.getNativeBoundingBox().getCRS()));
    assertTrue("#################", gpGeoserverFeatureTypeInfo.getLatLonBoundingBox().getMaxx() == featureType.getLatLonBoundingBox().getMaxX());
    assertTrue("#################", gpGeoserverFeatureTypeInfo.getLatLonBoundingBox().getMaxy() == featureType.getLatLonBoundingBox().getMaxY());
    assertTrue("#################", gpGeoserverFeatureTypeInfo.getLatLonBoundingBox().getMinx() == featureType.getLatLonBoundingBox().getMinX());
    assertTrue("#################", gpGeoserverFeatureTypeInfo.getLatLonBoundingBox().getMiny() == featureType.getLatLonBoundingBox().getMinY());
    assertTrue("#################", gpGeoserverFeatureTypeInfo.getLatLonBoundingBox().getCrs().equals(featureType.getLatLonBoundingBox().getCRS()));
    assertTrue("#################", gpGeoserverFeatureTypeInfo.getNativeName().equals(featureType.getNativeName()));
    stream(gpGeoserverFeatureTypeInfo.getAttributes().getValues().spliterator(), FALSE).forEach(c -> c.getName());
    stream(featureType.getAttributes().spliterator(), FALSE).forEach(c -> System.out.println(c.getName()));
}
Also used : GeoserverLoadWorkspaceLayerRequest(org.geosdi.geoplatform.connector.geoserver.request.layers.GeoserverLoadWorkspaceLayerRequest) GeoserverLayer(org.geosdi.geoplatform.connector.geoserver.model.layers.GeoserverLayer) IGPGeoserverFeatureTypeInfo(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.IGPGeoserverFeatureTypeInfo) GPGeoserverFeatureTypeInfo(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.GPGeoserverFeatureTypeInfo) RESTLayer(it.geosolutions.geoserver.rest.decoder.RESTLayer) RESTFeatureType(it.geosolutions.geoserver.rest.decoder.RESTFeatureType) GeoserverConnectorTest(org.geosdi.geoplatform.geoserver.GeoserverConnectorTest) Test(org.junit.Test)

Aggregations

RESTFeatureType (it.geosolutions.geoserver.rest.decoder.RESTFeatureType)1 RESTLayer (it.geosolutions.geoserver.rest.decoder.RESTLayer)1 GPGeoserverFeatureTypeInfo (org.geosdi.geoplatform.connector.geoserver.model.featuretypes.GPGeoserverFeatureTypeInfo)1 IGPGeoserverFeatureTypeInfo (org.geosdi.geoplatform.connector.geoserver.model.featuretypes.IGPGeoserverFeatureTypeInfo)1 GeoserverLayer (org.geosdi.geoplatform.connector.geoserver.model.layers.GeoserverLayer)1 GeoserverLoadWorkspaceLayerRequest (org.geosdi.geoplatform.connector.geoserver.request.layers.GeoserverLoadWorkspaceLayerRequest)1 GeoserverConnectorTest (org.geosdi.geoplatform.geoserver.GeoserverConnectorTest)1 Test (org.junit.Test)1