Search in sources :

Example 1 with FeatureTypeStyleDetails

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);
}
Also used : VendorOptionPresent(com.sldeditor.common.vendoroption.minversion.VendorOptionPresent) StyleFactoryImpl(org.geotools.styling.StyleFactoryImpl) VendorOptionVersion(com.sldeditor.common.vendoroption.VendorOptionVersion) FeatureTypeStyleDetails(com.sldeditor.ui.detail.FeatureTypeStyleDetails) ArrayList(java.util.ArrayList) FeatureTypeStyle(org.geotools.styling.FeatureTypeStyle) VOGeoServerFTSCompositeBase(com.sldeditor.ui.detail.vendor.geoserver.featuretypestyle.VOGeoServerFTSCompositeBase) Test(org.junit.Test)

Example 2 with FeatureTypeStyleDetails

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);
}
Also used : VendorOptionPresent(com.sldeditor.common.vendoroption.minversion.VendorOptionPresent) StyleFactoryImpl(org.geotools.styling.StyleFactoryImpl) VendorOptionVersion(com.sldeditor.common.vendoroption.VendorOptionVersion) FeatureTypeStyleDetails(com.sldeditor.ui.detail.FeatureTypeStyleDetails) ArrayList(java.util.ArrayList) VOGeoServerFTSComposite(com.sldeditor.ui.detail.vendor.geoserver.featuretypestyle.VOGeoServerFTSComposite) FeatureTypeStyle(org.geotools.styling.FeatureTypeStyle) Test(org.junit.Test)

Example 3 with FeatureTypeStyleDetails

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);
}
Also used : VendorOptionPresent(com.sldeditor.common.vendoroption.minversion.VendorOptionPresent) StyleFactoryImpl(org.geotools.styling.StyleFactoryImpl) VOGeoServerFTSRuleEvaluation(com.sldeditor.ui.detail.vendor.geoserver.featuretypestyle.VOGeoServerFTSRuleEvaluation) VendorOptionVersion(com.sldeditor.common.vendoroption.VendorOptionVersion) FeatureTypeStyleDetails(com.sldeditor.ui.detail.FeatureTypeStyleDetails) ArrayList(java.util.ArrayList) FeatureTypeStyle(org.geotools.styling.FeatureTypeStyle) Test(org.junit.Test)

Example 4 with FeatureTypeStyleDetails

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);
}
Also used : StyledLayerDescriptor(org.geotools.styling.StyledLayerDescriptor) FieldConfigString(com.sldeditor.ui.detail.config.FieldConfigString) FeatureTypeStyleDetails(com.sldeditor.ui.detail.FeatureTypeStyleDetails) Style(org.geotools.styling.Style) FeatureTypeStyle(org.geotools.styling.FeatureTypeStyle) FeatureTypeStyle(org.geotools.styling.FeatureTypeStyle) FieldConfigString(com.sldeditor.ui.detail.config.FieldConfigString) Rule(org.geotools.styling.Rule) NamedLayer(org.geotools.styling.NamedLayer) GraphicPanelFieldManager(com.sldeditor.ui.detail.GraphicPanelFieldManager) Test(org.junit.Test)

Aggregations

FeatureTypeStyleDetails (com.sldeditor.ui.detail.FeatureTypeStyleDetails)4 FeatureTypeStyle (org.geotools.styling.FeatureTypeStyle)4 Test (org.junit.Test)4 VendorOptionVersion (com.sldeditor.common.vendoroption.VendorOptionVersion)3 VendorOptionPresent (com.sldeditor.common.vendoroption.minversion.VendorOptionPresent)3 ArrayList (java.util.ArrayList)3 StyleFactoryImpl (org.geotools.styling.StyleFactoryImpl)3 GraphicPanelFieldManager (com.sldeditor.ui.detail.GraphicPanelFieldManager)1 FieldConfigString (com.sldeditor.ui.detail.config.FieldConfigString)1 VOGeoServerFTSComposite (com.sldeditor.ui.detail.vendor.geoserver.featuretypestyle.VOGeoServerFTSComposite)1 VOGeoServerFTSCompositeBase (com.sldeditor.ui.detail.vendor.geoserver.featuretypestyle.VOGeoServerFTSCompositeBase)1 VOGeoServerFTSRuleEvaluation (com.sldeditor.ui.detail.vendor.geoserver.featuretypestyle.VOGeoServerFTSRuleEvaluation)1 NamedLayer (org.geotools.styling.NamedLayer)1 Rule (org.geotools.styling.Rule)1 Style (org.geotools.styling.Style)1 StyledLayerDescriptor (org.geotools.styling.StyledLayerDescriptor)1