Search in sources :

Example 1 with GeoserverLayer

use of org.geosdi.geoplatform.connector.geoserver.model.layers.GeoserverLayer in project geo-platform by geosdi.

the class GeoserverConnectorLayersTest method f_existLayerInWorkspace.

@Test
public void f_existLayerInWorkspace() throws Exception {
    GeoserverLoadWorkspaceLayerRequest geoserverLoadWorkspaceLayerRequest = this.geoserverConnectorStore.loadWorkspaceLayerRequest().withQuietOnNotFound(FALSE).withLayerName("sfdem").withWorkspaceName("sf");
    Boolean result = geoserverLoadWorkspaceLayerRequest.exist();
    logger.info("################{}\n", result);
    GeoserverLayer geoserverLayer = geoserverLoadWorkspaceLayerRequest.getResponse();
    logger.info("################{}\n", geoserverLayer);
    assertTrue("####################", geoserverLayer.getLayerType() == GeoserverLayerType.Raster);
    assertTrue("####################", this.restReader.existsLayer("tiger", "poi", FALSE) == result);
    assertTrue("####################", this.restReader.existsLayer("tigerr", "poi", FALSE) == this.geoserverConnectorStore.loadWorkspaceLayerRequest().withQuietOnNotFound(FALSE).withLayerName("poi").withWorkspaceName("tigerr").exist());
}
Also used : GeoserverLoadWorkspaceLayerRequest(org.geosdi.geoplatform.connector.geoserver.request.layers.GeoserverLoadWorkspaceLayerRequest) GeoserverLayer(org.geosdi.geoplatform.connector.geoserver.model.layers.GeoserverLayer) GeoserverConnectorTest(org.geosdi.geoplatform.geoserver.GeoserverConnectorTest) Test(org.junit.Test)

Example 2 with GeoserverLayer

use of org.geosdi.geoplatform.connector.geoserver.model.layers.GeoserverLayer 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)

Example 3 with GeoserverLayer

use of org.geosdi.geoplatform.connector.geoserver.model.layers.GeoserverLayer in project geo-platform by geosdi.

the class GeoserverConnectorLayersTest method d_getLayerWithWorkspace.

@Test
public void d_getLayerWithWorkspace() throws Exception {
    RESTLayer restLayer = this.restReader.getLayer("nurc", "mosaic");
    GeoserverLoadWorkspaceLayerRequest geoserverLoadLayerRequest = this.geoserverConnectorStore.loadWorkspaceLayerRequest().withLayerName("mosaic").withWorkspaceName("nurc");
    GeoserverLayer geoserverLayer = geoserverLoadLayerRequest.getResponse();
    logger.info("##########################RESOURCE_URL_REST_READER {}\n", restLayer.getResourceUrl());
    logger.info("##########################RESOURCE_URL_GEOSERVER_CONNECTOR {}\n", geoserverLayer.getLayerResource().getHref());
    logger.info("#######################GEOSERVER_LAYER: {}\n", geoserverLayer);
    logger.info("#######################REST_READER_DEFAULT_STYLE: {}\n", restLayer.getDefaultStyle());
    assertTrue("###################STYLE NAME:", restLayer.getDefaultStyle().equals(geoserverLayer.getDefaultStyle().getName()));
}
Also used : GeoserverLoadWorkspaceLayerRequest(org.geosdi.geoplatform.connector.geoserver.request.layers.GeoserverLoadWorkspaceLayerRequest) GeoserverLayer(org.geosdi.geoplatform.connector.geoserver.model.layers.GeoserverLayer) RESTLayer(it.geosolutions.geoserver.rest.decoder.RESTLayer) GeoserverConnectorTest(org.geosdi.geoplatform.geoserver.GeoserverConnectorTest) Test(org.junit.Test)

Example 4 with GeoserverLayer

use of org.geosdi.geoplatform.connector.geoserver.model.layers.GeoserverLayer in project geo-platform by geosdi.

the class GeoserverConnectorLayersTest method b_getLayer.

