@Test void exportUserMailboxesDataShouldDeleteBlobAfterCompletion() throws Exception { createAMailboxWithAMail(MESSAGE_CONTENT); testee.export(progress, BOB).block(); String fileName = Files.getNameWithoutExtension(getFileUrl()); String blobId = fileName.substring(fileName.lastIndexOf("-") + 1); SoftAssertions.assertSoftly(softly -> { assertThatThrownBy(() -> testSystem.blobStore.read(testSystem.blobStore.getDefaultBucketName(), FACTORY.from(blobId))) .isInstanceOf(ObjectNotFoundException.class); assertThatThrownBy(() -> testSystem.blobStore.read(testSystem.blobStore.getDefaultBucketName(), FACTORY.from(blobId))) .hasMessage(String.format("blob '%s' not found in bucket '%s'", blobId, testSystem.blobStore.getDefaultBucketName().asString())); }); }
public Mono<Task.Result> export(Progress progress, Username username) { return Mono.usingWhen( Mono.fromCallable(() -> zipMailboxesContent(progress, username)), inputStream -> export(progress, username, inputStream), this::closeResource, (inputStream, throwable) -> closeResource(inputStream), this::closeResource ); }
ExportService { public Mono<Task.Result> export(Progress progress, Username username) { return Mono.usingWhen( Mono.fromCallable(() -> zipMailboxesContent(progress, username)), inputStream -> export(progress, username, inputStream), this::closeResource, (inputStream, throwable) -> closeResource(inputStream), this::closeResource ); } }
ExportService { public Mono<Task.Result> export(Progress progress, Username username) { return Mono.usingWhen( Mono.fromCallable(() -> zipMailboxesContent(progress, username)), inputStream -> export(progress, username, inputStream), this::closeResource, (inputStream, throwable) -> closeResource(inputStream), this::closeResource ); } @Inject  ExportService(MailboxBackup mailboxBackup, BlobStore blobStore, BlobExportMechanism blobExport, UsersRepository usersRepository); }
ExportService { public Mono<Task.Result> export(Progress progress, Username username) { return Mono.usingWhen( Mono.fromCallable(() -> zipMailboxesContent(progress, username)), inputStream -> export(progress, username, inputStream), this::closeResource, (inputStream, throwable) -> closeResource(inputStream), this::closeResource ); } @Inject  ExportService(MailboxBackup mailboxBackup, BlobStore blobStore, BlobExportMechanism blobExport, UsersRepository usersRepository); Mono<Task.Result> export(Progress progress, Username username); }
ExportService { public Mono<Task.Result> export(Progress progress, Username username) { return Mono.usingWhen( Mono.fromCallable(() -> zipMailboxesContent(progress, username)), inputStream -> export(progress, username, inputStream), this::closeResource, (inputStream, throwable) -> closeResource(inputStream), this::closeResource ); } @Inject  ExportService(MailboxBackup mailboxBackup, BlobStore blobStore, BlobExportMechanism blobExport, UsersRepository usersRepository); Mono<Task.Result> export(Progress progress, Username username);  }