Examples of AsyncBlockReport


Examples of org.apache.hadoop.hdfs.server.datanode.FSDataset.AsyncBlockReport

  }

  @Test(timeout=20000)
  public void testAsyncReport() throws Exception {
    FSDataset mock = Mockito.mock(FSDataset.class);
    AsyncBlockReport abr = new FSDataset.AsyncBlockReport(mock);
    abr.start();
    try {
      for (int i = 0; i < 3; i++) {
        HashMap<Block, File> mockResult = new HashMap<Block, File>();
        Mockito.doReturn(mockResult).when(mock).roughBlockScan();
       
        assertFalse(abr.isReady());
        abr.request();
        while (!abr.isReady()) {
          Thread.sleep(10);
        }
        assertSame(mockResult, abr.getAndReset());
        assertFalse(abr.isReady());
      }     
    } finally {
      abr.shutdown();
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.