You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@samza.apache.org by GitBox <gi...@apache.org> on 2020/02/04 22:10:44 UTC

[GitHub] [samza] kw2542 commented on a change in pull request #1265: SAMZA-2441: Update ApplicationRunnerMain#ApplicationRunnerCommandLine not to load local file

kw2542 commented on a change in pull request #1265: SAMZA-2441: Update ApplicationRunnerMain#ApplicationRunnerCommandLine not to load local file
URL: https://github.com/apache/samza/pull/1265#discussion_r374951906
 
 

 ##########
 File path: samza-core/src/test/java/org/apache/samza/runtime/TestApplicationRunnerMain.java
 ##########
 @@ -79,6 +82,28 @@ public void TestStatusOperation() throws Exception {
     assertEquals(1, TestApplicationRunnerInvocationCounts.statusCount);
   }
 
+  @Test
+  public void TestLoadConfig() {
+    ApplicationRunnerMain.ApplicationRunnerCommandLine cmdLine = new ApplicationRunnerMain.ApplicationRunnerCommandLine();
+    OptionSet options = cmdLine.parser().parse(
+        "--config-loader-factory",
+        "org.apache.samza.config.loaders.PropertiesConfigLoaderFactory",
+        "--config-loader-properties",
+        "path=" + getClass().getResource("/test.properties").getPath(),
+        "-config", String.format("%s=%s", ApplicationConfig.APP_CLASS, MockStreamApplication.class.getName()),
+        "-config", String.format("app.runner.class=%s", TestApplicationRunnerInvocationCounts.class.getName()));
+
+    Config actual = cmdLine.loadConfig(options);
+
+    assertEquals(4, actual.size());
+    assertEquals("org.apache.samza.config.loaders.PropertiesConfigLoaderFactory", actual.get(JobConfig.CONFIG_LOADER_FACTORY));
+    assertEquals(
+        getClass().getResource("/test.properties").getPath(),
+        actual.get(ConfigLoaderFactory.CONFIG_LOADER_PROPERTIES_PREFIX + "path"));
+    assertEquals(MockStreamApplication.class.getName(), actual.get(ApplicationConfig.APP_CLASS));
+    assertEquals(TestApplicationRunnerInvocationCounts.class.getName(), actual.get("app.runner.class"));
 
 Review comment:
   Good point, updated.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services