use of org.syncany.operations.down.actions.DeleteFileSystemAction in project syncany by syncany.
the class FileSystemActionComparatorTest method testFileSystemActionComparator.
// TODO [low] write more unit tests for FileSystemActionComparator
@Test
public void testFileSystemActionComparator() throws Exception {
// Setup
List<FileSystemAction> actions = new ArrayList<FileSystemAction>();
actions.add(createNewFileSystemAction("deletedfolderXX", FileType.FILE));
actions.add(createNewFileSystemAction("newsymlink", FileType.SYMLINK));
actions.add(createNewFileSystemAction("NEWfolder", FileType.FOLDER));
actions.add(createNewFileSystemAction("newfile.jpg", FileType.FILE));
// << same as folder above!
actions.add(createDeleteFileSystemAction("deletedfolderXX", FileType.FOLDER));
actions.add(createDeleteFileSystemAction("deletedsymlink.jpg", FileType.SYMLINK));
actions.add(createNewFileSystemAction("newfile2.jpg", FileType.FILE));
actions.add(createRenameFileSystemAction("from.jpg", "to.jpg", FileType.FILE));
actions.add(createDeleteFileSystemAction("deletedfile2.jpg", FileType.FILE));
// Run
FileSystemActionComparator actionComparator = new FileSystemActionComparator();
actionComparator.sort(actions);
// Test
assertArrayEquals("Actions should match order", new String[] { "DeleteFileSystemAction,deletedfile2.jpg,FILE", "DeleteFileSystemAction,deletedsymlink.jpg,SYMLINK", "NewFileSystemAction,NEWfolder,FOLDER", "NewFileSystemAction,newfile.jpg,FILE", "NewFileSystemAction,newfile2.jpg,FILE", "NewFileSystemAction,newsymlink,SYMLINK", "RenameFileSystemAction,to.jpg,FILE", "DeleteFileSystemAction,deletedfolderXX,FOLDER", // <<< moved here by postCompareSort!
"NewFileSystemAction,deletedfolderXX,FILE" }, toArray(actions));
System.out.println(actions);
}
Aggregations