Amend HDFS-2616 to fix mocking in TestBPOfferService

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-1623@1209315 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Todd Lipcon 2011-12-02 00:03:17 +00:00
parent 28dbd56de0
commit 74b1f069cc

View File

@ -34,6 +34,7 @@
import org.apache.hadoop.hdfs.server.protocol.BlockCommand;
import org.apache.hadoop.hdfs.server.protocol.DatanodeProtocol;
import org.apache.hadoop.hdfs.server.protocol.DatanodeRegistration;
import org.apache.hadoop.hdfs.server.protocol.HeartbeatResponse;
import org.apache.hadoop.hdfs.server.protocol.NamespaceInfo;
import org.apache.hadoop.hdfs.server.protocol.ReceivedDeletedBlockInfo;
import org.apache.hadoop.test.GenericTestUtils;
@ -97,6 +98,18 @@ private DatanodeProtocol setupNNMock() throws Exception {
new NamespaceInfo(1, FAKE_CLUSTERID, FAKE_BPID,
0, HdfsConstants.LAYOUT_VERSION))
.when(mock).versionRequest();
Mockito.doReturn(new HeartbeatResponse(null))
.when(mock).sendHeartbeat(
Mockito.any(DatanodeRegistration.class),
Mockito.anyLong(),
Mockito.anyLong(),
Mockito.anyLong(),
Mockito.anyLong(),
Mockito.anyInt(),
Mockito.anyInt(),
Mockito.anyInt());
return mock;
}