@Test void exportingBlobShouldCreateAFileWithPrefixWhenDeclaringPrefix() { BlobId blobId = Mono.from(blobStore.save(blobStore.getDefaultBucketName(), BLOB_CONTENT, LOW_COST)).block(); String filePrefix = "deleted-message-of-bob@james.org"; testee.blobId(blobId) .with(MailAddressFixture.RECIPIENT1) .explanation("The content of a deleted message vault had been shared with you.") .filePrefix(filePrefix) .fileExtension(FileExtension.ZIP) .export(); assertThat(mailetContext.getSentMails()) .element(0) .satisfies(sentMail -> { try { String fileUrl = sentMail.getMsg().getHeader(LocalFileBlobExportMechanism.CORRESPONDING_FILE_HEADER)[0]; assertThat(FilenameUtils.getName(fileUrl)) .startsWith(filePrefix); } catch (Exception e) { throw new RuntimeException(e); } }); }
@Override public ShareeStage blobId(BlobId blobId) { return mailAddress -> explanation -> fileCustomPrefix -> fileExtension -> () -> { String fileUrl = copyBlobToFile(blobId, fileCustomPrefix, fileExtension); sendMail(mailAddress, fileUrl, explanation); }; }
LocalFileBlobExportMechanism implements BlobExportMechanism { @Override public ShareeStage blobId(BlobId blobId) { return mailAddress -> explanation -> fileCustomPrefix -> fileExtension -> () -> { String fileUrl = copyBlobToFile(blobId, fileCustomPrefix, fileExtension); sendMail(mailAddress, fileUrl, explanation); }; } }
LocalFileBlobExportMechanism implements BlobExportMechanism { @Override public ShareeStage blobId(BlobId blobId) { return mailAddress -> explanation -> fileCustomPrefix -> fileExtension -> () -> { String fileUrl = copyBlobToFile(blobId, fileCustomPrefix, fileExtension); sendMail(mailAddress, fileUrl, explanation); }; } @VisibleForTesting @Inject  LocalFileBlobExportMechanism(MailetContext mailetContext, BlobStore blobStore, FileSystem fileSystem, DNSService dnsService, Configuration configuration); }
LocalFileBlobExportMechanism implements BlobExportMechanism { @Override public ShareeStage blobId(BlobId blobId) { return mailAddress -> explanation -> fileCustomPrefix -> fileExtension -> () -> { String fileUrl = copyBlobToFile(blobId, fileCustomPrefix, fileExtension); sendMail(mailAddress, fileUrl, explanation); }; } @VisibleForTesting @Inject  LocalFileBlobExportMechanism(MailetContext mailetContext, BlobStore blobStore, FileSystem fileSystem, DNSService dnsService, Configuration configuration); @Override ShareeStage blobId(BlobId blobId); }
LocalFileBlobExportMechanism implements BlobExportMechanism { @Override public ShareeStage blobId(BlobId blobId) { return mailAddress -> explanation -> fileCustomPrefix -> fileExtension -> () -> { String fileUrl = copyBlobToFile(blobId, fileCustomPrefix, fileExtension); sendMail(mailAddress, fileUrl, explanation); }; } @VisibleForTesting @Inject  LocalFileBlobExportMechanism(MailetContext mailetContext, BlobStore blobStore, FileSystem fileSystem, DNSService dnsService, Configuration configuration); @Override ShareeStage blobId(BlobId blobId);  }