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;
}
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));
}
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));
}
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));
}
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;
}
}
Aggregations