Search in sources :

Example 1 with ImageComponentVersions

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.image.ImageComponentVersions in project cloudbreak by hortonworks.

the class SdxRuntimeUpgradeServiceTest method testShowAvailableImagesShouldReturnAllUpgradeCandidates.

@Test
public void testShowAvailableImagesShouldReturnAllUpgradeCandidates() {
    ImageComponentVersions imageComponentVersionsFor702 = new ImageComponentVersions();
    imageComponentVersionsFor702.setCm(V_7_0_2);
    imageComponentVersionsFor702.setCdp(V_7_0_2);
    ImageComponentVersions imageComponentVersionsFor703 = new ImageComponentVersions();
    imageComponentVersionsFor703.setCm(V_7_0_3);
    imageComponentVersionsFor703.setCdp(V_7_0_3);
    ImageInfoV4Response imageInfo1 = new ImageInfoV4Response();
    imageInfo1.setImageId(IMAGE_ID + 1);
    imageInfo1.setCreated(1);
    imageInfo1.setComponentVersions(imageComponentVersionsFor702);
    ImageInfoV4Response imageInfo2 = new ImageInfoV4Response();
    imageInfo2.setImageId(IMAGE_ID + 2);
    imageInfo2.setCreated(2);
    imageInfo2.setComponentVersions(imageComponentVersionsFor702);
    ImageInfoV4Response imageInfo3 = new ImageInfoV4Response();
    imageInfo3.setImageId(IMAGE_ID + 3);
    imageInfo3.setCreated(3);
    imageInfo3.setComponentVersions(imageComponentVersionsFor703);
    UpgradeV4Response upgradeV4Response = new UpgradeV4Response();
    upgradeV4Response.setUpgradeCandidates(List.of(imageInfo1, imageInfo2, imageInfo3));
    sdxUpgradeRequest.setShowAvailableImages(SdxUpgradeShowAvailableImages.SHOW);
    underTest.filterSdxUpgradeResponse(ACCOUNT_ID, sdxCluster.getClusterName(), sdxUpgradeRequest, upgradeV4Response);
    assertEquals(3, upgradeV4Response.getUpgradeCandidates().size());
    assertTrue(upgradeV4Response.getUpgradeCandidates().stream().anyMatch(imageInfoV4Response -> imageInfoV4Response.getImageId().equals(IMAGE_ID + 1)));
    assertTrue(upgradeV4Response.getUpgradeCandidates().stream().anyMatch(imageInfoV4Response -> imageInfoV4Response.getImageId().equals(IMAGE_ID + 2)));
    assertTrue(upgradeV4Response.getUpgradeCandidates().stream().anyMatch(imageInfoV4Response -> imageInfoV4Response.getImageId().equals(IMAGE_ID + 3)));
}
Also used : UpgradeV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.upgrade.UpgradeV4Response) Assertions.assertThrows(org.junit.jupiter.api.Assertions.assertThrows) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) BeforeEach(org.junit.jupiter.api.BeforeEach) RestClientFactory(com.sequenceiq.cloudbreak.client.RestClientFactory) SdxCluster(com.sequenceiq.datalake.entity.SdxCluster) SdxUpgradeResponse(com.sequenceiq.sdx.api.model.SdxUpgradeResponse) SdxUpgradeShowAvailableImages(com.sequenceiq.sdx.api.model.SdxUpgradeShowAvailableImages) ArgumentMatchers.anyLong(org.mockito.ArgumentMatchers.anyLong) ImageComponentVersions(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.image.ImageComponentVersions) PaywallAccessChecker(com.sequenceiq.cloudbreak.auth.PaywallAccessChecker) EntitlementService(com.sequenceiq.cloudbreak.auth.altus.EntitlementService) SdxClusterShape(com.sequenceiq.sdx.api.model.SdxClusterShape) Mock(org.mockito.Mock) SdxReactorFlowManager(com.sequenceiq.datalake.flow.SdxReactorFlowManager) StringUtils(org.apache.commons.lang3.StringUtils) JsonCMLicense(com.sequenceiq.cloudbreak.auth.JsonCMLicense) ArrayList(java.util.ArrayList) Mockito.doThrow(org.mockito.Mockito.doThrow) CloudbreakMessagesService(com.sequenceiq.cloudbreak.message.CloudbreakMessagesService) SdxUpgradeClusterConverter(com.sequenceiq.datalake.controller.sdx.SdxUpgradeClusterConverter) ImageInfoV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.image.ImageInfoV4Response) ThreadBasedUserCrnProvider(com.sequenceiq.cloudbreak.auth.ThreadBasedUserCrnProvider) ArgumentCaptor(org.mockito.ArgumentCaptor) Assertions.assertFalse(org.junit.jupiter.api.Assertions.assertFalse) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) UpgradeV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.upgrade.UpgradeV4Response) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) SdxService(com.sequenceiq.datalake.service.sdx.SdxService) InjectMocks(org.mockito.InjectMocks) RegionAwareInternalCrnGenerator(com.sequenceiq.cloudbreak.auth.crn.RegionAwareInternalCrnGenerator) BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException) MockitoExtension(org.mockito.junit.jupiter.MockitoExtension) StackV4Endpoint(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.StackV4Endpoint) ReflectionTestUtils(org.springframework.test.util.ReflectionTestUtils) Mockito.times(org.mockito.Mockito.times) Mockito.when(org.mockito.Mockito.when) Crn(com.sequenceiq.cloudbreak.auth.crn.Crn) Mockito.verify(org.mockito.Mockito.verify) DisplayName(org.junit.jupiter.api.DisplayName) RegionAwareInternalCrnGeneratorFactory(com.sequenceiq.cloudbreak.auth.crn.RegionAwareInternalCrnGeneratorFactory) Test(org.junit.jupiter.api.Test) List(java.util.List) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) SdxUpgradeReplaceVms(com.sequenceiq.sdx.api.model.SdxUpgradeReplaceVms) SdxUpgradeRequest(com.sequenceiq.sdx.api.model.SdxUpgradeRequest) ClouderaManagerLicenseProvider(com.sequenceiq.cloudbreak.auth.ClouderaManagerLicenseProvider) Assertions.assertDoesNotThrow(org.junit.jupiter.api.Assertions.assertDoesNotThrow) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) ImageInfoV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.image.ImageInfoV4Response) ImageComponentVersions(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.image.ImageComponentVersions) Test(org.junit.jupiter.api.Test)

