use of com.sequenceiq.cloudbreak.service.upgrade.image.ImageFilterResult in project cloudbreak by hortonworks.
the class CloudPlatformBasedUpgradeImageFilterTest method testFilterShouldReturnErrorMessageWithoutImages.
@Test
public void testFilterShouldReturnErrorMessageWithoutImages() {
List<Image> images = List.of(createImage(IMAGE_ID_1, AZURE.name()), createImage(IMAGE_ID_2, AZURE.name()));
ImageFilterResult actual = underTest.filter(createImageFilterResult(images), imageFilterParams);
assertTrue(actual.getImages().isEmpty());
assertEquals("There are no eligible images to upgrade for AWS cloud platform.", actual.getReason());
}
use of com.sequenceiq.cloudbreak.service.upgrade.image.ImageFilterResult in project cloudbreak by hortonworks.
the class CloudPlatformBasedUpgradeImageFilterTest method testFilterShouldReturnOnlyOneImage.
@Test
public void testFilterShouldReturnOnlyOneImage() {
Image image1 = createImage(IMAGE_ID_1, AWS.name());
Image image2 = createImage(IMAGE_ID_2, AZURE.name());
List<Image> images = List.of(image1, image2);
ImageFilterResult actual = underTest.filter(createImageFilterResult(images), imageFilterParams);
assertTrue(actual.getImages().contains(image1));
assertFalse(actual.getImages().contains(image2));
assertTrue(actual.getReason().isEmpty());
}
use of com.sequenceiq.cloudbreak.service.upgrade.image.ImageFilterResult in project cloudbreak by hortonworks.
the class CmAndStackVersionUpgradeImageFilterTest method testFilterShouldReturnTrueWhenNotLockedAndCMAndStackPermitcheckIsTrue.
@Test
public void testFilterShouldReturnTrueWhenNotLockedAndCMAndStackPermitcheckIsTrue() {
ImageFilterParams imageFilterParams = createImageFilterParams(false);
when(upgradePermissionProvider.permitStackUpgrade(imageFilterParams, candidateImage)).thenReturn(Boolean.TRUE);
when(upgradePermissionProvider.permitCmUpgrade(imageFilterParams, candidateImage)).thenReturn(Boolean.TRUE);
ImageFilterResult actual = underTest.filter(new ImageFilterResult(List.of(candidateImage)), imageFilterParams);
assertFalse(actual.getImages().isEmpty());
assertTrue(actual.getReason().isEmpty());
}
use of com.sequenceiq.cloudbreak.service.upgrade.image.ImageFilterResult in project cloudbreak by hortonworks.
the class CmAndStackVersionUpgradeImageFilterTest method testFilterShouldReturnErrorMessageWhenNotLockedAndCMPermitcheckIsFalse.
@Test
public void testFilterShouldReturnErrorMessageWhenNotLockedAndCMPermitcheckIsFalse() {
ImageFilterParams imageFilterParams = createImageFilterParams(false);
lenient().when(upgradePermissionProvider.permitStackUpgrade(imageFilterParams, candidateImage)).thenReturn(Boolean.TRUE);
when(upgradePermissionProvider.permitCmUpgrade(imageFilterParams, candidateImage)).thenReturn(Boolean.FALSE);
ImageFilterResult actual = underTest.filter(new ImageFilterResult(List.of(candidateImage)), imageFilterParams);
assertNotLockedCommon(actual);
}
use of com.sequenceiq.cloudbreak.service.upgrade.image.ImageFilterResult in project cloudbreak by hortonworks.
the class CmAndStackVersionUpgradeImageFilterTest method testFilterShouldReturnFalseWhenNotLockedAndCMAndStackPermitcheckIsFalse.
@Test
public void testFilterShouldReturnFalseWhenNotLockedAndCMAndStackPermitcheckIsFalse() {
ImageFilterParams imageFilterParams = createImageFilterParams(false);
lenient().when(upgradePermissionProvider.permitStackUpgrade(imageFilterParams, candidateImage)).thenReturn(Boolean.FALSE);
when(upgradePermissionProvider.permitCmUpgrade(imageFilterParams, candidateImage)).thenReturn(Boolean.FALSE);
ImageFilterResult actual = underTest.filter(new ImageFilterResult(List.of(candidateImage)), imageFilterParams);
assertNotLockedCommon(actual);
}
Aggregations