public void testRenameWithNoMarker() throws Exception { String base = "test/hadoop"; Path dest = path("/test/hadoop2"); createTestFiles(base); fs.rename(path("/" + base), dest); Path path = path("/test"); assertTrue(fs.getFileStatus(path).isDirectory()); assertEquals(1, fs.listStatus(path).length); assertTrue(fs.getFileStatus(dest).isDirectory()); assertEquals(2, fs.listStatus(dest).length); }
public void testListStatusForRoot() throws Exception { FileStatus[] paths = fs.listStatus(path("/")); assertEquals(0, paths.length); Path testDir = path("/test"); assertTrue(fs.mkdirs(testDir)); paths = fs.listStatus(path("/")); assertEquals(1, paths.length); assertEquals(path("/test"), paths[0].getPath()); }
public void testBlockSize() throws Exception { Path file = path("/test/hadoop/file"); createFile(file); assertEquals("Default block size", fs.getDefaultBlockSize(), fs.getFileStatus(file).getBlockSize()); // Block size is determined at read time long newBlockSize = fs.getDefaultBlockSize() * 2; fs.getConf().setLong("fs.s3n.block.size", newBlockSize); assertEquals("Double default block size", newBlockSize, fs.getFileStatus(file).getBlockSize()); }
public void testNoTrailingBackslashOnBucket() throws Exception { assertTrue(fs.getFileStatus(new Path(fs.getUri().toString())).isDirectory()); }
public void testEmptyFile() throws Exception { store.storeEmptyFile("test/hadoop/file1"); fs.open(path("/test/hadoop/file1")).close(); }
@Override protected void setUp() throws Exception { Configuration conf = new Configuration(); store = getNativeFileSystemStore(); fs = new NativeS3FileSystem(store); fs.initialize(URI.create(conf.get("test.fs.s3n.name")), conf); }
byte[] temp = new byte[8]; int read = stream.read(temp, 0, 8); assertEquals(8, read); System.arraycopy(temp, 0, result, i, 8); assertEquals((byte)i, result[i]); assertEquals(144, ((TestInputStream)is).throwCount);
public void testDeleteWithNoMarker() throws Exception { String base = "test/hadoop"; Path path = path("/" + base); createTestFiles(base); fs.delete(path, true); path = path("/test"); assertTrue(fs.getFileStatus(path).isDirectory()); assertEquals(0, fs.listStatus(path).length); }
public void testDirWithDifferentMarkersWorks() throws Exception { for (int i = 0; i < 3; i++) { String base = "test/hadoop" + i; Path path = path("/" + base); createTestFiles(base); if (i == 0 ) { //do nothing, we are testing correctness with no markers } else if (i == 1) { // test for _$folder$ marker store.storeEmptyFile(base + "_$folder$"); store.storeEmptyFile(base + "/dir_$folder$"); } else if (i == 2) { // test the end slash file marker store.storeEmptyFile(base + "/"); store.storeEmptyFile(base + "/dir/"); } else if (i == 3) { // test both markers store.storeEmptyFile(base + "_$folder$"); store.storeEmptyFile(base + "/dir_$folder$"); store.storeEmptyFile(base + "/"); store.storeEmptyFile(base + "/dir/"); } assertTrue(fs.getFileStatus(path).isDirectory()); assertEquals(2, fs.listStatus(path).length); } }