From: Ben Soares Date: Wed, 2 Sep 2020 17:25:40 +0000 (+0100) Subject: JAL-3280 Test for remote release build_properties file version check X-Git-Tag: Develop-2_11_2_0-d20201215~4 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=012234b488930ee960dae2308a1f7dd03ff80b7a;p=jalview.git JAL-3280 Test for remote release build_properties file version check --- diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java index ef42589..13532e7 100755 --- a/src/jalview/bin/Cache.java +++ b/src/jalview/bin/Cache.java @@ -1666,13 +1666,13 @@ public class Cache getdownDistDir = distDir; } - private static String getGetdownAppbase() + public static String getGetdownAppbase() { setGetdownAppbase(); return getdownAppbase; } - private static String getAppbaseBuildProperties() + public static String getAppbaseBuildProperties() { String appbase = getGetdownAppbase(); return appbase + "/" + getdownDistDir + "/build_properties"; diff --git a/test/jalview/bin/CacheTest.java b/test/jalview/bin/CacheTest.java index e762dd5..9edfd3b 100644 --- a/test/jalview/bin/CacheTest.java +++ b/test/jalview/bin/CacheTest.java @@ -20,9 +20,10 @@ */ package jalview.bin; +import static org.testng.Assert.assertNotEquals; +import static org.testng.Assert.assertTrue; import static org.testng.AssertJUnit.assertEquals; - -import jalview.gui.JvOptionPane; +import static org.testng.AssertJUnit.assertNotNull; import java.text.SimpleDateFormat; import java.util.Date; @@ -32,6 +33,8 @@ import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; +import jalview.gui.JvOptionPane; + public class CacheTest { @@ -70,9 +73,28 @@ public class CacheTest assertEquals(formattedDate, formattedDate2); // currently using Locale.UK to format dates: - assertEquals( - formattedDate2, - SimpleDateFormat.getDateTimeInstance(SimpleDateFormat.MEDIUM, - SimpleDateFormat.MEDIUM, Locale.UK).format(now)); + assertEquals(formattedDate2, + SimpleDateFormat + .getDateTimeInstance(SimpleDateFormat.MEDIUM, + SimpleDateFormat.MEDIUM, Locale.UK) + .format(now)); + } + + @Test(groups = "Functional") + public void testVersionChecker() + { + Cache.loadProperties("test/jalview/bin/testProps.jvprops"); + try + { + // 10s sleep to allow VersionChecker thread to run + Thread.sleep(10000); + } catch (Exception e) + { + e.printStackTrace(); + } + String latestVersion = Cache.getProperty("LATEST_VERSION"); + assertNotNull(latestVersion); + assertNotEquals(latestVersion, "test"); + assertTrue(latestVersion.startsWith("2.")); } } diff --git a/test/jalview/bin/testProps.jvprops b/test/jalview/bin/testProps.jvprops new file mode 100644 index 0000000..a1ab82a --- /dev/null +++ b/test/jalview/bin/testProps.jvprops @@ -0,0 +1,2 @@ +VERSION_CHECK=true +LATEST_VERSION=test