use of com.sldeditor.common.vendoroption.VendorOptionVersion 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));
}
use of com.sldeditor.common.vendoroption.VendorOptionVersion in project sldeditor by robward-scisys.
the class VendorOptionVersionTest method testVendorOptionVersionClassOfQVersionDataVersionData.
/**
* Test method for {@link com.sldeditor.common.vendoroption.VendorOptionVersion#VendorOptionVersion(java.lang.Class, com.sldeditor.common.vendoroption.VersionData, com.sldeditor.common.vendoroption.VersionData)}.
*/
@Test
public void testVendorOptionVersionClassOfQVersionDataVersionData() {
VersionData versionDataMin = VersionData.decode(getClass(), "2.4.1");
VersionData versionDataMax = VersionData.decode(getClass(), "2.8.3");
VendorOptionVersion vo = new VendorOptionVersion(getClass(), versionDataMin, versionDataMax);
assertEquals(versionDataMax, vo.getLatest());
}
use of com.sldeditor.common.vendoroption.VendorOptionVersion in project sldeditor by robward-scisys.
the class VendorOptionVersionTest method testIsAllowed.
/**
* Test method for {@link com.sldeditor.common.vendoroption.VendorOptionVersion#isAllowed(com.sldeditor.common.vendoroption.VersionData)}.
*/
@Test
public void testIsAllowed() {
VersionData versionDataMin = VersionData.decode(getClass(), "2.4.1");
VersionData versionDataMax = VersionData.decode(getClass(), "2.8.3");
VendorOptionVersion vo = new VendorOptionVersion(getClass(), versionDataMin, versionDataMax);
assertFalse(vo.isAllowed(null));
assertFalse(vo.isAllowed(VersionData.decode(getClass(), "1.8.3")));
assertFalse(vo.isAllowed(VersionData.decode(getClass(), "2.8.4")));
assertTrue(vo.isAllowed(VersionData.decode(getClass(), "2.5.4")));
assertFalse(vo.isAllowed(VersionData.decode(String.class, "2.5.4")));
assertFalse(vo.isAllowed(VersionData.decode(VersionData.class, "2.8.4")));
}
use of com.sldeditor.common.vendoroption.VendorOptionVersion 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);
}
use of com.sldeditor.common.vendoroption.VendorOptionVersion in project sldeditor by robward-scisys.
the class CoordManager method populateCRSList.
/**
* Populate crs list.
*/
public void populateCRSList() {
if (isPopulated()) {
Runnable runnable = () -> {
VendorOptionVersion vendorOptionVersion = VendorOptionManager.getInstance().getDefaultVendorOptionVersion();
ValueComboBoxData notSetValue = new ValueComboBoxData(NOT_SET_CRS, Localisation.getString(CoordManager.class, "common.notSet"), vendorOptionVersion);
crsDataList.add(notSetValue);
Hints hints = null;
for (AuthorityFactory factory : ReferencingFactoryFinder.getCRSAuthorityFactories(hints)) {
String authorityCode = NOT_SET_CRS;
Citation citation = factory.getAuthority();
if (citation != null) {
@SuppressWarnings("unchecked") Collection<Identifier> identifierList = (Collection<Identifier>) citation.getIdentifiers();
authorityCode = identifierList.iterator().next().getCode();
}
Set<String> codeList;
try {
codeList = factory.getAuthorityCodes(CoordinateReferenceSystem.class);
for (String code : codeList) {
String fullCode = String.format("%s:%s", authorityCode, code);
String descriptionText = factory.getDescriptionText(code).toString();
String text = String.format("%s - %s", fullCode, descriptionText);
ValueComboBoxData value = new ValueComboBoxData(fullCode, text, vendorOptionVersion);
crsDataList.add(value);
crsMap.put(fullCode, value);
}
} catch (NoSuchAuthorityCodeException e) {
// ConsoleManager.getInstance().exception(this, e);
} catch (FactoryException e) {
ConsoleManager.getInstance().exception(this, e);
}
}
};
Thread thread = new Thread(runnable);
thread.start();
}
}
Aggregations