@Test public void testEncryptedStateToConfiguration() throws IOException { Map<String, String> vals = Maps.newHashMap(); vals.put("test_key1", "test_val1"); vals.put("test_key2", "test_val2"); State state = new State(); for (Map.Entry<String, String> entry : vals.entrySet()) { state.setProp(entry.getKey(), entry.getValue()); } Map<String, String> encryptedVals = Maps.newHashMap(); encryptedVals.put("key1", "val1"); encryptedVals.put("key2", "val2"); final String encryptedPath = "encrypted.name.space"; for (Map.Entry<String, String> entry : encryptedVals.entrySet()) { state.setProp(encryptedPath + "." + entry.getKey(), entry.getValue()); } Configuration configuration = HadoopUtils.getConfFromState(state, Optional.of(encryptedPath)); for (Map.Entry<String, String> entry : vals.entrySet()) { String val = configuration.get(entry.getKey()); Assert.assertEquals(val, entry.getValue()); } for (Map.Entry<String, String> entry : encryptedVals.entrySet()) { Assert.assertNotNull(configuration.get(entry.getKey())); } }
public static Configuration getConfFromState(State state) { return getConfFromState(state, Optional.<String> absent()); }
HadoopUtils { public static Configuration getConfFromState(State state) { return getConfFromState(state, Optional.<String> absent()); } }
HadoopUtils { public static Configuration getConfFromState(State state) { return getConfFromState(state, Optional.<String> absent()); }  }
HadoopUtils { public static Configuration getConfFromState(State state) { return getConfFromState(state, Optional.<String> absent()); }  static Configuration newConfiguration(); @Deprecated static List<FileStatus> listStatusRecursive(FileSystem fileSystem, Path path); static String toUriPath(Path path); static void deletePath(FileSystem fs, Path f, boolean recursive); static void deleteDirectories(FileSystem fs, List<String> directoriesToDelete, boolean recursive, boolean moveToTrash); static void deleteIfExists(FileSystem fs, Path path, boolean recursive); static void deletePathAndEmptyAncestors(FileSystem fs, Path f, boolean recursive); static void deletePathByRegex(FileSystem fs, final Path path, final String regex); static void moveToTrash(FileSystem fs, Path path); static boolean renamePathHandleLocalFSRace(FileSystem fs, Path src, Path dst); static void renamePath(FileContext fc, Path oldName, Path newName); static void renamePath(FileContext fc, Path oldName, Path newName, boolean overwrite); static void renamePath(FileSystem fs, Path oldName, Path newName); static void renamePath(FileSystem fs, Path oldName, Path newName, boolean overwrite); static void movePath(FileSystem srcFs, Path src, FileSystem dstFs, Path dst, Configuration conf); static void movePath(FileSystem srcFs, Path src, FileSystem dstFs, Path dst, boolean overwrite,
      Configuration conf); static void copyPath(FileSystem srcFs, Path src, FileSystem dstFs, Path dst, Configuration conf); static void copyPath(FileSystem srcFs, Path src, FileSystem dstFs, Path dst, boolean overwrite,
      Configuration conf); static void copyFile(FileSystem srcFs, Path src, FileSystem dstFs, Path dst, Path tmp, boolean overwriteDst,
      Configuration conf); static void copyFile(FileSystem srcFs, Path src, FileSystem dstFs, Path dst, boolean overwrite,
      Configuration conf); static void renameRecursively(FileSystem fileSystem, Path from, Path to); static FileSystem getOptionallyThrottledFileSystem(FileSystem fs, State state); static FileSystem getOptionallyThrottledFileSystem(FileSystem fs, int qpsLimit); synchronized static boolean safeRenameIfNotExists(FileSystem fs, Path from, Path to); static boolean unsafeRenameIfNotExists(FileSystem fs, Path from, Path to); static void safeRenameRecursively(FileSystem fileSystem, Path from, Path to); static Configuration getConfFromState(State state); static Configuration getConfFromState(State state, Optional<String> encryptedPath); static Configuration getConfFromProperties(Properties properties); static State getStateFromConf(Configuration conf); static void setGroup(FileSystem fs, Path path, String group); static String serializeToString(Writable writable); static Writable deserializeFromString(Class<? extends Writable> writableClass, String serializedWritableStr); static Writable deserializeFromString(Class<? extends Writable> writableClass, String serializedWritableStr,
      Configuration configuration); static void serializeWriterFilePermissions(State state, int numBranches, int branchId,
      FsPermission fsPermissions); static void serializeWriterDirPermissions(State state, int numBranches, int branchId,
      FsPermission fsPermissions); static void setWriterFileOctalPermissions(State state, int numBranches, int branchId,
      String octalPermissions); static void setWriterDirOctalPermissions(State state, int numBranches, int branchId, String octalPermissions); static FsPermission deserializeWriterFilePermissions(State state, int numBranches, int branchId); static FsPermission deserializeWriterDirPermissions(State state, int numBranches, int branchId); static FsPermission deserializeFsPermission(State props, String propName, FsPermission defaultPermission); static String sanitizePath(String path, String substitute); static Path sanitizePath(Path path, String substitute); static void setPermissions(Path location, Optional<String> owner, Optional<String> group, FileSystem fs,
      FsPermission permission); static boolean hasContent(FileSystem fs, Path path); static void addGobblinSite(); static FileSystem getSourceFileSystem(State state); static FileSystem getWriterFileSystem(State state, int numBranches, int branchId); }
