@Test public void folder_can_fetch_more_than_10_envelopes() throws MessagingException { when(mockStore.processRequest(anyString(), anyString(), anyString(), anyMapOf(String.class, String.class))) .thenReturn(mockDataSet); List<WebDavMessage> messages = new ArrayList<>(); for (int i = 0; i < 15; i++) { WebDavMessage mockMessage = mock(WebDavMessage.class); messages.add(mockMessage); } FetchProfile profile = new FetchProfile(); profile.add(FetchProfile.Item.ENVELOPE); folder.fetch(messages, profile, listener); }
@Override public void fetch(List<WebDavMessage> messages, FetchProfile fp, MessageRetrievalListener<WebDavMessage> listener) throws MessagingException { if (messages == null || messages.isEmpty()) { return; } if (fp.contains(FetchProfile.Item.ENVELOPE)) { fetchEnvelope(messages, listener); } if (fp.contains(FetchProfile.Item.FLAGS)) { fetchFlags(messages, listener); } if (fp.contains(FetchProfile.Item.BODY_SANE)) { int maximumAutoDownloadSize = store.getStoreConfig().getMaximumAutoDownloadMessageSize(); if (maximumAutoDownloadSize > 0) { fetchMessages(messages, listener, (maximumAutoDownloadSize / 76)); } else { fetchMessages(messages, listener, -1); } } if (fp.contains(FetchProfile.Item.BODY)) { fetchMessages(messages, listener, -1); } }
WebDavFolder extends Folder<WebDavMessage> { @Override public void fetch(List<WebDavMessage> messages, FetchProfile fp, MessageRetrievalListener<WebDavMessage> listener) throws MessagingException { if (messages == null || messages.isEmpty()) { return; } if (fp.contains(FetchProfile.Item.ENVELOPE)) { fetchEnvelope(messages, listener); } if (fp.contains(FetchProfile.Item.FLAGS)) { fetchFlags(messages, listener); } if (fp.contains(FetchProfile.Item.BODY_SANE)) { int maximumAutoDownloadSize = store.getStoreConfig().getMaximumAutoDownloadMessageSize(); if (maximumAutoDownloadSize > 0) { fetchMessages(messages, listener, (maximumAutoDownloadSize / 76)); } else { fetchMessages(messages, listener, -1); } } if (fp.contains(FetchProfile.Item.BODY)) { fetchMessages(messages, listener, -1); } } }
WebDavFolder extends Folder<WebDavMessage> { @Override public void fetch(List<WebDavMessage> messages, FetchProfile fp, MessageRetrievalListener<WebDavMessage> listener) throws MessagingException { if (messages == null || messages.isEmpty()) { return; } if (fp.contains(FetchProfile.Item.ENVELOPE)) { fetchEnvelope(messages, listener); } if (fp.contains(FetchProfile.Item.FLAGS)) { fetchFlags(messages, listener); } if (fp.contains(FetchProfile.Item.BODY_SANE)) { int maximumAutoDownloadSize = store.getStoreConfig().getMaximumAutoDownloadMessageSize(); if (maximumAutoDownloadSize > 0) { fetchMessages(messages, listener, (maximumAutoDownloadSize / 76)); } else { fetchMessages(messages, listener, -1); } } if (fp.contains(FetchProfile.Item.BODY)) { fetchMessages(messages, listener, -1); } } WebDavFolder(WebDavStore nStore, String id); }
WebDavFolder extends Folder<WebDavMessage> { @Override public void fetch(List<WebDavMessage> messages, FetchProfile fp, MessageRetrievalListener<WebDavMessage> listener) throws MessagingException { if (messages == null || messages.isEmpty()) { return; } if (fp.contains(FetchProfile.Item.ENVELOPE)) { fetchEnvelope(messages, listener); } if (fp.contains(FetchProfile.Item.FLAGS)) { fetchFlags(messages, listener); } if (fp.contains(FetchProfile.Item.BODY_SANE)) { int maximumAutoDownloadSize = store.getStoreConfig().getMaximumAutoDownloadMessageSize(); if (maximumAutoDownloadSize > 0) { fetchMessages(messages, listener, (maximumAutoDownloadSize / 76)); } else { fetchMessages(messages, listener, -1); } } if (fp.contains(FetchProfile.Item.BODY)) { fetchMessages(messages, listener, -1); } } WebDavFolder(WebDavStore nStore, String id); void setUrl(String url); @Override void open(int mode); @Override Map<String, String> copyMessages(List<? extends Message> messages, Folder folder); @Override Map<String, String> moveMessages(List<? extends Message> messages, Folder folder); @Override void delete(List<? extends Message> msgs, String trashFolderName); @Override int getMessageCount(); @Override int getUnreadMessageCount(); @Override int getFlaggedMessageCount(); @Override boolean isOpen(); @Override int getMode(); @Override String getId(); @Override String getParentId(); @Override String getName(); @Override boolean exists(); @Override boolean canHaveSubFolders(); @Override void close(); @Override boolean create(FolderType type); @Override void delete(boolean recursive); @Override WebDavMessage getMessage(String uid); @Override List<WebDavMessage> getMessages(int start, int end, Date earliestDate, MessageRetrievalListener<WebDavMessage> listener); @Override boolean areMoreMessagesAvailable(int indexOfOldestMessage, Date earliestDate); @Override void fetch(List<WebDavMessage> messages, FetchProfile fp, MessageRetrievalListener<WebDavMessage> listener); @Override void setFlags(List<? extends Message> messages, final Set<Flag> flags, boolean value); @Override Map<String, String> appendMessages(List<? extends Message> messages); List<? extends Message> appendWebDavMessages(List<? extends Message> messages); @Override boolean equals(Object o); @Override String getUidFromMessageId(Message message); @Override void setFlags(final Set<Flag> flags, boolean value); String getUrl(); }
WebDavFolder extends Folder<WebDavMessage> { @Override public void fetch(List<WebDavMessage> messages, FetchProfile fp, MessageRetrievalListener<WebDavMessage> listener) throws MessagingException { if (messages == null || messages.isEmpty()) { return; } if (fp.contains(FetchProfile.Item.ENVELOPE)) { fetchEnvelope(messages, listener); } if (fp.contains(FetchProfile.Item.FLAGS)) { fetchFlags(messages, listener); } if (fp.contains(FetchProfile.Item.BODY_SANE)) { int maximumAutoDownloadSize = store.getStoreConfig().getMaximumAutoDownloadMessageSize(); if (maximumAutoDownloadSize > 0) { fetchMessages(messages, listener, (maximumAutoDownloadSize / 76)); } else { fetchMessages(messages, listener, -1); } } if (fp.contains(FetchProfile.Item.BODY)) { fetchMessages(messages, listener, -1); } } WebDavFolder(WebDavStore nStore, String id); void setUrl(String url); @Override void open(int mode); @Override Map<String, String> copyMessages(List<? extends Message> messages, Folder folder); @Override Map<String, String> moveMessages(List<? extends Message> messages, Folder folder); @Override void delete(List<? extends Message> msgs, String trashFolderName); @Override int getMessageCount(); @Override int getUnreadMessageCount(); @Override int getFlaggedMessageCount(); @Override boolean isOpen(); @Override int getMode(); @Override String getId(); @Override String getParentId(); @Override String getName(); @Override boolean exists(); @Override boolean canHaveSubFolders(); @Override void close(); @Override boolean create(FolderType type); @Override void delete(boolean recursive); @Override WebDavMessage getMessage(String uid); @Override List<WebDavMessage> getMessages(int start, int end, Date earliestDate, MessageRetrievalListener<WebDavMessage> listener); @Override boolean areMoreMessagesAvailable(int indexOfOldestMessage, Date earliestDate); @Override void fetch(List<WebDavMessage> messages, FetchProfile fp, MessageRetrievalListener<WebDavMessage> listener); @Override void setFlags(List<? extends Message> messages, final Set<Flag> flags, boolean value); @Override Map<String, String> appendMessages(List<? extends Message> messages); List<? extends Message> appendWebDavMessages(List<? extends Message> messages); @Override boolean equals(Object o); @Override String getUidFromMessageId(Message message); @Override void setFlags(final Set<Flag> flags, boolean value); String getUrl();  }