Java 类org.apache.hadoop.hdfs.tools.DFSck 实例源码

项目:hadoop    文件:TestClientReportBadBlock.java   
static String runFsck(Configuration conf, int expectedErrCode,
    boolean checkErrorCode, String... path) throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  int errCode = ToolRunner.run(new DFSck(conf, out), path);
  if (checkErrorCode)
    Assert.assertEquals(expectedErrCode, errCode);
  return bStream.toString();
}
项目:hadoop    文件:TestHAFsck.java   
static void runFsck(Configuration conf) throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  int errCode = ToolRunner.run(new DFSck(conf, out),
      new String[]{"/", "-files"});
  String result = bStream.toString();
  System.out.println("output from fsck:\n" + result);
  assertEquals(0, errCode);
  assertTrue(result.contains("/test1"));
  assertTrue(result.contains("/test2"));
}
项目:hadoop    文件:TestFsck.java   
static String runFsck(Configuration conf, int expectedErrCode, 
                      boolean checkErrorCode,String... path)
                      throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  ((Log4JLogger)FSPermissionChecker.LOG).getLogger().setLevel(Level.ALL);
  int errCode = ToolRunner.run(new DFSck(conf, out), path);
  if (checkErrorCode) {
    assertEquals(expectedErrCode, errCode);
  }
  ((Log4JLogger)FSPermissionChecker.LOG).getLogger().setLevel(Level.INFO);
  FSImage.LOG.error("OUTPUT = " + bStream.toString());
  return bStream.toString();
}
项目:hadoop    文件:TestEncryptionZones.java   
/**
 * Test running fsck on a system with encryption zones.
 */
@Test(timeout = 60000)
public void testFsckOnEncryptionZones() throws Exception {
  final int len = 8196;
  final Path zoneParent = new Path("/zones");
  final Path zone1 = new Path(zoneParent, "zone1");
  final Path zone1File = new Path(zone1, "file");
  fsWrapper.mkdir(zone1, FsPermission.getDirDefault(), true);
  dfsAdmin.createEncryptionZone(zone1, TEST_KEY);
  DFSTestUtil.createFile(fs, zone1File, len, (short) 1, 0xFEED);
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  int errCode = ToolRunner.run(new DFSck(conf, out),
      new String[]{ "/" });
  assertEquals("Fsck ran with non-zero error code", 0, errCode);
  String result = bStream.toString();
  assertTrue("Fsck did not return HEALTHY status",
      result.contains(NamenodeFsck.HEALTHY_STATUS));

  // Run fsck directly on the encryption zone instead of root
  errCode = ToolRunner.run(new DFSck(conf, out),
      new String[]{ zoneParent.toString() });
  assertEquals("Fsck ran with non-zero error code", 0, errCode);
  result = bStream.toString();
  assertTrue("Fsck did not return HEALTHY status",
      result.contains(NamenodeFsck.HEALTHY_STATUS));
}
项目:aliyun-oss-hadoop-fs    文件:TestClientReportBadBlock.java   
static String runFsck(Configuration conf, int expectedErrCode,
    boolean checkErrorCode, String... path) throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  int errCode = ToolRunner.run(new DFSck(conf, out), path);
  if (checkErrorCode)
    Assert.assertEquals(expectedErrCode, errCode);
  return bStream.toString();
}
项目:aliyun-oss-hadoop-fs    文件:TestHAFsck.java   
static void runFsck(Configuration conf) throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  int errCode = ToolRunner.run(new DFSck(conf, out),
      new String[]{"/", "-files"});
  String result = bStream.toString();
  System.out.println("output from fsck:\n" + result);
  assertEquals(0, errCode);
  assertTrue(result.contains("/test1"));
  assertTrue(result.contains("/test2"));
}
项目:aliyun-oss-hadoop-fs    文件:TestFsck.java   
static String runFsck(Configuration conf, int expectedErrCode, 
                      boolean checkErrorCode,String... path)
                      throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  GenericTestUtils.setLogLevel(FSPermissionChecker.LOG, Level.ALL);
  int errCode = ToolRunner.run(new DFSck(conf, out), path);
  if (checkErrorCode) {
    assertEquals(expectedErrCode, errCode);
  }
  GenericTestUtils.setLogLevel(FSPermissionChecker.LOG, Level.INFO);
  FSImage.LOG.error("OUTPUT = " + bStream.toString());
  return bStream.toString();
}
项目:aliyun-oss-hadoop-fs    文件:TestEncryptionZones.java   
/**
 * Test running fsck on a system with encryption zones.
 */
