> On febr. 18, 2019, 8:43 du, Peter Bacsko wrote: > > sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/LauncherAM.java > > Lines 94-96 (patched) > > <https://reviews.apache.org/r/68317/diff/6/?file=2125751#file2125751line94> > > > > I think we already support Java8, so it can be a good practice to use > > lambdas. > > > > I recently faced a similar problem with System.getEnv(), I think this > > solution should be considered because it's more compact: > > > > ``` > > import java.util.function.Function; > > ... > > private static Function<String, String> envProvider = System::getenv; > > ... > > @VisibleForTesting > > static void setEnvProvider(Function<String, String> envProvider) { > > LauncherAM.envProvider = envProvider; > > } > > ... > > String envValue = envProvider.apply(key); > > ``` > > > > Then in the test code, you can just override like that: > > > > ``` > > LauncherAM.setEnvProvider(s -> { return dummyEnv.get(s); }); > > ``` > > > > So we don't need that tiny helper class, just replace the method > > reference with a new one. > > Denes Bodo wrote: > Thanks Peter for your comment. I agree with we should use the latest > technology in Oozie. However in this specific case we need two functions: one > for System.getenv(KEY) and one for System.getenv(). Latter is only used to > print out key-value pairs and does not affect anything but I think we should > not use two form of getting sysenv nor to use two functions for it.
Hi Denes. Well, once we have the environment Map<String,String> then we don't need System.getEnv(). But if it's too much hassle then we can leave it as it is. - Peter ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/68317/#review212905 ----------------------------------------------------------- On febr. 15, 2019, 11:33 de, Denes Bodo wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/68317/ > ----------------------------------------------------------- > > (Updated febr. 15, 2019, 11:33 de) > > > Review request for oozie and Andras Salamon. > > > Bugs: OOZIE-3326 > https://issues.apache.org/jira/browse/OOZIE-3326 > > > Repository: oozie-git > > > Description > ------- > > SqoopMain needs to support tez delegation tokens for hive-imports. > Implementation is similar to that of HiveMain and Hive2Main. > > At present, hive-import will fail to start a tez session in secure > environment. > > > Diffs > ----- > > sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/LauncherAM.java > 63afd91d3 > > sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/LauncherMain.java > b6599f7f3 > > sharelib/oozie/src/main/java/org/apache/oozie/action/hadoop/SystemEnvironment.java > PRE-CREATION > sharelib/sqoop/src/main/java/org/apache/oozie/action/hadoop/SqoopMain.java > 27f9306a0 > > sharelib/sqoop/src/test/java/org/apache/oozie/action/hadoop/TestSqoopMain.java > d6f96d546 > > > Diff: https://reviews.apache.org/r/68317/diff/6/ > > > Testing > ------- > > > Thanks, > > Denes Bodo > >
