public async Task GetLocalPathsForMissingDS() { var repro = BuildRepro("ExistingFileInExistingDataset"); BuildDatset(repro, "ds1", "f1.root", "f2.root"); var place = new PlaceLocalWindowsDisk("test", repro); var files = (await place.GetLocalFileLocationsAsync(new Uri[] { new Uri("gridds://ds3/f2.root") })).ToArray(); }
public async Task FileInNonExistingDataset() { var repro = BuildRepro("ExistingFileInExistingDataset"); BuildDatset(repro, "ds1", "f1.root", "f2.root"); var place = new PlaceLocalWindowsDisk("test", repro); var u = new Uri("gridds://ds2/f3.root"); Assert.IsFalse(await place.HasFileAsync(u)); }
public async Task GetDSFileListForNonExistingDataset() { var repro = BuildRepro("ExistingFileInExistingDataset"); BuildDatset(repro, "ds1", "f1.root", "f2.root"); var place = new PlaceLocalWindowsDisk("test", repro); var files = await place.GetListOfFilesForDataSetAsync("ds2"); Assert.IsNull(files); }
public async Task BadFileInExistingDataset() { var repro = BuildRepro("ExistingFileInExistingDataset"); BuildDatset(repro, "ds1", "f1.root", "f2.root"); var place = new PlaceLocalWindowsDisk("test", repro); var u = new Uri("gridds://ds1/f3.root"); // This is undefined behavior - HasFile can only take URI's for files that exist in the dataset. Assert.IsFalse(await place.HasFileAsync(u)); }
public async Task NonExistingFileInExistingDataset() { var repro = BuildRepro("ExistingFileInExistingDataset"); BuildDatset(repro, "ds1", "f1.root", "f2.root"); File.Delete($"{repro.FullName}\\ds1\\files\\f1.root"); var place = new PlaceLocalWindowsDisk("test", repro); var u = new Uri("gridds://ds1/f1.root"); Assert.IsFalse(await place.HasFileAsync(u)); }
public void CantCopyFromAnotherTypeOfRepro() { var repro1 = BuildRepro("repro1"); BuildDatset(repro1, "ds1", "f1.root", "f2.root"); var place1 = new PlaceLocalWindowsDisk("test1", repro1); var place2 = new DummyPlace("dork"); Assert.IsFalse(place1.CanSourceCopy(place2)); }
public async Task FileNameColonsAreIgnored() { var repro = BuildRepro("repro"); BuildDatset(repro, "ds1", "f1.root", "f2.root"); AddNamespaceToDatasetText(repro, "ds1", "user.gwatts"); var place = new PlaceLocalWindowsDisk("test", repro); var files = await place.GetListOfFilesForDataSetAsync("ds1"); Assert.AreEqual("f1.root", files[0]); Assert.AreEqual("f2.root", files[1]); }
public void CanCopyFromAnotherLikeThis() { var repro1 = BuildRepro("repro1"); BuildDatset(repro1, "ds1", "f1.root", "f2.root"); var repro2 = BuildRepro("repro2"); var place1 = new PlaceLocalWindowsDisk("test1", repro1); var place2 = new PlaceLocalWindowsDisk("test2", repro2); Assert.IsTrue(place1.CanSourceCopy(place2)); }
public void CanCopyFromNeverVisibleSCP() { var repro1 = BuildRepro("repro1"); BuildDatset(repro1, "ds1", "f1.root", "f2.root"); var place1 = new PlaceLocalWindowsDisk("test1", repro1); var place2 = new SCPPlaceCanCopyTestJig() { ReturnSCPIsVisibleFrom = false }; Assert.IsFalse(place1.CanSourceCopy(place2)); }
public async Task GetLocalPathsForDSFiles() { var repro = BuildRepro("ExistingFileInExistingDataset"); BuildDatset(repro, "ds1", "f1.root", "f2.root"); var place = new PlaceLocalWindowsDisk("test", repro); var files = await place.GetLocalFileLocationsAsync(new Uri[] { new Uri("gridds://ds1/f1.root"), new Uri("gridds://ds1/f2.root") }); Assert.AreEqual(2, files.Count()); foreach (var f in files) { Assert.IsTrue(new FileInfo(f.LocalPath).Exists); } }
public async Task GetDSFileListForExistingDatasetButMissingOneFile() { var repro = BuildRepro("ExistingFileInExistingDataset"); BuildDatset(repro, "ds1", "f1.root", "f2.root"); File.Delete($"{repro.FullName}\\ds1\\files\\f1.root"); var place = new PlaceLocalWindowsDisk("test", repro); var files = await place.GetListOfFilesForDataSetAsync("ds1"); Assert.IsNotNull(files); Assert.AreEqual(2, files.Length); Assert.AreEqual("f1.root", files[0]); Assert.AreEqual("f2.root", files[1]); }
public async Task CopyTo() { var repro1 = BuildRepro("repro1"); BuildDatset(repro1, "ds1", "f1.root", "f2.root"); var repro2 = BuildRepro("repro2"); var place1 = new PlaceLocalWindowsDisk("test1", repro1); var place2 = new PlaceLocalWindowsDisk("test2", repro2); DataSetManager.ResetDSM(place1, place2); Assert.IsNull(await place2.GetListOfFilesForDataSetAsync("ds1")); await place1.CopyToAsync(place2, (await place1.GetListOfFilesForDataSetAsync("ds1")).Select(f => new Uri($"gridds://ds1/{f}")).ToArray()); Assert.AreEqual(2, (await place2.GetListOfFilesForDataSetAsync("ds1")).Length); }
public async Task CopyFromSCPTarget() { // Build remote dataset up on linux _ssh.CreateRepro(); _ssh.CreateDS("ds1", "f1.root", "f2.root"); var place1 = new PlaceLinuxRemote("test1", _ssh.RemotePath, _ssh.RemoteHostInfo); var repro1 = BuildRepro("repro2"); var place2 = new PlaceLocalWindowsDisk("test1", repro1); DataSetManager.ResetDSM(place1, place2); var uris = new Uri[] { new Uri("gridds://ds1/f1.root"), new Uri("gridds://ds1/f2.root") }; await place2.CopyFromAsync(place1, uris); var files = await place2.GetListOfFilesForDataSetAsync("ds1"); Assert.AreEqual(2, files.Length); Assert.IsTrue(await place2.HasFileAsync(uris[0])); Assert.IsTrue(await place2.HasFileAsync(uris[1])); }
public async Task TestUNCLocation() { // Create a UNC repro string uncRoot = File.ReadLines("location_test_unc.txt").First(); var repro1 = new DirectoryInfo(uncRoot); if (repro1.Exists) { repro1.Delete(true); } repro1.Create(); repro1.Refresh(); // Now build a dataset there. BuildDatset(repro1, "ds1", "f1.root", "f2.root"); var place1 = new PlaceLocalWindowsDisk("test1", repro1); var files = (await place1.GetLocalFileLocationsAsync(new[] { new Uri("gridds://ds1/f1.root") })).ToArray(); Assert.AreEqual(1, files.Length); Assert.AreEqual($"{uncRoot}\\ds1\\files\\f1.root", files[0].LocalPath); }