Package it.geosolutions.geoserver.rest.decoder

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


      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.");
View Full Code Here


                assertEquals("true", element.getNillable());
                assertEquals("java.lang.Integer", element.getBinding());
            }
        }

        RESTStructuredCoverageGranulesList granulesList = null;
        RESTStructuredCoverageGranule granule = null;
       
       
        // get with paging
        granulesList = manager.getGranules(DEFAULT_WS, coverageStoreName, coverageName , null, 0, 1);
        assertNotNull(granulesList);
        assertEquals(1, granulesList.size());
        assertFalse(granulesList.isEmpty());
        granule = granulesList.get(0);
        assertNotNull(granule);      
       
        granulesList = manager.getGranules(DEFAULT_WS, coverageStoreName, coverageName, null, null, 2);
        assertNotNull(granulesList);
        assertEquals(2, granulesList.size());
        assertFalse(granulesList.isEmpty());
        granule = granulesList.get(0);
        assertNotNull(granule);
       
        // get with no paging
        granulesList = manager.getGranules(DEFAULT_WS, coverageStoreName, coverageName);
        assertNotNull(granulesList);
        assertEquals(4, granulesList.size());
        assertFalse(granulesList.isEmpty());
        granule = granulesList.get(0);
        assertNotNull(granule);  
       
        // examples of filtering with CQL
        granulesList = manager.getGranules(DEFAULT_WS, coverageStoreName, coverageName, "depth = 100", null, null);
        assertNotNull(granulesList);
        assertEquals(2, granulesList.size());
        assertFalse(granulesList.isEmpty());
        granule = granulesList.get(0);
        assertNotNull(granule);
       
        granulesList = manager.getGranules(DEFAULT_WS, coverageStoreName, coverageName, "depth = 100 AND date='20081101T0000000'", null, null);
        assertNotNull(granulesList);
        assertEquals(1, granulesList.size());
        assertFalse(granulesList.isEmpty());
        granule = granulesList.get(0);
        assertNotNull(granule);
       
        granulesList = manager.getGranules(DEFAULT_WS, coverageStoreName, coverageName, "location LIKE 'NCOM_wattemp%'", 0, 1);
        assertNotNull(granulesList);
        assertEquals(1, granulesList.size());
        assertFalse(granulesList.isEmpty());
        granule = granulesList.get(0);
        assertNotNull(granule);
       
        // remove by filter
        final String fileLocation = "NCOM_wattemp_100_20081101T0000000_12.tiff";
        boolean result = manager.removeGranulesByCQL(DEFAULT_WS, coverageStoreName, coverageName, "location = '" + fileLocation + "'");
        Assert.assertTrue(result);
       
        granulesList = manager.getGranules(DEFAULT_WS, coverageStoreName, coverageName);
        assertNotNull(granulesList);
        assertFalse(granulesList.isEmpty());
        assertEquals(3, granulesList.size());
        granule = granulesList.get(0);
        assertNotNull(granule);
       
        // Readding that granule with harvest
        result = manager.harvestExternal(DEFAULT_WS, coverageStoreName, format, new ClassPathResource("testdata/granules/NCOM_wattemp_100_20081101T0000000_12.tiff").getFile().getAbsolutePath() );
        Assert.assertTrue(result);
       
        granulesList = manager.getGranules(DEFAULT_WS, coverageStoreName, coverageName, null, null, null);
        assertNotNull(granulesList);
        assertEquals(4, granulesList.size());
        assertFalse(granulesList.isEmpty());
        granule = granulesList.get(0);
        assertNotNull(granule);
       
       
        // delete
        delete(DEFAULT_WS, coverageStoreName);
View Full Code Here

        checkString(coverage);
        checkString(filter);
        checkString(coverageStore);

        // does it exist?
        RESTStructuredCoverageGranulesList granulesList = null;
        try {
            granulesList = getGranules(workspace, coverageStore, coverage, filter, null, 1);
        } catch (MalformedURLException e) {
            if (LOGGER.isTraceEnabled()) {
                LOGGER.trace(e.getMessage(), e);
            }
        } catch (UnsupportedEncodingException e) {
            if (LOGGER.isTraceEnabled()) {
                LOGGER.trace(e.getMessage(), e);
            }
        }
        if (granulesList == null || granulesList.isEmpty()) {
            if (LOGGER.isTraceEnabled()) {
                LOGGER.trace("Granules for filter: " + filter + " does not exist for coverage "
                        + coverage);
            }
            return true; // nothing to remove
        }

        // method
        String sUrl = HTTPUtils.append(gsBaseUrl, "/rest/workspaces/", workspace, "/coveragestores",
                "/", coverageStore, "/coverages/", coverage, "/index/granules?filter=",
                URLEncoder.encode(filter, "UTF-8")).toString();
        if (!HTTPUtils.delete(sUrl, gsuser, gspass)) {
            return false;
        }

        // does it exist?
        granulesList = null;
        try {
            granulesList = getGranules(workspace, coverageStore, coverage, filter, null, 1);
        } catch (MalformedURLException e) {
            if (LOGGER.isTraceEnabled()) {
                LOGGER.trace(e.getMessage(), e);
            }
        } catch (UnsupportedEncodingException e) {
            if (LOGGER.isTraceEnabled()) {
                LOGGER.trace(e.getMessage(), e);
            }
        }
        if (granulesList == null || granulesList.isEmpty()) {
            return true; // nothing to remove
        }
        return false;
    }
View Full Code Here

        checkString(coverage);
        checkString(granuleId);
        checkString(coverageStore);

        // does it exist?
        RESTStructuredCoverageGranulesList granule = null;
        try {
            granule = getGranuleById(workspace, coverageStore, coverage, granuleId);
        } catch (MalformedURLException e) {
            if (LOGGER.isTraceEnabled()) {
                LOGGER.trace(e.getMessage(), e);
View Full Code Here

TOP

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

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.