public virtual void TestHighestPriReplSrcChosenDespiteMaxReplLimit() { bm.maxReplicationStreams = 0; bm.replicationStreamsHardLimit = 1; long blockId = 42; // arbitrary Block aBlock = new Block(blockId, 0, 0); IList <DatanodeDescriptor> origNodes = GetNodes(0, 1); // Add the block to the first node. AddBlockOnNodes(blockId, origNodes.SubList(0, 1)); IList <DatanodeDescriptor> cntNodes = new List <DatanodeDescriptor>(); IList <DatanodeStorageInfo> liveNodes = new List <DatanodeStorageInfo>(); NUnit.Framework.Assert.IsNotNull("Chooses source node for a highest-priority replication" + " even if all available source nodes have reached their replication" + " limits below the hard limit." , bm.ChooseSourceDatanode(aBlock, cntNodes, liveNodes, new NumberReplicas(), UnderReplicatedBlocks .QueueHighestPriority)); NUnit.Framework.Assert.IsNull("Does not choose a source node for a less-than-highest-priority" + " replication since all available source nodes have reached" + " their replication limits." , bm.ChooseSourceDatanode(aBlock, cntNodes, liveNodes, new NumberReplicas(), UnderReplicatedBlocks .QueueVeryUnderReplicated)); // Increase the replication count to test replication count > hard limit DatanodeStorageInfo[] targets = new DatanodeStorageInfo[] { origNodes[1].GetStorageInfos ()[0] }; origNodes[0].AddBlockToBeReplicated(aBlock, targets); NUnit.Framework.Assert.IsNull("Does not choose a source node for a highest-priority" + " replication when all available nodes exceed the hard limit.", bm.ChooseSourceDatanode (aBlock, cntNodes, liveNodes, new NumberReplicas(), UnderReplicatedBlocks.QueueHighestPriority )); }