Example 2 with ImageComponentVersions

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.image.ImageComponentVersions in project cloudbreak by hortonworks.

the class SdxRuntimeUpgradeServiceTest method creatImageComponentVersions.

private ImageComponentVersions creatImageComponentVersions(String cmVersion, String cdpVersion) {
    ImageComponentVersions imageComponentVersions = new ImageComponentVersions();
    imageComponentVersions.setCm(cmVersion);
    imageComponentVersions.setCdp(cdpVersion);
    return imageComponentVersions;
}
Also used : ImageComponentVersions(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.image.ImageComponentVersions)

Example 3 with ImageComponentVersions

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.image.ImageComponentVersions in project cloudbreak by hortonworks.

the class UpgradeOptionsResponseFactoryTest method creatExpectedPackageVersions.

private ImageComponentVersions creatExpectedPackageVersions() {
    ImageComponentVersions imageComponentVersions = new ImageComponentVersions();
    imageComponentVersions.setCm(V_7_0_3);
    imageComponentVersions.setCdp(V_7_0_2);
    return imageComponentVersions;
}
Also used : ImageComponentVersions(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.image.ImageComponentVersions)

Example 4 with ImageComponentVersions

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.image.ImageComponentVersions in project cloudbreak by hortonworks.

the class ClusterUpgradeAvailabilityServiceTest method createExpectedPackageVersions.

private ImageComponentVersions createExpectedPackageVersions() {
    ImageComponentVersions imageComponentVersions = new ImageComponentVersions();
    imageComponentVersions.setCm(V_7_0_3);
    imageComponentVersions.setCdp(V_7_0_2);
    return imageComponentVersions;
}
Also used : ImageComponentVersions(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.image.ImageComponentVersions)

Example 5 with ImageComponentVersions

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.image.ImageComponentVersions in project cloudbreak by hortonworks.

the class SdxRuntimeUpgradeServiceTest method creatExpectedPackageVersions.

private ImageComponentVersions creatExpectedPackageVersions() {
    ImageComponentVersions imageComponentVersions = new ImageComponentVersions();
    imageComponentVersions.setCm(V_7_0_3);
    imageComponentVersions.setCdp(V_7_0_2);
    return imageComponentVersions;
}
Also used : ImageComponentVersions(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.image.ImageComponentVersions)

Aggregations

ImageComponentVersions (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.image.ImageComponentVersions)11 ImageInfoV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.image.ImageInfoV4Response)5 UpgradeV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.upgrade.UpgradeV4Response)3 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)3 Test (org.junit.jupiter.api.Test)3 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)3 StackV4Endpoint (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.StackV4Endpoint)2 ClouderaManagerLicenseProvider (com.sequenceiq.cloudbreak.auth.ClouderaManagerLicenseProvider)2 JsonCMLicense (com.sequenceiq.cloudbreak.auth.JsonCMLicense)2 PaywallAccessChecker (com.sequenceiq.cloudbreak.auth.PaywallAccessChecker)2 ThreadBasedUserCrnProvider (com.sequenceiq.cloudbreak.auth.ThreadBasedUserCrnProvider)2 EntitlementService (com.sequenceiq.cloudbreak.auth.altus.EntitlementService)2 Crn (com.sequenceiq.cloudbreak.auth.crn.Crn)2 RegionAwareInternalCrnGenerator (com.sequenceiq.cloudbreak.auth.crn.RegionAwareInternalCrnGenerator)2 RegionAwareInternalCrnGeneratorFactory (com.sequenceiq.cloudbreak.auth.crn.RegionAwareInternalCrnGeneratorFactory)2 RestClientFactory (com.sequenceiq.cloudbreak.client.RestClientFactory)2 CloudbreakMessagesService (com.sequenceiq.cloudbreak.message.CloudbreakMessagesService)2 SdxUpgradeClusterConverter (com.sequenceiq.datalake.controller.sdx.SdxUpgradeClusterConverter)2 SdxCluster (com.sequenceiq.datalake.entity.SdxCluster)2 SdxReactorFlowManager (com.sequenceiq.datalake.flow.SdxReactorFlowManager)2