use of com.sldeditor.common.DataSourcePropertiesInterface in project sldeditor by robward-scisys.
the class DataSourceImplTest method testConnectToInlineDataSource.
/**
* Test method for {@link com.sldeditor.datasource.impl.DataSourceImpl#connect()}.
*/
@Test
public void testConnectToInlineDataSource() {
DataSourceImpl ds = new DataSourceImpl();
DummyInlineSLDFile editorFile = new DummyInlineSLDFile();
DummyDataSourceUpdate dataSourceUpdateListener = new DummyDataSourceUpdate();
ds.addListener(dataSourceUpdateListener);
CreateDataSourceInterface internalDataSource = new DummyCreateDataSource();
CreateDataSourceInterface externalDataSource = new DummyCreateDataSource();
CreateDataSourceInterface inlineDataSource = new CreateInlineDataSource();
ds.setDataSourceCreation(internalDataSource, externalDataSource, inlineDataSource);
ds.connect("typeName", editorFile, null);
assertTrue(dataSourceUpdateListener.hasBeenCalled());
assertEquals(GeometryTypeEnum.UNKNOWN, dataSourceUpdateListener.geometryType);
assertFalse(dataSourceUpdateListener.isConnectedToDataSourceFlag);
Collection<PropertyDescriptor> fieldList = ds.getPropertyDescriptorList();
assertNull(fieldList);
FeatureSource<SimpleFeatureType, SimpleFeature> exampleLayer = ds.getExampleFeatureSource();
assertNull(exampleLayer);
Map<UserLayer, FeatureSource<SimpleFeatureType, SimpleFeature>> userLayerMap = ds.getUserLayerFeatureSource();
assertEquals(1, userLayerMap.size());
assertFalse(dataSourceUpdateListener.hasBeenCalled());
ds.updateUserLayers();
assertTrue(dataSourceUpdateListener.hasBeenCalled());
DataSourcePropertiesInterface dsi = ds.getDataConnectorProperties();
assertNotNull(dsi);
}
Aggregations