Search in sources :

Example 6 with StringInMimePartRule

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

the class Test_StringInMimePartRule method isMatchRegexRegularPartUTF8Positive.

@Test
public void isMatchRegexRegularPartUTF8Positive() throws RbvException, PackageException {
    MimePackage utf8Package = new MimePackage();
    utf8Package.addPart("Изчерпателна информация", MimePackage.PART_TYPE_TEXT_PLAIN, "utf-8");
    ImapMetaData utf8MetaData = new ImapMetaData(utf8Package);
    //expected true
    StringInMimePartRule rule = new StringInMimePartRule(".*информация$", true, 0, false, "isMatchRegexRegularPartPositive1", true);
    assertTrue(rule.isMatch(utf8MetaData));
    //expected false
    rule = new StringInMimePartRule("Изчерпателна.*яа", true, 0, false, "isMatchRegexRegularPartPositive2", false);
    assertTrue(rule.isMatch(utf8MetaData));
}
Also used : MimePackage(com.axway.ats.action.objects.MimePackage) ImapMetaData(com.axway.ats.rbv.imap.ImapMetaData) StringInMimePartRule(com.axway.ats.rbv.imap.rules.StringInMimePartRule) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 7 with StringInMimePartRule

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

the class Test_StringInMimePartRule method isMatchWrongMetaData.

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

Example 8 with StringInMimePartRule

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

the class Test_StringInMimePartRule method isMatchAttachmentNegative.

@Test
public void isMatchAttachmentNegative() throws RbvException {
    //expected true
    StringInMimePartRule rule = new StringInMimePartRule("afasf", false, 0, true, "isMatchAttachmentNegative1", true);
    assertFalse(rule.isMatch(metaData));
    //expected false
    rule = new StringInMimePartRule("You are now ready to run TOMTOM 6", false, 0, true, "isMatchAttachmentNegative2", 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 9 with StringInMimePartRule

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

the class Test_StringInMimePartRule method isMatchRegexRegularPartUTF8WholeMessagePositive.

@Test
public void isMatchRegexRegularPartUTF8WholeMessagePositive() throws RbvException, PackageException {
    MimePackage utf8Package = new MimePackage(Test_StringInMimePartRule.class.getResourceAsStream("mail_with_one_attachment.msg"));
    utf8Package.addPart("Изчерпателна информация", MimePackage.PART_TYPE_TEXT_PLAIN, "utf-8");
    ImapMetaData utf8MetaData = new ImapMetaData(utf8Package);
    //expected true
    StringInMimePartRule rule = new StringInMimePartRule(".*информация$", true, "isMatchRegexRegularPartPositive1", true);
    assertTrue(rule.isMatch(utf8MetaData));
    //expected false
    rule = new StringInMimePartRule("Изчерпателна.*яа", true, "isMatchRegexRegularPartPositive2", false);
    assertTrue(rule.isMatch(utf8MetaData));
}
Also used : MimePackage(com.axway.ats.action.objects.MimePackage) ImapMetaData(com.axway.ats.rbv.imap.ImapMetaData) StringInMimePartRule(com.axway.ats.rbv.imap.rules.StringInMimePartRule) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Example 10 with StringInMimePartRule

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

the class Test_StringInMimePartRule method isMatchRegularPartUTF8WholeMessagePositive.

@Test
public void isMatchRegularPartUTF8WholeMessagePositive() throws RbvException, PackageException {
    MimePackage utf8Package = new MimePackage(Test_StringInMimePartRule.class.getResourceAsStream("mail_with_one_attachment.msg"));
    utf8Package.addPart("Изчерпателна информация", MimePackage.PART_TYPE_TEXT_PLAIN, "utf-8");
    ImapMetaData utf8MetaData = new ImapMetaData(utf8Package);
    //expected true
    StringInMimePartRule rule = new StringInMimePartRule("Изчерпателна", false, "isMatchRegularPartPositive1", true);
    assertTrue(rule.isMatch(utf8MetaData));
    //expected false
    rule = new StringInMimePartRule("Изчерпатслна", false, "isMatchRegularPartPositive2", false);
    assertTrue(rule.isMatch(utf8MetaData));
}
Also used : MimePackage(com.axway.ats.action.objects.MimePackage) ImapMetaData(com.axway.ats.rbv.imap.ImapMetaData) 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