use of com.axway.ats.core.filesystem.snapshot.LocalFileSystemSnapshot in project ats-framework by Axway.
the class FileSystemSnapshot method compare.
/**
* Compare two snapshots
* @param that the other snapshot
*/
@PublicAtsApi
public void compare(FileSystemSnapshot that) {
// both instances are compared locally
LocalFileSystemSnapshot thisLocal;
if (this.fsSnapshotImpl instanceof LocalFileSystemSnapshot) {
thisLocal = (LocalFileSystemSnapshot) this.fsSnapshotImpl;
} else {
thisLocal = ((RemoteFileSystemSnapshot) this.fsSnapshotImpl).getFileSystemSnapshot();
}
LocalFileSystemSnapshot thatLocal;
if (that.fsSnapshotImpl instanceof LocalFileSystemSnapshot) {
thatLocal = (LocalFileSystemSnapshot) that.fsSnapshotImpl;
} else {
thatLocal = ((RemoteFileSystemSnapshot) that.fsSnapshotImpl).getFileSystemSnapshot();
}
thisLocal.compare(thatLocal);
}
use of com.axway.ats.core.filesystem.snapshot.LocalFileSystemSnapshot in project ats-framework by Axway.
the class InternalFileSystemSnapshot method compare.
@Action
public void compare(@Parameter(name = "thisInternalProcessId") String thisInternalProcessId, @Parameter(name = "thatInternalProcessId") String thatInternalProcessId) {
LocalFileSystemSnapshot thisLocalFileSystemSnapshot = (LocalFileSystemSnapshot) dataRepo.getObject(OBJECT_KEY_PREFIX + thisInternalProcessId);
LocalFileSystemSnapshot thatLocalFileSystemSnapshot = (LocalFileSystemSnapshot) dataRepo.getObject(OBJECT_KEY_PREFIX + thatInternalProcessId);
thisLocalFileSystemSnapshot.compare(thatLocalFileSystemSnapshot);
}
use of com.axway.ats.core.filesystem.snapshot.LocalFileSystemSnapshot in project ats-framework by Axway.
the class FileSystemSnapshot method loadFromLocalFile.
/**
* Load a snapshot from a local file
*
* @param newSnapshotName the name of the new snapshot
* </br>Pass null or empty string if want to use the snapshot name as saved in the file,
* or provide a new name here
* @param sourceFile the source file
* @return the new snapshot instance
*/
@PublicAtsApi
public void loadFromLocalFile(String newSnapshotName, String sourceFile) throws FileSystemSnapshotException {
if (this.fsSnapshotImpl instanceof LocalFileSystemSnapshot) {
// local file - local instance
((LocalFileSystemSnapshot) this.fsSnapshotImpl).loadFromFile(sourceFile);
if (!StringUtils.isNullOrEmpty(newSnapshotName)) {
// update snapshot name
((LocalFileSystemSnapshot) this.fsSnapshotImpl).setName(newSnapshotName);
}
} else {
// local file must be pushed to a remote File System Snapshot instance
LocalFileSystemSnapshot localFSS = new LocalFileSystemSnapshot(newSnapshotName, configuration);
localFSS.loadFromFile(sourceFile);
// now we will replace the remote instance with the local one which was just loaded from a local file
((RemoteFileSystemSnapshot) this.fsSnapshotImpl).pushFileSystemSnapshot(localFSS);
}
}
use of com.axway.ats.core.filesystem.snapshot.LocalFileSystemSnapshot in project ats-framework by Axway.
the class FileSystemSnapshot method toLocalFile.
/**
* Save a snapshot in a local file
* @param backupFile the backup file name
*/
@PublicAtsApi
public void toLocalFile(String backupFile) {
LocalFileSystemSnapshot localFSS;
if (this.fsSnapshotImpl instanceof LocalFileSystemSnapshot) {
localFSS = (LocalFileSystemSnapshot) this.fsSnapshotImpl;
} else {
localFSS = ((RemoteFileSystemSnapshot) this.fsSnapshotImpl).getFileSystemSnapshot();
}
localFSS.toFile(backupFile);
}
Aggregations