phet commented on code in PR #4075: URL: https://github.com/apache/gobblin/pull/4075#discussion_r1842571836
########## gobblin-utility/src/main/java/org/apache/gobblin/util/AzkabanLauncherUtils.java: ########## @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.gobblin.util; + +import java.util.Map; +import java.util.Properties; + +import com.google.common.base.Splitter; +import com.google.common.collect.ImmutableBiMap; + +/** + * Utility class for Azkaban App Launcher. + */ +public class AzkabanLauncherUtils { + public static final String PLACEHOLDER_MAP_KEY = "placeholderMap"; + + public static Properties undoPlaceholderConversion(Properties appProperties) { Review Comment: javadoc ########## gobblin-utility/src/test/java/org/apache/gobblin/AzkabanLauncherUtilsTest.java: ########## @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.gobblin; + +import java.util.Properties; + +import org.testng.Assert; +import org.testng.annotations.Test; + +import org.apache.gobblin.util.AzkabanLauncherUtils; + + +@Test +public class AzkabanLauncherUtilsTest { + + @Test + public void testPropertyPlaceholderReplacement() { + Properties props = new Properties(); + + props.setProperty("placeholderMap", ":emptyStringPlaceholder, :spacePlaceholder,\\t:tabPlaceholder"); + props.setProperty("key1", "emptyStringPlaceholder"); + props.setProperty("key2", "spacePlaceholder"); + props.setProperty("key3", "tabPlaceholder"); + props.setProperty("key4", "someOtherValue"); + props.setProperty("key5", "123emptyStringPlaceholder"); + + props = AzkabanLauncherUtils.undoPlaceholderConversion(props); + Assert.assertEquals("", props.get("key1").toString()); + Assert.assertEquals(" ", props.get("key2").toString()); + Assert.assertEquals("\\t", props.get("key3").toString()); + Assert.assertEquals("someOtherValue", props.get("key4").toString()); + + // should replace exact matches only + Assert.assertEquals("123emptyStringPlaceholder", props.get("key5").toString()); Review Comment: the args here are switched - see param names in source: ``` public static void assertEquals(String actual, String expected) { ... } ``` ########## gobblin-utility/src/main/java/org/apache/gobblin/util/AzkabanLauncherUtils.java: ########## @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.gobblin.util; + +import java.util.Map; +import java.util.Properties; + +import com.google.common.base.Splitter; +import com.google.common.collect.ImmutableBiMap; + +/** + * Utility class for Azkaban App Launcher. + */ +public class AzkabanLauncherUtils { + public static final String PLACEHOLDER_MAP_KEY = "placeholderMap"; + + public static Properties undoPlaceholderConversion(Properties appProperties) { + Properties convertedProperties = new Properties(); + convertedProperties.putAll(appProperties); + + // Undo properties converted to placeholders + Map<String, String> inversePlaceholderMap = ImmutableBiMap.copyOf(Splitter.on(",").withKeyValueSeparator(":") + .split(convertedProperties.get(PLACEHOLDER_MAP_KEY).toString())).inverse(); Review Comment: if the prop named `PLACEHOLDER_MAP_KEY` were not found, would it `.split("null")`? ########## gobblin-yarn/src/main/java/org/apache/gobblin/yarn/GobblinYarnConfigurationKeys.java: ########## @@ -57,6 +57,8 @@ public class GobblinYarnConfigurationKeys { public static final String YARN_APPLICATION_LIB_JAR_LIST = GOBBLIN_YARN_PREFIX + "lib.jar.list"; + public static final String YARN_APPLICATION_PROXY_JVM_ARGS = GOBBLIN_YARN_PREFIX + "proxy.jvm.args"; Review Comment: while I see it in the test, given the uncommon format (of embedding multiple `-D` params in the string), let's javadoc an example of the expected format -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
