Search in sources :

Example 1 with CreateSampleData

use of com.sldeditor.datasource.impl.CreateSampleData in project sldeditor by robward-scisys.

the class CreateSampleDataTest method testGetDataStore.

/**
 * Test method for {@link com.sldeditor.datasource.impl.CreateSampleData#getDataStore()}.
 */
@Test
public void testGetDataStore() {
    SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder();
    String typeName = "test type name";
    b.setName(typeName);
    String namespace = null;
    b.setNamespaceURI(namespace);
    // add a geometry property
    // set crs first
    b.setCRS(DefaultGeographicCRS.WGS84);
    b.add("the_geom", Polygon.class);
    b.setDefaultGeometry("the_geom");
    // Build the feature type
    SimpleFeatureType schema = b.buildFeatureType();
    CreateSampleData sampleData = new CreateSampleData();
    sampleData.create(null, null);
    sampleData.create(schema, null);
    DataStore dataStore = sampleData.getDataStore();
    assertTrue(dataStore != null);
    assertEquals(GeometryTypeEnum.POLYGON, sampleData.getGeometryType());
}
Also used : SimpleFeatureTypeBuilder(org.geotools.feature.simple.SimpleFeatureTypeBuilder) SimpleFeatureType(org.opengis.feature.simple.SimpleFeatureType) CreateSampleData(com.sldeditor.datasource.impl.CreateSampleData) DataStore(org.geotools.data.DataStore) Test(org.junit.jupiter.api.Test)

Aggregations

CreateSampleData (com.sldeditor.datasource.impl.CreateSampleData)1 DataStore (org.geotools.data.DataStore)1 SimpleFeatureTypeBuilder (org.geotools.feature.simple.SimpleFeatureTypeBuilder)1 Test (org.junit.jupiter.api.Test)1 SimpleFeatureType (org.opengis.feature.simple.SimpleFeatureType)1