You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apex.apache.org by da...@apache.org on 2016/09/21 22:00:22 UTC
apex-core git commit: APEXCORE-533 layering of properties in case of
Config apps were not working
Repository: apex-core
Updated Branches:
refs/heads/master fdfba966f -> b782835cc
APEXCORE-533 layering of properties in case of Config apps were not working
Project: http://git-wip-us.apache.org/repos/asf/apex-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/apex-core/commit/b782835c
Tree: http://git-wip-us.apache.org/repos/asf/apex-core/tree/b782835c
Diff: http://git-wip-us.apache.org/repos/asf/apex-core/diff/b782835c
Branch: refs/heads/master
Commit: b782835cce69c77449c689a5af87727d06edfaae
Parents: fdfba96
Author: sandeshh <sa...@gmail.com>
Authored: Wed Sep 21 14:15:32 2016 -0700
Committer: sandeshh <sa...@gmail.com>
Committed: Wed Sep 21 14:15:32 2016 -0700
----------------------------------------------------------------------
.../datatorrent/stram/client/AppPackage.java | 25 ++++++++++++--------
.../com/datatorrent/stram/cli/ApexCliTest.java | 16 +++++++++++++
2 files changed, 31 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/apex-core/blob/b782835c/engine/src/main/java/com/datatorrent/stram/client/AppPackage.java
----------------------------------------------------------------------
diff --git a/engine/src/main/java/com/datatorrent/stram/client/AppPackage.java b/engine/src/main/java/com/datatorrent/stram/client/AppPackage.java
index a260fc0..addf68e 100644
--- a/engine/src/main/java/com/datatorrent/stram/client/AppPackage.java
+++ b/engine/src/main/java/com/datatorrent/stram/client/AppPackage.java
@@ -159,9 +159,7 @@ public class AppPackage extends JarFile
}
classPath.addAll(Arrays.asList(StringUtils.split(classPathString, " ")));
extractToDirectory(directory, file);
- if (processAppDirectory) {
- processAppDirectory(false);
- }
+
File confDirectory = new File(directory, "conf");
if (confDirectory.exists()) {
processConfDirectory(confDirectory);
@@ -174,13 +172,18 @@ public class AppPackage extends JarFile
}
if (processAppDirectory) {
- for (AppInfo app : applications) {
- app.requiredProperties.addAll(requiredProperties);
- app.defaultProperties.putAll(defaultProperties);
- File appPropertiesXml = new File(directory, "META-INF/properties-" + app.name + ".xml");
- if (appPropertiesXml.exists()) {
- processPropertiesXml(appPropertiesXml, app);
- }
+ processAppDirectory(false);
+ }
+ }
+
+ private void processAppProperties()
+ {
+ for (AppInfo app : applications) {
+ app.requiredProperties.addAll(requiredProperties);
+ app.defaultProperties.putAll(defaultProperties);
+ File appPropertiesXml = new File(directory, "META-INF/properties-" + app.name + ".xml");
+ if (appPropertiesXml.exists()) {
+ processPropertiesXml(appPropertiesXml, app);
}
}
}
@@ -404,6 +407,8 @@ public class AppPackage extends JarFile
LOG.warn("Ignoring file {} with unknown extension in app directory", entry.getName());
}
}
+
+ processAppProperties();
}
private void processConfDirectory(File dir)
http://git-wip-us.apache.org/repos/asf/apex-core/blob/b782835c/engine/src/test/java/com/datatorrent/stram/cli/ApexCliTest.java
----------------------------------------------------------------------
diff --git a/engine/src/test/java/com/datatorrent/stram/cli/ApexCliTest.java b/engine/src/test/java/com/datatorrent/stram/cli/ApexCliTest.java
index 6db389c..52e737a 100644
--- a/engine/src/test/java/com/datatorrent/stram/cli/ApexCliTest.java
+++ b/engine/src/test/java/com/datatorrent/stram/cli/ApexCliTest.java
@@ -206,6 +206,22 @@ public class ApexCliTest
}
@Test
+ public void testLaunchAppPackagePrecedenceWithConfigPackageApps() throws Exception
+ {
+ // set launch command options
+ ApexCli.LaunchCommandLineInfo commandLineInfo = ApexCli
+ .getLaunchCommandLineInfo(new String[]{"-D", "dt.test.1=launch-define", "-apconf", "my-app-conf1.xml", "-conf", configFile.getAbsolutePath(), "-useConfigApps", "exclusive"});
+ // process and look at launch config
+
+ DTConfiguration props = cli.getLaunchAppPackageProperties(ap, cp, commandLineInfo, "testApp");
+ Assert.assertEquals("launch-define", props.get("dt.test.1"));
+ Assert.assertEquals("config-package", props.get("dt.test.2"));
+ Assert.assertEquals("app-package-config", props.get("dt.test.3"));
+ Assert.assertEquals("user-home-config", props.get("dt.test.4"));
+ Assert.assertEquals("package-default", props.get("dt.test.5"));
+ }
+
+ @Test
public void testAppFromOnlyConfigPackage() throws Exception
{
ApexCli.LaunchCommandLineInfo commandLineInfo = ApexCli