@Test
public void b_getLayer() throws Exception {
    RESTLayer restLayer = this.restReader.getLayer("poi");
    GeoserverLoadLayerRequest geoserverLoadLayerRequest = this.geoserverConnectorStore.loadLayerRequest().withName("poi");
    GeoserverLayer geoserverLayer = geoserverLoadLayerRequest.getResponse();
    logger.info("##########################RESOURCE_URL_REST_READER {}\n", restLayer.getResourceUrl());
    logger.info("##########################RESOURCE_URL_GEOSERVER_CONNECTOR {}\n", geoserverLayer.getLayerResource().getHref());
    logger.info("#######################GEOSERVER_LAYER: {}\n", geoserverLayer);
    List<String> styleNames = geoserverLoadLayerRequest.getResponse().getLayerStyle().getStyles().stream().map(s -> s.getName()).collect(Collectors.toList());
    assertTrue("###################STYLES_LENGTH", styleNames.size() == restLayer.getStyles().getNames().size());
    if (restLayer.getStyles() != null) {
        for (String styleName : restLayer.getStyles().getNames()) {
            logger.info("#######################STYLE_NAME: {}\n", styleName);
            assertTrue("###################STYLE NAME:", styleNames.contains(styleName));
        }
    }
}
Also used : GeoserverLayerType(org.geosdi.geoplatform.connector.geoserver.model.layers.GeoserverLayerType) GPGeoserverFeatureTypeCategory(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.category.GPGeoserverFeatureTypeCategory) LoggerFactory(org.slf4j.LoggerFactory) GPGeoserverCoverageInfo(org.geosdi.geoplatform.connector.geoserver.model.workspace.coverages.GPGeoserverCoverageInfo) IGPGeoserverStyle(org.geosdi.geoplatform.connector.geoserver.model.styles.IGPGeoserverStyle) RESTFeatureType(it.geosolutions.geoserver.rest.decoder.RESTFeatureType) Lists(com.google.common.collect.Lists) IGPGeoserverFeatureTypeInfo(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.IGPGeoserverFeatureTypeInfo) GPGeoserverFeatureTypeInfo(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.GPGeoserverFeatureTypeInfo) GPGeoserverLatLonBoundingBox(org.geosdi.geoplatform.connector.geoserver.model.bbox.GPGeoserverLatLonBoundingBox) Arrays.asList(java.util.Arrays.asList) GeoserverLoadWorkspaceLayerRequest(org.geosdi.geoplatform.connector.geoserver.request.layers.GeoserverLoadWorkspaceLayerRequest) GeoserverConnectorTest(org.geosdi.geoplatform.geoserver.GeoserverConnectorTest) RESTCoverage(it.geosolutions.geoserver.rest.decoder.RESTCoverage) GeoserverLoadLayerRequest(org.geosdi.geoplatform.connector.geoserver.request.layers.GeoserverLoadLayerRequest) FALSE(java.lang.Boolean.FALSE) GeoserverLayerStyle(org.geosdi.geoplatform.connector.geoserver.model.layers.GeoserverLayerStyle) Logger(org.slf4j.Logger) GPFeatureTypeAttributes(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.attribute.GPFeatureTypeAttributes) GPGeoserverNativeBoundingBox(org.geosdi.geoplatform.connector.geoserver.model.bbox.GPGeoserverNativeBoundingBox) GPFeatureTypeAttribute(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.attribute.GPFeatureTypeAttribute) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) GPGeoserverFeatureTypes(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.configured.GPGeoserverFeatureTypes) GeoserverLoadFeatureTypeWithUrlRequest(org.geosdi.geoplatform.connector.geoserver.request.featuretypes.GeoserverLoadFeatureTypeWithUrlRequest) RESTLayer(it.geosolutions.geoserver.rest.decoder.RESTLayer) Collectors(java.util.stream.Collectors) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) Ignore(org.junit.Ignore) StreamSupport.stream(java.util.stream.StreamSupport.stream) GeoserverCreateFeatureTypeRequest(org.geosdi.geoplatform.connector.geoserver.request.featuretypes.GeoserverCreateFeatureTypeRequest) GPGeoserverStyle(org.geosdi.geoplatform.connector.geoserver.model.styles.GPGeoserverStyle) IGPFeatureTypeAttributes(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.attribute.IGPFeatureTypeAttributes) GeoserverLayer(org.geosdi.geoplatform.connector.geoserver.model.layers.GeoserverLayer) IGPFeatureTypeAttribute(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.attribute.IGPFeatureTypeAttribute) Assert(org.junit.Assert) TRUE(java.lang.Boolean.TRUE) GeoserverLayer(org.geosdi.geoplatform.connector.geoserver.model.layers.GeoserverLayer) GeoserverLoadLayerRequest(org.geosdi.geoplatform.connector.geoserver.request.layers.GeoserverLoadLayerRequest) RESTLayer(it.geosolutions.geoserver.rest.decoder.RESTLayer) GeoserverConnectorTest(org.geosdi.geoplatform.geoserver.GeoserverConnectorTest) Test(org.junit.Test)

