Github user davidyan74 commented on a diff in the pull request:
https://github.com/apache/apex-core/pull/360#discussion_r73581887
--- Diff: engine/src/test/java/com/datatorrent/stram/cli/ApexCliTest.java
---
@@ -180,4 +188,40 @@ public void
testLaunchAppPackagePrecedenceWithConfigPackage() throws Exception
Assert.assertEquals("app-default", props.get("dt.test.5"));
Assert.assertEquals("package-default", props.get("dt.test.6"));
}
+
+ @Test
+ public void testAppFromOnlyConfigPackage() throws Exception
+ {
+ ApexCli.LaunchCommandLineInfo commandLineInfo =
+ ApexCli.getLaunchCommandLineInfo(new String[]{"-conf",
configFile.getAbsolutePath(), appFile.getAbsolutePath(), "-useConfigApps",
"exclusive"});
+
+ ApexCli apexCli = new ApexCli();
+ apexCli.init();
+
+ Assert.assertEquals("configApps", "exclusive",
commandLineInfo.useConfigApps);
+
+ apexCli.getLaunchAppPackageArgs(ap, cp, commandLineInfo, new
ConsoleReader());
+
+ Assert.assertEquals(ap.getApplications().size(), 1);
+ }
+
+ @Test
+ public void testMergeAppFromConfigAndAppPackage() throws Exception
+ {
+ ApexCli.LaunchCommandLineInfo commandLineInfo =
+ ApexCli.getLaunchCommandLineInfo(new String[]{"-conf",
configFile.getAbsolutePath(), appFile.getAbsolutePath(), "-useConfigApps",
"inclusive"});
+
+ Assert.assertEquals("configApps", "inclusive",
commandLineInfo.useConfigApps);
+
+ ApexCli apexCli = new ApexCli();
+ apexCli.init();
+
+ try {
+ apexCli.getLaunchAppPackageArgs(ap, cp, commandLineInfo, new
ConsoleReader());
+ } catch (Throwable throwable ) {
--- End diff --
Also, why should this throw an exception? It should be okay to have the
conf package to include multiple apps and in which case, let the user choose by
showing a menu, just like app package can contain multiple apps.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---