@Test(expected=IllegalStateException.class) public void testGetWALRootDirIllegalWALDir() throws IOException { Path root = new Path("file:///hbase/root"); Path invalidWALDir = new Path("file:///hbase/root/logroot"); CommonFSUtils.setRootDir(conf, root); CommonFSUtils.setWALRootDir(conf, invalidWALDir); CommonFSUtils.getWALRootDir(conf); }
@Test public void testRemoveWALRootPath() throws Exception { CommonFSUtils.setRootDir(conf, new Path("file:///user/hbase")); Path testFile = new Path(CommonFSUtils.getRootDir(conf), "test/testfile"); Path tmpFile = new Path("file:///test/testfile"); assertEquals("test/testfile", CommonFSUtils.removeWALRootPath(testFile, conf)); assertEquals(tmpFile.toString(), CommonFSUtils.removeWALRootPath(tmpFile, conf)); CommonFSUtils.setWALRootDir(conf, new Path("file:///user/hbaseLogDir")); assertEquals(testFile.toString(), CommonFSUtils.removeWALRootPath(testFile, conf)); Path logFile = new Path(CommonFSUtils.getWALRootDir(conf), "test/testlog"); assertEquals("test/testlog", CommonFSUtils.removeWALRootPath(logFile, conf)); }
@Test public void testGetWALRootDir() throws IOException { Path root = new Path("file:///hbase/root"); Path walRoot = new Path("file:///hbase/logroot"); CommonFSUtils.setRootDir(conf, root); assertEquals(root, CommonFSUtils.getRootDir(conf)); assertEquals(root, CommonFSUtils.getWALRootDir(conf)); CommonFSUtils.setWALRootDir(conf, walRoot); assertEquals(walRoot, CommonFSUtils.getWALRootDir(conf)); }
@Test(expected=IllegalStateException.class) public void testGetWALRootDirIllegalWALDir() throws IOException { Path root = new Path("file:///hbase/root"); Path invalidWALDir = new Path("file:///hbase/root/logroot"); CommonFSUtils.setRootDir(conf, root); CommonFSUtils.setWALRootDir(conf, invalidWALDir); CommonFSUtils.getWALRootDir(conf); }
@Test(expected=IllegalStateException.class) public void testGetWALRootDirIllegalWALDir() throws IOException { Path root = new Path("file:///hbase/root"); Path invalidWALDir = new Path("file:///hbase/root/logroot"); CommonFSUtils.setRootDir(conf, root); CommonFSUtils.setWALRootDir(conf, invalidWALDir); CommonFSUtils.getWALRootDir(conf); }
@Test public void testRemoveWALRootPath() throws Exception { CommonFSUtils.setRootDir(conf, new Path("file:///user/hbase")); Path testFile = new Path(CommonFSUtils.getRootDir(conf), "test/testfile"); Path tmpFile = new Path("file:///test/testfile"); assertEquals("test/testfile", CommonFSUtils.removeWALRootPath(testFile, conf)); assertEquals(tmpFile.toString(), CommonFSUtils.removeWALRootPath(tmpFile, conf)); CommonFSUtils.setWALRootDir(conf, new Path("file:///user/hbaseLogDir")); assertEquals(testFile.toString(), CommonFSUtils.removeWALRootPath(testFile, conf)); Path logFile = new Path(CommonFSUtils.getWALRootDir(conf), "test/testlog"); assertEquals("test/testlog", CommonFSUtils.removeWALRootPath(logFile, conf)); }
@Test public void testRemoveWALRootPath() throws Exception { CommonFSUtils.setRootDir(conf, new Path("file:///user/hbase")); Path testFile = new Path(CommonFSUtils.getRootDir(conf), "test/testfile"); Path tmpFile = new Path("file:///test/testfile"); assertEquals("test/testfile", CommonFSUtils.removeWALRootPath(testFile, conf)); assertEquals(tmpFile.toString(), CommonFSUtils.removeWALRootPath(tmpFile, conf)); CommonFSUtils.setWALRootDir(conf, new Path("file:///user/hbaseLogDir")); assertEquals(testFile.toString(), CommonFSUtils.removeWALRootPath(testFile, conf)); Path logFile = new Path(CommonFSUtils.getWALRootDir(conf), "test/testlog"); assertEquals("test/testlog", CommonFSUtils.removeWALRootPath(logFile, conf)); }
@Test public void testGetWALRootDir() throws IOException { Path root = new Path("file:///hbase/root"); Path walRoot = new Path("file:///hbase/logroot"); CommonFSUtils.setRootDir(conf, root); assertEquals(root, CommonFSUtils.getRootDir(conf)); assertEquals(root, CommonFSUtils.getWALRootDir(conf)); CommonFSUtils.setWALRootDir(conf, walRoot); assertEquals(walRoot, CommonFSUtils.getWALRootDir(conf)); }
@Test public void testGetWALRootDir() throws IOException { Path root = new Path("file:///hbase/root"); Path walRoot = new Path("file:///hbase/logroot"); CommonFSUtils.setRootDir(conf, root); assertEquals(root, CommonFSUtils.getRootDir(conf)); assertEquals(root, CommonFSUtils.getWALRootDir(conf)); CommonFSUtils.setWALRootDir(conf, walRoot); assertEquals(walRoot, CommonFSUtils.getWALRootDir(conf)); }