@Test public void canHandleConnectionRefused() throws IOException { Map<String, String> s3Properties = getS3Properties(); s3Properties.put(MpfConstants.S3_RESULTS_BUCKET_PROPERTY, "http: Path filePath = getTestFileCopy(); JsonOutputObject outputObject = mock(JsonOutputObject.class); when(outputObject.getJobProperties()) .thenReturn(s3Properties); when(_mockLocalStorageBackend.store(outputObject)) .thenReturn(filePath.toUri()); try { _s3StorageBackend.store(outputObject); fail("Expected StorageException to be thrown."); } catch (StorageException expected) { assertTrue(OBJECTS_POSTED.isEmpty()); assertTrue(Files.exists(filePath)); } }
@Override public URI store(JsonOutputObject outputObject) throws StorageException, IOException { URI localUri = _localStorageBackend.store(outputObject); return putInS3IfAbsent(Paths.get(localUri), outputObject.getJobProperties()::get); }
S3StorageBackend implements StorageBackend { @Override public URI store(JsonOutputObject outputObject) throws StorageException, IOException { URI localUri = _localStorageBackend.store(outputObject); return putInS3IfAbsent(Paths.get(localUri), outputObject.getJobProperties()::get); } }
S3StorageBackend implements StorageBackend { @Override public URI store(JsonOutputObject outputObject) throws StorageException, IOException { URI localUri = _localStorageBackend.store(outputObject); return putInS3IfAbsent(Paths.get(localUri), outputObject.getJobProperties()::get); } @Inject  S3StorageBackend(PropertiesUtil propertiesUtil,
                            LocalStorageBackend localStorageBackend,
                            InProgressBatchJobsService inProgressBatchJobsService,
                            AggregateJobPropertiesUtil aggregateJobPropertiesUtil); }
S3StorageBackend implements StorageBackend { @Override public URI store(JsonOutputObject outputObject) throws StorageException, IOException { URI localUri = _localStorageBackend.store(outputObject); return putInS3IfAbsent(Paths.get(localUri), outputObject.getJobProperties()::get); } @Inject  S3StorageBackend(PropertiesUtil propertiesUtil,
                            LocalStorageBackend localStorageBackend,
                            InProgressBatchJobsService inProgressBatchJobsService,
                            AggregateJobPropertiesUtil aggregateJobPropertiesUtil); @Override boolean canStore(JsonOutputObject outputObject); @Override URI store(JsonOutputObject outputObject); @Override boolean canStore(ArtifactExtractionRequest request); @Override Table<Integer, Integer, URI> storeArtifacts(ArtifactExtractionRequest request); @Override boolean canStore(MarkupResult markupResult); @Override void store(MarkupResult markupResult); static void validateS3Properties(Function<String, String> properties); static boolean requiresS3MediaDownload(Function<String, String> properties); static boolean requiresS3ResultUpload(Function<String, String> properties); void downloadFromS3(Media media, Function<String, String> combinedProperties); S3Object getFromS3(String uri, Function<String, String> properties); }
S3StorageBackend implements StorageBackend { @Override public URI store(JsonOutputObject outputObject) throws StorageException, IOException { URI localUri = _localStorageBackend.store(outputObject); return putInS3IfAbsent(Paths.get(localUri), outputObject.getJobProperties()::get); } @Inject  S3StorageBackend(PropertiesUtil propertiesUtil,
                            LocalStorageBackend localStorageBackend,
                            InProgressBatchJobsService inProgressBatchJobsService,
                            AggregateJobPropertiesUtil aggregateJobPropertiesUtil); @Override boolean canStore(JsonOutputObject outputObject); @Override URI store(JsonOutputObject outputObject); @Override boolean canStore(ArtifactExtractionRequest request); @Override Table<Integer, Integer, URI> storeArtifacts(ArtifactExtractionRequest request); @Override boolean canStore(MarkupResult markupResult); @Override void store(MarkupResult markupResult); static void validateS3Properties(Function<String, String> properties); static boolean requiresS3MediaDownload(Function<String, String> properties); static boolean requiresS3ResultUpload(Function<String, String> properties); void downloadFromS3(Media media, Function<String, String> combinedProperties); S3Object getFromS3(String uri, Function<String, String> properties);  }