use of com.sldeditor.ui.detail.vendor.geoserver.featuretypestyle.VOGeoServerFTSRuleEvaluation in project sldeditor by robward-scisys.
the class VOGeoServerFTSRuleEvaluationTest method testVOGeoServerFTSRuleEvaluation.
/**
* Test method for
* {@link com.sldeditor.ui.detail.vendor.geoserver.featuretypestyle.VOGeoServerFTSRuleEvaluationTest#VOGeoServerFTSRuleEvaluationTest(java.lang.Class)}.
*/
@Test
public void testVOGeoServerFTSRuleEvaluation() {
Class<FeatureTypeStyleDetails> panelId = FeatureTypeStyleDetails.class;
VOGeoServerFTSRuleEvaluation obj = new VOGeoServerFTSRuleEvaluation(panelId);
assertEquals(panelId, obj.getPanelId());
assertNotNull(obj.getFieldDataManager());
assertNotNull(obj.getPanel());
assertTrue(obj.isDataPresent());
assertNotNull(obj.getVendorOptionInfo());
// Check getVendorOptionVersion
VendorOptionVersion vendorOption = obj.getVendorOption();
assertEquals(GeoServerVendorOption.class, vendorOption.getClassType());
String actualVersionString = vendorOption.getEarliest().getVersionString();
String expectedVersionString = "2.4.0";
assertEquals(expectedVersionString, actualVersionString);
obj.setParentPanel(null);
assertNull(obj.getParentPanel());
obj.preLoadSymbol();
List<VendorOptionPresent> vendorOptionsPresentList = new ArrayList<VendorOptionPresent>();
String testString = "test";
obj.getMinimumVersion(null, testString, vendorOptionsPresentList);
assertTrue(vendorOptionsPresentList.isEmpty());
StyleFactoryImpl styleFactory = (StyleFactoryImpl) CommonFactoryFinder.getStyleFactory();
FeatureTypeStyle fts = styleFactory.createFeatureTypeStyle();
obj.getMinimumVersion(null, fts, vendorOptionsPresentList);
assertEquals(0, vendorOptionsPresentList.size());
// Valid string - first
String expectedValue = "first";
fts.getOptions().put(FeatureTypeStyle.KEY_EVALUATION_MODE, expectedValue);
obj.getMinimumVersion(null, fts, vendorOptionsPresentList);
assertEquals(1, vendorOptionsPresentList.size());
obj.populate(fts);
obj.updateSymbol(fts);
String actualValue = fts.getOptions().get(FeatureTypeStyle.KEY_EVALUATION_MODE);
assertEquals(actualValue, expectedValue);
// Valid string - all
expectedValue = "all";
fts.getOptions().put(FeatureTypeStyle.KEY_EVALUATION_MODE, expectedValue);
obj.populate(fts);
obj.updateSymbol(fts);
actualValue = fts.getOptions().get(FeatureTypeStyle.KEY_EVALUATION_MODE);
assertEquals(actualValue, expectedValue);
// Invalid string
expectedValue = "invalid";
fts.getOptions().put(FeatureTypeStyle.KEY_EVALUATION_MODE, expectedValue);
obj.populate(fts);
obj.updateSymbol(fts);
actualValue = fts.getOptions().get(FeatureTypeStyle.KEY_EVALUATION_MODE);
assertEquals("all", actualValue);
// Increase code coverage
obj.populate((PolygonSymbolizer) null);
obj.updateSymbol((PolygonSymbolizer) null);
obj.populate((RasterSymbolizer) null);
obj.updateSymbol((RasterSymbolizer) null);
obj.populate((TextSymbolizer) null);
obj.updateSymbol((TextSymbolizer) null);
obj.populate((SelectedSymbol) null);
obj.dataChanged(FieldIdEnum.VO_FTS_RULE_EVALUATION_OPTION);
}
Aggregations