Search in sources :

Example 1 with StringInMimePartRule

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

the class ImapVerification method checkStringInAttachment.

/**
     * Check that the nested IMAP message contains the specified string in the given attachment part
     *
     * @param searchString      the string 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 checkStringInAttachment(String searchString, int attachmentIndex, int... nestedPackagePath) {
    //create the rule
    StringInMimePartRule stringInPartRule = new StringInMimePartRule(nestedPackagePath, searchString, false, attachmentIndex, true, "checkStringInAttachment" + getNestedMimePackagePathDescription(nestedPackagePath), true);
    rootRule.addRule(stringInPartRule);
}
Also used : StringInMimePartRule(com.axway.ats.rbv.imap.rules.StringInMimePartRule) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 2 with StringInMimePartRule

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

the class ImapVerification method checkRegexInRegularBodyPart.

/**
     * Check that the nested IMAP message contains the specified regular expression in the given regular body part
     *
     * @param searchRegex  the regular expression 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 checkRegexInRegularBodyPart(String searchRegex, int partIndex, int... nestedPackagePath) {
    //create the rule
    StringInMimePartRule stringInPartRule = new StringInMimePartRule(nestedPackagePath, searchRegex, true, partIndex, false, "checkRegexInRegularBodyPart" + getNestedMimePackagePathDescription(nestedPackagePath), true);
    rootRule.addRule(stringInPartRule);
}
Also used : StringInMimePartRule(com.axway.ats.rbv.imap.rules.StringInMimePartRule) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 3 with StringInMimePartRule

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

the class Test_StringInMimePartRule method isMatchAttachmentPositive.

@Test
public void isMatchAttachmentPositive() throws RbvException {
    //expected true
    StringInMimePartRule rule = new StringInMimePartRule("You are now ready to run TOMTOM", false, 0, true, "isMatchAttachmentPositive1", true);
    assertTrue(rule.isMatch(metaData));
    //expected false
    rule = new StringInMimePartRule("asdfasdf", false, 0, true, "isMatchAttachmentPositive2", 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 4 with StringInMimePartRule

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

the class Test_StringInMimePartRule method isMatchRegularPartNegative.

@Test
public void isMatchRegularPartNegative() throws RbvException {
    //expected true
    StringInMimePartRule rule = new StringInMimePartRule("US asdfasdf FORCE", false, 2, false, "isMatchRegularPartNegative1", true);
    assertFalse(rule.isMatch(metaData));
    //expected false
    rule = new StringInMimePartRule("US AIR FORCE", false, 2, false, "isMatchRegularPartNegative2", false);
    assertFalse(rule.isMatch(metaData));
}
Also used : StringInMimePartRule(com.axway.ats.rbv.imap.rules.StringInMimePartRule) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 5 with StringInMimePartRule

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

the class Test_StringInMimePartRule method isMatchRegexAttachmentPositive.

@Test
public void isMatchRegexAttachmentPositive() throws RbvException {
    //expected true
    StringInMimePartRule rule = new StringInMimePartRule("You .* now", true, 0, true, "isMatchRegexAttachmentPositive1", true);
    assertTrue(rule.isMatch(metaData));
    //expected false
    rule = new StringInMimePartRule("asdas.?", true, 0, true, "isMatchRegexAttachmentPositive2", 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)

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