public void CanSerializeValidJobRequest_Arguments_And_Defines() { var piJob = new MapReduceJobCreateParameters(); piJob.JarFile = "hadoop-examples.jar"; piJob.Arguments.Add("16"); piJob.Arguments.Add("10000"); piJob.Defines.Add("map.red.tasks", "1000"); piJob.Defines.Add("other.tasks", "1000"); var payloadConverter = new PayloadConverterBase(); var payload = payloadConverter.SerializeMapReduceRequest("hadoop", piJob); foreach (var argument in piJob.Arguments) { Assert.IsTrue(payload.Contains(string.Format("{0}={1}", WebHCatConstants.Arg, argument))); } int defineCounter = 0; foreach (var define in piJob.Defines) { defineCounter++; Assert.IsTrue(payload.Contains(Uri.EscapeDataString(string.Format("{0}={1}", define.Key, define.Value)))); } Assert.AreEqual(piJob.Defines.Count, defineCounter); }
public void CanSerializeValidJobRequest_JobName() { var mapReduceJob = new MapReduceJobCreateParameters() { JobName = "pi estimation jobDetails" }; var payloadConverter = new PayloadConverterBase(); var payload = payloadConverter.SerializeMapReduceRequest("hadoop", mapReduceJob); Assert.IsTrue(payload.Contains(Uri.EscapeDataString(string.Format("{0}={1}", WebHCatConstants.DefineJobName, mapReduceJob.JobName)))); }
public void CanSerializeValidJobRequestWithCallback() { var mapReduceJob = new MapReduceJobCreateParameters() { JobName = "pi estimation jobDetails", Callback = "http://someball.com/$jobid/notvalid" }; var payloadConverter = new PayloadConverterBase(); var payload = payloadConverter.SerializeMapReduceRequest("hadoop", mapReduceJob); Assert.IsTrue(payload.Contains(Uri.EscapeDataString(string.Format("{0}={1}", WebHCatConstants.DefineJobName, mapReduceJob.JobName)))); Assert.IsTrue(payload.Contains(string.Format("{0}={1}", Uri.EscapeDataString(WebHCatConstants.Callback), Uri.EscapeDataString(mapReduceJob.Callback)))); }
public void CanSerializeValidMapReduceJobRequest() { var mapReduceJob = new MapReduceJobCreateParameters() { JarFile = "/example/hadoop-examples.jar", ClassName = "pi" }; var payloadConverter = new PayloadConverterBase(); var payload = payloadConverter.SerializeMapReduceRequest("hadoop", mapReduceJob); Assert.IsTrue(payload.Contains(string.Format("{0}={1}", WebHCatConstants.Jar, Uri.EscapeDataString(mapReduceJob.JarFile)))); Assert.IsTrue(payload.Contains(string.Format("{0}={1}", WebHCatConstants.Class, Uri.EscapeDataString(mapReduceJob.ClassName)))); }
public void CanSerializeValidJobRequest_Defines() { var mapReduceJob = new MapReduceJobCreateParameters(); mapReduceJob.JobName = "Define counter test"; mapReduceJob.Defines.Add(new KeyValuePair <string, string>("map.input.tasks", "1000")); mapReduceJob.Defines.Add(new KeyValuePair <string, string>("map.input.mappers", "6")); mapReduceJob.Defines.Add(new KeyValuePair <string, string>("map.input.reducers", "16")); var payloadConverter = new PayloadConverterBase(); var payload = payloadConverter.SerializeMapReduceRequest("hadoop", mapReduceJob); int defineCounter = 0; foreach (var define in mapReduceJob.Defines) { defineCounter++; Assert.IsTrue(payload.Contains(Uri.EscapeDataString(string.Format("{0}={1}", define.Key, define.Value)))); } Assert.AreEqual(mapReduceJob.Defines.Count, defineCounter); }