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));
}
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));
}
use of com.axway.ats.rbv.imap.ImapMetaData in project ats-framework by Axway.
the class MimePartRule method performMatch.
@Override
protected boolean performMatch(MetaData metaData) throws RbvException {
boolean actualResult = false;
//get the emailMessage
//the meta data type check already passed, so it is safe to cast
MimePackage emailMessage = ((ImapMetaData) metaData).getMimePackage();
try {
InputStream actualPartDataStream = null;
try {
actualPartDataStream = emailMessage.getPartData(partIndex, isPartAttachment);
} catch (NoSuchMimePartException e) {
//if there is no such mime part then the parts do not match
log.debug("No MIME part at position '" + partIndex + "'");
return false;
}
if (actualPartDataStream != null) {
long actualChecksum = emailMessage.getPartChecksum(partIndex, isPartAttachment);
actualResult = (expectedChecksum == actualChecksum);
} else {
log.debug("MIME part at position '" + partIndex + "' does not have any content");
return false;
}
} catch (PackageException pe) {
throw new RbvException(pe);
}
return actualResult;
}
use of com.axway.ats.rbv.imap.ImapMetaData in project ats-framework by Axway.
the class Test_SubjectRule method setUp.
@Before
public void setUp() throws Exception {
MimePackage mailMessage = new MimePackage(Test_ImapStorage.class.getResourceAsStream("mail.msg"));
metaData = new ImapMetaData(mailMessage);
}
use of com.axway.ats.rbv.imap.ImapMetaData in project ats-framework by Axway.
the class Test_StringInMimePartRule method isMatchRegularPartUTF8Positive.
@Test
public void isMatchRegularPartUTF8Positive() 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("Изчерпателна", false, 0, false, "isMatchRegularPartPositive1", true);
assertTrue(rule.isMatch(utf8MetaData));
//expected false
rule = new StringInMimePartRule("Изчерпатслна", false, 0, false, "isMatchRegularPartPositive2", false);
assertTrue(rule.isMatch(utf8MetaData));
}
Aggregations