@Test void exportUserMailboxesDataShouldProduceAZipWithEntry() throws Exception { ComposedMessageId id = createAMailboxWithAMail(MESSAGE_CONTENT); testee.export(progress, BOB).block(); ZipAssert.assertThatZip(new FileInputStream(getFileUrl())) .containsOnlyEntriesMatching( ZipAssert.EntryChecks.hasName(INBOX + "/").isDirectory(), ZipAssert.EntryChecks.hasName(id.getMessageId().serialize()).hasStringContent(MESSAGE_CONTENT)); }
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);  }