Exemple #1
0
 /// <exception cref="System.IO.IOException"/>
 private void OneTest(int offBegin, int offEnd, FileStatus status)
 {
     if (offBegin > offEnd)
     {
         int tmp = offBegin;
         offBegin = offEnd;
         offEnd   = tmp;
     }
     BlockLocation[] locations = fs.GetFileBlockLocations(status, offBegin, offEnd - offBegin
                                                          );
     if (offBegin < status.GetLen())
     {
         Arrays.Sort(locations, new _IComparer_69());
         offBegin = (int)Math.Min(offBegin, status.GetLen() - 1);
         offEnd   = (int)Math.Min(offEnd, status.GetLen());
         BlockLocation first = locations[0];
         BlockLocation last  = locations[locations.Length - 1];
         Assert.True(first.GetOffset() <= offBegin);
         Assert.True(offEnd <= last.GetOffset() + last.GetLength());
     }
     else
     {
         Assert.True(locations.Length == 0);
     }
 }
 /// <exception cref="System.Exception"/>
 private static void CheckBlockLocation(BlockLocation loc, string[] names, string[]
                                        hosts, string[] cachedHosts, string[] topologyPaths, long offset, long length,
                                        bool corrupt)
 {
     NUnit.Framework.Assert.IsNotNull(loc.GetHosts());
     NUnit.Framework.Assert.IsNotNull(loc.GetCachedHosts());
     NUnit.Framework.Assert.IsNotNull(loc.GetNames());
     NUnit.Framework.Assert.IsNotNull(loc.GetTopologyPaths());
     Assert.AssertArrayEquals(hosts, loc.GetHosts());
     Assert.AssertArrayEquals(cachedHosts, loc.GetCachedHosts());
     Assert.AssertArrayEquals(names, loc.GetNames());
     Assert.AssertArrayEquals(topologyPaths, loc.GetTopologyPaths());
     Assert.Equal(offset, loc.GetOffset());
     Assert.Equal(length, loc.GetLength());
     Assert.Equal(corrupt, loc.IsCorrupt());
 }
Exemple #3
0
 /// <exception cref="System.IO.IOException"/>
 public BlockStorageLocation(BlockLocation loc, VolumeId[] volumeIds)
     : base(loc.GetNames(), loc.GetHosts(), loc.GetTopologyPaths(), loc.GetOffset(), loc
            .GetLength(), loc.IsCorrupt())
 {
     // Initialize with data from passed in BlockLocation
     this.volumeIds = volumeIds;
 }