Search in sources :

Example 21 with VersionData

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

the class VersionDataTest method testDecode.

/**
 * Test method for {@link com.sldeditor.common.vendoroption.VersionData#decode(java.lang.Class, java.lang.String)}.
 * Test method for {@link com.sldeditor.common.vendoroption.VersionData#getVersionString()}.
 */
@Test
public void testDecode() {
    assertNull(VersionData.decode(null, null));
    String expectedVersionString1 = "1.2.3";
    VersionData versionData1 = VersionData.decode(getClass(), expectedVersionString1);
    assertEquals(getClass(), versionData1.getVendorOptionType());
    assertEquals(expectedVersionString1, versionData1.getVersionString());
    String expectedVersionString2 = "1.2";
    VersionData versionData2 = VersionData.decode(getClass(), expectedVersionString2);
    assertEquals(expectedVersionString2, versionData2.getVersionString());
    String expectedVersionString3 = "1";
    VersionData versionData3 = VersionData.decode(getClass(), expectedVersionString3);
    assertEquals(expectedVersionString3, versionData3.getVersionString());
    String expectedVersionString4 = "";
    VersionData versionData4 = VersionData.decode(getClass(), expectedVersionString4);
    assertNull(versionData4);
    String expectedVersionString5 = "1,2,3";
    VersionData versionData5 = VersionData.decode(getClass(), expectedVersionString5);
    assertNull(versionData5);
    String expectedVersionString6 = "1.2.3a";
    VersionData versionData6 = VersionData.decode(getClass(), expectedVersionString6);
    assertNull(versionData6);
    String expectedVersionString7 = "Latest";
    VersionData versionData7 = VersionData.decode(getClass(), expectedVersionString7);
    assertEquals(expectedVersionString7, versionData7.getVersionString());
    String expectedVersionString8 = "first";
    VersionData versionData8 = VersionData.decode(getClass(), expectedVersionString8);
    assertEquals(expectedVersionString8, versionData8.getVersionString());
    String expectedVersionString9 = "1.2.3-SNAPSHOT";
    VersionData versionData9 = VersionData.decode(getClass(), expectedVersionString9);
    assertEquals(expectedVersionString9, versionData9.getVersionString());
}
Also used : VersionData(com.sldeditor.common.vendoroption.VersionData) Test(org.junit.Test)

Example 22 with VersionData

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

the class VersionDataTest method testEncodedString.

/**
 * Test method for {@link com.sldeditor.common.vendoroption.VersionData#getEncodedString()}.
 * Test method for {@link com.sldeditor.common.vendoroption.VersionData#getDecodedString(java.lang.String)}.
 */
@Test
public void testEncodedString() {
    VersionData versionData1 = VersionData.decode(getClass(), "2.4.1");
    String encodeString1 = versionData1.getEncodedString();
    VersionData versionData1Decoded = VersionData.getDecodedString(encodeString1);
    assertEquals(versionData1, versionData1Decoded);
    VersionData versionData2 = VersionData.getEarliestVersion(getClass());
    String encodeString2 = versionData2.getEncodedString();
    VersionData versionData2Decoded = VersionData.getDecodedString(encodeString2);
    assertEquals(versionData2, versionData2Decoded);
    VersionData versionData3 = VersionData.getLatestVersion(getClass());
    String encodeString3 = versionData3.getEncodedString();
    VersionData versionData3Decoded = VersionData.getDecodedString(encodeString3);
    assertEquals(versionData3, versionData3Decoded);
}
Also used : VersionData(com.sldeditor.common.vendoroption.VersionData) Test(org.junit.Test)

Example 23 with VersionData

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

the class VersionDataTest method testGetEarliestVersion.

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

Example 24 with VersionData

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

the class VersionDataTest method testGetNotSetVersion.

/**
 * Test method for {@link com.sldeditor.common.vendoroption.VersionData#getNotSetVersion(java.lang.Class)}.
 * Test method for {@link com.sldeditor.common.vendoroption.VersionData#isNotSet()}.
 */
@Test
public void testGetNotSetVersion() {
    VersionData latest = VersionData.getLatestVersion(getClass());
    assertFalse(latest.isNotSet());
    VersionData notSet = VersionData.getNotSetVersion(getClass());
    assertTrue(notSet.isNotSet());
}
Also used : VersionData(com.sldeditor.common.vendoroption.VersionData) Test(org.junit.Test)

Example 25 with VersionData

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

the class VersionDataTest method testInRange.

/**
 * Test method for {@link com.sldeditor.common.vendoroption.VersionData#inRange(com.sldeditor.common.vendoroption.VersionData, com.sldeditor.common.vendoroption.VersionData)}.
 */
@Test
public void testInRange() {
    VersionData versionDataMin = VersionData.decode(getClass(), "2.4.1");
    VersionData versionDataMax = VersionData.decode(getClass(), "2.8.3");
    VersionData versionData1 = VersionData.decode(getClass(), "1.2");
    VersionData versionData2 = VersionData.decode(getClass(), "2.4.0");
    VersionData versionData3 = VersionData.decode(getClass(), "2.4.1");
    // CHECKSTYLE:OFF
    VersionData versionData4 = VersionData.decode(getClass(), "2.5.1");
    VersionData versionData5 = VersionData.decode(getClass(), "2.8.3");
    VersionData versionData6 = VersionData.decode(getClass(), "2.8.4");
    VersionData versionData7 = VersionData.getNotSetVersion(getClass());
    // CHECKSTYLE:ON
    assertFalse(versionData1.inRange(versionDataMin, versionDataMax));
    assertFalse(versionData2.inRange(versionDataMin, versionDataMax));
    assertTrue(versionData3.inRange(versionDataMin, versionDataMax));
    assertTrue(versionData4.inRange(versionDataMin, versionDataMax));
    assertTrue(versionData5.inRange(versionDataMin, versionDataMax));
    assertFalse(versionData6.inRange(versionDataMin, versionDataMax));
    assertFalse(versionData7.inRange(versionDataMin, versionDataMax));
    assertFalse(versionData1.inRange(null, versionDataMax));
    assertFalse(versionData1.inRange(versionDataMin, null));
    assertFalse(versionData1.inRange(null, null));
}
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