@Ignore
    @Test
    public void createAndDelete() throws Exception{
        if (!enabled()) {
            return;
        }
        deleteAll();

        assertFalse("Workspace was not properly removed", reader.existsNamespace(DEFAULT_WS) );

        publisher.createWorkspace(DEFAULT_WS);
        
        // crea the manager
        GeoServerRESTStructuredGridCoverageReaderManager manager = 
            new GeoServerRESTStructuredGridCoverageReaderManager(new URL(RESTURL), RESTUSER, RESTPW);
        
        // create mosaic
        final String coverageStoreName = "mosaic";
        final String coverageName = "mosaic";
        final String format = "imagemosaic";

        assertFalse("CoverageStore was not properly removed", reader.existsCoveragestore(DEFAULT_WS, coverageStoreName));

        // upload the mosaic
        boolean create=manager.create(DEFAULT_WS, coverageStoreName,new ClassPathResource("testdata/granules/mosaic.zip").getFile().getAbsolutePath());
        assertTrue(create);
        
        // enable dimension
        fixDimensions(DEFAULT_WS, coverageStoreName, coverageName);
        
        // check index format
        RESTStructuredCoverageIndexSchema indexFormat = manager.getGranuleIndexSchema(DEFAULT_WS, coverageName,coverageName);
        assertNotNull(indexFormat);
        assertFalse(indexFormat.isEmpty());
        assertEquals(5, indexFormat.size());

        Set<String> allowedDateFormats = new HashSet<String>(Arrays.asList(
                "java.util.Date",  // shapefile
                "java.sql.Timestamp")); // h2

        for (RESTStructuredCoverageIndexAttribute element : indexFormat) {

            final String elementName = element.getName();

            if (elementName.equals("location")) {
                assertEquals("0", element.getMinOccurs());
                assertEquals("1", element.getMaxOccurs());
                assertEquals("true", element.getNillable());
                assertEquals("java.lang.String", element.getBinding());
            } else if (elementName.equals("time")) {
                assertEquals("0", element.getMinOccurs());
                assertEquals("1", element.getMaxOccurs());
                assertEquals("true", element.getNillable());
                assertTrue(allowedDateFormats.contains(element.getBinding()));
            } else if (elementName.equals("date")) {
                assertEquals("0", element.getMinOccurs());
                assertEquals("1", element.getMaxOccurs());
                assertEquals("true", element.getNillable());
                assertEquals("java.lang.String", element.getBinding());
            } else if (elementName.equals("depth")) {
                assertEquals("0", element.getMinOccurs());
                assertEquals("1", element.getMaxOccurs());
                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);

        for (RESTStructuredCoverageGranule g : granulesList) {
            LOGGER.info("    GRANULE before delete: " + g);
        }

        assertEquals("At first insertion 4 granules are expected", 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());

        for (RESTStructuredCoverageGranule g : granulesList) {
            LOGGER.info("    GRANULE: " + g);
        }

        assertEquals("After deletion only 3 granules are expected", 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("After harvest 4 granules are expected", 4, granulesList.size());
        assertFalse(granulesList.isEmpty());
        granule = granulesList.get(0);
        assertNotNull(granule);
        
        
        // delete
        delete(DEFAULT_WS, coverageStoreName);
    }