Ejemplo n.º 1
0
 public virtual void TestConvertBlockWithLocations()
 {
     BlocksWithLocations.BlockWithLocations locs      = GetBlockWithLocations(1);
     HdfsProtos.BlockWithLocationsProto     locsProto = PBHelper.Convert(locs);
     BlocksWithLocations.BlockWithLocations locs2     = PBHelper.Convert(locsProto);
     Compare(locs, locs2);
 }
Ejemplo n.º 2
0
 private void Compare(BlocksWithLocations.BlockWithLocations locs1, BlocksWithLocations.BlockWithLocations
                      locs2)
 {
     NUnit.Framework.Assert.AreEqual(locs1.GetBlock(), locs2.GetBlock());
     NUnit.Framework.Assert.IsTrue(Arrays.Equals(locs1.GetStorageIDs(), locs2.GetStorageIDs
                                                     ()));
 }
Ejemplo n.º 3
0
        public virtual void TestConvertBlocksWithLocations()
        {
            BlocksWithLocations.BlockWithLocations[] list = new BlocksWithLocations.BlockWithLocations
                                                            [] { GetBlockWithLocations(1), GetBlockWithLocations(2) };
            BlocksWithLocations locs = new BlocksWithLocations(list);

            HdfsProtos.BlocksWithLocationsProto locsProto = PBHelper.Convert(locs);
            BlocksWithLocations locs2 = PBHelper.Convert(locsProto);

            BlocksWithLocations.BlockWithLocations[] blocks  = locs.GetBlocks();
            BlocksWithLocations.BlockWithLocations[] blocks2 = locs2.GetBlocks();
            NUnit.Framework.Assert.AreEqual(blocks.Length, blocks2.Length);
            for (int i = 0; i < blocks.Length; i++)
            {
                Compare(blocks[i], blocks2[i]);
            }
        }