Search in sources :

Example 41 with VersionData

use of com.sldeditor.common.vendoroption.VersionData 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());
}
Also used : VersionData(com.sldeditor.common.vendoroption.VersionData) VendorOptionVersion(com.sldeditor.common.vendoroption.VendorOptionVersion) Test(org.junit.Test)

Example 42 with VersionData

use of com.sldeditor.common.vendoroption.VersionData 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")));
}
Also used : VersionData(com.sldeditor.common.vendoroption.VersionData) VendorOptionVersion(com.sldeditor.common.vendoroption.VendorOptionVersion) Test(org.junit.Test)

Example 43 with VersionData

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

the class VersionDataTest method testGetLatestVersion.

/**
 * Test method for {@link com.sldeditor.common.vendoroption.VersionData#getLatestVersion(java.lang.Class)}.
 */
@Test
public void testGetLatestVersion() {
    VersionData latest = VersionData.getLatestVersion(getClass());
    assertEquals("Latest", latest.getVersionString());
}
Also used : VersionData(com.sldeditor.common.vendoroption.VersionData) Test(org.junit.Test)

Example 44 with VersionData

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

the class VersionDataTest method testCompareTo.

/**
 * Test method for {@link com.sldeditor.common.vendoroption.VersionData#compareTo(com.sldeditor.common.vendoroption.VersionData)}.
 * Test method for {@link com.sldeditor.common.vendoroption.VersionData#equals(java.lang.Object)}.
 */
@Test
public void testCompareTo() {
    VersionData versionData1 = VersionData.decode(getClass(), "1.2.3");
    VersionData versionData2 = VersionData.decode(getClass(), "1.2.3");
    VersionData versionData3 = VersionData.decode(getClass(), "1.2");
    // CHECKSTYLE:OFF
    VersionData versionData4 = VersionData.decode(getClass(), "8.2.3");
    VersionData versionData5 = VersionData.decode(getClass(), "8.2.2");
    VersionData versionData6 = VersionData.decode(getClass(), "8.2.4");
    VersionData versionData7 = VersionData.decode(getClass(), "8.1.2");
    VersionData versionData8 = VersionData.decode(getClass(), "8.3.4");
    VersionData versionData9 = VersionData.decode(getClass(), "8.3.4-SNAPSHOT");
    // CHECKSTYLE:ON
    assertTrue(versionData1.compareTo(versionData2) == 0);
    assertTrue(versionData1.equals(versionData2));
    assertTrue(versionData1.compareTo(versionData3) != 0);
    assertFalse(versionData1.equals(versionData3));
    assertTrue(versionData1.compareTo(versionData4) != 0);
    assertFalse(versionData1.equals(versionData4));
    assertTrue(versionData3.compareTo(versionData4) != 0);
    assertFalse(versionData3.equals(versionData4));
    assertTrue(versionData4.compareTo(versionData5) != 0);
    assertFalse(versionData4.equals(versionData5));
    assertTrue(versionData4.compareTo(versionData6) != 0);
    assertFalse(versionData4.equals(versionData6));
    assertTrue(versionData4.compareTo(versionData7) != 0);
    assertFalse(versionData4.equals(versionData7));
    assertTrue(versionData4.compareTo(versionData8) != 0);
    assertFalse(versionData4.equals(versionData8));
    assertFalse(versionData4.equals(null));
    assertFalse(versionData4.equals(new String()));
    assertTrue(versionData1.hashCode() == versionData2.hashCode());
    assertFalse(versionData1.hashCode() == versionData4.hashCode());
    // SNAPSHOT versions come before non-SNAPSHOT versions if the numbes are the same
    assertTrue(versionData8.compareTo(versionData9) == 1);
    assertFalse(versionData8.equals(versionData9));
}
Also used : VersionData(com.sldeditor.common.vendoroption.VersionData) Test(org.junit.Test)

Example 45 with VersionData

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

the class VersionDataTest method testClone.

/**
 * Test method for {@link com.sldeditor.common.vendoroption.VersionData#clone()}.
 */
@Test
public void testClone() {
    VersionData versionData1 = VersionData.decode(getClass(), "1.2.3");
    VersionData versionData2 = versionData1.clone();
    assertEquals(versionData1, versionData2);
}
Also used : VersionData(com.sldeditor.common.vendoroption.VersionData) Test(org.junit.Test)

Aggregations

VersionData (com.sldeditor.common.vendoroption.VersionData)56 Test (org.junit.Test)36 ArrayList (java.util.ArrayList)26 VendorOptionVersion (com.sldeditor.common.vendoroption.VendorOptionVersion)13 GeoServerVendorOption (com.sldeditor.common.vendoroption.GeoServerVendorOption)9 PrefData (com.sldeditor.common.preferences.PrefData)7 VendorOptionInfo (com.sldeditor.common.vendoroption.info.VendorOptionInfo)5 Color (java.awt.Color)5 SLDData (com.sldeditor.common.data.SLDData)4 VendorOptionTypeInterface (com.sldeditor.common.vendoroption.VendorOptionTypeInterface)4 File (java.io.File)4 VendorOptionTableModel (com.sldeditor.common.vendoroption.selection.VendorOptionTableModel)3 ValueComboBoxDataGroup (com.sldeditor.ui.widgets.ValueComboBoxDataGroup)3 IOException (java.io.IOException)3 LinkedHashMap (java.util.LinkedHashMap)3 DataSourcePropertiesInterface (com.sldeditor.common.DataSourcePropertiesInterface)2 StyleWrapper (com.sldeditor.common.data.StyleWrapper)2 JsonArray (com.google.gson.JsonArray)1 JsonObject (com.google.gson.JsonObject)1 JsonParser (com.google.gson.JsonParser)1