Search in sources :

Example 11 with StringInMimePartRule

use of com.axway.ats.rbv.imap.rules.StringInMimePartRule in project ats-framework by Axway.

the class Test_StringInMimePartRule method isMatchEmptyMetaData.

@Test(expected = MetaDataIncorrectException.class)
public void isMatchEmptyMetaData() throws RbvException {
    StringInMimePartRule rule = new StringInMimePartRule("US AIR FORCE", false, 2, false, "isMatchEmptyMetaData", false);
    metaData = new ImapMetaData(null);
    assertFalse(rule.isMatch(metaData));
}
Also used : StringInMimePartRule(com.axway.ats.rbv.imap.rules.StringInMimePartRule) ImapMetaData(com.axway.ats.rbv.imap.ImapMetaData) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 12 with StringInMimePartRule

use of com.axway.ats.rbv.imap.rules.StringInMimePartRule in project ats-framework by Axway.

the class Test_StringInMimePartRule method isMatchRegexRegularPartPositive.

@Test
public void isMatchRegexRegularPartPositive() throws RbvException {
    //expected true
    StringInMimePartRule rule = new StringInMimePartRule("US .* FORCE", true, 2, false, "isMatchRegexRegularPartPositive1", true);
    assertTrue(rule.isMatch(metaData));
    //expected false
    rule = new StringInMimePartRule("US .? FORCE", true, 2, false, "isMatchRegexRegularPartPositive2", false);
    assertTrue(rule.isMatch(metaData));
}
Also used : StringInMimePartRule(com.axway.ats.rbv.imap.rules.StringInMimePartRule) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 13 with StringInMimePartRule

use of com.axway.ats.rbv.imap.rules.StringInMimePartRule in project ats-framework by Axway.

the class ImapVerification method checkRegexInAttachment.

/**
     * Check that the nested IMAP message contains the specified regular expression in the given attachment part
     *
     * @param searchRegex       the regular expression to search for
     * @param attachmentIndex   the index of the attachment in the MIME structure (regular parts are skipped)
     * @param nestedPackagePath path to the nested message
     */
@PublicAtsApi
public void checkRegexInAttachment(String searchRegex, int attachmentIndex, int... nestedPackagePath) {
    //create the rule
    StringInMimePartRule stringInPartRule = new StringInMimePartRule(nestedPackagePath, searchRegex, true, attachmentIndex, true, "checkRegexgInAttachment" + getNestedMimePackagePathDescription(nestedPackagePath), true);
    rootRule.addRule(stringInPartRule);
}
Also used : StringInMimePartRule(com.axway.ats.rbv.imap.rules.StringInMimePartRule) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 14 with StringInMimePartRule

use of com.axway.ats.rbv.imap.rules.StringInMimePartRule in project ats-framework by Axway.

the class ImapVerification method checkStringInRegularBodyPart.

/**
     * Check that the nested IMAP message contains the specified string in the given regular body part
     *
     * @param searchString  the string to search for
     * @param partIndex     the index of the regular part in the MIME structure (attachments are skipped)
     * @param nestedPackagePath path to the nested message
     */
@PublicAtsApi
public void checkStringInRegularBodyPart(String searchString, int partIndex, int... nestedPackagePath) {
    //create the rule
    StringInMimePartRule stringInPartRule = new StringInMimePartRule(nestedPackagePath, searchString, false, partIndex, false, "checkStringInRegularBodyPart" + getNestedMimePackagePathDescription(nestedPackagePath), true);
    rootRule.addRule(stringInPartRule);
}
Also used : StringInMimePartRule(com.axway.ats.rbv.imap.rules.StringInMimePartRule) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 15 with StringInMimePartRule

use of com.axway.ats.rbv.imap.rules.StringInMimePartRule in project ats-framework by Axway.

the class ImapVerification method checkBody.

/**
     * Check that the body of the nested message (including all parts) contains the specified string
     *
     * @param body  the string to search for
     * @param nestedPackagePath path to the nested message
     */
@PublicAtsApi
public void checkBody(String body, int... nestedPackagePath) {
    //create the rule
    StringInMimePartRule stringInPartRule = new StringInMimePartRule(nestedPackagePath, body, false, "checkBody" + getNestedMimePackagePathDescription(nestedPackagePath), true);
    rootRule.addRule(stringInPartRule);
}
Also used : StringInMimePartRule(com.axway.ats.rbv.imap.rules.StringInMimePartRule) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Aggregations

StringInMimePartRule (com.axway.ats.rbv.imap.rules.StringInMimePartRule)20 BaseTest (com.axway.ats.rbv.BaseTest)15 Test (org.junit.Test)15 ImapMetaData (com.axway.ats.rbv.imap.ImapMetaData)6 PublicAtsApi (com.axway.ats.common.PublicAtsApi)5 MimePackage (com.axway.ats.action.objects.MimePackage)4 MetaData (com.axway.ats.rbv.MetaData)1