Search in sources :

Example 21 with VendorOptionPresent

use of com.sldeditor.common.vendoroption.minversion.VendorOptionPresent 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 22 with VendorOptionPresent

use of com.sldeditor.common.vendoroption.minversion.VendorOptionPresent in project sldeditor by robward-scisys.

the class VendorOptionFTSFactoryTest method testVendorOptionFTSFactory.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.featuretypestyle.VendorOptionFTSFactory#VendorOptionFTSFactory(java.lang.Class)}.
 */
@Test
public void testVendorOptionFTSFactory() {
    VendorOptionFTSFactory obj = new VendorOptionFTSFactory(FeatureTypeStyleDetails.class);
    int expectedNoOfVO = 4;
    assertEquals(expectedNoOfVO, obj.getVendorOptionList().size());
    List<VendorOptionPresent> vendorOptionsPresentList = new ArrayList<VendorOptionPresent>();
    StyleFactoryImpl styleFactory = (StyleFactoryImpl) CommonFactoryFinder.getStyleFactory();
    FeatureTypeStyle fts = styleFactory.createFeatureTypeStyle();
    obj.getMinimumVersion(null, fts, vendorOptionsPresentList);
    assertEquals(0, vendorOptionsPresentList.size());
    // Valid string
    String expectedValue = "exclude,0.12";
    fts.getOptions().put(FeatureTypeStyle.COMPOSITE, expectedValue);
    obj.getMinimumVersion(null, fts, vendorOptionsPresentList);
    assertEquals(1, vendorOptionsPresentList.size());
    assertEquals(expectedNoOfVO, obj.getVendorOptionInfoList().size());
    assertEquals(1, obj.getVendorOptionList(VOGeoServerFTSComposite.class.getName()).size());
    GraphicPanelFieldManager fieldMgr = new GraphicPanelFieldManager(FeatureTypeStyleDetails.class);
    obj.getFieldDataManager(fieldMgr);
    obj.populate(fts);
    obj.updateSymbol(fts);
}
Also used : VendorOptionPresent(com.sldeditor.common.vendoroption.minversion.VendorOptionPresent) StyleFactoryImpl(org.geotools.styling.StyleFactoryImpl) ArrayList(java.util.ArrayList) FeatureTypeStyle(org.geotools.styling.FeatureTypeStyle) VOGeoServerFTSComposite(com.sldeditor.ui.detail.vendor.geoserver.featuretypestyle.VOGeoServerFTSComposite) VendorOptionFTSFactory(com.sldeditor.ui.detail.vendor.geoserver.featuretypestyle.VendorOptionFTSFactory) GraphicPanelFieldManager(com.sldeditor.ui.detail.GraphicPanelFieldManager) Test(org.junit.Test)

Aggregations

VendorOptionPresent (com.sldeditor.common.vendoroption.minversion.VendorOptionPresent)22 FeatureTypeStyle (org.geotools.styling.FeatureTypeStyle)10 Test (org.junit.Test)8 ArrayList (java.util.ArrayList)7 StyleFactoryImpl (org.geotools.styling.StyleFactoryImpl)6 VendorOptionVersion (com.sldeditor.common.vendoroption.VendorOptionVersion)4 FieldIdEnum (com.sldeditor.common.xml.ui.FieldIdEnum)4 FeatureTypeStyleDetails (com.sldeditor.ui.detail.FeatureTypeStyleDetails)3 File (java.io.File)3 PolygonSymbolizer (org.geotools.styling.PolygonSymbolizer)3 TextSymbolizer (org.geotools.styling.TextSymbolizer)3 TextSymbolizerDetails (com.sldeditor.ui.detail.TextSymbolizerDetails)2 VOGeoServerFTSComposite (com.sldeditor.ui.detail.vendor.geoserver.featuretypestyle.VOGeoServerFTSComposite)2 GetMinimumVersionInterface (com.sldeditor.ui.panels.GetMinimumVersionInterface)2 MalformedURLException (java.net.MalformedURLException)2 Graphic (org.geotools.styling.Graphic)2 OtherText (org.geotools.styling.OtherText)2 OtherTextImpl (org.geotools.styling.OtherTextImpl)2 RasterSymbolizer (org.geotools.styling.RasterSymbolizer)2 TextSymbolizer2 (org.geotools.styling.TextSymbolizer2)2