Example #1
0
        public virtual void TestMoveSpecificPaths()
        {
            Log.Info("testMoveSpecificPaths");
            Path foo      = new Path("/foo");
            Path barFile  = new Path(foo, "bar");
            Path foo2     = new Path("/foo2");
            Path bar2File = new Path(foo2, "bar2");
            IDictionary <Path, BlockStoragePolicy> policyMap = Maps.NewHashMap();

            policyMap[foo]  = Cold;
            policyMap[foo2] = Warm;
            TestStorageMover.NamespaceScheme nsScheme = new TestStorageMover.NamespaceScheme(
                Arrays.AsList(foo, foo2), Arrays.AsList(barFile, bar2File), BlockSize, null, policyMap
                );
            TestStorageMover.ClusterScheme clusterScheme = new TestStorageMover.ClusterScheme
                                                               (DefaultConf, NumDatanodes, Repl, GenStorageTypes(NumDatanodes), null);
            TestStorageMover.MigrationTest test = new TestStorageMover.MigrationTest(this, clusterScheme
                                                                                     , nsScheme);
            test.SetupCluster();
            try
            {
                test.PrepareNamespace();
                test.SetStoragePolicy();
                IDictionary <URI, IList <Path> > map = Mover.Cli.GetNameNodePathsToMove(test.conf, "-p"
                                                                                        , "/foo/bar", "/foo2");
                int result = Org.Apache.Hadoop.Hdfs.Server.Mover.Mover.Run(map, test.conf);
                NUnit.Framework.Assert.AreEqual(ExitStatus.Success.GetExitCode(), result);
                Sharpen.Thread.Sleep(5000);
                test.Verify(true);
            }
            finally
            {
                test.ShutdownCluster();
            }
        }