@Test public void testWriteCuboidStatistics() throws IOException { final Configuration conf = HadoopUtil.getCurrentConfiguration(); File tmp = File.createTempFile("cuboidstatistics", ""); final Path outputPath = new Path(tmp.getParent().toString() + File.separator + RandomUtil.randomUUID().toString()); if (!FileSystem.getLocal(conf).exists(outputPath)) { // FileSystem.getLocal(conf).create(outputPath); } System.out.println(outputPath); Map<Long, HLLCounter> cuboidHLLMap = Maps.newHashMap(); CubeStatsWriter.writeCuboidStatistics(conf, outputPath, cuboidHLLMap, 100); FileSystem.getLocal(conf).delete(outputPath, true); } }
OutputStream outputStream = localFileSystem.create(indexPath, true); outputStream.close(); Assert.assertTrue("index file is not created ??", localFileSystem.exists(indexPath)); Assert.assertTrue(localFileSystem.exists(segmentOutputPath)); Assert.assertFalse("Index file still there ??", localFileSystem.exists(indexPath)); Assert.assertFalse("PartitionNum directory still there ??", localFileSystem.exists(segmentOutputPath)); Assert.assertFalse("Version directory still there ??", localFileSystem.exists(segmentOutputPath.getParent())); Assert.assertFalse("Interval directory still there ??", localFileSystem.exists(segmentOutputPath.getParent().getParent())); Assert.assertFalse("Data source directory still there ??", localFileSystem.exists(segmentOutputPath.getParent().getParent().getParent()));
assertTrue(localFileSystem.exists(repeatedCreate));
private static void rmBufferDirs() throws IOException { assertTrue(!localFs.exists(BUFFER_PATH_ROOT) || localFs.delete(BUFFER_PATH_ROOT, true)); }
private static void rmBufferDirs() throws IOException { assertTrue(!localFs.exists(BUFFER_PATH_ROOT) || localFs.delete(BUFFER_PATH_ROOT, true)); }
private static void rmBufferDirs() throws IOException { assertTrue(!localFs.exists(BUFFER_PATH_ROOT) || localFs.delete(BUFFER_PATH_ROOT, true)); }
@Override public void setUp() throws Exception { LocalFileSystem fs = FileSystem.getLocal(conf); if (fs.exists(TEST_ROOT) && !fs.delete(TEST_ROOT, true)) { Assert.fail("Can't clean up test root dir"); } fs.mkdirs(TEST_ROOT); }
@Override public void setUp() throws Exception { LocalFileSystem fs = FileSystem.getLocal(conf); if (fs.exists(TEST_ROOT) && !fs.delete(TEST_ROOT, true)) { Assert.fail("Can't clean up test root dir"); } fs.mkdirs(TEST_ROOT); }
@Test public void testMoveDirFromLocal() throws Exception { Path testRoot = new Path(testRootDir, "testPutDir"); lfs.delete(testRoot, true); lfs.mkdirs(testRoot); Path srcDir = new Path(testRoot, "srcDir"); lfs.mkdirs(srcDir); Path targetDir = new Path(testRoot, "target"); int exit = shell.run(new String[]{ "-moveFromLocal", srcDir.toString(), targetDir.toString() }); assertEquals(0, exit); assertFalse(lfs.exists(srcDir)); assertTrue(lfs.exists(targetDir)); }
@Test public void testMoveDirFromLocal() throws Exception { Path testRoot = new Path(testRootDir, "testPutDir"); lfs.delete(testRoot, true); lfs.mkdirs(testRoot); Path srcDir = new Path(testRoot, "srcDir"); lfs.mkdirs(srcDir); Path targetDir = new Path(testRoot, "target"); int exit = shell.run(new String[]{ "-moveFromLocal", srcDir.toString(), targetDir.toString() }); assertEquals(0, exit); assertFalse(lfs.exists(srcDir)); assertTrue(lfs.exists(targetDir)); }
@Test public void testMoveFileFromLocal() throws Exception { Path testRoot = new Path(testRootDir, "testPutFile"); lfs.delete(testRoot, true); lfs.mkdirs(testRoot); Path target = new Path(testRoot, "target"); Path srcFile = new Path(testRoot, new Path("srcFile")); lfs.createNewFile(srcFile); int exit = shell.run(new String[]{ "-moveFromLocal", srcFile.toString(), target.toString() }); assertEquals(0, exit); assertFalse(lfs.exists(srcFile)); assertTrue(lfs.exists(target)); assertTrue(lfs.isFile(target)); }
@Test public void testMoveFileFromLocal() throws Exception { Path testRoot = new Path(testRootDir, "testPutFile"); lfs.delete(testRoot, true); lfs.mkdirs(testRoot); Path target = new Path(testRoot, "target"); Path srcFile = new Path(testRoot, new Path("srcFile")); lfs.createNewFile(srcFile); int exit = shell.run(new String[]{ "-moveFromLocal", srcFile.toString(), target.toString() }); assertEquals(0, exit); assertFalse(lfs.exists(srcFile)); assertTrue(lfs.exists(target)); assertTrue(lfs.isFile(target)); }
@Before public void setup() throws Exception { LocalFileSystem fs = FileSystem.getLocal(conf); if (fs.exists(TEST_DIR) && !fs.delete(TEST_DIR, true)) { Assert.fail("Can't clean up test root dir"); } fs.mkdirs(TEST_DIR); }
@Before public void setup() throws Exception { LocalFileSystem fs = FileSystem.getLocal(conf); if (fs.exists(TEST_DIR) && !fs.delete(TEST_DIR, true)) { Assert.fail("Can't clean up test root dir"); } fs.mkdirs(TEST_DIR); }
/** * Tests a simple rename of a directory. */ @Test public void testRenameDirectory() throws IOException { Path src = new Path(TEST_ROOT_DIR, "dir1"); Path dst = new Path(TEST_ROOT_DIR, "dir2"); fileSys.delete(src, true); fileSys.delete(dst, true); assertTrue(fileSys.mkdirs(src)); assertTrue(fileSys.rename(src, dst)); assertTrue(fileSys.exists(dst)); assertFalse(fileSys.exists(src)); }
/** * Tests a simple rename of a directory. */ @Test public void testRenameDirectory() throws IOException { Path src = new Path(TEST_ROOT_DIR, "dir1"); Path dst = new Path(TEST_ROOT_DIR, "dir2"); fileSys.delete(src, true); fileSys.delete(dst, true); assertTrue(fileSys.mkdirs(src)); assertTrue(fileSys.rename(src, dst)); assertTrue(fileSys.exists(dst)); assertFalse(fileSys.exists(src)); }
@Before public void prepFiles() throws Exception { lfs.setVerifyChecksum(true); lfs.setWriteChecksum(true); lfs.delete(srcPath, true); lfs.delete(dstPath, true); FSDataOutputStream out = lfs.create(srcPath); out.writeChars("hi"); out.close(); assertTrue(lfs.exists(lfs.getChecksumFile(srcPath))); }
@Before public void prepFiles() throws Exception { lfs.setVerifyChecksum(true); lfs.setWriteChecksum(true); lfs.delete(srcPath, true); lfs.delete(dstPath, true); FSDataOutputStream out = lfs.create(srcPath); out.writeChars("hi"); out.close(); assertTrue(lfs.exists(lfs.getChecksumFile(srcPath))); }