public void TestZip() { var temp = new RaiFile($"{TestDir}/Data/pic3/d/iserv/testpic/325/325859/325859_00.tiff"); var original = new RaiFile($"{TestDir}/Data/pic3/d/iserv/testpic/AB5/AB5678/AB5678_03.tiff"); Assert.True(File.Exists(original.FullName)); temp.cp(original); var zipFile = temp.Zip(); var t1 = DateTime.Now; Assert.True(File.Exists(zipFile.FullName)); var zipSize = new FileInfo(zipFile.FullName).Length; zipFile.rm(); temp.cp(original); var t2 = DateTime.Now; // var zip7 = temp.Zip7(); // var t3 = DateTime.Now; // Assert.True(zip7.Exists()); // var zip7Size = new FileInfo(zip7.FullName).Length; // zip7.rm(); temp.cp(original); var t4 = DateTime.Now; // var ultra = temp.ZipUltra(); // var t5 = DateTime.Now; // Assert.True(ultra.Exists()); // var ultraSize = new FileInfo(ultra.FullName).Length; // Debug.WriteLine("zip:/t/t" + (t1 - t0) + "/t" + zipSize); // Debug.WriteLine("7zip:/t" + (t3 - t2) + "/t" + zip7Size); // Debug.WriteLine("ultra:/t" + (t5 - t4) + "/t" + ultraSize); }
public void TestRaiFileEnsure() { // this test does not really challange the delay caused by massive parallel change operations in Dropbox var f0 = new RaiFile($"{TestDir}/Data/EnsureTests/kill.txt"); f0.mkdir(); var f = new TextFile($"{TestDir}/Data/EnsureTests/kill.txt"); for (int i = 0; i < 10000; i++) { f.Append("Test line " + i.ToString()); } f.Save(); var f2 = new RaiFile($"{TestDir}/Data/EnsureTests/kill2.txt"); var start = DateTimeOffset.UtcNow; var result1 = f2.cp(f); Assert.True(File.Exists(f2.FullName), "File is supposed to have materialized by now."); var cpDuration = DateTimeOffset.UtcNow - start; var f3 = new TmpFile(); var result2 = f3.mv(f2); Assert.True(File.Exists(f3.FullName), "File is supposed to have materialized by now."); Assert.False(File.Exists(f2.FullName), "File is supposed to have vanished by now."); Assert.Equal(0, result1 + result2); }
public void TestRaiFile1() { var temp = new RaiFile($"{TestDir}/Data/pic3/d/iserv/testpic/325/325859/325859_11.tiff"); var original = new RaiFile($"{TestDir}/Data/pic3/d/iserv/testpic/325/325859/325859_03.tiff"); Assert.True(File.Exists(original.FullName)); temp.rm(); Assert.False(File.Exists(temp.FullName)); temp.cp(original); Assert.True(File.Exists(temp.FullName)); var dest = new RaiFile($"{TestDir}/Data/pic3/d/iserv/testpic/325/325859/325859_01.tiff"); dest.rm(); dest.mv(temp); Assert.True(File.Exists(dest.FullName)); Assert.False(File.Exists(temp.FullName)); }