|
@@ -188,6 +188,20 @@ public class TestBlockListAsLongs {
|
|
|
assertTrue(reportReplicas.isEmpty());
|
|
|
}
|
|
|
|
|
|
+ private BlockListAsLongs getBlockList(Replica ... replicas) {
|
|
|
+ int numBlocks = replicas.length;
|
|
|
+ List<Long> longs = new ArrayList<Long>(2 + numBlocks);
|
|
|
+ longs.add(Long.valueOf(numBlocks));
|
|
|
+ longs.add(0L);
|
|
|
+ for(Replica r : replicas) {
|
|
|
+ longs.add(r.getBlockId());
|
|
|
+ longs.add(r.getBytesOnDisk());
|
|
|
+ longs.add(r.getGenerationStamp());
|
|
|
+ }
|
|
|
+ BlockListAsLongs blockList = BlockListAsLongs.decodeLongs(longs);
|
|
|
+ return blockList;
|
|
|
+ }
|
|
|
+
|
|
|
@Test
|
|
|
public void testCapabilitiesInited() {
|
|
|
NamespaceInfo nsInfo = new NamespaceInfo();
|
|
@@ -237,7 +251,10 @@ public class TestBlockListAsLongs {
|
|
|
// back up to prior version and check DN sends old-style BR
|
|
|
request.set(null);
|
|
|
nsInfo.setCapabilities(Capability.UNKNOWN.getMask());
|
|
|
- nn.blockReport(reg, "pool", sbr,
|
|
|
+ BlockListAsLongs blockList = getBlockList(r);
|
|
|
+ StorageBlockReport[] obp = new StorageBlockReport[] {
|
|
|
+ new StorageBlockReport(new DatanodeStorage("s1"), blockList) };
|
|
|
+ nn.blockReport(reg, "pool", obp,
|
|
|
new BlockReportContext(1, 0, System.nanoTime(), 0L));
|
|
|
proto = request.get();
|
|
|
assertNotNull(proto);
|