@Test(timeout = 60000)
public void testFsckOnEncryptionZones() throws Exception {
  final int len = 8196;
  final Path zoneParent = new Path("/zones");
  final Path zone1 = new Path(zoneParent, "zone1");
  final Path zone1File = new Path(zone1, "file");
  fsWrapper.mkdir(zone1, FsPermission.getDirDefault(), true);
  dfsAdmin.createEncryptionZone(zone1, TEST_KEY);
  DFSTestUtil.createFile(fs, zone1File, len, (short) 1, 0xFEED);
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  int errCode = ToolRunner.run(new DFSck(conf, out),
      new String[]{ "/" });
  assertEquals("Fsck ran with non-zero error code", 0, errCode);
  String result = bStream.toString();
  assertTrue("Fsck did not return HEALTHY status",
      result.contains(NamenodeFsck.HEALTHY_STATUS));

  // Run fsck directly on the encryption zone instead of root
  errCode = ToolRunner.run(new DFSck(conf, out),
      new String[]{ zoneParent.toString() });
  assertEquals("Fsck ran with non-zero error code", 0, errCode);
  result = bStream.toString();
  assertTrue("Fsck did not return HEALTHY status",
      result.contains(NamenodeFsck.HEALTHY_STATUS));
}
项目:big-c    文件:TestClientReportBadBlock.java   
static String runFsck(Configuration conf, int expectedErrCode,
    boolean checkErrorCode, String... path) throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  int errCode = ToolRunner.run(new DFSck(conf, out), path);
  if (checkErrorCode)
    Assert.assertEquals(expectedErrCode, errCode);
  return bStream.toString();
}
项目:big-c    文件:TestHAFsck.java   
static void runFsck(Configuration conf) throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  int errCode = ToolRunner.run(new DFSck(conf, out),
      new String[]{"/", "-files"});
  String result = bStream.toString();
  System.out.println("output from fsck:\n" + result);
  assertEquals(0, errCode);
  assertTrue(result.contains("/test1"));
  assertTrue(result.contains("/test2"));
}
项目:big-c    文件:TestFsck.java   
static String runFsck(Configuration conf, int expectedErrCode, 
                      boolean checkErrorCode,String... path)
                      throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  ((Log4JLogger)FSPermissionChecker.LOG).getLogger().setLevel(Level.ALL);
  int errCode = ToolRunner.run(new DFSck(conf, out), path);
  if (checkErrorCode) {
    assertEquals(expectedErrCode, errCode);
  }
  ((Log4JLogger)FSPermissionChecker.LOG).getLogger().setLevel(Level.INFO);
  FSImage.LOG.error("OUTPUT = " + bStream.toString());
  return bStream.toString();
}
项目:big-c    文件:TestEncryptionZones.java   
/**
 * Test running fsck on a system with encryption zones.
 */
