Search in sources :

Example 1 with VOGeoServerFTSCompositeBase

use of com.sldeditor.ui.detail.vendor.geoserver.featuretypestyle.VOGeoServerFTSCompositeBase 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)

Aggregations

VendorOptionVersion (com.sldeditor.common.vendoroption.VendorOptionVersion)1 VendorOptionPresent (com.sldeditor.common.vendoroption.minversion.VendorOptionPresent)1 FeatureTypeStyleDetails (com.sldeditor.ui.detail.FeatureTypeStyleDetails)1 VOGeoServerFTSCompositeBase (com.sldeditor.ui.detail.vendor.geoserver.featuretypestyle.VOGeoServerFTSCompositeBase)1 ArrayList (java.util.ArrayList)1 FeatureTypeStyle (org.geotools.styling.FeatureTypeStyle)1 StyleFactoryImpl (org.geotools.styling.StyleFactoryImpl)1 Test (org.junit.Test)1