Example #1
0
        public virtual void TestArguments()
        {
            ConfigExtractor extractor = GetTestConfig(true);

            NUnit.Framework.Assert.AreEqual(extractor.GetOpCount(), Constants.OperationType.Values
                                                ().Length);
            NUnit.Framework.Assert.AreEqual(extractor.GetMapAmount(), 2);
            NUnit.Framework.Assert.AreEqual(extractor.GetReducerAmount(), 2);
            Range <long> apRange = extractor.GetAppendSize();

            NUnit.Framework.Assert.AreEqual(apRange.GetLower(), Constants.Megabytes * 1);
            NUnit.Framework.Assert.AreEqual(apRange.GetUpper(), Constants.Megabytes * 2);
            Range <long> wRange = extractor.GetWriteSize();

            NUnit.Framework.Assert.AreEqual(wRange.GetLower(), Constants.Megabytes * 1);
            NUnit.Framework.Assert.AreEqual(wRange.GetUpper(), Constants.Megabytes * 2);
            Range <long> trRange = extractor.GetTruncateSize();

            NUnit.Framework.Assert.AreEqual(trRange.GetLower(), 0);
            NUnit.Framework.Assert.AreEqual(trRange.GetUpper(), Constants.Megabytes * 1);
            Range <long> bRange = extractor.GetBlockSize();

            NUnit.Framework.Assert.AreEqual(bRange.GetLower(), Constants.Megabytes * 1);
            NUnit.Framework.Assert.AreEqual(bRange.GetUpper(), Constants.Megabytes * 2);
            string resfile = extractor.GetResultFile();

            NUnit.Framework.Assert.AreEqual(resfile, GetResultFile().ToString());
            int durationMs = extractor.GetDurationMilliseconds();

            NUnit.Framework.Assert.AreEqual(durationMs, 10 * 1000);
        }
Example #2
0
        /// <summary>Sets up a job conf for the given job using the given config object.</summary>
        /// <remarks>
        /// Sets up a job conf for the given job using the given config object. Ensures
        /// that the correct input format is set, the mapper and and reducer class and
        /// the input and output keys and value classes along with any other job
        /// configuration.
        /// </remarks>
        /// <param name="config"/>
        /// <returns>JobConf representing the job to be ran</returns>
        /// <exception cref="System.IO.IOException"/>
        private JobConf GetJob(ConfigExtractor config)
        {
            JobConf job = new JobConf(config.GetConfig(), typeof(Org.Apache.Hadoop.FS.Slive.SliveTest
                                                                 ));

            job.SetInputFormat(typeof(DummyInputFormat));
            FileOutputFormat.SetOutputPath(job, config.GetOutputPath());
            job.SetMapperClass(typeof(SliveMapper));
            job.SetPartitionerClass(typeof(SlivePartitioner));
            job.SetReducerClass(typeof(SliveReducer));
            job.SetOutputKeyClass(typeof(Text));
            job.SetOutputValueClass(typeof(Text));
            job.SetOutputFormat(typeof(TextOutputFormat));
            TextOutputFormat.SetCompressOutput(job, false);
            job.SetNumReduceTasks(config.GetReducerAmount());
            job.SetNumMapTasks(config.GetMapAmount());
            return(job);
        }