Search in sources :

Example 1 with GeoserverLoadWorkspaceLayerRequest

use of org.geosdi.geoplatform.connector.geoserver.request.layers.GeoserverLoadWorkspaceLayerRequest 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 GeoserverLoadWorkspaceLayerRequest

use of org.geosdi.geoplatform.connector.geoserver.request.layers.GeoserverLoadWorkspaceLayerRequest 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 GeoserverLoadWorkspaceLayerRequest

use of org.geosdi.geoplatform.connector.geoserver.request.layers.GeoserverLoadWorkspaceLayerRequest 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 GeoserverLoadWorkspaceLayerRequest

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

Example 5 with GeoserverLoadWorkspaceLayerRequest

use of org.geosdi.geoplatform.connector.geoserver.request.layers.GeoserverLoadWorkspaceLayerRequest in project geo-platform by geosdi.

the class GPGeoserverLayersConnectorStoreV220XTest method h_loadGeoserverWorkspaceLayerTest.

@Test
public void h_loadGeoserverWorkspaceLayerTest() throws Exception {
    GeoserverLoadWorkspaceLayerRequest loadWorkspaceLayerRequest = geoserverConnectorStoreV2_20_x.loadWorkspaceLayerRequest();
    loadWorkspaceLayerRequest.withWorkspaceName("tiger").withLayerName("poi");
    logger.info("######################LOAD_WORKSPACE_LAYER_RESPONSE : {}\n", loadWorkspaceLayerRequest.getResponse());
}
Also used : GeoserverLoadWorkspaceLayerRequest(org.geosdi.geoplatform.connector.geoserver.request.layers.GeoserverLoadWorkspaceLayerRequest) GPBaseGeoserverConnectorStoreV220xTest(org.geosdi.geoplatform.connector.store.GPBaseGeoserverConnectorStoreV220xTest) Test(org.junit.Test)

Aggregations

GeoserverLoadWorkspaceLayerRequest (org.geosdi.geoplatform.connector.geoserver.request.layers.GeoserverLoadWorkspaceLayerRequest)8 Test (org.junit.Test)7 GeoserverLayer (org.geosdi.geoplatform.connector.geoserver.model.layers.GeoserverLayer)5 GeoserverConnectorTest (org.geosdi.geoplatform.geoserver.GeoserverConnectorTest)4 RESTLayer (it.geosolutions.geoserver.rest.decoder.RESTLayer)3 RESTFeatureType (it.geosolutions.geoserver.rest.decoder.RESTFeatureType)2 GPGeoserverFeatureTypeInfo (org.geosdi.geoplatform.connector.geoserver.model.featuretypes.GPGeoserverFeatureTypeInfo)2 IGPGeoserverFeatureTypeInfo (org.geosdi.geoplatform.connector.geoserver.model.featuretypes.IGPGeoserverFeatureTypeInfo)2 Lists (com.google.common.collect.Lists)1 RESTCoverage (it.geosolutions.geoserver.rest.decoder.RESTCoverage)1 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 FALSE (java.lang.Boolean.FALSE)1 TRUE (java.lang.Boolean.TRUE)1 Arrays.asList (java.util.Arrays.asList)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Collectors.toList (java.util.stream.Collectors.toList)1 StreamSupport.stream (java.util.stream.StreamSupport.stream)1