use of com.sequenceiq.cloudbreak.util.VersionComparator in project cloudbreak by hortonworks.
the class StackImageUpdateService method isCbVersionOk.
public boolean isCbVersionOk(Stack stack) {
CloudbreakDetails cloudbreakDetails = componentConfigProviderService.getCloudbreakDetails(stack.getId());
VersionComparator versionComparator = new VersionComparator();
String version = StringUtils.substringBefore(cloudbreakDetails.getVersion(), "-");
int compare = versionComparator.compare(() -> version, () -> MIN_VERSION);
return compare >= 0;
}
use of com.sequenceiq.cloudbreak.util.VersionComparator in project cloudbreak by hortonworks.
the class StackStopRestrictionService method isCbVersionBeforeMinVersion.
private boolean isCbVersionBeforeMinVersion(String cbVersion, String minVersion) {
VersionComparator versionComparator = new VersionComparator();
String version = StringUtils.substringBefore(cbVersion, "-");
int compare = versionComparator.compare(() -> version, () -> minVersion);
return compare < 0;
}
use of com.sequenceiq.cloudbreak.util.VersionComparator in project cloudbreak by hortonworks.
the class MountDisks method isCbVersionPostOptimisation.
private boolean isCbVersionPostOptimisation(Stack stack) {
CloudbreakDetails cloudbreakDetails = componentConfigProviderService.getCloudbreakDetails(stack.getId());
VersionComparator versionComparator = new VersionComparator();
String version = substringBefore(cloudbreakDetails.getVersion(), "-");
int compare = versionComparator.compare(() -> version, () -> MIN_VERSION);
return compare >= 0;
}
use of com.sequenceiq.cloudbreak.util.VersionComparator in project cloudbreak by hortonworks.
the class ComponentVersionComparator method permitCmAndStackUpgradeByComponentVersion.
boolean permitCmAndStackUpgradeByComponentVersion(String currentVersion, String newVersion) {
boolean result = false;
if (currentVersion != null && newVersion != null) {
VersionPrefix prefixMatcher = new VersionPrefix();
if (prefixMatcher.prefixMatch(() -> currentVersion, () -> newVersion, MAJOR)) {
VersionComparator comparator = new VersionComparator();
result = comparator.compare(() -> currentVersion, () -> newVersion) < 0;
}
}
return result;
}
use of com.sequenceiq.cloudbreak.util.VersionComparator in project cloudbreak by hortonworks.
the class MixedPackageVersionComparator method getComponentsWithNewerVersionThanTheTarget.
public Map<String, String> getComponentsWithNewerVersionThanTheTarget(Map<String, String> targetProducts, String targetCmVersion, Set<ParcelInfo> activeParcels, String activeCmVersion) {
VersionComparator versionComparator = new VersionComparator();
Map<String, String> componentsWithNewerVersion = activeParcels.stream().filter(parcelInfo -> compareParcelVersions(parcelInfo, targetProducts, versionComparator)).collect(Collectors.toMap(ParcelInfo::getName, ParcelInfo::getVersion));
if (versionComparator.compare(() -> activeCmVersion, () -> targetCmVersion) > 0) {
componentsWithNewerVersion.put(CM.getDisplayName(), activeCmVersion);
}
return componentsWithNewerVersion;
}
Aggregations