@Test public void testIsCbVersionOk() { CloudbreakDetails cloudbreakDetails = new CloudbreakDetails(); cloudbreakDetails.setVersion(StackImageUpdateService.MIN_VERSION); when(componentConfigProviderService.getCloudbreakDetails(stack.getId())).thenReturn(cloudbreakDetails); assertTrue(underTest.isCbVersionOk(stack)); cloudbreakDetails.setVersion("2.6.0"); assertFalse(underTest.isCbVersionOk(stack)); }
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; }
StackImageUpdateService { 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; } }
StackImageUpdateService { 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; }  }
StackImageUpdateService { 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; }  void storeNewImageComponent(Stack stack, StatedImage image); StatedImage getNewImageIfVersionsMatch(Stack stack, String newImageId, String imageCatalogName, String imageCatalogUrl); boolean isCbVersionOk(Stack stack); boolean isStackMatchIfPrewarmed(StatedImage image); CheckResult checkPackageVersions(Stack stack, StatedImage newImage); boolean isValidImage(Stack stack, String newImageId, String imageCatalogName, String imageCatalogUrl); }
StackImageUpdateService { 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; }  void storeNewImageComponent(Stack stack, StatedImage image); StatedImage getNewImageIfVersionsMatch(Stack stack, String newImageId, String imageCatalogName, String imageCatalogUrl); boolean isCbVersionOk(Stack stack); boolean isStackMatchIfPrewarmed(StatedImage image); CheckResult checkPackageVersions(Stack stack, StatedImage newImage); boolean isValidImage(Stack stack, String newImageId, String imageCatalogName, String imageCatalogUrl); static final String MIN_VERSION; }