@Test(timeout = 60000)
public void testFsckOnEncryptionZones() throws Exception {
  final int len = 8196;
  final Path zoneParent = new Path("/zones");
  final Path zone1 = new Path(zoneParent, "zone1");
  final Path zone1File = new Path(zone1, "file");
  fsWrapper.mkdir(zone1, FsPermission.getDirDefault(), true);
  dfsAdmin.createEncryptionZone(zone1, TEST_KEY);
  DFSTestUtil.createFile(fs, zone1File, len, (short) 1, 0xFEED);
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  int errCode = ToolRunner.run(new DFSck(conf, out),
      new String[]{ "/" });
  assertEquals("Fsck ran with non-zero error code", 0, errCode);
  String result = bStream.toString();
  assertTrue("Fsck did not return HEALTHY status",
      result.contains(NamenodeFsck.HEALTHY_STATUS));

  // Run fsck directly on the encryption zone instead of root
  errCode = ToolRunner.run(new DFSck(conf, out),
      new String[]{ zoneParent.toString() });
  assertEquals("Fsck ran with non-zero error code", 0, errCode);
  result = bStream.toString();
  assertTrue("Fsck did not return HEALTHY status",
      result.contains(NamenodeFsck.HEALTHY_STATUS));
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestClientReportBadBlock.java   
static String runFsck(Configuration conf, int expectedErrCode,
    boolean checkErrorCode, String... path) throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  int errCode = ToolRunner.run(new DFSck(conf, out), path);
  if (checkErrorCode)
    Assert.assertEquals(expectedErrCode, errCode);
  return bStream.toString();
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestHAFsck.java   
static void runFsck(Configuration conf) throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  int errCode = ToolRunner.run(new DFSck(conf, out),
      new String[]{"/", "-files"});
  String result = bStream.toString();
  System.out.println("output from fsck:\n" + result);
  assertEquals(0, errCode);
  assertTrue(result.contains("/test1"));
  assertTrue(result.contains("/test2"));
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestFsck.java   
static String runFsck(Configuration conf, int expectedErrCode, 
                      boolean checkErrorCode,String... path) 
                      throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  ((Log4JLogger)FSPermissionChecker.LOG).getLogger().setLevel(Level.ALL);
  int errCode = ToolRunner.run(new DFSck(conf, out), path);
  if (checkErrorCode) {
    assertEquals(expectedErrCode, errCode);
  }
  ((Log4JLogger)FSPermissionChecker.LOG).getLogger().setLevel(Level.INFO);
  FSImage.LOG.error("OUTPUT = " + bStream.toString());
  return bStream.toString();
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestEncryptionZones.java   
/**
 * Test running fsck on a system with encryption zones.
 */
@Test(timeout = 60000)
public void testFsckOnEncryptionZones() throws Exception {
  final int len = 8196;
  final Path zoneParent = new Path("/zones");
  final Path zone1 = new Path(zoneParent, "zone1");
  final Path zone1File = new Path(zone1, "file");
  fsWrapper.mkdir(zone1, FsPermission.getDirDefault(), true);
  dfsAdmin.createEncryptionZone(zone1, TEST_KEY);
  DFSTestUtil.createFile(fs, zone1File, len, (short) 1, 0xFEED);
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  int errCode = ToolRunner.run(new DFSck(conf, out),
      new String[]{ "/" });
  assertEquals("Fsck ran with non-zero error code", 0, errCode);
  String result = bStream.toString();
  assertTrue("Fsck did not return HEALTHY status",
      result.contains(NamenodeFsck.HEALTHY_STATUS));

  // Run fsck directly on the encryption zone instead of root
  errCode = ToolRunner.run(new DFSck(conf, out),
      new String[]{ zoneParent.toString() });
  assertEquals("Fsck ran with non-zero error code", 0, errCode);
  result = bStream.toString();
  assertTrue("Fsck did not return HEALTHY status",
      result.contains(NamenodeFsck.HEALTHY_STATUS));
}
项目:hadoop-EAR    文件:TestHttpServerShutdown.java   
public void run() {
  try {
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    PrintStream ps = new PrintStream(os);
    new DFSck(conf, ps).run(new String[] { "/" });
  } catch (Exception e) {
  }
}
项目:hadoop-EAR    文件:TestFsck.java   
static String runFsck(Configuration conf, int expectedErrCode,
                      boolean checkErrorCode, String... path)
  throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  ((Log4JLogger) FSPermissionChecker.LOG).getLogger().setLevel(Level.ALL);
  int errCode = ToolRunner.run(new DFSck(conf, out), path);
  if (checkErrorCode) {
    assertEquals(expectedErrCode, errCode);
  }
  ((Log4JLogger) FSPermissionChecker.LOG).getLogger().setLevel(Level.INFO);
  return bStream.toString();
}
项目:hadoop-EAR    文件:DistBlockIntegrityMonitor.java   
private BufferedReader getLostFileReader(String[] dfsckArgs) 
    throws IOException {

  ByteArrayOutputStream bout = new ByteArrayOutputStream();
  PrintStream ps = new PrintStream(bout, true);
  DFSck dfsck = new DFSck(getConf(), ps);
  try {
    dfsck.run(dfsckArgs);
  } catch (Exception e) {
    throw new IOException(e);
  }
  ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
  return new BufferedReader(new InputStreamReader(bin));
}
项目:hadoop-plus    文件:TestClientReportBadBlock.java   
static String runFsck(Configuration conf, int expectedErrCode,
    boolean checkErrorCode, String... path) throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  int errCode = ToolRunner.run(new DFSck(conf, out), path);
  if (checkErrorCode)
    Assert.assertEquals(expectedErrCode, errCode);
  return bStream.toString();
}
项目:hadoop-plus    文件:TestHAFsck.java   
static void runFsck(Configuration conf) throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  int errCode = ToolRunner.run(new DFSck(conf, out),
      new String[]{"/", "-files"});
  String result = bStream.toString();
  System.out.println("output from fsck:\n" + result);
  assertEquals(0, errCode);
  assertTrue(result.contains("/test1"));
  assertTrue(result.contains("/test2"));
}
项目:hadoop-plus    文件:TestFsck.java   
static String runFsck(Configuration conf, int expectedErrCode, 
                      boolean checkErrorCode,String... path) 
                      throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  ((Log4JLogger)FSPermissionChecker.LOG).getLogger().setLevel(Level.ALL);
  int errCode = ToolRunner.run(new DFSck(conf, out), path);
  if (checkErrorCode) {
    assertEquals(expectedErrCode, errCode);
  }
  ((Log4JLogger)FSPermissionChecker.LOG).getLogger().setLevel(Level.INFO);
  FSImage.LOG.error("OUTPUT = " + bStream.toString());
  return bStream.toString();
}
项目:FlexMap    文件:TestClientReportBadBlock.java   
static String runFsck(Configuration conf, int expectedErrCode,
    boolean checkErrorCode, String... path) throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  int errCode = ToolRunner.run(new DFSck(conf, out), path);
  if (checkErrorCode)
    Assert.assertEquals(expectedErrCode, errCode);
  return bStream.toString();
}
项目:FlexMap    文件:TestHAFsck.java   
static void runFsck(Configuration conf) throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  int errCode = ToolRunner.run(new DFSck(conf, out),
      new String[]{"/", "-files"});
  String result = bStream.toString();
  System.out.println("output from fsck:\n" + result);
  assertEquals(0, errCode);
  assertTrue(result.contains("/test1"));
  assertTrue(result.contains("/test2"));
}
项目:FlexMap    文件:TestFsck.java   
static String runFsck(Configuration conf, int expectedErrCode, 
                      boolean checkErrorCode,String... path) 
                      throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  ((Log4JLogger)FSPermissionChecker.LOG).getLogger().setLevel(Level.ALL);
  int errCode = ToolRunner.run(new DFSck(conf, out), path);
  if (checkErrorCode) {
    assertEquals(expectedErrCode, errCode);
  }
  ((Log4JLogger)FSPermissionChecker.LOG).getLogger().setLevel(Level.INFO);
  FSImage.LOG.error("OUTPUT = " + bStream.toString());
  return bStream.toString();
}
项目:FlexMap    文件:TestEncryptionZones.java   
/**
 * Test running fsck on a system with encryption zones.
 */
