use of com.sldeditor.common.vendoroption.VersionData in project sldeditor by robward-scisys.
the class VendorOptionTableModelTest method testGetValueAt.
/**
* Test method for
* {@link com.sldeditor.common.vendoroption.selection.VendorOptionTableModel#getValueAt(int, int)}.
* Test method for
* {@link com.sldeditor.common.vendoroption.selection.VendorOptionTableModel#getRowCount()}.
*/
@Test
public void testGetValueAt() {
Map<VendorOptionTypeInterface, String> options = new LinkedHashMap<VendorOptionTypeInterface, String>();
VendorOptionTypeInterface vendorOption = VendorOptionManager.getInstance().getClass(GeoServerVendorOption.class);
options.put(vendorOption, vendorOption.getName());
VendorOptionTableModel model = new VendorOptionTableModel(options, null);
assertEquals(1, model.getRowCount());
String actualValue1 = (String) model.getValueAt(0, 0);
assertEquals(vendorOption.getName(), actualValue1);
VersionData actualValue2 = (VersionData) model.getValueAt(0, 1);
VersionData latest = VersionData.getLatestVersion(GeoServerVendorOption.class);
assertEquals(latest.getVersionString(), actualValue2.getVersionString());
assertNull(model.getValueAt(0, -1));
assertNull(model.getValueAt(0, 5));
}
use of com.sldeditor.common.vendoroption.VersionData in project sldeditor by robward-scisys.
the class VendorOptionManagerTest method testGetDefaultVendorOptionVersionData.
/**
* Test method for {@link com.sldeditor.common.vendoroption.VendorOptionManager#getDefaultVendorOptionVersionData()}.
*/
@Test
public void testGetDefaultVendorOptionVersionData() {
VersionData versionData = VendorOptionManager.getInstance().getDefaultVendorOptionVersionData();
assertEquals("Latest", versionData.getVersionString());
}
use of com.sldeditor.common.vendoroption.VersionData in project sldeditor by robward-scisys.
the class VendorOptionManagerTest method testOverrideSelectedVendorOptions.
/**
* Test method for
* {@link com.sldeditor.common.vendoroption.VendorOptionManager#overrideSelectedVendorOptions(java.util.List, com.sldeditor.common.vendoroption.VendorOptionVersion)}.
*/
@Test
public void testOverrideSelectedVendorOptions() {
VendorOptionManager.destroyInstance();
VendorOptionManager.getInstance().addVendorOptionListener(obj);
obj.vendorOptionVersionsList.clear();
List<VersionData> vendorOptionList = new ArrayList<VersionData>();
VersionData actualPrefVO = VersionData.decode(GeoServerVendorOption.class, "2.4.2");
vendorOptionList.add(actualPrefVO);
VendorOptionManager.getInstance().setSelectedVendorOptions(vendorOptionList);
assertEquals(1, obj.vendorOptionVersionsList.size());
obj.vendorOptionVersionsList.clear();
List<VersionData> vendorOptionList2 = new ArrayList<VersionData>();
VersionData actualPrefVO2 = VersionData.decode(GeoServerVendorOption.class, "2.3.2");
vendorOptionList2.add(actualPrefVO2);
VendorOptionManager.getInstance().overrideSelectedVendorOptions(vendorOptionList2);
assertEquals(1, obj.vendorOptionVersionsList.size());
// Should now be unaffected by changes in vendor option
obj.vendorOptionVersionsList.clear();
VendorOptionManager.getInstance().setSelectedVendorOptions(vendorOptionList2);
assertEquals(0, obj.vendorOptionVersionsList.size());
VendorOptionManager.destroyInstance();
}
use of com.sldeditor.common.vendoroption.VersionData in project sldeditor by robward-scisys.
the class VendorOptionManagerTest method testIsAllowed.
/**
* Test method for
* {@link com.sldeditor.common.vendoroption.VendorOptionManager#isAllowed(java.util.List, com.sldeditor.common.vendoroption.VendorOptionVersion)}.
*/
@Test
public void testIsAllowed() {
assertFalse(VendorOptionManager.getInstance().isAllowed(null, null));
VersionData versionDataMin = VersionData.decode(getClass(), "2.4.1");
VersionData versionDataMax = VersionData.decode(getClass(), "2.8.3");
VendorOptionVersion vo = new VendorOptionVersion(GeoServerVendorOption.class, versionDataMin, versionDataMax);
List<VersionData> versionList = new ArrayList<VersionData>();
versionList.add(VersionData.decode(GeoServerVendorOption.class, "1.8.3"));
assertFalse(VendorOptionManager.getInstance().isAllowed(versionList, vo));
versionList.add(VersionData.decode(GeoServerVendorOption.class, "2.7.x"));
assertTrue(VendorOptionManager.getInstance().isAllowed(versionList, vo));
}
use of com.sldeditor.common.vendoroption.VersionData in project sldeditor by robward-scisys.
the class VendorOptionStatusTest method testGetVendorOptionVersionString.
/**
* Test method for {@link com.sldeditor.common.vendoroption.VendorOptionStatus#getVendorOptionVersionString(VersionData)}.
*/
@Test
public void testGetVendorOptionVersionString() {
VersionData versionDataMin = VersionData.decode(getClass(), "2.4.1");
VersionData versionDataMax = VersionData.decode(getClass(), "2.8.3");
VendorOptionVersion versionData = new VendorOptionVersion(GeoServerVendorOption.class, versionDataMin, versionDataMax);
assertEquals("", VendorOptionStatus.getVendorOptionVersionString(null));
assertEquals("GeoServer 2.4.1-2.8.3", VendorOptionStatus.getVendorOptionVersionString(versionData));
versionData = new VendorOptionVersion(GeoServerVendorOption.class, versionDataMin, VersionData.decode(getClass(), "Latest"));
assertEquals("GeoServer 2.4.1-", VendorOptionStatus.getVendorOptionVersionString(versionData));
versionData = new VendorOptionVersion(GeoServerVendorOption.class, VersionData.decode(getClass(), "Earliest"), versionDataMax);
assertEquals("GeoServer -2.8.3", VendorOptionStatus.getVendorOptionVersionString(versionData));
}
Aggregations