Search in sources :

Example 16 with ApiParcel

use of com.cloudera.api.swagger.model.ApiParcel in project cloudbreak by hortonworks.

the class ClouderaManagerParcelDecommissionServiceTest method createApiParcel.

private ApiParcel createApiParcel(String product, String version, ParcelStatus parcelStatus) {
    ApiParcel parcel = new ApiParcel();
    parcel.setProduct(product);
    parcel.setVersion(version);
    parcel.setStage(parcelStatus.name());
    return parcel;
}
Also used : ApiParcel(com.cloudera.api.swagger.model.ApiParcel)

Example 17 with ApiParcel

use of com.cloudera.api.swagger.model.ApiParcel in project cloudbreak by hortonworks.

the class ClouderaManagerParcelActivationListenerTaskTest method checkStatusOneActivating.

@Test
void checkStatusOneActivating() throws ApiException {
    when(clouderaManagerApiPojoFactory.getParcelsResourceApi(apiClientMock)).thenReturn(parcelsResourcesApi);
    ClouderaManagerCommandPollerObject clouderaManagerCommandPollerObject = new ClouderaManagerCommandPollerObject(stack, apiClientMock, COMMAND_ID);
    ApiParcel apiParcel1 = TestUtil.apiParcel(CDH, ACTIVATED);
    ApiParcel apiParcel2 = TestUtil.apiParcel(CDSW, ACTIVATING);
    ApiParcelList apiParcelList = new ApiParcelList().items(List.of(apiParcel1, apiParcel2));
    when(parcelsResourcesApi.readParcels(eq(STACK_NAME), eq(SUMMARY))).thenReturn(apiParcelList);
    assertFalse(underTest.checkStatus(clouderaManagerCommandPollerObject));
}
Also used : ApiParcel(com.cloudera.api.swagger.model.ApiParcel) ClouderaManagerCommandPollerObject(com.sequenceiq.cloudbreak.cm.polling.ClouderaManagerCommandPollerObject) ApiParcelList(com.cloudera.api.swagger.model.ApiParcelList) Test(org.junit.jupiter.api.Test)

Example 18 with ApiParcel

use of com.cloudera.api.swagger.model.ApiParcel in project cloudbreak by hortonworks.

the class ClouderaManagerParcelActivationListenerTaskTest method checkStatusBothActivating.

@Test
void checkStatusBothActivating() throws ApiException {
    when(clouderaManagerApiPojoFactory.getParcelsResourceApi(eq(apiClientMock))).thenReturn(parcelsResourcesApi);
    ClouderaManagerCommandPollerObject clouderaManagerCommandPollerObject = new ClouderaManagerCommandPollerObject(stack, apiClientMock, COMMAND_ID);
    ApiParcel apiParcel1 = TestUtil.apiParcel(CDH, ACTIVATING);
    ApiParcel apiParcel2 = TestUtil.apiParcel(CDSW, ACTIVATING);
    ApiParcelList apiParcelList = new ApiParcelList().items(List.of(apiParcel1, apiParcel2));
    when(parcelsResourcesApi.readParcels(eq(STACK_NAME), eq(SUMMARY))).thenReturn(apiParcelList);
    assertFalse(underTest.checkStatus(clouderaManagerCommandPollerObject));
}
Also used : ApiParcel(com.cloudera.api.swagger.model.ApiParcel) ClouderaManagerCommandPollerObject(com.sequenceiq.cloudbreak.cm.polling.ClouderaManagerCommandPollerObject) ApiParcelList(com.cloudera.api.swagger.model.ApiParcelList) Test(org.junit.jupiter.api.Test)

Example 19 with ApiParcel

use of com.cloudera.api.swagger.model.ApiParcel in project cloudbreak by hortonworks.

the class ClouderaManagerParcelActivationListenerTaskTest method checkStatusMissing.

