Java 类org.apache.hadoop.hdfs.server.datanode.DataNode.DataNodeDiskChecker 实例源码

项目:hadoop    文件:TestDataDirs.java   
@Test (timeout = 30000)
public void testDataDirValidation() throws Throwable {

  DataNodeDiskChecker diskChecker = mock(DataNodeDiskChecker.class);
  doThrow(new IOException()).doThrow(new IOException()).doNothing()
    .when(diskChecker).checkDir(any(LocalFileSystem.class), any(Path.class));
  LocalFileSystem fs = mock(LocalFileSystem.class);
  AbstractList<StorageLocation> locations = new ArrayList<StorageLocation>();

  locations.add(StorageLocation.parse("file:/p1/"));
  locations.add(StorageLocation.parse("file:/p2/"));
  locations.add(StorageLocation.parse("file:/p3/"));

  List<StorageLocation> checkedLocations =
      DataNode.checkStorageLocations(locations, fs, diskChecker);
  assertEquals("number of valid data dirs", 1, checkedLocations.size());
  String validDir = checkedLocations.iterator().next().getFile().getPath();
  assertThat("p3 should be valid", new File("/p3/").getPath(), is(validDir));
}
项目:aliyun-oss-hadoop-fs    文件:TestDataDirs.java   
@Test(timeout = 30000)
public void testDataDirValidation() throws Throwable {

  DataNodeDiskChecker diskChecker = mock(DataNodeDiskChecker.class);
  doThrow(new IOException()).doThrow(new IOException()).doNothing()
      .when(diskChecker)
      .checkDir(any(LocalFileSystem.class), any(Path.class));
  LocalFileSystem fs = mock(LocalFileSystem.class);
  AbstractList<StorageLocation> locations = new ArrayList<StorageLocation>();

  locations.add(StorageLocation.parse("file:/p1/"));
  locations.add(StorageLocation.parse("file:/p2/"));
  locations.add(StorageLocation.parse("file:/p3/"));

  List<StorageLocation> checkedLocations =
      DataNode.checkStorageLocations(locations, fs, diskChecker);
  assertEquals("number of valid data dirs", 1, checkedLocations.size());
  String validDir = checkedLocations.iterator().next().getFile().getPath();
  assertThat("p3 should be valid", new File("/p3/").getPath(), is(validDir));
}
项目:big-c    文件:TestDataDirs.java   
@Test (timeout = 30000)
public void testDataDirValidation() throws Throwable {

  DataNodeDiskChecker diskChecker = mock(DataNodeDiskChecker.class);
  doThrow(new IOException()).doThrow(new IOException()).doNothing()
    .when(diskChecker).checkDir(any(LocalFileSystem.class), any(Path.class));
  LocalFileSystem fs = mock(LocalFileSystem.class);
  AbstractList<StorageLocation> locations = new ArrayList<StorageLocation>();

  locations.add(StorageLocation.parse("file:/p1/"));
  locations.add(StorageLocation.parse("file:/p2/"));
  locations.add(StorageLocation.parse("file:/p3/"));

  List<StorageLocation> checkedLocations =
      DataNode.checkStorageLocations(locations, fs, diskChecker);
  assertEquals("number of valid data dirs", 1, checkedLocations.size());
  String validDir = checkedLocations.iterator().next().getFile().getPath();
  assertThat("p3 should be valid", new File("/p3/").getPath(), is(validDir));
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestDataDirs.java   
@Test (timeout = 30000)
public void testDataDirValidation() throws Throwable {

  DataNodeDiskChecker diskChecker = mock(DataNodeDiskChecker.class);
  doThrow(new IOException()).doThrow(new IOException()).doNothing()
    .when(diskChecker).checkDir(any(LocalFileSystem.class), any(Path.class));
  LocalFileSystem fs = mock(LocalFileSystem.class);
  AbstractList<StorageLocation> locations = new ArrayList<StorageLocation>();

  locations.add(StorageLocation.parse("file:/p1/"));
  locations.add(StorageLocation.parse("file:/p2/"));
  locations.add(StorageLocation.parse("file:/p3/"));

  List<StorageLocation> checkedLocations =
      DataNode.checkStorageLocations(locations, fs, diskChecker);
  assertEquals("number of valid data dirs", 1, checkedLocations.size());
  String validDir = checkedLocations.iterator().next().getFile().getPath();
  assertThat("p3 should be valid", new File("/p3/").getPath(), is(validDir));
}
项目:FlexMap    文件:TestDataDirs.java   
@Test (timeout = 30000)
public void testDataDirValidation() throws Throwable {

  DataNodeDiskChecker diskChecker = mock(DataNodeDiskChecker.class);
  doThrow(new IOException()).doThrow(new IOException()).doNothing()
    .when(diskChecker).checkDir(any(LocalFileSystem.class), any(Path.class));
  LocalFileSystem fs = mock(LocalFileSystem.class);
  AbstractList<StorageLocation> locations = new ArrayList<StorageLocation>();

  locations.add(StorageLocation.parse("file:/p1/"));
  locations.add(StorageLocation.parse("file:/p2/"));
  locations.add(StorageLocation.parse("file:/p3/"));

  List<StorageLocation> checkedLocations =
      DataNode.checkStorageLocations(locations, fs, diskChecker);
  assertEquals("number of valid data dirs", 1, checkedLocations.size());
  String validDir = checkedLocations.iterator().next().getFile().getPath();
  assertThat("p3 should be valid", new File("/p3/").getPath(), is(validDir));
}
项目:hadoop-on-lustre2    文件:TestDataDirs.java   
@Test (timeout = 30000)
public void testDataDirValidation() throws Throwable {

  DataNodeDiskChecker diskChecker = mock(DataNodeDiskChecker.class);
  doThrow(new IOException()).doThrow(new IOException()).doNothing()
    .when(diskChecker).checkDir(any(LocalFileSystem.class), any(Path.class));
  LocalFileSystem fs = mock(LocalFileSystem.class);
  AbstractList<StorageLocation> locations = new ArrayList<StorageLocation>();

  locations.add(StorageLocation.parse("file:/p1/"));
  locations.add(StorageLocation.parse("file:/p2/"));
  locations.add(StorageLocation.parse("file:/p3/"));

  List<StorageLocation> checkedLocations =
      DataNode.checkStorageLocations(locations, fs, diskChecker);
  assertEquals("number of valid data dirs", 1, checkedLocations.size());
  String validDir = checkedLocations.iterator().next().getFile().getPath();
  assertThat("p3 should be valid", new File("/p3/").getPath(), is(validDir));
}
项目:hadoop-plus    文件:TestDataDirs.java   
@Test (timeout = 10000)
public void testGetDataDirsFromURIs() throws Throwable {

  DataNodeDiskChecker diskChecker = mock(DataNodeDiskChecker.class);
  doThrow(new IOException()).doThrow(new IOException()).doNothing()
    .when(diskChecker).checkDir(any(LocalFileSystem.class), any(Path.class));
  LocalFileSystem fs = mock(LocalFileSystem.class);
  Collection<URI> uris = Arrays.asList(new URI("file:/p1/"),
      new URI("file:/p2/"), new URI("file:/p3/"));

  List<File> dirs = DataNode.getDataDirsFromURIs(uris, fs, diskChecker);
  assertEquals("number of valid data dirs", 1, dirs.size());
  String validDir = dirs.iterator().next().getPath();
  assertEquals("p3 should be valid", new File("/p3").getPath(), validDir);
}
项目:hadoop-TCP    文件:TestDataDirs.java   
@Test (timeout = 10000)
public void testGetDataDirsFromURIs() throws Throwable {

  DataNodeDiskChecker diskChecker = mock(DataNodeDiskChecker.class);
  doThrow(new IOException()).doThrow(new IOException()).doNothing()
    .when(diskChecker).checkDir(any(LocalFileSystem.class), any(Path.class));
  LocalFileSystem fs = mock(LocalFileSystem.class);
  Collection<URI> uris = Arrays.asList(new URI("file:/p1/"),
      new URI("file:/p2/"), new URI("file:/p3/"));

  List<File> dirs = DataNode.getDataDirsFromURIs(uris, fs, diskChecker);
  assertEquals("number of valid data dirs", 1, dirs.size());
  String validDir = dirs.iterator().next().getPath();
  assertEquals("p3 should be valid", new File("/p3").getPath(), validDir);
}
项目:hardfs    文件:TestDataDirs.java   
@Test (timeout = 10000)
public void testGetDataDirsFromURIs() throws Throwable {

  DataNodeDiskChecker diskChecker = mock(DataNodeDiskChecker.class);
  doThrow(new IOException()).doThrow(new IOException()).doNothing()
    .when(diskChecker).checkDir(any(LocalFileSystem.class), any(Path.class));
  LocalFileSystem fs = mock(LocalFileSystem.class);
  Collection<URI> uris = Arrays.asList(new URI("file:/p1/"),
      new URI("file:/p2/"), new URI("file:/p3/"));

  List<File> dirs = DataNode.getDataDirsFromURIs(uris, fs, diskChecker);
  assertEquals("number of valid data dirs", 1, dirs.size());
  String validDir = dirs.iterator().next().getPath();
  assertEquals("p3 should be valid", new File("/p3").getPath(), validDir);
}