Search in sources :

Example 6 with ImapMetaData

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

the class Test_AndRuleOperation method setUpTest_AndRuleOperation.

@BeforeClass
public static void setUpTest_AndRuleOperation() throws PackageException, RbvException {
    MimePackage testMessage = new MimePackage(Test_ImapStorage.class.getResourceAsStream("mail.msg"));
    //init the meta data with the test message
    metaData = new ImapMetaData(testMessage);
}
Also used : MimePackage(com.axway.ats.action.objects.MimePackage) ImapMetaData(com.axway.ats.rbv.imap.ImapMetaData) Test_ImapStorage(com.axway.ats.rbv.imap.Test_ImapStorage) BeforeClass(org.junit.BeforeClass)

Example 7 with ImapMetaData

use of com.axway.ats.rbv.imap.ImapMetaData 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 8 with ImapMetaData

use of com.axway.ats.rbv.imap.ImapMetaData 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)

Example 9 with ImapMetaData

use of com.axway.ats.rbv.imap.ImapMetaData 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 10 with ImapMetaData

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

the class Test_SubjectRule method isMatchEmptyMetaData.

@Test(expected = MetaDataIncorrectException.class)
public void isMatchEmptyMetaData() throws RbvException {
    SubjectRule rule = new SubjectRule("infos1.mercatoloterie@gmail.com", SubjectMatchMode.FIND, "isMatchEmptyMetaData", true);
    metaData = new ImapMetaData(null);
    assertFalse(rule.isMatch(metaData));
}
Also used : ImapMetaData(com.axway.ats.rbv.imap.ImapMetaData) SubjectRule(com.axway.ats.rbv.imap.rules.SubjectRule) BaseTest(com.axway.ats.rbv.BaseTest) Test(org.junit.Test)

Aggregations

ImapMetaData (com.axway.ats.rbv.imap.ImapMetaData)20 MimePackage (com.axway.ats.action.objects.MimePackage)15 BaseTest (com.axway.ats.rbv.BaseTest)11 Test (org.junit.Test)11 Before (org.junit.Before)6 StringInMimePartRule (com.axway.ats.rbv.imap.rules.StringInMimePartRule)5 Test_ImapStorage (com.axway.ats.rbv.imap.Test_ImapStorage)4 MimePartRule (com.axway.ats.rbv.imap.rules.MimePartRule)3 BeforeClass (org.junit.BeforeClass)2 NoSuchMimePartException (com.axway.ats.action.objects.model.NoSuchMimePartException)1 PackageException (com.axway.ats.action.objects.model.PackageException)1 HeaderRule (com.axway.ats.rbv.imap.rules.HeaderRule)1 MimePartCountRule (com.axway.ats.rbv.imap.rules.MimePartCountRule)1 SubjectRule (com.axway.ats.rbv.imap.rules.SubjectRule)1 RbvException (com.axway.ats.rbv.model.RbvException)1 InputStream (java.io.InputStream)1