use of com.sldeditor.datasource.checks.MissingSLDAttributes in project sldeditor by robward-scisys.
the class MissingSLDAttributesTest method testCheckAttributes.
/**
* Test method for {@link
* com.sldeditor.datasource.checks.MissingSLDAttributes#checkAttributes(com.sldeditor.datasource.SLDEditorFileInterface)}.
*/
@Test
void testCheckAttributes() {
MissingSLDAttributes obj = new MissingSLDAttributes();
obj.checkAttributes(null);
DummyInternalSLDFile3 testSLD = new DummyInternalSLDFile3();
SLDDataInterface sldData = testSLD.getSLDData();
SLDEditorFile.destroyInstance();
SelectedSymbol.destroyInstance();
SelectedSymbol.getInstance().setSld(testSLD.getSLD());
SLDEditorFile editorFile = SLDEditorFile.getInstance();
Map<String, Object> propertyMap = new HashMap<String, Object>();
propertyMap.put("field1", "value1");
propertyMap.put("field2", "value2");
propertyMap.put("field3", "value3");
DataSourceConnectorInterface dsc = new DataSourceConnector();
DataSourceProperties dsp = new DataSourceProperties(dsc);
dsp.setPropertyMap(propertyMap);
List<DataSourceAttributeData> fieldList = new ArrayList<DataSourceAttributeData>();
fieldList.add(new DataSourceAttributeData("Field 1", String.class, null));
fieldList.add(new DataSourceAttributeData("Field 2", Double.class, null));
fieldList.add(new DataSourceAttributeData("Field 3", Double.class, null));
// Try when no fields have been specified
obj.checkAttributes(editorFile);
editorFile.setSLDData(sldData);
obj.checkAttributes(editorFile);
// Specify the field list
sldData.setFieldList(fieldList);
sldData.setDataSourceProperties(dsp);
editorFile.setDataSource(dsp);
obj.checkAttributes(editorFile);
// Tidy up
SLDEditorFile.destroyInstance();
SelectedSymbol.destroyInstance();
}
Aggregations