Ejemplo n.º 1
0
        public void CreateStreamingJob()
        {
            var args    = new[] { "arg1", "arg2" };
            var defines = new Dictionary <string, string>
            {
                { "hive.1", "val1" },
                { "hive.2", "val2" }
            };
            const string status     = "folder";
            const string inputpath  = "input";
            const string outputpath = "output";
            const string mapper     = "mapper.exe";
            const string reducer    = "reducer.exe";
            const string file       = "file";
            var          cmdlet     = new NewAzureHDInsightStreamingMapReduceJobDefinitionCommand
            {
                CommandRuntime     = commandRuntimeMock.Object,
                HDInsightJobClient = hdinsightJobManagementMock.Object,
                Arguments          = args,
                File         = file,
                StatusFolder = status,
                InputPath    = inputpath,
                OutputPath   = outputpath,
                Mapper       = mapper,
                Reducer      = reducer
            };

            foreach (var define in defines)
            {
                cmdlet.Defines.Add(define.Key, define.Value);
            }

            cmdlet.ExecuteCmdlet();
            commandRuntimeMock.VerifyAll();
            commandRuntimeMock.Verify(
                f =>
                f.WriteObject(
                    It.Is <AzureHDInsightStreamingMapReduceJobDefinition>(
                        job =>
                        job.Arguments.Count == args.Length && job.File == file && job.StatusFolder == status &&
                        job.Input == inputpath && job.Output == outputpath && job.Mapper == mapper &&
                        job.Reducer == reducer && job.Defines.Count == defines.Count)));
        }
Ejemplo n.º 2
0
        public void CreateStreamingJob()
        {
            var args = new[] { "arg1", "arg2" };
            var defines = new Dictionary<string, string>
                {
                    {"hive.1", "val1"},
                    {"hive.2", "val2"}
                };
            const string status = "folder";
            const string inputpath = "input";
            const string outputpath = "output";
            const string mapper = "mapper.exe";
            const string reducer = "reducer.exe";
            const string file = "file";
            var cmdlet = new NewAzureHDInsightStreamingMapReduceJobDefinitionCommand
            {
                CommandRuntime = commandRuntimeMock.Object,
                HDInsightJobClient = hdinsightJobManagementMock.Object,
                Arguments = args,
                File = file,
                StatusFolder = status,
                InputPath = inputpath,
                OutputPath = outputpath,
                Mapper = mapper,
                Reducer = reducer
            };
            foreach (var define in defines)
            {
                cmdlet.Defines.Add(define.Key, define.Value);
            }

            cmdlet.ExecuteCmdlet();
            commandRuntimeMock.VerifyAll();
            commandRuntimeMock.Verify(
                f =>
                    f.WriteObject(
                        It.Is<AzureHDInsightStreamingMapReduceJobDefinition>(
                            job =>
                                job.Arguments.Count == args.Length && job.File == file && job.StatusFolder == status &&
                                job.Input == inputpath && job.Output == outputpath && job.Mapper == mapper &&
                                job.Reducer == reducer && job.Defines.Count == defines.Count)));
        }