private ExitStatus run() {
    try {
      init();
      return new Processor().processNamespace().getExitStatus();
    } catch (IllegalArgumentException e) {
      System.out.println(e + ".  Exiting ...");
      return ExitStatus.ILLEGAL_ARGUMENTS;
    } catch (IOException e) {
      System.out.println(e + ".  Exiting ...");
      LOG.error(e + ".  Exiting ...");
      return ExitStatus.IO_EXCEPTION;
    } finally {
      dispatcher.shutdownNow();
    }
  }
@Test(timeout=100000)
  public void testMoverMetrics() throws Exception {
    long blockSize = 10*1024*1024;
    final Configuration conf = new HdfsConfiguration();
    initConf(conf);
    conf.setInt(DFSConfigKeys.DFS_MOVER_MOVERTHREADS_KEY, 1);
    conf.setLong(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, blockSize);
    conf.setLong(DFSConfigKeys.DFS_BYTES_PER_CHECKSUM_KEY, blockSize);

    final MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf)
        .numDataNodes(2)
        .storageTypes(
            new StorageType[][] {{StorageType.DISK, StorageType.DISK},
                {StorageType.ARCHIVE, StorageType.ARCHIVE}})
        .build();

    cluster.waitActive();
    final DistributedFileSystem fs = cluster.getFileSystem();

    final String file = "/testMaxIterationTime.dat";
    final Path path = new Path(file);
    short repFactor = 1;
    int seed = 0xFAFAFA;
    // write to DISK
    DFSTestUtil.createFile(fs, path, 4L * blockSize, repFactor, seed);

    // move to ARCHIVE
    fs.setStoragePolicy(new Path(file), "COLD");

    Map<URI, List<Path>> nnWithPath = new HashMap<>();
    List<Path> paths = new ArrayList<>();
    paths.add(path);
    nnWithPath
        .put(DFSUtil.getInternalNsRpcUris(conf).iterator().next(), paths);

    Mover.run(nnWithPath, conf);

    final String moverMetricsName = "Mover-"
        + cluster.getNameNode(0).getNamesystem().getBlockPoolId();
    MetricsSource moverMetrics =
        DefaultMetricsSystem.instance().getSource(moverMetricsName);
    assertNotNull(moverMetrics);

    MetricsRecordBuilder rb = MetricsAsserts.getMetrics(moverMetricsName);
    // Check metrics
    assertEquals(4, MetricsAsserts.getLongCounter("BlocksScheduled", rb));
    assertEquals(1, MetricsAsserts.getLongCounter("FilesProcessed", rb));
    assertEquals(41943040, MetricsAsserts.getLongGauge("BytesMoved", rb));
    assertEquals(4, MetricsAsserts.getLongGauge("BlocksMoved", rb));
    assertEquals(0, MetricsAsserts.getLongGauge("BlocksFailed", rb));
  }