Package it.geosolutions.geoserver.rest.decoder

Examples of it.geosolutions.geoserver.rest.decoder.RESTCoverageStore


        GSLayerEncoder layerEncoder=new GSLayerEncoder();
       
        layerEncoder.setDefaultStyle(styleName);
        LOGGER.info(layerEncoder.toString());
        // creation test
        RESTCoverageStore coverageStore =null;
        try {
          final File mosaicFile = new ClassPathResource("testdata/time_geotiff/").getFile();
         
          if (!publisher.publishExternalMosaic(wsName,coverageStoreName,mosaicFile,coverageEncoder,layerEncoder)){
            fail();
          }
        coverageStore = reader.getCoverageStore(wsName,coverageStoreName);
       
        if (coverageStore==null){
                LOGGER.error("*** coveragestore " + coverageStoreName + " has not been created.");
                fail("*** coveragestore " + coverageStoreName + " has not been created.");
        }

    } catch (FileNotFoundException e) {
      e.printStackTrace();
      fail(e.getLocalizedMessage());
    } catch (IOException e) {
      e.printStackTrace();
      fail(e.getLocalizedMessage());
    }
        // Get a Granule
        String coverageName = "time_geotiff";
        RESTStructuredCoverageGranulesList granules = reader.getGranules(wsName, coverageStoreName, coverageName, null, null, null);
        String granuleId = granules.get(0).getFid();
        // Test Granule Exists
        assertTrue(reader.existsGranule(wsName, coverageStoreName, coverageName, granuleId));
        // test a Granule does not exists
        assertFalse(reader.existsGranule(wsName, coverageStoreName, coverageName, granuleId.substring(0, granuleId.indexOf(".")) + "." + granules.size() + 1));
   
        // removing recursively coveragestore
        boolean removed = publisher.removeCoverageStore(coverageStore.getWorkspaceName(), coverageStore.getName(), true);
        if( ! removed ){
            LOGGER.error("*** CoverageStore " + coverageStoreName + " has not been removed.");
            fail("*** CoverageStore " + coverageStoreName + " has not been removed.");
        }
       


        boolean pc = publisher.publishExternalGeoTIFF(DEFAULT_WS, storeName, geotiff, layerName,"EPSG:4326",ProjectionPolicy.FORCE_DECLARED,"raster");
        assertTrue("publish() failed", pc);
        assertTrue(existsLayer(layerName));
        assertFalse(reader.existsLayer(DEFAULT_WS, layerName));
        LOGGER.info("Published "+pc);
        RESTCoverageStore reloadedCS = reader.getCoverageStore(DEFAULT_WS, storeName);

        assertEquals(storeName, reloadedCS.getName());
        assertEquals(DEFAULT_WS, reloadedCS.getWorkspaceName());

        //test delete
        assertTrue("Unpublish() failed", publisher.unpublishCoverage(DEFAULT_WS, storeName, layerName));
        assertTrue("Unpublish() failed", publisher.removeCoverageStore(DEFAULT_WS, storeName));
        assertFalse("Bad unpublish()",   publisher.unpublishCoverage(DEFAULT_WS, storeName, layerName));

    }

    private void deleteCoverage(RESTLayer layer) {
        RESTCoverage coverage = reader.getCoverage(layer);
        RESTCoverageStore coverageStore = reader.getCoverageStore(coverage);

        LOGGER.warn("Deleting Coverage " + coverageStore.getWorkspaceName() + " : "
                + coverageStore.getName() + " / " + coverage.getName());

        boolean removed = publisher.unpublishCoverage(coverageStore.getWorkspaceName(),
                coverageStore.getName(), coverage.getName());
        assertTrue("Coverage not deleted " + coverageStore.getWorkspaceName() + " : "
                + coverageStore.getName() + " / " + coverage.getName(), removed);
    }

        if (layerEncoder == null) {
            throw new IllegalArgumentException("no layerEncoder provided for " + mosaicDir);
        }

        RESTCoverageStore store = createExternaMosaicDatastore(workspace, storeName, mosaicDir,
                ParameterConfigure.NONE, ParameterUpdate.OVERWRITE);

        if (store == null) {
            return false;
        }

TOP

Related Classes of it.geosolutions.geoserver.rest.decoder.RESTCoverageStore

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.