cameronlee314 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_r374938467
 
 

 ##########
 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:
   Minor suggestion: Instead of needing to check the size and each individual 
entry, could you build the expected config map and then do an equals check?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to