HadoopUtils { public static Configuration getConfFromState(State state) { return getConfFromState(state, Optional.<String> absent()); }  static Configuration newConfiguration(); @Deprecated static List<FileStatus> listStatusRecursive(FileSystem fileSystem, Path path); static String toUriPath(Path path); static void deletePath(FileSystem fs, Path f, boolean recursive); static void deleteDirectories(FileSystem fs, List<String> directoriesToDelete, boolean recursive, boolean moveToTrash); static void deleteIfExists(FileSystem fs, Path path, boolean recursive); static void deletePathAndEmptyAncestors(FileSystem fs, Path f, boolean recursive); static void deletePathByRegex(FileSystem fs, final Path path, final String regex); static void moveToTrash(FileSystem fs, Path path); static boolean renamePathHandleLocalFSRace(FileSystem fs, Path src, Path dst); static void renamePath(FileContext fc, Path oldName, Path newName); static void renamePath(FileContext fc, Path oldName, Path newName, boolean overwrite); static void renamePath(FileSystem fs, Path oldName, Path newName); static void renamePath(FileSystem fs, Path oldName, Path newName, boolean overwrite); static void movePath(FileSystem srcFs, Path src, FileSystem dstFs, Path dst, Configuration conf); static void movePath(FileSystem srcFs, Path src, FileSystem dstFs, Path dst, boolean overwrite,
      Configuration conf); static void copyPath(FileSystem srcFs, Path src, FileSystem dstFs, Path dst, Configuration conf); static void copyPath(FileSystem srcFs, Path src, FileSystem dstFs, Path dst, boolean overwrite,
      Configuration conf); static void copyFile(FileSystem srcFs, Path src, FileSystem dstFs, Path dst, Path tmp, boolean overwriteDst,
      Configuration conf); static void copyFile(FileSystem srcFs, Path src, FileSystem dstFs, Path dst, boolean overwrite,
      Configuration conf); static void renameRecursively(FileSystem fileSystem, Path from, Path to); static FileSystem getOptionallyThrottledFileSystem(FileSystem fs, State state); static FileSystem getOptionallyThrottledFileSystem(FileSystem fs, int qpsLimit); synchronized static boolean safeRenameIfNotExists(FileSystem fs, Path from, Path to); static boolean unsafeRenameIfNotExists(FileSystem fs, Path from, Path to); static void safeRenameRecursively(FileSystem fileSystem, Path from, Path to); static Configuration getConfFromState(State state); static Configuration getConfFromState(State state, Optional<String> encryptedPath); static Configuration getConfFromProperties(Properties properties); static State getStateFromConf(Configuration conf); static void setGroup(FileSystem fs, Path path, String group); static String serializeToString(Writable writable); static Writable deserializeFromString(Class<? extends Writable> writableClass, String serializedWritableStr); static Writable deserializeFromString(Class<? extends Writable> writableClass, String serializedWritableStr,
      Configuration configuration); static void serializeWriterFilePermissions(State state, int numBranches, int branchId,
      FsPermission fsPermissions); static void serializeWriterDirPermissions(State state, int numBranches, int branchId,
      FsPermission fsPermissions); static void setWriterFileOctalPermissions(State state, int numBranches, int branchId,
      String octalPermissions); static void setWriterDirOctalPermissions(State state, int numBranches, int branchId, String octalPermissions); static FsPermission deserializeWriterFilePermissions(State state, int numBranches, int branchId); static FsPermission deserializeWriterDirPermissions(State state, int numBranches, int branchId); static FsPermission deserializeFsPermission(State props, String propName, FsPermission defaultPermission); static String sanitizePath(String path, String substitute); static Path sanitizePath(Path path, String substitute); static void setPermissions(Path location, Optional<String> owner, Optional<String> group, FileSystem fs,
      FsPermission permission); static boolean hasContent(FileSystem fs, Path path); static void addGobblinSite(); static FileSystem getSourceFileSystem(State state); static FileSystem getWriterFileSystem(State state, int numBranches, int branchId); static final String HDFS_ILLEGAL_TOKEN_REGEX; static final Collection<String> FS_SCHEMES_NON_ATOMIC; static final String MAX_FILESYSTEM_QPS; }