Package it.geosolutions.geoserver.rest.decoder

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


      assertNotNull(result);
            dsnum += result.size();
            for (NameLinkElem ds : result) {
                assertNotNull(ds.getName());
        System.out.print(ds.getName() + " " );
                RESTDataStore datastore = reader.getDatastore(ws.getName(), ds.getName());
                assertNotNull(datastore);
                assertEquals(ds.getName(), datastore.getName());
                assertEquals(ws.getName(), datastore.getWorkspaceName());
            }
            System.out.println();
    }
        System.out.println();
        System.out.println("Datastores:" + dsnum); // value in default gs installation


        GSDirectoryOfShapefilesDatastoreEncoder create = new GSDirectoryOfShapefilesDatastoreEncoder(
                DS_NAME, LOCATION_1);
        assertTrue(manager.getStoreManager().create(WS_NAME, create));

        // Read the store from server; check all parameter values
        RESTDataStore read = reader.getDatastore(WS_NAME, DS_NAME);
        assertEquals(read.getName(), DS_NAME);
        assertEquals(read.getWorkspaceName(), WS_NAME);
        assertEquals(read.isEnabled(), true);

        Map<String, String> connParams = read.getConnectionParameters();
        assertEquals(connParams.get("url"), LOCATION_1.toString());
        assertEquals(connParams.get("charset"), "ISO-8859-1");
        assertEquals(connParams.get("create spatial index"), "true");
        assertEquals(connParams.get("memory mapped buffer"), "false");
        assertEquals(connParams.get("cache and reuse memory maps"), "true");

        // Change all parameter to non-default values
        GSDirectoryOfShapefilesDatastoreEncoder update = new GSDirectoryOfShapefilesDatastoreEncoder(
                read);
        update.setDescription(DS_DESCRIPTION);
        update.setEnabled(false);
        update.setUrl(LOCATION_2);
        update.setCharset(Charset.forName("UTF-8"));
        update.setCreateSpatialIndex(false);
        update.setMemoryMappedBuffer(true);
        update.setCacheAndReuseMemoryMaps(false);

        // update the store
        assertTrue(manager.getStoreManager().update(WS_NAME, update));

        // Read again, check that all parameters have changed
        read = reader.getDatastore(WS_NAME, DS_NAME);
        assertEquals(read.getWorkspaceName(), WS_NAME);
        assertEquals(read.isEnabled(), false);
        connParams = read.getConnectionParameters();
        assertEquals(connParams.get("url"), LOCATION_2.toString());
        assertEquals(connParams.get("charset"), "UTF-8");
        assertEquals(connParams.get("create spatial index"), "false");
        assertEquals(connParams.get("memory mapped buffer"), "true");
        assertEquals(connParams.get("cache and reuse memory maps"), "false");

        }
    }

    private void deleteFeatureType(RESTLayer layer) {
        RESTFeatureType featureType = reader.getFeatureType(layer);
        RESTDataStore datastore = reader.getDatastore(featureType);

        LOGGER.warn("Deleting FeatureType" + datastore.getWorkspaceName() + " : "
                + datastore.getName() + " / " + featureType.getName());

        boolean removed = publisher.unpublishFeatureType(datastore.getWorkspaceName(),
                datastore.getName(), layer.getName());
        assertTrue(
                "FeatureType not removed:" + datastore.getWorkspaceName() + " : "
                        + datastore.getName() + " / " + featureType.getName(), removed);

    }

        boolean created = storeManager.create(DEFAULT_WS, storeEncoder);

        assertTrue("*** store " + storeName + " has not been created.", created);

        RESTDataStore datastore = reader.getDatastore(DEFAULT_WS, storeName);
        assertNotNull(datastore);
        LOGGER.info("The type of the created datastore is: " + datastore.getStoreType());

        // check if the datastore is properly configured in GS for publishing layers
        String layername = "states";
       
        if (storeEncoder instanceof GSOracleNGDatastoreEncoder)

TOP

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

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.