abhioncbr commented on code in PR #12440:
URL: https://github.com/apache/pinot/pull/12440#discussion_r1612507311


##########
pinot-spi/src/test/java/org/apache/pinot/spi/env/CommonsConfigurationUtilsTest.java:
##########
@@ -50,6 +53,33 @@ public void tearDown()
     FileUtils.deleteDirectory(TEMP_DIR);
   }
 
+  @Test
+  public void testSegmentMetadataFromFile() {
+    // load the existing config and check the properties config instance
+    try {
+      PropertiesConfiguration config = CommonsConfigurationUtils
+          .getSegmentMetadataFromFile(SEGMENT_METADATA_CONFIG_FILE, true);
+      assertNotNull(config);
+
+      config.setProperty("testKey", "testValue");
+
+      // add the segment version header to the file and read it again
+      CommonsConfigurationUtils.saveSegmentMetadataToFile(config, CONFIG_FILE,
+          CommonsConfigurationUtils.PROPERTIES_CONFIGURATION_HEADER_VERSION_2);
+
+      // reading the property with header.
+      config = 
CommonsConfigurationUtils.getSegmentMetadataFromFile(CONFIG_FILE, true);
+      assertNotNull(config);
+      assertEquals(config.getHeader(), "# version=2");
+    } catch (Exception ex) {
+      Assert.fail("should not throw ConfigurationException exception with 
valid file");
+    }
+
+    // load the non-existing file and expect the exception
+    Assert.expectThrows(NullPointerException.class,
+        () -> CommonsConfigurationUtils.getSegmentMetadataFromFile(null, 
true));

Review Comment:
   addressed in the [PR](https://github.com/apache/pinot/pull/13201). marking 
it as resolved.



-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to