use of com.cloudera.api.swagger.model.ApiParcelState in project cloudbreak by hortonworks.
the class ParcelGeneratorUtil method getActivatedCDHParcelWithVersion.
public ApiParcel getActivatedCDHParcelWithVersion(String version) {
ApiParcel parcel = new ApiParcel();
ApiParcelState state = new ApiParcelState();
state.setCount(new BigDecimal(0));
parcel.setProduct("CDH");
parcel.setState(state);
parcel.setVersion(version);
parcel.setStage("ACTIVATED");
return parcel;
}
use of com.cloudera.api.swagger.model.ApiParcelState in project cloudbreak by hortonworks.
the class ParcelMockActivatorUtil method getDefaultApiParcels.
private List<ApiParcel> getDefaultApiParcels(MockedTestContext testContext) {
String blueprintCdhVersion = testContext.getCloudProvider().getBlueprintCdhVersion();
DefaultCDHInfo defaultCDHInfo = inTestCdhParcelProvider.getParcels(blueprintCdhVersion).get(blueprintCdhVersion);
return defaultCDHInfo.getParcels().stream().map(product -> {
ApiParcel apiParcel = new ApiParcel();
apiParcel.setVersion(product.getVersion());
apiParcel.setProduct(product.getName());
apiParcel.setStage("ACTIVATED");
ApiParcelState state = new ApiParcelState();
state.setCount(new BigDecimal(0));
apiParcel.setState(state);
return apiParcel;
}).collect(Collectors.toList());
}
use of com.cloudera.api.swagger.model.ApiParcelState in project cloudbreak by hortonworks.
the class ClouderaManagerUpgradeParcelDownloadListenerTask method handleTimeout.
@Override
public void handleTimeout(ClouderaManagerCommandPollerObject pollerObject) {
// when downloading, progress and totalProgress will show the current number of bytes downloaded
// and the total number of bytes needed to be downloaded respectively.
String baseMessage = "Operation timed out. Failed to download parcel in time.";
try {
ApiParcel apiParcel = getApiParcel(pollerObject);
ApiParcelState parcelState = apiParcel.getState();
String progress = FileUtils.byteCountToDisplaySize(parcelState.getProgress().toBigInteger());
String totalProgress = FileUtils.byteCountToDisplaySize(parcelState.getTotalProgress().toBigInteger());
String progressMessage = String.format(" %s out of total %s has been downloaded!", progress, totalProgress);
throw new ClouderaManagerOperationFailedException(baseMessage + progressMessage);
} catch (ApiException e) {
throw new ClouderaManagerOperationFailedException(baseMessage);
}
}
Aggregations