Search in sources :

Example 6 with VendorOptionInfo

use of com.sldeditor.common.vendoroption.info.VendorOptionInfo in project sldeditor by robward-scisys.

the class VendorOptionInfoModelTest method testAddVendorOptionInfo.

/**
 * Test method for {@link com.sldeditor.common.vendoroption.info.VendorOptionInfoModel#addVendorOptionInfo(java.util.List)}.
 */
@Test
public void testAddVendorOptionInfo() {
    VendorOptionInfoModel model = new VendorOptionInfoModel();
    assertEquals(0, model.getRowCount());
    model.addVendorOptionInfo(null);
    List<VendorOptionInfo> vendorOptionInfoList = new ArrayList<VendorOptionInfo>();
    String name = "name";
    VersionData versionDataMin = VersionData.decode(getClass(), "2.4.1");
    VersionData versionDataMax = VersionData.decode(getClass(), "2.8.3");
    VendorOptionVersion versionData = new VendorOptionVersion(GeoServerVendorOption.class, versionDataMin, versionDataMax);
    String description = "test description";
    VendorOptionInfo info = new VendorOptionInfo(name, versionData, description);
    vendorOptionInfoList.add(info);
    String name2 = "name2";
    String description2 = "test description2";
    VendorOptionVersion versionData2 = VendorOptionManager.getInstance().getDefaultVendorOptionVersion();
    vendorOptionInfoList.add(new VendorOptionInfo(name2, versionData2, description2));
    VersionData versionDataMin3 = VersionData.decode(getClass(), "2.8.1");
    VersionData versionDataMax3 = VersionData.decode(getClass(), "Latest");
    VendorOptionVersion versionData3 = new VendorOptionVersion(GeoServerVendorOption.class, versionDataMin3, versionDataMax3);
    String name3 = "name3";
    String description3 = "test description3";
    vendorOptionInfoList.add(new VendorOptionInfo(name3, versionData3, description3));
    model.addVendorOptionInfo(vendorOptionInfoList);
    assertEquals(vendorOptionInfoList.size(), model.getRowCount());
    assertNull(model.getValueAt(-1, 0));
    assertNull(model.getValueAt(-1, -1));
    assertNull(model.getValueAt(4, -1));
    assertNull(model.getValueAt(4, 4));
    assertEquals(name2, model.getValueAt(0, 0));
    assertEquals("Strict SLD", model.getValueAt(0, 1));
    assertEquals("GeoServer 2.4.1-2.8.3", model.getValueAt(1, 1));
    // Test get description
    assertNull(model.getDescription(-1));
    assertNull(model.getDescription(10));
    assertEquals(description2, model.getDescription(0));
    model.setSelectedVersion(VersionData.decode(getClass(), "2.5.1"));
    model.isVendorOptionAvailable(-1);
    model.isVendorOptionAvailable(42);
    model.isVendorOptionAvailable(1);
}
Also used : VersionData(com.sldeditor.common.vendoroption.VersionData) VendorOptionVersion(com.sldeditor.common.vendoroption.VendorOptionVersion) ArrayList(java.util.ArrayList) VendorOptionInfoModel(com.sldeditor.common.vendoroption.info.VendorOptionInfoModel) VendorOptionInfo(com.sldeditor.common.vendoroption.info.VendorOptionInfo) Test(org.junit.Test)

Aggregations

VendorOptionInfo (com.sldeditor.common.vendoroption.info.VendorOptionInfo)6 VersionData (com.sldeditor.common.vendoroption.VersionData)5 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)4 VendorOptionVersion (com.sldeditor.common.vendoroption.VendorOptionVersion)3 SLDData (com.sldeditor.common.data.SLDData)1 PrefData (com.sldeditor.common.preferences.PrefData)1 VendorOptionInfoModel (com.sldeditor.common.vendoroption.info.VendorOptionInfoModel)1 VendorOptionInfoPanel (com.sldeditor.common.vendoroption.info.VendorOptionInfoPanel)1 VendorOptionPresent (com.sldeditor.common.vendoroption.minversion.VendorOptionPresent)1 VendorOptionFactoryInterface (com.sldeditor.ui.detail.vendor.VendorOptionFactoryInterface)1 VendorOptionInterface (com.sldeditor.ui.detail.vendor.geoserver.VendorOptionInterface)1 GetMinimumVersionInterface (com.sldeditor.ui.panels.GetMinimumVersionInterface)1 File (java.io.File)1 FeatureTypeStyle (org.geotools.styling.FeatureTypeStyle)1 NamedLayer (org.geotools.styling.NamedLayer)1 PointSymbolizer (org.geotools.styling.PointSymbolizer)1 Rule (org.geotools.styling.Rule)1 Style (org.geotools.styling.Style)1 StyledLayerDescriptor (org.geotools.styling.StyledLayerDescriptor)1