use of gov.cms.qpp.conversion.api.exceptions.UncheckedInterruptedException in project qpp-conversion-tool by CMSgov.
the class AuditServiceImplTest method testFileUploadFailureException.
@Test
public void testFileUploadFailureException() throws TimeoutException {
when(environment.getProperty(Constants.NO_AUDIT_ENV_VARIABLE)).thenReturn(null);
successfulEncodingPrep();
problematic();
final Waiter waiter = new Waiter();
CompletableFuture<Metadata> future = underTest.success(report);
future.whenComplete((nada, ex) -> {
waiter.assertNull(metadata.getQppLocator());
waiter.assertNull(metadata.getSubmissionLocator());
waiter.assertTrue(ex.getCause() instanceof UncheckedInterruptedException);
waiter.resume();
});
waiter.await(5000);
}
use of gov.cms.qpp.conversion.api.exceptions.UncheckedInterruptedException in project qpp-conversion-tool by CMSgov.
the class StorageServiceImpl method asynchronousAction.
/**
* Uses the {@link TransferManager} to upload a file.
*
* @param objectToActOn The put request.
* @return The object key in the bucket.
*/
@Override
protected String asynchronousAction(Supplier<PutObjectRequest> objectToActOn) {
String returnValue;
PutObjectRequest request = objectToActOn.get();
try {
Upload upload = s3TransferManager.upload(request);
returnValue = upload.waitForUploadResult().getKey();
} catch (InterruptedException exception) {
Thread.currentThread().interrupt();
throw new UncheckedInterruptedException(exception);
}
API_LOG.info("Successfully wrote object {} to S3 bucket {}", returnValue, request.getBucketName());
return returnValue;
}
Aggregations