Class AbstractInboxConnector

  • All Implemented Interfaces:
    eu.tsystems.mms.tic.testframework.logging.Loggable
    Direct Known Subclasses:
    ImapMailConnector, POP3MailConnector

    public abstract class AbstractInboxConnector
    extends AbstractMailConnector
    implements eu.tsystems.mms.tic.testframework.logging.Loggable
    abstract class to handle mail connector
    • Constructor Detail

      • AbstractInboxConnector

        public AbstractInboxConnector()
    • Method Detail

      • waitForMails

        @Deprecated
        public java.util.List<Email> waitForMails​(java.util.List<SearchCriteria> searchCriterias)
                                           throws jakarta.mail.internet.AddressException
        Deprecated.
        Use query(EmailQuery) instead
        Wait until messages with search criteria are received.
        Parameters:
        searchCriterias - The subject which message should contain.
        Returns:
        The message.
        Throws:
        jakarta.mail.internet.AddressException - thrown if an error by waiting for the message occurs.
      • waitForMails

        @Deprecated
        public java.util.List<Email> waitForMails​(jakarta.mail.search.SearchTerm searchTerm)
        Deprecated.
        Use query(EmailQuery) instead
        Wait until messages with search term are received.
        Parameters:
        searchTerm - The criterias which the message should contain.
        Returns:
        The message.
      • waitForMails

        @Deprecated
        public java.util.List<Email> waitForMails​(jakarta.mail.search.SearchTerm searchTerm,
                                                  java.lang.String folderName)
        Deprecated.
        Use query(EmailQuery) instead
        Wait until messages with search term are received in the given folder.
        Parameters:
        searchTerm -
        folderName -
        Returns:
      • waitForMails

        @Deprecated
        public java.util.List<Email> waitForMails​(java.util.List<SearchCriteria> searchCriterias,
                                                  int maxReadTries,
                                                  int pollingTimerSeconds)
                                           throws jakarta.mail.internet.AddressException
        Deprecated.
        Use query(EmailQuery) instead
        Wait until messages with search criteria are received.
        Parameters:
        searchCriterias - The subject which message should contain.
        maxReadTries -
        pollingTimerSeconds -
        Returns:
        The message.
        Throws:
        jakarta.mail.internet.AddressException - thrown if an error by waiting for the message occurs.
      • waitForMails

        public java.util.List<Email> waitForMails​(jakarta.mail.search.SearchTerm searchTerm,
                                                  int maxReadTries,
                                                  int pollingTimerSeconds)
        Deprecated.
        Use query(EmailQuery) instead
        Wait until messages with the specified search term are received.
        Parameters:
        searchTerm - The search term which the message should contain.
        maxReadTries -
        pollingTimerSeconds -
        Returns:
        The message.
      • waitForMails

        public java.util.List<Email> waitForMails​(jakarta.mail.search.SearchTerm searchTerm,
                                                  int maxReadTries,
                                                  int pollingTimerSeconds,
                                                  java.lang.String folderName)
        Deprecated.
        Use query(EmailQuery) instead
        Wait until messages with the specified search term are received in the given folder.
        Parameters:
        searchTerm -
        maxReadTries -
        pollingTimerSeconds -
        folderName -
        Returns:
        Throws:
        java.lang.RuntimeException - When there are no emails present.
      • getMessageCount

        public long getMessageCount​(java.lang.String folderName)
        Get the message count from a specified folder name.
      • deleteMessage

        public boolean deleteMessage​(java.lang.String recipient,
                                     jakarta.mail.Message.RecipientType recipientType,
                                     java.lang.String subject,
                                     java.lang.String messageId)
        Deletes a message.
        Parameters:
        recipient - The recipient String. Can be null.
        recipientType - The type of the recipient.
        subject - The subject of the mail. Can be null if mail has no subject.
        messageId - The id of the message. Can be null.
        Returns:
        true if message was deleted, else false
      • deleteMessage

        public boolean deleteMessage​(Email mail)
        deletes tt. mail by it's message id from inbox.
        Parameters:
        mail - Email object with messageId set.
        Returns:
        true if message has been deleted.
      • deleteMessage

        @Deprecated
        public boolean deleteMessage​(java.util.List<java.util.List<SearchCriteria>> messagesCriterias)
                              throws jakarta.mail.internet.AddressException
        Deprecated.
        deletes messages by given search criterias
        Parameters:
        messagesCriterias - List of search criteria list - inner list represents searchcriterias to identify one message
        Returns:
        true if messages were deleted
        Throws:
        jakarta.mail.internet.AddressException - thrown if an error occurred in the translation of the searchCriterias to SearchTerm.
      • deleteMessages

        public boolean deleteMessages​(java.util.List<jakarta.mail.search.SearchTerm> searchTerms)
        deletes messages by given search criterias
        Parameters:
        searchTerms - List of search criteria list - inner list represents searchcriterias to identify one message
        Returns:
        true if messages were deleted
      • deleteMessage

        public boolean deleteMessage​(jakarta.mail.search.SearchTerm searchTerm)
        delete message by given SearchTerm in the InboxFolder
        Parameters:
        searchTerm -
        Returns:
      • deleteMessage

        public boolean deleteMessage​(jakarta.mail.search.SearchTerm searchTerm,
                                     java.lang.String folderName)
        delete message by given SearchTerm in the given folder
        Parameters:
        searchTerm -
        folderName -
        Returns:
      • moveMessage

        public boolean moveMessage​(java.lang.String targetFolder,
                                   Email message)
        move given message into folder with given name.
        Parameters:
        targetFolder - Name of folder to move into.
        message - Email to move (compared by messageId)
        Returns:
        true if moved.
      • moveMessage

        public int moveMessage​(java.lang.String targetFolder,
                               jakarta.mail.search.SearchTerm... searchTerms)
        move messages by given search terms into folder with given name.
        Parameters:
        targetFolder - Name of folder to move into.
        searchTerms - List of search term list - inner list represents searchcriterias to identify one message
        Returns:
        count of moved mails.
      • moveMessage

        public int moveMessage​(java.lang.String targetFolder,
                               SearchCriteria... searchCriterias)
                        throws jakarta.mail.internet.AddressException
        move messages by given search criterias into folder with given name.
        Parameters:
        targetFolder - Name of folder to move into.
        searchCriterias - List of search criteria list - inner list represents searchcriterias to identify one message
        Returns:
        count of moved mails.
        Throws:
        jakarta.mail.internet.AddressException - thrown if an error occurred in the translation of the searchCriterias to SearchTerm.
      • deleteMessages

        @Deprecated
        public boolean deleteMessages​(java.util.List<java.lang.String> deleteCriteriaValues,
                                      DeleteCriteriaType deleteCriteriaType)
        Deprecated.
        deletes messages with fitting parameters
        Parameters:
        deleteCriteriaValues - String List containing the desired values
        deleteCriteriaType - Delete Criteria Type - Recipient, Subject or MessageID
        Returns:
        boolean - true if messages were deleted
      • deleteAllMessages

        public boolean deleteAllMessages()
        delete all message in the InboxFolder
        Returns: