use of com.github.zafarkhaja.semver.Version in project grafikon by jub77.
the class MainFrame method getInfoText.
private String getInfoText(String txt) {
log.debug(txt);
Version version = model.getVersionInfo().getVersionWithoutBuild();
return String.format("%s%n%s", version.toString(), txt);
}
use of com.github.zafarkhaja.semver.Version in project steve by RWTH-i5-IDSG.
the class GithubReleaseCheckService method getReport.
// -------------------------------------------------------------------------
// Private helpers
// -------------------------------------------------------------------------
private static ReleaseReport getReport(ReleaseResponse response) {
String githubVersion = extractVersion(response);
Version build = Version.valueOf(SteveConfiguration.CONFIG.getSteveVersion());
Version github = Version.valueOf(githubVersion);
boolean isGithubMoreRecent = github.greaterThan(build);
String downloadUrl = decideDownloadUrl(response);
ReleaseReport ur = new ReleaseReport(isGithubMoreRecent);
ur.setGithubVersion(githubVersion);
ur.setDownloadUrl(downloadUrl);
ur.setHtmlUrl(response.getHtmlUrl());
return ur;
}
use of com.github.zafarkhaja.semver.Version in project incubator-pulsar by apache.
the class BrokerVersionFilter method filter.
/**
* From the given set of available broker candidates, filter those using the version numbers.
*
* @param brokers
* The currently available brokers that have not already been filtered.
* @param bundleToAssign
* The data for the bundle to assign.
* @param loadData
* The load data from the leader broker.
* @param conf
* The service configuration.
*/
public void filter(Set<String> brokers, BundleData bundleToAssign, LoadData loadData, ServiceConfiguration conf) throws BrokerFilterBadVersionException {
if (!conf.isPreferLaterVersions()) {
return;
}
com.github.zafarkhaja.semver.Version latestVersion = null;
try {
latestVersion = getLatestVersionNumber(brokers, loadData);
LOG.info("Latest broker version found was [{}]", latestVersion);
} catch (Exception x) {
LOG.warn("Disabling PreferLaterVersions feature; reason: " + x.getMessage());
throw new BrokerFilterBadVersionException("Cannot determine newest broker version: " + x.getMessage());
}
int numBrokersLatestVersion = 0;
int numBrokersOlderVersion = 0;
Iterator<String> brokerIterator = brokers.iterator();
while (brokerIterator.hasNext()) {
String broker = brokerIterator.next();
BrokerData data = loadData.getBrokerData().get(broker);
String brokerVersion = data.getLocalData().getBrokerVersionString();
com.github.zafarkhaja.semver.Version brokerVersionVersion = Version.valueOf(brokerVersion);
if (brokerVersionVersion.equals(latestVersion)) {
LOG.debug("Broker [{}] is running the latest version ([{}])", broker, brokerVersion);
++numBrokersLatestVersion;
} else {
LOG.info("Broker [{}] is running an older version ([{}]); latest version is [{}]", broker, brokerVersion, latestVersion);
++numBrokersOlderVersion;
brokerIterator.remove();
}
}
if (numBrokersOlderVersion == 0) {
LOG.info("All {} brokers are running the latest version [{}]", numBrokersLatestVersion, latestVersion);
}
}
use of com.github.zafarkhaja.semver.Version in project incubator-pulsar by apache.
the class BrokerVersionFilterTest method testLatestVersion.
@Test
public void testLatestVersion() {
LoadData loadData = initLoadData();
Set<String> brokers = new TreeSet<>();
brokers.add("broker1");
brokers.add("broker2");
brokers.add("broker3");
BrokerVersionFilter filter = new BrokerVersionFilter();
try {
Version latestVersion = filter.getLatestVersionNumber(brokers, loadData);
Assert.assertEquals(latestVersion.getMajorVersion(), 1);
Assert.assertEquals(latestVersion.getMinorVersion(), 2);
Assert.assertEquals(latestVersion.getPatchVersion(), 0);
} catch (BrokerFilterBadVersionException bad) {
Assert.fail(bad.getMessage(), bad);
}
ServiceConfiguration configuration = new ServiceConfiguration();
configuration.setPreferLaterVersions(true);
try {
filter.filter(brokers, null, loadData, configuration);
// Only one broker is running the latest version
Assert.assertEquals(brokers.size(), 1);
} catch (BrokerFilterBadVersionException bad) {
Assert.fail(bad.getMessage(), bad);
}
}
use of com.github.zafarkhaja.semver.Version in project cf-java-client by cloudfoundry.
the class InfoTest method info.
@Test
public void info() {
this.cloudFoundryClient.info().get(GetInfoRequest.builder().build()).as(StepVerifier::create).consumeNextWith(response -> {
Version expected = Version.valueOf(SUPPORTED_API_VERSION);
Version actual = Version.valueOf(response.getApiVersion());
assertThat(actual).isLessThanOrEqualTo(expected);
}).expectComplete().verify(Duration.ofMinutes(5));
}
Aggregations