Search in sources :

Example 1 with ShortCircuitRegistry

use of org.apache.hadoop.hdfs.server.datanode.ShortCircuitRegistry in project hadoop by apache.

the class TestFsDatasetImpl method setUp.

@Before
public void setUp() throws IOException {
    datanode = mock(DataNode.class);
    storage = mock(DataStorage.class);
    this.conf = new Configuration();
    this.conf.setLong(DFS_DATANODE_SCAN_PERIOD_HOURS_KEY, 0);
    when(datanode.getConf()).thenReturn(conf);
    final DNConf dnConf = new DNConf(datanode);
    when(datanode.getDnConf()).thenReturn(dnConf);
    final BlockScanner disabledBlockScanner = new BlockScanner(datanode);
    when(datanode.getBlockScanner()).thenReturn(disabledBlockScanner);
    final ShortCircuitRegistry shortCircuitRegistry = new ShortCircuitRegistry(conf);
    when(datanode.getShortCircuitRegistry()).thenReturn(shortCircuitRegistry);
    createStorageDirs(storage, conf, NUM_INIT_VOLUMES);
    dataset = new FsDatasetImpl(datanode, storage, conf);
    for (String bpid : BLOCK_POOL_IDS) {
        dataset.addBlockPool(bpid, conf);
    }
    assertEquals(NUM_INIT_VOLUMES, getNumVolumes());
    assertEquals(0, dataset.getNumFailedVolumes());
}
Also used : DataStorage(org.apache.hadoop.hdfs.server.datanode.DataStorage) Configuration(org.apache.hadoop.conf.Configuration) HdfsConfiguration(org.apache.hadoop.hdfs.HdfsConfiguration) BlockScanner(org.apache.hadoop.hdfs.server.datanode.BlockScanner) DataNode(org.apache.hadoop.hdfs.server.datanode.DataNode) ShortCircuitRegistry(org.apache.hadoop.hdfs.server.datanode.ShortCircuitRegistry) DNConf(org.apache.hadoop.hdfs.server.datanode.DNConf) Matchers.anyString(org.mockito.Matchers.anyString) Before(org.junit.Before)

Aggregations

Configuration (org.apache.hadoop.conf.Configuration)1 HdfsConfiguration (org.apache.hadoop.hdfs.HdfsConfiguration)1 BlockScanner (org.apache.hadoop.hdfs.server.datanode.BlockScanner)1 DNConf (org.apache.hadoop.hdfs.server.datanode.DNConf)1 DataNode (org.apache.hadoop.hdfs.server.datanode.DataNode)1 DataStorage (org.apache.hadoop.hdfs.server.datanode.DataStorage)1 ShortCircuitRegistry (org.apache.hadoop.hdfs.server.datanode.ShortCircuitRegistry)1 Before (org.junit.Before)1 Matchers.anyString (org.mockito.Matchers.anyString)1