eaolson commented on a change in pull request #4854:
URL: https://github.com/apache/nifi/pull/4854#discussion_r589107860



##########
File path: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-properties-loader/src/test/groovy/org/apache/nifi/properties/NiFiPropertiesLoaderGroovyTest.groovy
##########
@@ -472,4 +472,21 @@ class NiFiPropertiesLoaderGroovyTest extends 
GroovyTestCase {
 
         assert readPropertiesAndValues == readPasswordPropertiesAndValues
     }
+    
+    @Test
+    void testShouldStripWhitespace() throws Exception {
+        // Arrange
+        File unprotectedFile = new 
File("src/test/resources/conf/nifi_with_whitespace.properties")
+        NiFiPropertiesLoader niFiPropertiesLoader = new NiFiPropertiesLoader()
+
+        // Act
+        NiFiProperties niFiProperties = 
niFiPropertiesLoader.load(unprotectedFile.path)
+
+        // Assert
+        assert 
niFiProperties.getProperty("nifi.whitespace.propWithLeadingSpace") == "foo";
+        assert 
niFiProperties.getProperty("nifi.whitespace.propWithTrailingSpace") == "foo";
+        assert 
niFiProperties.getProperty("nifi.whitespace.propWithLeadingAndTrailingSpace") 
== "foo";
+        assert 
niFiProperties.getProperty("nifi.whitespace.propWithTrailingTab") == "foo";

Review comment:
       I think I misunderstood how multiline properties worked and this change 
fixes that. That simplified the regex a lot. Users can still embed a newline 
character with "\n". I figure if they go to that much trouble, they should be 
allowed to. The tab issue has been fixed. I also moved the test into a test 
class that executes under Windows, where I'm working.




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to