コード例 #1
0
 @Test
 public void testReadingArchiveDirectoryFromFS() throws IOException {
   FileSystem fs = FileSystem.get(UTIL.getConfiguration());
   try {
     new FSTableDescriptors(fs, FSUtils.getRootDir(UTIL.getConfiguration()))
         .get(HConstants.HFILE_ARCHIVE_DIRECTORY);
     fail("Shouldn't be able to read a table descriptor for the archive directory.");
   } catch (IOException e) {
     LOG.debug(
         "Correctly got error when reading a table descriptor from the archive directory: "
             + e.getMessage());
   }
 }
コード例 #2
0
 @Test
 public void testCreateAndUpdate() throws IOException {
   Path testdir = UTIL.getDataTestDir("testCreateAndUpdate");
   HTableDescriptor htd = new HTableDescriptor("testCreate");
   FileSystem fs = FileSystem.get(UTIL.getConfiguration());
   assertTrue(FSTableDescriptors.createTableDescriptor(fs, testdir, htd));
   assertFalse(FSTableDescriptors.createTableDescriptor(fs, testdir, htd));
   FileStatus[] statuses = fs.listStatus(testdir);
   assertTrue("statuses.length=" + statuses.length, statuses.length == 1);
   for (int i = 0; i < 10; i++) {
     FSTableDescriptors.updateHTableDescriptor(fs, testdir, htd);
   }
   statuses = fs.listStatus(testdir);
   assertTrue(statuses.length == 1);
   Path tmpTableDir = new Path(FSUtils.getTablePath(testdir, htd.getName()), ".tmp");
   statuses = fs.listStatus(tmpTableDir);
   assertTrue(statuses.length == 0);
 }