private void createTestFiles(String base) throws IOException { store.storeEmptyFile(base + "/file1"); store.storeEmptyFile(base + "/dir/file2"); store.storeEmptyFile(base + "/dir/file3"); }
public void testEmptyFile() throws Exception { store.storeEmptyFile("test/hadoop/file1"); fs.open(path("/test/hadoop/file1")).close(); }
private void createParent(Path path) throws IOException { Path parent = path.getParent(); if (parent != null) { String key = pathToKey(makeAbsolute(parent)); if (key.length() > 0) { store.storeEmptyFile(key + FOLDER_SUFFIX); } } }
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); } }
private void createParent(Path path) throws IOException { Path parent = path.getParent(); if (parent != null) { String key = pathToKey(makeAbsolute(parent)); if (key.length() > 0) { store.storeEmptyFile(key + FOLDER_SUFFIX); } } }
private void createParent(Path path) throws IOException { Path parent = path.getParent(); if (parent != null) { String key = pathToKey(makeAbsolute(parent)); if (key.length() > 0) { store.storeEmptyFile(key + FOLDER_SUFFIX); } } }
private boolean mkdir(Path f) throws IOException { try { FileStatus fileStatus = getFileStatus(f); if (!fileStatus.isDir()) { throw new IOException(String.format( "Can't make directory for path %s since it is a file.", f)); } } catch (FileNotFoundException e) { String key = pathToKey(f) + FOLDER_SUFFIX; store.storeEmptyFile(key); } return true; }
private boolean mkdir(Path f) throws IOException { try { FileStatus fileStatus = getFileStatus(f); if (!fileStatus.isDir()) { throw new IOException(String.format( "Can't make directory for path %s since it is a file.", f)); } } catch (FileNotFoundException e) { String key = pathToKey(f) + FOLDER_SUFFIX; store.storeEmptyFile(key); } return true; }
private boolean mkdir(Path f) throws IOException { try { FileStatus fileStatus = getFileStatus(f); if (fileStatus.isFile()) { throw new FileAlreadyExistsException(String.format( "Can't make directory for path '%s' since it is a file.", f)); } } catch (FileNotFoundException e) { if(LOG.isDebugEnabled()) { LOG.debug("Making dir '" + f + "' in S3"); } String key = pathToKey(f) + FOLDER_SUFFIX; store.storeEmptyFile(key); } return true; }
LOG.debug(debugPreamble + "src is directory, so copying contents"); store.storeEmptyFile(dstKey + FOLDER_SUFFIX);
store.storeEmptyFile(dstKey + FOLDER_SUFFIX);
store.storeEmptyFile(dstKey + FOLDER_SUFFIX);