@Test(timeout = 60000)
public void testFsckOnEncryptionZones() throws Exception {
  final int len = 8196;
  final Path zoneParent = new Path("/zones");
  final Path zone1 = new Path(zoneParent, "zone1");
  final Path zone1File = new Path(zone1, "file");
  fsWrapper.mkdir(zone1, FsPermission.getDirDefault(), true);
  dfsAdmin.createEncryptionZone(zone1, TEST_KEY);
  DFSTestUtil.createFile(fs, zone1File, len, (short) 1, 0xFEED);
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  int errCode = ToolRunner.run(new DFSck(conf, out),
      new String[]{ "/" });
  assertEquals("Fsck ran with non-zero error code", 0, errCode);
  String result = bStream.toString();
  assertTrue("Fsck did not return HEALTHY status",
      result.contains(NamenodeFsck.HEALTHY_STATUS));

  // Run fsck directly on the encryption zone instead of root
  errCode = ToolRunner.run(new DFSck(conf, out),
      new String[]{ zoneParent.toString() });
  assertEquals("Fsck ran with non-zero error code", 0, errCode);
  result = bStream.toString();
  assertTrue("Fsck did not return HEALTHY status",
      result.contains(NamenodeFsck.HEALTHY_STATUS));
}
项目:hops    文件:TestClientReportBadBlock.java   
static String runFsck(Configuration conf, int expectedErrCode,
    boolean checkErrorCode, String... path) throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  int errCode = ToolRunner.run(new DFSck(conf, out), path);
  if (checkErrorCode) {
    Assert.assertEquals(expectedErrCode, errCode);
  }
  return bStream.toString();
}
项目:hops    文件:TestFsck.java   
static String runFsck(Configuration conf, int expectedErrCode,
    boolean checkErrorCode, String... path) throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  ((Log4JLogger) FSPermissionChecker.LOG).getLogger().setLevel(Level.ALL);
  int errCode = ToolRunner.run(new DFSck(conf, out), path);
  if (checkErrorCode) {
    assertEquals(expectedErrCode, errCode);
  }
  ((Log4JLogger) FSPermissionChecker.LOG).getLogger().setLevel(Level.INFO);
  System.out.println("OUTPUT = " + bStream.toString());
  return bStream.toString();
}
项目:hadoop-TCP    文件:TestClientReportBadBlock.java   
static String runFsck(Configuration conf, int expectedErrCode,
    boolean checkErrorCode, String... path) throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  int errCode = ToolRunner.run(new DFSck(conf, out), path);
  if (checkErrorCode)
    Assert.assertEquals(expectedErrCode, errCode);
  return bStream.toString();
}
项目:hadoop-TCP    文件:TestHAFsck.java   
static void runFsck(Configuration conf) throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  int errCode = ToolRunner.run(new DFSck(conf, out),
      new String[]{"/", "-files"});
  String result = bStream.toString();
  System.out.println("output from fsck:\n" + result);
  assertEquals(0, errCode);
  assertTrue(result.contains("/test1"));
  assertTrue(result.contains("/test2"));
}
项目:hadoop-TCP    文件:TestFsck.java   
static String runFsck(Configuration conf, int expectedErrCode, 
                      boolean checkErrorCode,String... path) 
                      throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  ((Log4JLogger)FSPermissionChecker.LOG).getLogger().setLevel(Level.ALL);
  int errCode = ToolRunner.run(new DFSck(conf, out), path);
  if (checkErrorCode) {
    assertEquals(expectedErrCode, errCode);
  }
  ((Log4JLogger)FSPermissionChecker.LOG).getLogger().setLevel(Level.INFO);
  FSImage.LOG.error("OUTPUT = " + bStream.toString());
  return bStream.toString();
}
项目:hadoop-on-lustre    文件:TestFsck.java   
static String runFsck(Configuration conf, int expectedErrCode, 
                      boolean checkErrorCode,String... path) 
                      throws Exception {
  PrintStream oldOut = System.out;
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream newOut = new PrintStream(bStream, true);
  System.setOut(newOut);
  ((Log4JLogger)FSPermissionChecker.LOG).getLogger().setLevel(Level.ALL);
  int errCode = ToolRunner.run(new DFSck(conf), path);
  if (checkErrorCode)
    assertEquals(expectedErrCode, errCode);
  ((Log4JLogger)FSPermissionChecker.LOG).getLogger().setLevel(Level.INFO);
  System.setOut(oldOut);
  return bStream.toString();
}
项目:hardfs    文件:TestClientReportBadBlock.java   
static String runFsck(Configuration conf, int expectedErrCode,
    boolean checkErrorCode, String... path) throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  int errCode = ToolRunner.run(new DFSck(conf, out), path);
  if (checkErrorCode)
    Assert.assertEquals(expectedErrCode, errCode);
  return bStream.toString();
}
项目:hardfs    文件:TestHAFsck.java   
static void runFsck(Configuration conf) throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  int errCode = ToolRunner.run(new DFSck(conf, out),
      new String[]{"/", "-files"});
  String result = bStream.toString();
  System.out.println("output from fsck:\n" + result);
  assertEquals(0, errCode);
  assertTrue(result.contains("/test1"));
  assertTrue(result.contains("/test2"));
}
项目:hardfs    文件:TestFsck.java   
static String runFsck(Configuration conf, int expectedErrCode, 
                      boolean checkErrorCode,String... path) 
                      throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  ((Log4JLogger)FSPermissionChecker.LOG).getLogger().setLevel(Level.ALL);
  int errCode = ToolRunner.run(new DFSck(conf, out), path);
  if (checkErrorCode) {
    assertEquals(expectedErrCode, errCode);
  }
  ((Log4JLogger)FSPermissionChecker.LOG).getLogger().setLevel(Level.INFO);
  FSImage.LOG.error("OUTPUT = " + bStream.toString());
  return bStream.toString();
}
项目:hadoop-on-lustre2    文件:TestClientReportBadBlock.java   
static String runFsck(Configuration conf, int expectedErrCode,
    boolean checkErrorCode, String... path) throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  int errCode = ToolRunner.run(new DFSck(conf, out), path);
  if (checkErrorCode)
    Assert.assertEquals(expectedErrCode, errCode);
  return bStream.toString();
}
项目:hadoop-on-lustre2    文件:TestHAFsck.java   
static void runFsck(Configuration conf) throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  int errCode = ToolRunner.run(new DFSck(conf, out),
      new String[]{"/", "-files"});
  String result = bStream.toString();
  System.out.println("output from fsck:\n" + result);
  assertEquals(0, errCode);
  assertTrue(result.contains("/test1"));
  assertTrue(result.contains("/test2"));
}
项目:hadoop-on-lustre2    文件:TestFsck.java   
static String runFsck(Configuration conf, int expectedErrCode, 
                      boolean checkErrorCode,String... path) 
                      throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  ((Log4JLogger)FSPermissionChecker.LOG).getLogger().setLevel(Level.ALL);
  int errCode = ToolRunner.run(new DFSck(conf, out), path);
  if (checkErrorCode) {
    assertEquals(expectedErrCode, errCode);
  }
  ((Log4JLogger)FSPermissionChecker.LOG).getLogger().setLevel(Level.INFO);
  FSImage.LOG.error("OUTPUT = " + bStream.toString());
  return bStream.toString();
}
项目:cumulus    文件:TestFsck.java   
static String runFsck(Configuration conf, int expectedErrCode, 
                      boolean checkErrorCode,String... path) 
                      throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  ((Log4JLogger)FSPermissionChecker.LOG).getLogger().setLevel(Level.ALL);
  int errCode = ToolRunner.run(new DFSck(conf, out), path);
  if (checkErrorCode)
    assertEquals(expectedErrCode, errCode);
  ((Log4JLogger)FSPermissionChecker.LOG).getLogger().setLevel(Level.INFO);
  return bStream.toString();
}
项目:RDFS    文件:TestFsck.java   
static String runFsck(Configuration conf, int expectedErrCode,
                      boolean checkErrorCode, String... path)
  throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  ((Log4JLogger) FSPermissionChecker.LOG).getLogger().setLevel(Level.ALL);
  int errCode = ToolRunner.run(new DFSck(conf, out), path);
  if (checkErrorCode) {
    assertEquals(expectedErrCode, errCode);
  }
  ((Log4JLogger) FSPermissionChecker.LOG).getLogger().setLevel(Level.INFO);
  return bStream.toString();
}