Search in sources :

Example 16 with HeaderRule

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

the class Test_OrRuleOperation method isMatchBothRulesExpectedTrue.

@Test
public void isMatchBothRulesExpectedTrue() throws RbvException {
    HeaderRule firstRule = new HeaderRule("Sender", "gmail.com", HeaderMatchMode.FIND, "isMatchBothRulesExpectedTrue1", true);
    HeaderRule secondRule = new HeaderRule("Sender", "gmail.com", HeaderMatchMode.FIND, "isMatchBothRulesExpectedTrue2", true);
    OrRuleOperation andRule = new OrRuleOperation();
    andRule.addRule(firstRule);
    andRule.addRule(secondRule);
    assertTrue(andRule.isMatch(metaData));
}
Also used : HeaderRule(com.axway.ats.rbv.imap.rules.HeaderRule) OrRuleOperation(com.axway.ats.rbv.rules.OrRuleOperation) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 17 with HeaderRule

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

the class ImapVerification method checkHeader.

/**
     * Check that the nested message contains a header with the specified value
     * in one of its MIME parts
     *
     * @param headerName    the name of the header
     * @param headerValue   the value to search for
     * @param partIndex     the MIME part index
     * @param searchWhere   type of matching to use
     * @param nestedPackagePath path to the nested message
     */
@PublicAtsApi
public void checkHeader(String headerName, String headerValue, int partIndex, HeaderMatchMode searchWhere, int... nestedPackagePath) {
    //create the rule
    HeaderRule stringInPartRule = new HeaderRule(nestedPackagePath, headerName, headerValue, partIndex, -1, searchWhere, "checkHeader" + getNestedMimePackagePathDescription(nestedPackagePath), true);
    rootRule.addRule(stringInPartRule);
}
Also used : HeaderRule(com.axway.ats.rbv.imap.rules.HeaderRule) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 18 with HeaderRule

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

the class ImapVerification method checkHeaderForMessageTag.

/**
     * Check that the nested message is tagged with the specified message tag
     *
     * @param messageTag
     * @param nestedPackagePath path to the nested message
     */
@PublicAtsApi
public void checkHeaderForMessageTag(String messageTag, int... nestedPackagePath) {
    //create the rule
    //set this rule with highest priority, so it is evaluated first
    HeaderRule stringInPartRule = new HeaderRule(nestedPackagePath, "Automation-Message-Tag", messageTag, HeaderMatchMode.FIND, "checkMessageTagHeader" + getNestedMimePackagePathDescription(nestedPackagePath), true, Integer.MIN_VALUE);
    rootRule.addRule(stringInPartRule);
}
Also used : HeaderRule(com.axway.ats.rbv.imap.rules.HeaderRule) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 19 with HeaderRule

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

the class Test_AndRuleOperation method isMatchBothRulesExpectedTrueNegative.

@Test
public void isMatchBothRulesExpectedTrueNegative() throws RbvException {
    HeaderRule firstRule = new HeaderRule("Sender", "gmail.com", HeaderMatchMode.FIND, "isMatchBothRulesExpectedTrueNegative", true);
    HeaderRule secondRule = new HeaderRule("Sender", "gmail123.com", HeaderMatchMode.FIND, "isMatchBothRulesExpectedTrueNegative", true);
    firstRule.equals(secondRule);
    AndRuleOperation andRule = new AndRuleOperation();
    andRule.addRule(firstRule);
    andRule.addRule(secondRule);
    assertFalse(andRule.isMatch(metaData));
}
Also used : HeaderRule(com.axway.ats.rbv.imap.rules.HeaderRule) AndRuleOperation(com.axway.ats.rbv.rules.AndRuleOperation) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 20 with HeaderRule

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

the class Test_AndRuleOperation method isMatchBothRulesExpectedTruePositive.

@Test
public void isMatchBothRulesExpectedTruePositive() throws RbvException {
    HeaderRule firstRule = new HeaderRule("Sender", "gmail.com", HeaderMatchMode.FIND, "isMatchBothRulesExpectedTruePositive", true);
    HeaderRule secondRule = new HeaderRule("Sender", "gmail.com", HeaderMatchMode.FIND, "isMatchBothRulesExpectedTruePositive", true);
    AndRuleOperation andRule = new AndRuleOperation();
    andRule.addRule(firstRule);
    andRule.addRule(secondRule);
    assertTrue(andRule.isMatch(metaData));
}
Also used : HeaderRule(com.axway.ats.rbv.imap.rules.HeaderRule) AndRuleOperation(com.axway.ats.rbv.rules.AndRuleOperation) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Aggregations

HeaderRule (com.axway.ats.rbv.imap.rules.HeaderRule)45 BaseTest (com.axway.ats.rbv.BaseTest)43 Test (org.junit.Test)43 AndRuleOperation (com.axway.ats.rbv.rules.AndRuleOperation)4 OrRuleOperation (com.axway.ats.rbv.rules.OrRuleOperation)4 PublicAtsApi (com.axway.ats.common.PublicAtsApi)2 ImapMetaData (com.axway.ats.rbv.imap.ImapMetaData)2 MetaData (com.axway.ats.rbv.MetaData)1