use of com.axway.ats.action.objects.model.PackageException in project ats-framework by Axway.
the class Test_FileGIDRule method performMatchNegativeWxception.
@Test(expected = RbvException.class)
public void performMatchNegativeWxception() throws RbvException, PackageException {
expect(meta.getFilePackage()).andReturn(pack);
expect(pack.getGid()).andThrow(new PackageException(""));
replayAll();
rule = new FileGidRule(1, "ruleName", true);
rule.performMatch(meta);
verifyAll();
}
use of com.axway.ats.action.objects.model.PackageException in project ats-framework by Axway.
the class Test_FileFolderRule method performMatchException.
@Test(expected = RbvException.class)
public void performMatchException() throws RbvException, PackageException {
expect(meta.getFilePackage()).andReturn(pack);
expect(pack.isFile()).andThrow(new PackageException(""));
replayAll();
rule = new FileFolderRule(true, "ruleName", true);
assertTrue(rule.performMatch(meta));
verifyAll();
}
use of com.axway.ats.action.objects.model.PackageException in project ats-framework by Axway.
the class FileModtimeRule method performMatch.
@Override
public boolean performMatch(MetaData metaData) throws RbvException {
boolean actualResult = false;
if (metaData instanceof FileSystemMetaData) {
//get the file from the meta data
FilePackage file = ((FileSystemMetaData) metaData).getFilePackage();
try {
//get destination file's size
long destModtime = file.getModTime();
actualResult = destModtime == this.srcModtime;
} catch (PackageException pe) {
throw new RbvStorageException(pe);
}
}
return actualResult;
}
use of com.axway.ats.action.objects.model.PackageException in project ats-framework by Axway.
the class ImapFolder method createImapMetaData.
/**
* This method will convert a MIME message to meta data
*
* @param mimeMessage the input MimeMessage instance
* @return the MetaData produced
* @throws RbvStorageException
*/
protected ImapMetaData createImapMetaData(MimeMessage mimeMessage) throws RbvException {
try {
MimePackage mimePackage = new MimePackage(mimeMessage);
ImapMetaData metaData = new ImapMetaData(mimePackage);
return metaData;
} catch (PackageException pe) {
throw new RbvStorageException("Could not get meta data from " + getDescription(), pe);
}
}
use of com.axway.ats.action.objects.model.PackageException in project ats-framework by Axway.
the class MimePackage method setSenderName.
/**
* Set the sender display name on the From header
*
* @param name
* the display name to set
* @throws PackageException
*/
@PublicAtsApi
public void setSenderName(String name) throws PackageException {
try {
InternetAddress address = new InternetAddress();
String[] fromHeaders = getHeaderValues(FROM_HEADER);
if (fromHeaders != null && fromHeaders.length > 0) {
// parse the from header if such exists
String fromHeader = fromHeaders[0];
if (fromHeader != null) {
address = InternetAddress.parse(fromHeader)[0];
}
}
address.setPersonal(name);
message.setFrom(address);
} catch (ArrayIndexOutOfBoundsException aioobe) {
throw new PackageException("Sender not present");
} catch (MessagingException me) {
throw new PackageException(me);
} catch (UnsupportedEncodingException uee) {
throw new PackageException(uee);
}
}
Aggregations