use of com.axway.ats.common.filesystem.snapshot.equality.DifferenceType in project ats-framework by Axway.
the class FileSystemSnapshotException method getFilesPresentInOneSnapshotOnly.
/**
* Get the all files which are present in just one of the snapshots.
* </br>Note that <b>null</b> is returned if provide a not existing snapshot name.
*
* @param snapshot snapshot name
* @return list of matching files
*/
@PublicAtsApi
public List<String> getFilesPresentInOneSnapshotOnly(String snapshot) {
DifferenceType searchedDiffType;
if (equality.getFirstSnapshotName().equals(snapshot)) {
searchedDiffType = DifferenceType.FILE_PRESENT_IN_FIRST_SNAPSHOT_ONLY;
} else if (equality.getSecondSnapshotName().equals(snapshot)) {
searchedDiffType = DifferenceType.FILE_PRESENT_IN_SECOND_SNAPSHOT_ONLY;
} else {
return null;
}
List<String> files = new ArrayList<String>();
for (FileTrace diff : equality.getDifferences()) {
if (diff.getDifferenceType() == searchedDiffType) {
files.add(diff.toString());
}
}
return files;
}
use of com.axway.ats.common.filesystem.snapshot.equality.DifferenceType in project ats-framework by Axway.
the class FileSystemSnapshotException method getDirectoriesPresentInOneSnapshotOnly.
/**
* Get the all directories which are present in just one of the snapshots.
* </br>Note that <b>null</b> is returned if provide a not existing snapshot name.
*
* @param snapshot snapshot name
* @return list of matching directories
*/
@PublicAtsApi
public List<String> getDirectoriesPresentInOneSnapshotOnly(String snapshot) {
DifferenceType searchedDiffType;
if (equality.getFirstSnapshotName().equals(snapshot)) {
searchedDiffType = DifferenceType.DIR_PRESENT_IN_FIRST_SNAPSHOT_ONLY;
} else if (equality.getSecondSnapshotName().equals(snapshot)) {
searchedDiffType = DifferenceType.DIR_PRESENT_IN_SECOND_SNAPSHOT_ONLY;
} else {
return null;
}
List<String> dirs = new ArrayList<String>();
for (FileTrace diff : equality.getDifferences()) {
if (diff.getDifferenceType() == searchedDiffType) {
dirs.add(diff.toString());
}
}
return dirs;
}
use of com.axway.ats.common.filesystem.snapshot.equality.DifferenceType in project ats-framework by Axway.
the class FileSystemSnapshotException method getMessage.
@Override
@PublicAtsApi
public String getMessage() {
if (equality == null) {
// got a generic exception, not directly concerning the comparision
return super.getMessage();
} else {
StringBuilder msg = new StringBuilder();
msg.append("Comparing [");
msg.append(equality.getFirstSnapshotName());
msg.append("] and [");
msg.append(equality.getSecondSnapshotName());
msg.append("] produced the following unexpected differences:");
// tell all differences sorted by their type
DifferenceType diffType = null;
DifferenceType nextDiffType;
for (FileTrace diff : equality.getDifferences()) {
nextDiffType = diff.getDifferenceType();
if (nextDiffType != diffType) {
// add new difference type
msg.append("\n\n");
msg.append(nextDiffType.getDescription(diff.getFirstSnapshot(), diff.getSecondSnapshot()));
diffType = nextDiffType;
}
// add new difference
msg.append("\n");
msg.append(diff.toString());
}
msg.append("\n");
return msg.toString();
}
}
Aggregations