public CoordinatorService() { this.storage = new FileSystemStorage(@"c:\temp\netreduce\coordinator", true); this.coordinator = new Coordinator<RemoteWorker<ServiceClientWrapper>>(this.storage); this.uriProvider = new UriProvider(); ServiceClientWrapper.UriProvider = this.uriProvider; }
public void RemoteCoordinatorWorks() { this.storage.Store(Base64.Encode("f1"), "ala ma kota"); this.storage.Store(Base64.Encode("f2"), "kota alama"); this.storage.Store(Base64.Encode("f3"), "dolan ma"); var filesToRead = this.storage.ListFiles(); var mapperCodeFile = new Uri("file:///SampleMapper.cs"); var reducerCodeFile = new Uri("file:///SampleReducer.cs"); TestHelpers.LoadToStorage(@"..\..\..\NetReduce.Core.Tests\SampleMapper.cs", mapperCodeFile, this.storage); TestHelpers.LoadToStorage(@"..\..\..\NetReduce.Core.Tests\SampleReducer.cs", reducerCodeFile, this.storage); IUriProvider uriProvider = new UriProvider(); uriProvider.Uris.Add(new Uri("http://*****:*****@"c:\temp\netreduce\3", false); var reduceStorage4 = new FileSystemStorage(@"c:\temp\netreduce\4", false); var storages = new[] { reduceStorage3, reduceStorage4 }; string result = string.Empty; foreach (var reduceStorage in storages) { foreach (var uri in reduceStorage.ListFiles()) { var file = reduceStorage.GetFileName(uri); if (file.Contains("REDUCE") && file.Contains(Base64.Encode("kota"))) { result = reduceStorage.Read(file); } } } result.ShouldBe("2"); }
public void RemoteReduceWorks() { var coordinatorStorage = new FileSystemStorage(@"c:\temp\netreduce\coordinator", true); var coordinatorProcess = Process.Start(new ProcessStartInfo(@"..\..\..\NetReduce.CoordinatorService.ConsoleHost\bin\Debug\NetReduce.CoordinatorService.ConsoleHost.exe")); Thread.Sleep(100); try { var workerStorage = new FileSystemStorage(@"c:\temp\netreduce\0", false); var reducerCodeFileName = new Uri("file:///SampleReducer.cs"); TestHelpers.LoadToStorage(@"..\..\..\NetReduce.Core.Tests\SampleReducer.cs", reducerCodeFileName, this.storage); IUriProvider uriProvider = new UriProvider(); uriProvider.Uris.Add(new Uri("http://*****:*****@"(?<Key>.+)", "[0-9]+", RegexExtensions.GuidRegexString)); var uris = workerStorage.ListFiles(); foreach (var uri in uris) { var fileName = workerStorage.GetFileName(uri); if (regex.IsMatch(fileName)) { var key = regex.Match(fileName).Groups["Key"].Value; if (Base64.Decode(key) == "k1") { result = workerStorage.Read(fileName); } } } result.ShouldBe("3"); } finally { coordinatorProcess.Kill(); } }
public void RemoteMapWorks() { var fileName = new Uri(string.Format("file:///{0}", Base64.Encode("file1.txt"))); var fileContent = "whatever am i i"; var mapperCodeFileName = new Uri("file:///SampleMapper.cs"); this.storage.Store(fileName, fileContent); TestHelpers.LoadToStorage(@"..\..\..\NetReduce.Core.Tests\SampleMapper.cs", mapperCodeFileName, this.storage); IUriProvider uriProvider = new UriProvider(); uriProvider.Uris.Add(new Uri("http://*****:*****@"c:\temp\netreduce\0", false); var fileNo = workerStorage.ListFiles().Count(); fileNo.ShouldBe(6); }