use of com.sldeditor.datasource.impl.DataSourceInfo in project sldeditor by robward-scisys.
the class CreateInternalDataSourceTest method testConnect.
/**
* Test method for {@link
* com.sldeditor.datasource.impl.CreateInternalDataSource#connect(com.sldeditor.datasource.SLDEditorFileInterface)}.
*/
@Test
public void testConnect() {
CreateInternalDataSource ds = new CreateInternalDataSource();
List<DataSourceInfo> dataSourceInfoList = ds.connect(null, null, null);
DataSourceInfo dsInfo = dataSourceInfoList.get(0);
assertTrue(dsInfo != null);
assertNull(dsInfo.getDataStore());
assertNull(dsInfo.getTypeName());
SLDEditorFileInterface sldEditor = new DummyInternalSLDFile();
dataSourceInfoList = ds.connect(null, null, sldEditor);
dsInfo = dataSourceInfoList.get(0);
assertTrue(dsInfo != null);
assertTrue(dsInfo.getTypeName() != null);
assertTrue(dsInfo.getDataStore() != null);
}
use of com.sldeditor.datasource.impl.DataSourceInfo in project sldeditor by robward-scisys.
the class DataSourceInfoTest method testGetFeatures.
/**
* Test method for {@link com.sldeditor.datasource.impl.DataSourceInfo#getFeatures()}.
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void testGetFeatures() {
URL url = SLDEditorFile.class.getClassLoader().getResource("point/sld/shp/sld_cookbook_point.shp");
Map map = new HashMap();
map.put("url", url);
DataStore dataStore;
try {
dataStore = DataStoreFinder.getDataStore(map);
DataSourceInfo dsInfo = new DataSourceInfo();
String typeName = dataStore.getTypeNames()[0];
dsInfo.setTypeName(typeName);
SimpleFeatureSource source = dataStore.getFeatureSource(typeName);
SimpleFeatureType schema = source.getSchema();
assertNull(dsInfo.getFeatures());
dsInfo.setSchema(schema);
assertNull(dsInfo.getFeatures());
dsInfo.setDataStore(dataStore);
assertTrue(dsInfo.getFeatures() != null);
} catch (IOException e) {
e.printStackTrace();
fail(e.getMessage());
}
}
use of com.sldeditor.datasource.impl.DataSourceInfo in project sldeditor by robward-scisys.
the class DataSourceInfoTest method testGetGeometryFieldName.
/**
* Test method for {@link com.sldeditor.datasource.impl.DataSourceInfo#getGeometryFieldName()}.
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void testGetGeometryFieldName() {
URL url = SLDEditorFile.class.getClassLoader().getResource("point/sld/shp/sld_cookbook_point.shp");
Map map = new HashMap();
map.put("url", url);
DataStore dataStore;
try {
dataStore = DataStoreFinder.getDataStore(map);
DataSourceInfo dsInfo = new DataSourceInfo();
String typeName = dataStore.getTypeNames()[0];
dsInfo.setTypeName(typeName);
SimpleFeatureSource source = dataStore.getFeatureSource(typeName);
SimpleFeatureType schema = source.getSchema();
assertNull(dsInfo.getGeometryFieldName());
dsInfo.setSchema(schema);
assertEquals("the_geom", dsInfo.getGeometryFieldName());
} catch (IOException e) {
e.printStackTrace();
fail(e.getMessage());
}
}
use of com.sldeditor.datasource.impl.DataSourceInfo in project sldeditor by robward-scisys.
the class DataSourceInfoTest method testSetTypeName.
/**
* Test method for {@link
* com.sldeditor.datasource.impl.DataSourceInfo#setTypeName(java.lang.String)}. Test method for
* {@link com.sldeditor.datasource.impl.DataSourceInfo#getTypeName()}.
*/
@Test
public void testSetTypeName() {
DataSourceInfo ds = new DataSourceInfo();
String expectedTypeName = "test type name";
ds.setTypeName(expectedTypeName);
assertEquals(expectedTypeName, ds.getTypeName());
ds.reset();
assertNull(ds.getTypeName());
}
use of com.sldeditor.datasource.impl.DataSourceInfo in project sldeditor by robward-scisys.
the class DataSourceInfoTest method testGetFeatureCollection.
/**
* Test method for {@link com.sldeditor.datasource.impl.DataSourceInfo#getFeatureCollection()}.
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void testGetFeatureCollection() {
URL url = SLDEditorFile.class.getClassLoader().getResource("point/sld/shp/sld_cookbook_point.shp");
Map map = new HashMap();
map.put("url", url);
DataStore dataStore;
try {
dataStore = DataStoreFinder.getDataStore(map);
DataSourceInfo dsInfo = new DataSourceInfo();
String typeName = dataStore.getTypeNames()[0];
dsInfo.setTypeName(typeName);
SimpleFeatureSource source = dataStore.getFeatureSource(typeName);
SimpleFeatureType schema = source.getSchema();
assertNull(dsInfo.getGeometryFieldName());
dsInfo.setSchema(schema);
assertEquals("the_geom", dsInfo.getGeometryFieldName());
} catch (IOException e) {
e.printStackTrace();
fail(e.getMessage());
}
}
Aggregations