@Test public void testPermitUpgradeShouldReturnTrueWhenTheVersionsAreEqualAndTheBuildNumberIsGreater() { Image currentImage = createImage("7.2.1", "2000"); Image candidateImage = createImage("7.2.1", "2001"); when(componentBuildNumberComparator.compare(currentImage, candidateImage, BUILD_NUMBER_KEY)).thenReturn(true); boolean actual = underTest.permitCmAndStackUpgrade(currentImage, candidateImage, VERSION_KEY, BUILD_NUMBER_KEY); assertTrue(actual); verify(componentBuildNumberComparator).compare(currentImage, candidateImage, BUILD_NUMBER_KEY); }
public boolean permitCmAndStackUpgrade(Image currentImage, Image image, String versionKey, String buildNumberKey) { String currentVersion = getVersionFromImage(currentImage, versionKey); String newVersion = getVersionFromImage(image, versionKey); return versionsArePresent(currentVersion, newVersion) && permitCmAndStackUpgradeByComponentVersion(currentVersion, newVersion) || permitCmAndStackUpgradeByBuildNumber(currentImage, image, buildNumberKey, currentVersion, newVersion); }
UpgradePermissionProvider { public boolean permitCmAndStackUpgrade(Image currentImage, Image image, String versionKey, String buildNumberKey) { String currentVersion = getVersionFromImage(currentImage, versionKey); String newVersion = getVersionFromImage(image, versionKey); return versionsArePresent(currentVersion, newVersion) && permitCmAndStackUpgradeByComponentVersion(currentVersion, newVersion) || permitCmAndStackUpgradeByBuildNumber(currentImage, image, buildNumberKey, currentVersion, newVersion); } }
UpgradePermissionProvider { public boolean permitCmAndStackUpgrade(Image currentImage, Image image, String versionKey, String buildNumberKey) { String currentVersion = getVersionFromImage(currentImage, versionKey); String newVersion = getVersionFromImage(image, versionKey); return versionsArePresent(currentVersion, newVersion) && permitCmAndStackUpgradeByComponentVersion(currentVersion, newVersion) || permitCmAndStackUpgradeByBuildNumber(currentImage, image, buildNumberKey, currentVersion, newVersion); }  }
UpgradePermissionProvider { public boolean permitCmAndStackUpgrade(Image currentImage, Image image, String versionKey, String buildNumberKey) { String currentVersion = getVersionFromImage(currentImage, versionKey); String newVersion = getVersionFromImage(image, versionKey); return versionsArePresent(currentVersion, newVersion) && permitCmAndStackUpgradeByComponentVersion(currentVersion, newVersion) || permitCmAndStackUpgradeByBuildNumber(currentImage, image, buildNumberKey, currentVersion, newVersion); }  boolean permitCmAndStackUpgrade(Image currentImage, Image image, String versionKey, String buildNumberKey); boolean permitExtensionUpgrade(String currentVersion, String newVersion); }
UpgradePermissionProvider { public boolean permitCmAndStackUpgrade(Image currentImage, Image image, String versionKey, String buildNumberKey) { String currentVersion = getVersionFromImage(currentImage, versionKey); String newVersion = getVersionFromImage(image, versionKey); return versionsArePresent(currentVersion, newVersion) && permitCmAndStackUpgradeByComponentVersion(currentVersion, newVersion) || permitCmAndStackUpgradeByBuildNumber(currentImage, image, buildNumberKey, currentVersion, newVersion); }  boolean permitCmAndStackUpgrade(Image currentImage, Image image, String versionKey, String buildNumberKey); boolean permitExtensionUpgrade(String currentVersion, String newVersion);  }