public virtual void TestChooseTarget2()
        {
            DatanodeStorageInfo[]       targets;
            BlockPlacementPolicyDefault repl          = (BlockPlacementPolicyDefault)replicator;
            IList <DatanodeStorageInfo> chosenNodes   = new AList <DatanodeStorageInfo>();
            ICollection <Node>          excludedNodes = new HashSet <Node>();

            excludedNodes.AddItem(dataNodes[1]);
            targets = repl.ChooseTarget(filename, 4, dataNodes[0], chosenNodes, false, excludedNodes
                                        , BlockSize, TestBlockStoragePolicy.DefaultStoragePolicy);
            NUnit.Framework.Assert.AreEqual(targets.Length, 4);
            NUnit.Framework.Assert.AreEqual(storages[0], targets[0]);
            NUnit.Framework.Assert.IsTrue(cluster.IsNodeGroupAware());
            // Make sure no replicas are on the same nodegroup
            for (int i = 1; i < 4; i++)
            {
                NUnit.Framework.Assert.IsFalse(IsOnSameNodeGroup(targets[0], targets[i]));
            }
            NUnit.Framework.Assert.IsTrue(IsOnSameRack(targets[1], targets[2]) || IsOnSameRack
                                              (targets[2], targets[3]));
            NUnit.Framework.Assert.IsFalse(IsOnSameRack(targets[1], targets[3]));
            excludedNodes.Clear();
            chosenNodes.Clear();
            excludedNodes.AddItem(dataNodes[1]);
            chosenNodes.AddItem(storages[2]);
            targets = repl.ChooseTarget(filename, 1, dataNodes[0], chosenNodes, true, excludedNodes
                                        , BlockSize, TestBlockStoragePolicy.DefaultStoragePolicy);
            System.Console.Out.WriteLine("targets=" + Arrays.AsList(targets));
            NUnit.Framework.Assert.AreEqual(2, targets.Length);
            //make sure that the chosen node is in the target.
            int i_1 = 0;

            for (; i_1 < targets.Length && !storages[2].Equals(targets[i_1]); i_1++)
            {
            }
            NUnit.Framework.Assert.IsTrue(i_1 < targets.Length);
        }