Example 5 with GeoserverLayer

use of org.geosdi.geoplatform.connector.geoserver.model.layers.GeoserverLayer in project geo-platform by geosdi.

the class GeoserverConnectorLayersTest method c_getLayerWithWorkspace.

@Test
public void c_getLayerWithWorkspace() throws Exception {
    RESTLayer restLayer = this.restReader.getLayer("tiger", "poi");
    GeoserverLoadWorkspaceLayerRequest geoserverLoadLayerRequest = this.geoserverConnectorStore.loadWorkspaceLayerRequest().withLayerName("poi").withWorkspaceName("tiger");
    GeoserverLayer geoserverLayer = geoserverLoadLayerRequest.getResponse();
    logger.info("##########################STYLES_REST_READER {}\n", restLayer.getStyles().getNames());
    logger.info("#######################GEOSERVER_LAYER: {}\n", geoserverLayer);
    List<String> styleNames = geoserverLoadLayerRequest.getResponse().getLayerStyle().getStyles().stream().map(s -> s.getName()).collect(Collectors.toList());
    logger.info("#######################GEOSERVER_STYLE_NAMES: {}\n", styleNames);
    assertTrue("###################STYLES_LENGTH", styleNames.size() == restLayer.getStyles().getNames().size());
    if (restLayer.getStyles() != null) {
        for (String styleName : restLayer.getStyles().getNames()) {
            logger.info("#######################STYLE_NAME: {}\n", styleName);
            assertTrue("###################STYLE NAME:", styleNames.contains(styleName));
        }
    }
}
Also used : GeoserverLayerType(org.geosdi.geoplatform.connector.geoserver.model.layers.GeoserverLayerType) GPGeoserverFeatureTypeCategory(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.category.GPGeoserverFeatureTypeCategory) LoggerFactory(org.slf4j.LoggerFactory) GPGeoserverCoverageInfo(org.geosdi.geoplatform.connector.geoserver.model.workspace.coverages.GPGeoserverCoverageInfo) IGPGeoserverStyle(org.geosdi.geoplatform.connector.geoserver.model.styles.IGPGeoserverStyle) RESTFeatureType(it.geosolutions.geoserver.rest.decoder.RESTFeatureType) Lists(com.google.common.collect.Lists) IGPGeoserverFeatureTypeInfo(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.IGPGeoserverFeatureTypeInfo) GPGeoserverFeatureTypeInfo(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.GPGeoserverFeatureTypeInfo) GPGeoserverLatLonBoundingBox(org.geosdi.geoplatform.connector.geoserver.model.bbox.GPGeoserverLatLonBoundingBox) Arrays.asList(java.util.Arrays.asList) GeoserverLoadWorkspaceLayerRequest(org.geosdi.geoplatform.connector.geoserver.request.layers.GeoserverLoadWorkspaceLayerRequest) GeoserverConnectorTest(org.geosdi.geoplatform.geoserver.GeoserverConnectorTest) RESTCoverage(it.geosolutions.geoserver.rest.decoder.RESTCoverage) GeoserverLoadLayerRequest(org.geosdi.geoplatform.connector.geoserver.request.layers.GeoserverLoadLayerRequest) FALSE(java.lang.Boolean.FALSE) GeoserverLayerStyle(org.geosdi.geoplatform.connector.geoserver.model.layers.GeoserverLayerStyle) Logger(org.slf4j.Logger) GPFeatureTypeAttributes(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.attribute.GPFeatureTypeAttributes) GPGeoserverNativeBoundingBox(org.geosdi.geoplatform.connector.geoserver.model.bbox.GPGeoserverNativeBoundingBox) GPFeatureTypeAttribute(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.attribute.GPFeatureTypeAttribute) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) GPGeoserverFeatureTypes(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.configured.GPGeoserverFeatureTypes) GeoserverLoadFeatureTypeWithUrlRequest(org.geosdi.geoplatform.connector.geoserver.request.featuretypes.GeoserverLoadFeatureTypeWithUrlRequest) RESTLayer(it.geosolutions.geoserver.rest.decoder.RESTLayer) Collectors(java.util.stream.Collectors) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) Ignore(org.junit.Ignore) StreamSupport.stream(java.util.stream.StreamSupport.stream) GeoserverCreateFeatureTypeRequest(org.geosdi.geoplatform.connector.geoserver.request.featuretypes.GeoserverCreateFeatureTypeRequest) GPGeoserverStyle(org.geosdi.geoplatform.connector.geoserver.model.styles.GPGeoserverStyle) IGPFeatureTypeAttributes(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.attribute.IGPFeatureTypeAttributes) GeoserverLayer(org.geosdi.geoplatform.connector.geoserver.model.layers.GeoserverLayer) IGPFeatureTypeAttribute(org.geosdi.geoplatform.connector.geoserver.model.featuretypes.attribute.IGPFeatureTypeAttribute) Assert(org.junit.Assert) TRUE(java.lang.Boolean.TRUE) GeoserverLoadWorkspaceLayerRequest(org.geosdi.geoplatform.connector.geoserver.request.layers.GeoserverLoadWorkspaceLayerRequest) GeoserverLayer(org.geosdi.geoplatform.connector.geoserver.model.layers.GeoserverLayer) RESTLayer(it.geosolutions.geoserver.rest.decoder.RESTLayer) GeoserverConnectorTest(org.geosdi.geoplatform.geoserver.GeoserverConnectorTest) Test(org.junit.Test)

