public async Task CopyFromGRIDWithTwoOptions() { // Make sure it finds a 3 step routing, from CERN, to the tev machines, back to a local. var loc1 = new DummyPlace("LocalDisk") { IsLocal = true, NeedsConfirmationCopy = false, CanSourceACopy = true }; var loc2 = new DummyPlace("tev") { IsLocal = false, DataTier = 10, CanSourceACopy = true, NeedsConfirmationCopy = false }; var loc3 = new DummyPlace("tev-GRID") { IsLocal = false, DataTier = 100, CanSourceACopy = true, NeedsConfirmationCopy = false }; var loc4 = new DummyPlace("cern") { IsLocal = false, DataTier = 10, CanSourceACopy = true, NeedsConfirmationCopy = false }; var loc5 = new DummyPlace("cern-GRID") { IsLocal = false, DataTier = 100, CanSourceACopy = true, NeedsConfirmationCopy = false }; // The tev-GRID can copy only to tev loc3.ExplicitlyNotAllowed.Add(loc1); loc3.ExplicitlyNotAllowed.Add(loc4); loc3.ExplicitlyNotAllowed.Add(loc5); // tev-CERN can copy only to cern loc5.ExplicitlyNotAllowed.Add(loc1); loc5.ExplicitlyNotAllowed.Add(loc2); loc5.ExplicitlyNotAllowed.Add(loc3); // loc1 can only access tev and cern loc1.ExplicitlyNotAllowed.Add(loc3); loc1.ExplicitlyNotAllowed.Add(loc5); // loc1 can only source a copy loc2.ExplicitlyNotAllowed.Add(loc1); loc4.ExplicitlyNotAllowed.Add(loc1); loc3.Add("ds1", "f1", "f2"); loc5.Add("ds1", "f1", "f2"); DataSetManager.ResetDSM(loc1, loc2, loc3, loc4, loc5); var files = await DataSetManager.ListOfFilesInDataSetAsync("ds1"); var localFiles = await MakeFilesLocalAsync(files); Assert.AreEqual(2, localFiles.Length); foreach (var c in DummyPlace.CopyLogs) { Console.WriteLine(c); } Assert.AreEqual(2, DummyPlace.CopyLogs.Count); Assert.AreEqual("*tev-GRID -> tev (2 files)", DummyPlace.CopyLogs[0]); Assert.AreEqual("tev -> *LocalDisk (2 files)", DummyPlace.CopyLogs[1]); }
public async Task CopyFromSourceToDestButFilesThere() { var loc1 = new DummyPlace("bogusLocal") { NeedsConfirmationCopy = false, CanSourceACopy = true }; var loc2 = new DummyPlace("bogusNonLocal") { IsLocal = false, DataTier = 10 }; loc1.Add("ds1", "f1", "f2"); loc1.BlockHasFileFor("f1"); loc2.Add("ds1", "f1", "f2"); DataSetManager.ResetDSM(loc1, loc2); var files = await DataSetManager.ListOfFilesInDataSetAsync("ds1"); var localFiles = await DataSetManager.CopyFilesAsync(loc2, loc1, files); Assert.IsNotNull(localFiles); Assert.AreEqual(2, localFiles.Length); Assert.AreEqual(@"c:\junk\f1.txt", localFiles[0].OriginalString); Assert.AreEqual(@"c:\junk\f2.txt", localFiles[1].OriginalString); Assert.AreEqual(1, DummyPlace.CopyLogs.Count); Assert.AreEqual("bogusNonLocal -> *bogusLocal (1 files)", DummyPlace.CopyLogs[0]); }
public async Task CopyToLocalFromMultipleDatasets() { var loc1 = new DummyPlace("bogusLocal") { NeedsConfirmationCopy = false, CanSourceACopy = true }; var loc2 = new DummyPlace("bogusNonLocal") { IsLocal = false, DataTier = 10 }; loc2.Add("ds1", "f1", "f2"); loc2.Add("ds2", "f3", "f4"); DataSetManager.ResetDSM(loc1, loc2); var files = (await DataSetManager.ListOfFilesInDataSetAsync("ds1")) .Concat(await DataSetManager.ListOfFilesInDataSetAsync("ds2")).ToArray(); var localFiles = await DataSetManager.MakeFilesLocalAsync(files); Assert.AreEqual(4, localFiles.Length); Assert.AreEqual(@"c:\junk\f1.txt", localFiles[0].OriginalString); Assert.AreEqual(@"c:\junk\f2.txt", localFiles[1].OriginalString); Assert.AreEqual(@"c:\junk\f3.txt", localFiles[2].OriginalString); Assert.AreEqual(@"c:\junk\f4.txt", localFiles[3].OriginalString); }
public async Task DSMgrGetListOfFilesFromBadDS() { var loc1 = new DummyPlace("bogusLocal") { NeedsConfirmationCopy = false, CanSourceACopy = true }; var loc2 = new DummyPlace("bogusNonLocal") { IsLocal = false, DataTier = 10 }; loc2.Add("ds1", "f1", "f2"); DataSetManager.ResetDSM(loc1, loc2); var files = await DataSetManager.ListOfFilesInDataSetAsync("ds2"); }
public async Task CopyToLocalWithNoNonConfirmLocalAvailable() { var loc1 = new DummyPlace("bogusLocal") { NeedsConfirmationCopy = true, CanSourceACopy = true }; var loc2 = new DummyPlace("bogusNonLocal") { IsLocal = false, DataTier = 10 }; loc2.Add("ds1", "f1", "f2"); DataSetManager.ResetDSM(loc1, loc2); var files = await DataSetManager.ListOfFilesInDataSetAsync("ds1"); var localFiles = await DataSetManager.MakeFilesLocalAsync(files); }
public async Task CopyToLocalWithoutConfirm() { var loc1 = new DummyPlace("l1") { IsLocal = true, NeedsConfirmationCopy = true, CanSourceACopy = true }; var loc2 = new DummyPlace("l2") { IsLocal = true, NeedsConfirmationCopy = true, CanSourceACopy = true }; loc1.Add("ds1", "f1", "f2"); DataSetManager.ResetDSM(loc1, loc2); var f = await DataSetManager.CopyFilesToAsync(loc2, await DataSetManager.ListOfFilesInDataSetAsync("ds1")); Assert.AreEqual(2, f.Length); Assert.AreEqual(1, DummyPlace.CopyLogs.Count); Assert.AreEqual("*l1 -> l2 (2 files)", DummyPlace.CopyLogs[0]); }
public async Task CopyFromFireWalledPlace() { // Make sure it finds a 3 step routing, from CERN, to the tev machines, back to a local. var loc1 = new DummyPlace("LocalDisk") { IsLocal = true, NeedsConfirmationCopy = false, CanSourceACopy = true }; var loc2 = new DummyPlace("tev") { IsLocal = false, DataTier = 10, CanSourceACopy = true, NeedsConfirmationCopy = false }; var loc3 = new DummyPlace("CERN") { IsLocal = false, DataTier = 10, CanSourceACopy = true, NeedsConfirmationCopy = false }; loc1.ExplicitlyNotAllowed.Add(loc3); loc2.ExplicitlyNotAllowed.Add(loc3); loc2.ExplicitlyNotAllowed.Add(loc1); loc3.ExplicitlyNotAllowed.Add(loc1); loc3.Add("ds1", "f1", "f2"); DataSetManager.ResetDSM(loc1, loc2, loc3); var files = await DataSetManager.ListOfFilesInDataSetAsync("ds1"); var localFiles = await MakeFilesLocalAsync(files); Assert.AreEqual(2, localFiles.Length); foreach (var c in DummyPlace.CopyLogs) { Console.WriteLine(c); } Assert.AreEqual(2, DummyPlace.CopyLogs.Count); Assert.AreEqual("*CERN -> tev (2 files)", DummyPlace.CopyLogs[0]); Assert.AreEqual("tev -> *LocalDisk (2 files)", DummyPlace.CopyLogs[1]); }