boolean requiresUpdate(Version latestVersion) { if(latestVersion.isGreaterThan(new VersionImpl(Versions.CURRENT))) { return true; } return false; }
XmlBodyRead(String version) { readVersion = new VersionImpl(version); }
boolean requiresUpdate() throws IOException { data = VersionWSUtil.getLatestVersion(UPDATE_URL); final Version latestVersion = data.getVersion(); if(requiresUpdate(latestVersion)) { return true; } return false; }
public static void versionValidCheck(final String restVersion) throws VersionValidationException { if (restVersion == null) { throw new VersionValidationException("Attribute `version' not available for root element"); } Version stored = new VersionImpl(restVersion); if(!stored.isWithin(MIN, MAX)) { throw new VersionValidationException("Version not supported"); } }
@Override public void run() { final int opt = JOptionPane.showConfirmDialog(null, "An updated version of RESTClient is available. Do you want to download?", "Download update?", JOptionPane.YES_NO_OPTION); if(opt == JOptionPane.YES_OPTION) { openUrl(data.getDlUrl()); } } });
private String getPartValue(Element e) { if(readVersion.isLessThan(VERSION_SINCE_PART_CONTENT)) { return e.getValue(); } else { Element eContent = e.getChildElements("content").get(0); return eContent.getValue(); } }
@Test public void testRequiresUpdate() throws Exception { AppUpdateRunner instance = new AppUpdateRunner(); boolean result = instance.requiresUpdate(new VersionImpl("10.0")); assertTrue(result); } }