Aggregations

GeoserverLayer (org.geosdi.geoplatform.connector.geoserver.model.layers.GeoserverLayer)14 GeoserverLoadWorkspaceLayerRequest (org.geosdi.geoplatform.connector.geoserver.request.layers.GeoserverLoadWorkspaceLayerRequest)7 GeoserverConnectorTest (org.geosdi.geoplatform.geoserver.GeoserverConnectorTest)7 Test (org.junit.Test)7 FileNotFoundException (java.io.FileNotFoundException)6 IOException (java.io.IOException)6 GPGeoserverFeatureTypeInfo (org.geosdi.geoplatform.connector.geoserver.model.featuretypes.GPGeoserverFeatureTypeInfo)6 DataSourceException (org.geotools.data.DataSourceException)6 FactoryException (org.opengis.referencing.FactoryException)6 RESTLayer (it.geosolutions.geoserver.rest.decoder.RESTLayer)5 GeoserverLayerStyle (org.geosdi.geoplatform.connector.geoserver.model.layers.GeoserverLayerStyle)5 GPGeoserverStyle (org.geosdi.geoplatform.connector.geoserver.model.styles.GPGeoserverStyle)5 IGPGeoserverStyle (org.geosdi.geoplatform.connector.geoserver.model.styles.IGPGeoserverStyle)5 GPGeoserverCoverageInfo (org.geosdi.geoplatform.connector.geoserver.model.workspace.coverages.GPGeoserverCoverageInfo)5 GeoserverLoadFeatureTypeWithUrlRequest (org.geosdi.geoplatform.connector.geoserver.request.featuretypes.GeoserverLoadFeatureTypeWithUrlRequest)5 ResourceNotFoundFault (org.geosdi.geoplatform.exception.ResourceNotFoundFault)5 IGPGeoserverFeatureTypeInfo (org.geosdi.geoplatform.connector.geoserver.model.featuretypes.IGPGeoserverFeatureTypeInfo)4 GeoserverLoadLayerRequest (org.geosdi.geoplatform.connector.geoserver.request.layers.GeoserverLoadLayerRequest)4 Lists (com.google.common.collect.Lists)3 RESTCoverage (it.geosolutions.geoserver.rest.decoder.RESTCoverage)3