use of com.sldeditor.ui.detail.FeatureTypeStyleDetails in project sldeditor by robward-scisys.
the class VOGeoServerFTSCompositeBaseTest method testVOGeoServerFTSCompositeBase.
/**
* Test method for
* {@link com.sldeditor.ui.detail.vendor.geoserver.featuretypestyle.VOGeoServerFTSCompositeBase#VOGeoServerFTSCompositeBase(java.lang.Class)}.
*/
@Test
public void testVOGeoServerFTSCompositeBase() {
Class<FeatureTypeStyleDetails> panelId = FeatureTypeStyleDetails.class;
VOGeoServerFTSCompositeBase obj = new VOGeoServerFTSCompositeBase(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.7.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
String expectedValue = "true";
fts.getOptions().put(FeatureTypeStyle.COMPOSITE_BASE, expectedValue);
obj.getMinimumVersion(null, fts, vendorOptionsPresentList);
assertEquals(1, vendorOptionsPresentList.size());
obj.populate(fts);
obj.updateSymbol(fts);
String actualValue = fts.getOptions().get(FeatureTypeStyle.COMPOSITE_BASE);
assertEquals(actualValue, expectedValue);
// No opacity
expectedValue = "false";
fts.getOptions().put(FeatureTypeStyle.COMPOSITE_BASE, expectedValue);
obj.populate(fts);
obj.updateSymbol(fts);
actualValue = fts.getOptions().get(FeatureTypeStyle.COMPOSITE_BASE);
assertEquals(actualValue, expectedValue);
// Invalid string
expectedValue = "invalid";
fts.getOptions().put(FeatureTypeStyle.COMPOSITE_BASE, expectedValue);
obj.populate(fts);
obj.updateSymbol(fts);
actualValue = fts.getOptions().get(FeatureTypeStyle.COMPOSITE_BASE);
assertEquals("false", 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_COMPOSITE_BASE_BOOL);
}
use of com.sldeditor.ui.detail.FeatureTypeStyleDetails in project sldeditor by robward-scisys.
the class VOGeoServerFTSCompositeTest method testVOGeoServerFTSComposite.
/**
* Test method for
* {@link com.sldeditor.ui.detail.vendor.geoserver.featuretypestyle.VOGeoServerFTSComposite#VOGeoServerFTSComposite(java.lang.Class)}.
*/
@Test
public void testVOGeoServerFTSComposite() {
Class<FeatureTypeStyleDetails> panelId = FeatureTypeStyleDetails.class;
VOGeoServerFTSComposite obj = new VOGeoServerFTSComposite(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.7.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
String expectedValue = "copy,0.42";
fts.getOptions().put(FeatureTypeStyle.COMPOSITE, expectedValue);
obj.getMinimumVersion(null, fts, vendorOptionsPresentList);
assertEquals(1, vendorOptionsPresentList.size());
obj.populate(fts);
obj.updateSymbol(fts);
String actualValue = fts.getOptions().get(FeatureTypeStyle.COMPOSITE);
assertEquals(actualValue, expectedValue);
// No opacity
expectedValue = "source-in";
fts.getOptions().put(FeatureTypeStyle.COMPOSITE, expectedValue);
obj.populate(fts);
obj.updateSymbol(fts);
actualValue = fts.getOptions().get(FeatureTypeStyle.COMPOSITE);
assertEquals(actualValue, expectedValue);
// Invalid string
expectedValue = "invalid";
fts.getOptions().put(FeatureTypeStyle.COMPOSITE, expectedValue);
obj.populate(fts);
obj.updateSymbol(fts);
actualValue = fts.getOptions().get(FeatureTypeStyle.COMPOSITE);
assertEquals(actualValue, "copy");
// 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_COMPOSITE_OPACITY);
}
use of com.sldeditor.ui.detail.FeatureTypeStyleDetails 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);
}
use of com.sldeditor.ui.detail.FeatureTypeStyleDetails in project sldeditor by robward-scisys.
the class FeatureTypeStyleDetailsTest method testFeatureTypeStyleDetails.
/**
* Test method for {@link com.sldeditor.ui.detail.FeatureTypeStyleDetails#FeatureTypeStyleDetails(com.sldeditor.filter.v2.function.FunctionNameInterface)}.
* Test method for {@link com.sldeditor.ui.detail.FeatureTypeStyleDetails#populate(com.sldeditor.common.data.SelectedSymbol)}.
* Test method for {@link com.sldeditor.ui.detail.FeatureTypeStyleDetails#dataChanged(com.sldeditor.ui.detail.config.FieldId)}.
* Test method for {@link com.sldeditor.ui.detail.FeatureTypeStyleDetails#getFieldDataManager()}.
* Test method for {@link com.sldeditor.ui.detail.FeatureTypeStyleDetails#isDataPresent()}.
* Test method for {@link com.sldeditor.ui.detail.FeatureTypeStyleDetails#preLoadSymbol()}.
*/
@Test
public void testFeatureTypeStyleDetails() {
FeatureTypeStyleDetails panel = new FeatureTypeStyleDetails();
panel.populate(null);
// Set up test data
StyledLayerDescriptor sld = DefaultSymbols.createNewSLD();
SelectedSymbol.getInstance().createNewSLD(sld);
NamedLayer namedLayer = DefaultSymbols.createNewNamedLayer();
String expectedNameLayerValue = "named layer test value";
namedLayer.setName(expectedNameLayerValue);
Style style = DefaultSymbols.createNewStyle();
String expectedNameStyleValue = "style test value";
style.setName(expectedNameStyleValue);
namedLayer.addStyle(style);
FeatureTypeStyle fts = DefaultSymbols.createNewFeatureTypeStyle();
String expectedNameValue = "feature type style test value";
fts.setName(expectedNameValue);
style.featureTypeStyles().add(fts);
Rule rule = DefaultSymbols.createNewRule();
String expectedRuleNameValue = "rule test value";
rule.setName(expectedRuleNameValue);
fts.rules().add(rule);
sld.layers().add(namedLayer);
SelectedSymbol.getInstance().addNewStyledLayer(namedLayer);
SelectedSymbol.getInstance().setStyledLayer(namedLayer);
SelectedSymbol.getInstance().setStyle(style);
SelectedSymbol.getInstance().setFeatureTypeStyle(fts);
panel.populate(SelectedSymbol.getInstance());
panel.dataChanged(null);
GraphicPanelFieldManager fieldDataManager = panel.getFieldDataManager();
assertNotNull(fieldDataManager);
FieldConfigString nameField = (FieldConfigString) fieldDataManager.get(FieldIdEnum.NAME);
String actualValue = nameField.getStringValue();
assertTrue(expectedNameValue.compareTo(actualValue) == 0);
assertTrue(panel.isDataPresent());
// Reset to default value
panel.preLoadSymbol();
actualValue = nameField.getStringValue();
assertTrue("".compareTo(actualValue) == 0);
}
Aggregations