コード例 #1
0
        public virtual void TestListStatusErrorOnNonExistantDir()
        {
            Configuration conf = new Configuration();

            conf.SetInt(FileInputFormat.ListStatusNumThreads, numThreads);
            Org.Apache.Hadoop.Mapreduce.Lib.Input.TestFileInputFormat.ConfigureTestErrorOnNonExistantDir
                (conf, localFs);
            JobConf         jobConf = new JobConf(conf);
            TextInputFormat fif     = new TextInputFormat();

            fif.Configure(jobConf);
            try
            {
                fif.ListStatus(jobConf);
                NUnit.Framework.Assert.Fail("Expecting an IOException for a missing Input path");
            }
            catch (IOException e)
            {
                Path expectedExceptionPath = new Path(TestRootDir, "input2");
                expectedExceptionPath = localFs.MakeQualified(expectedExceptionPath);
                NUnit.Framework.Assert.IsTrue(e is InvalidInputException);
                NUnit.Framework.Assert.AreEqual("Input path does not exist: " + expectedExceptionPath
                                                .ToString(), e.Message);
            }
        }
コード例 #2
0
        public virtual void TestListStatusNestedNonRecursive()
        {
            Configuration conf = new Configuration();

            conf.SetInt(FileInputFormat.ListStatusNumThreads, numThreads);
            IList <Path> expectedPaths = Org.Apache.Hadoop.Mapreduce.Lib.Input.TestFileInputFormat
                                         .ConfigureTestNestedNonRecursive(conf, localFs);
            JobConf         jobConf = new JobConf(conf);
            TextInputFormat fif     = new TextInputFormat();

            fif.Configure(jobConf);
            FileStatus[] statuses = fif.ListStatus(jobConf);
            Org.Apache.Hadoop.Mapreduce.Lib.Input.TestFileInputFormat.VerifyFileStatuses(expectedPaths
                                                                                         , Lists.NewArrayList(statuses), localFs);
        }