@Test void doBackupWithoutMessageShouldStoreAnArchiveWithOnlyOneEntry() throws Exception { ByteArrayOutputStream destination = new ByteArrayOutputStream(BUFFER_SIZE); createMailbox(sessionUser, MAILBOX_PATH_USER1_MAILBOX1); backup.backupAccount(USERNAME_1, destination); try (ZipAssert zipAssert = ZipAssert.assertThatZip(destination)) { zipAssert.containsOnlyEntriesMatching(EntryChecks.hasName(MAILBOX_1_NAME + "/").isDirectory()); } }
@Override public void backupAccount(Username username, OutputStream destination) throws IOException, MailboxException { MailboxSession session = mailboxManager.createSystemSession(username); List<MailAccountContent> accountContents = getAccountContentForUser(session); List<MailboxWithAnnotations> mailboxes = accountContents.stream() .map(MailAccountContent::getMailboxWithAnnotations) .collect(Guavate.toImmutableList()); Stream<MessageResult> messages = allMessagesForUser(accountContents); archive(mailboxes, messages, destination); }
DefaultMailboxBackup implements MailboxBackup { @Override public void backupAccount(Username username, OutputStream destination) throws IOException, MailboxException { MailboxSession session = mailboxManager.createSystemSession(username); List<MailAccountContent> accountContents = getAccountContentForUser(session); List<MailboxWithAnnotations> mailboxes = accountContents.stream() .map(MailAccountContent::getMailboxWithAnnotations) .collect(Guavate.toImmutableList()); Stream<MessageResult> messages = allMessagesForUser(accountContents); archive(mailboxes, messages, destination); } }
DefaultMailboxBackup implements MailboxBackup { @Override public void backupAccount(Username username, OutputStream destination) throws IOException, MailboxException { MailboxSession session = mailboxManager.createSystemSession(username); List<MailAccountContent> accountContents = getAccountContentForUser(session); List<MailboxWithAnnotations> mailboxes = accountContents.stream() .map(MailAccountContent::getMailboxWithAnnotations) .collect(Guavate.toImmutableList()); Stream<MessageResult> messages = allMessagesForUser(accountContents); archive(mailboxes, messages, destination); } @Inject  DefaultMailboxBackup(MailboxManager mailboxManager, ArchiveService archiveService, MailArchiveRestorer archiveRestorer); }
DefaultMailboxBackup implements MailboxBackup { @Override public void backupAccount(Username username, OutputStream destination) throws IOException, MailboxException { MailboxSession session = mailboxManager.createSystemSession(username); List<MailAccountContent> accountContents = getAccountContentForUser(session); List<MailboxWithAnnotations> mailboxes = accountContents.stream() .map(MailAccountContent::getMailboxWithAnnotations) .collect(Guavate.toImmutableList()); Stream<MessageResult> messages = allMessagesForUser(accountContents); archive(mailboxes, messages, destination); } @Inject  DefaultMailboxBackup(MailboxManager mailboxManager, ArchiveService archiveService, MailArchiveRestorer archiveRestorer); @Override void backupAccount(Username username, OutputStream destination); @Override Publisher<BackupStatus> restore(Username username, InputStream source); }
DefaultMailboxBackup implements MailboxBackup { @Override public void backupAccount(Username username, OutputStream destination) throws IOException, MailboxException { MailboxSession session = mailboxManager.createSystemSession(username); List<MailAccountContent> accountContents = getAccountContentForUser(session); List<MailboxWithAnnotations> mailboxes = accountContents.stream() .map(MailAccountContent::getMailboxWithAnnotations) .collect(Guavate.toImmutableList()); Stream<MessageResult> messages = allMessagesForUser(accountContents); archive(mailboxes, messages, destination); } @Inject  DefaultMailboxBackup(MailboxManager mailboxManager, ArchiveService archiveService, MailArchiveRestorer archiveRestorer); @Override void backupAccount(Username username, OutputStream destination); @Override Publisher<BackupStatus> restore(Username username, InputStream source);  }