use of com.axway.ats.rbv.model.RbvStorageException in project ats-framework by Axway.
the class FileMd5Rule 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 {
String destMD5 = file.getMd5sum(this.binaryMode);
actualResult = !StringUtils.isNullOrEmpty(destMD5) && destMD5.equals(this.srcMD5);
} catch (PackageException pe) {
throw new RbvStorageException(pe);
}
}
return actualResult;
}
use of com.axway.ats.rbv.model.RbvStorageException in project ats-framework by Axway.
the class FileSizeRule method performMatch.
@Override
public boolean performMatch(MetaData metaData) throws RbvException {
boolean actuaResult = false;
if (metaData instanceof FileSystemMetaData) {
//get the file from the meta data
FilePackage file = ((FileSystemMetaData) metaData).getFilePackage();
try {
//get destination file's size
long destSize = file.getSize();
actuaResult = this.srcSize == destSize;
} catch (PackageException pe) {
throw new RbvStorageException(pe);
}
}
return actuaResult;
}
use of com.axway.ats.rbv.model.RbvStorageException in project ats-framework by Axway.
the class ImapFolder method open.
/**
*
* @see com.axway.ats.rbv.storage.Matchable#open()
*/
public void open() throws RbvStorageException {
//first check if the folder is already open
if (isOpen) {
throw new MatchableAlreadyOpenException(getDescription() + " is already open");
}
try {
isInitialPass = true;
// create and connect to the user's imap folder
if (!store.isConnected()) {
store.connect(serverHost, userName, password);
log.debug("Connected to store '" + serverHost + "' with user '" + userName + "' and password '" + password + "'");
}
if (folder == null || !folder.isOpen()) {
folder = store.getFolder(folderName);
folder.open(Folder.READ_WRITE);
}
allMetaDataList.clear();
newMetaDataList.clear();
isOpen = true;
log.info("Opened " + getDescription());
} catch (MessagingException me) {
throw new RbvStorageException("Could not open " + getDescription(), me);
}
}
use of com.axway.ats.rbv.model.RbvStorageException in project ats-framework by Axway.
the class Test_RBVStorageException method constructors.
@Test
public void constructors() {
RbvStorageException exception;
exception = new RbvStorageException("test");
assertEquals("test", exception.getMessage());
assertNull(exception.getCause());
Exception helperException = new Exception();
exception = new RbvStorageException("test", helperException);
assertEquals("test", exception.getMessage());
assertEquals(helperException, exception.getCause());
exception = new RbvStorageException(helperException);
assertEquals("java.lang.Exception", exception.getMessage());
assertEquals(helperException, exception.getCause());
}
use of com.axway.ats.rbv.model.RbvStorageException in project ats-framework by Axway.
the class Test_FileSystemFolder method openNegativeInvalidHost.
@Test(expected = InvalidInputArgumentsException.class)
public void openNegativeInvalidHost() throws Exception {
expectNew(SystemOperations.class, "invalid hosttt").andThrow(new RbvStorageException("Could not open File system folder '/tmp/test/' on server 'invalid hosttt'"));
replayAll();
FileSystemStorage invalidStorage = new FileSystemStorage("invalid hosttt");
FileSystemFolder folder = (FileSystemFolder) invalidStorage.getFolder(new FileSystemFolderSearchTerm(path, null, true));
folder.open();
verifyAll();
}
Aggregations