@Test
void checkStatusMissing() throws ApiException {
    when(clouderaManagerApiPojoFactory.getParcelsResourceApi(eq(apiClientMock))).thenReturn(parcelsResourcesApi);
    ClouderaManagerCommandPollerObject clouderaManagerCommandPollerObject = new ClouderaManagerCommandPollerObject(stack, apiClientMock, COMMAND_ID);
    ApiParcel apiParcel1 = TestUtil.apiParcel(CDH, ACTIVATED);
    ApiParcelList apiParcelList = new ApiParcelList().items(List.of(apiParcel1));
    when(parcelsResourcesApi.readParcels(eq(STACK_NAME), eq(SUMMARY))).thenReturn(apiParcelList);
    assertFalse(underTest.checkStatus(clouderaManagerCommandPollerObject));
}
Also used : ApiParcel(com.cloudera.api.swagger.model.ApiParcel) ClouderaManagerCommandPollerObject(com.sequenceiq.cloudbreak.cm.polling.ClouderaManagerCommandPollerObject) ApiParcelList(com.cloudera.api.swagger.model.ApiParcelList) Test(org.junit.jupiter.api.Test)

Example 20 with ApiParcel

use of com.cloudera.api.swagger.model.ApiParcel in project cloudbreak by hortonworks.

the class ClouderaManagerParcelDeletedListenerTask method doStatusCheck.

@Override
protected boolean doStatusCheck(ClouderaManagerCommandPollerObject pollerObject) throws ApiException {
    ApiClient apiClient = pollerObject.getApiClient();
    Stack stack = pollerObject.getStack();
    ApiParcelList parcels = getClouderaManagerParcels(apiClient, stack.getName());
    List<ApiParcel> existedParcels = collectExistingParcels(parcels);
    if (existedParcels.isEmpty()) {
        LOGGER.debug("Parcels are deleted successfully.");
        return true;
    } else {
        LOGGER.debug("Some parcels are not yet deleted: [{}].", getJoinedParcelStages(existedParcels));
        return false;
    }
}
Also used : ApiParcel(com.cloudera.api.swagger.model.ApiParcel) ApiParcelList(com.cloudera.api.swagger.model.ApiParcelList) ApiClient(com.cloudera.api.swagger.client.ApiClient) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack)

Aggregations

ApiParcel (com.cloudera.api.swagger.model.ApiParcel)20 ApiParcelList (com.cloudera.api.swagger.model.ApiParcelList)9 ApiClient (com.cloudera.api.swagger.client.ApiClient)7 ClouderaManagerCommandPollerObject (com.sequenceiq.cloudbreak.cm.polling.ClouderaManagerCommandPollerObject)6 Test (org.junit.jupiter.api.Test)6 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)5 ParcelResourceApi (com.cloudera.api.swagger.ParcelResourceApi)4 ApiParcelState (com.cloudera.api.swagger.model.ApiParcelState)3 Description (com.sequenceiq.it.cloudbreak.context.Description)3 Test (org.testng.annotations.Test)3 ApiException (com.cloudera.api.swagger.client.ApiException)2 Multimap (com.google.common.collect.Multimap)2 ClouderaManagerProduct (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct)2 ExtendedPollingResult (com.sequenceiq.cloudbreak.polling.ExtendedPollingResult)2 TestCaseDescription (com.sequenceiq.it.cloudbreak.context.TestCaseDescription)2 ClouderaManagerProductTestDto (com.sequenceiq.it.cloudbreak.dto.ClouderaManagerProductTestDto)2 ClouderaManagerTestDto (com.sequenceiq.it.cloudbreak.dto.ClouderaManagerTestDto)2 ClusterTestDto (com.sequenceiq.it.cloudbreak.dto.ClusterTestDto)2 InstanceGroupTestDto (com.sequenceiq.it.cloudbreak.dto.InstanceGroupTestDto)2 StackTestDto (com.sequenceiq.it.cloudbreak.dto.stack.StackTestDto)2