use of com.axway.ats.common.filesystem.FileSystemOperationException in project ats-framework by Axway.
the class RemoteFileSystemOperations method copyDirectory.
@Override
public void copyDirectory(String fromDirName, String toDirName, boolean isRecursive, boolean failOnError) {
try {
int port = remoteFileSystemOperations.openFileTransferSocket();
localFileSystemOperations.sendDirectoryTo(fromDirName, toDirName, HostUtils.splitAddressHostAndPort(atsAgent)[0], port, isRecursive, failOnError);
remoteFileSystemOperations.waitForFileTransferCompletion(port);
} catch (Exception e) {
String message = new StringBuilder().append("Unable to copy directory ").append(fromDirName).append(" to ").append(toDirName).append(" on host ").append(this.atsAgent).toString();
throw new FileSystemOperationException(message, e);
}
}
use of com.axway.ats.common.filesystem.FileSystemOperationException in project ats-framework by Axway.
the class Test_FileSystemOperations method testPurgeDirectoryRemoteException.
/**
* Test case
* @throws Exception
*/
@Test(expected = FileSystemOperationException.class)
public void testPurgeDirectoryRemoteException() throws Exception {
// setup expectations
expectNew(RemoteFileSystemOperations.class, REMOTE_HOST_NAME_VALID).andReturn(remoteFSOperationsMock);
remoteFSOperationsMock.purgeDirectoryContents(SOURCE_DIRECTORY_NAME_VALID);
expectLastCall().andThrow(new FileSystemOperationException("Test"));
replayAll();
// execute operation
fileSystemOperationsRemote.deleteDirectoryContent(SOURCE_DIRECTORY_NAME_VALID);
// verify results
verifyAll();
}
use of com.axway.ats.common.filesystem.FileSystemOperationException in project ats-framework by Axway.
the class Test_FileSystemOperations method computeMD5NegativeExceptionRemote.
/**
* Test case
* @throws Exception
*/
@Test(expected = FileSystemOperationException.class)
public void computeMD5NegativeExceptionRemote() throws Exception {
// setup expectations
expectNew(RemoteFileSystemOperations.class, REMOTE_HOST_NAME_VALID).andReturn(remoteFSOperationsMock);
expect(remoteFSOperationsMock.computeMd5Sum(SOURCE_FILE_NAME_VALID, Md5SumMode.BINARY)).andThrow(new FileSystemOperationException("Test"));
replayAll();
// execute operation
fileSystemOperationsRemote.computeMd5Sum(SOURCE_FILE_NAME_VALID, Md5SumMode.BINARY);
// verify results
verifyAll();
}
use of com.axway.ats.common.filesystem.FileSystemOperationException in project ats-framework by Axway.
the class Test_FileSystemOperations method testDeleteDirectoryRemoteException.
/**
* Test case
* @throws Exception
*/
@Test(expected = FileSystemOperationException.class)
public void testDeleteDirectoryRemoteException() throws Exception {
// setup expectations
expectNew(RemoteFileSystemOperations.class, REMOTE_HOST_NAME_VALID).andReturn(remoteFSOperationsMock);
remoteFSOperationsMock.deleteDirectory(SOURCE_DIRECTORY_NAME_VALID, true);
expectLastCall().andThrow(new FileSystemOperationException("Test"));
replayAll();
// execute operation
fileSystemOperationsRemote.deleteDirectory(SOURCE_DIRECTORY_NAME_VALID);
// verify results
verifyAll();
}
use of com.axway.ats.common.filesystem.FileSystemOperationException in project ats-framework by Axway.
the class Test_FileSystemOperations method testCreateFileLocalAltNegativeException.
/**
* Test case
* @throws Exception
*/
@Test(expected = FileSystemOperationException.class)
public void testCreateFileLocalAltNegativeException() throws Exception {
// setup expectations
expectNew(LocalFileSystemOperations.class).andReturn(localFSOperationsMock);
localFSOperationsMock.createFile(SOURCE_FILE_NAME_VALID, FILE_SIZE_VALID, true, EndOfLineStyle.UNIX);
expectLastCall().andThrow(new FileSystemOperationException("Test"));
replayAll();
// execute operation
fileSystemOperationsLocal.createFile(SOURCE_FILE_NAME_VALID, FILE_SIZE_VALID, EndOfLineStyle.UNIX, true);
// verify results
verifyAll();
}
Aggregations