[java-identity-provider] branch main updated: Support replacing properties without values

Tom Zeller tzeller at dragonacea.biz
Fri Feb 18 19:09:45 UTC 2022


This is an automated email from the git hooks/post-receive script.

tzeller pushed a commit to branch main
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=afea4acc7c743ddb67cfb358387166e9d16ab8ca

The following commit(s) were added to refs/heads/main by this push:
     new afea4acc7 Support replacing properties without values
afea4acc7 is described below

commit afea4acc7c743ddb67cfb358387166e9d16ab8ca
Author: Tom Zeller <tzeller at dragonacea.biz>
AuthorDate: Fri Feb 18 13:09:32 2022 -0600

    Support replacing properties without values
    
    https://shibboleth.atlassian.net/browse/IDP-1905
---
 .../idp/installer/TestPropertiesWithComments.java     | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/idp-installer/src/test/java/net/shibboleth/idp/installer/TestPropertiesWithComments.java b/idp-installer/src/test/java/net/shibboleth/idp/installer/TestPropertiesWithComments.java
index 8c8612483..81f6c50c8 100644
--- a/idp-installer/src/test/java/net/shibboleth/idp/installer/TestPropertiesWithComments.java
+++ b/idp-installer/src/test/java/net/shibboleth/idp/installer/TestPropertiesWithComments.java
@@ -19,12 +19,14 @@ package net.shibboleth.idp.installer;
 
 import static org.testng.Assert.fail;
 
+import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.nio.file.Files;
 import java.util.Properties;
 import java.util.Set;
 
@@ -140,4 +142,21 @@ public class TestPropertiesWithComments {
         
     }
 
+    @Test( enabled=false ) public void testBareKey() throws FileNotFoundException, IOException {
+        final PropertiesWithComments pwc = new PropertiesWithComments();
+        final String bareKey = "key";
+        pwc.load(new ByteArrayInputStream(bareKey.getBytes()));
+
+        pwc.store(new FileOutputStream(testFile));
+
+        final Properties p = new Properties();
+        p.load(new FileInputStream(testFile));
+
+        Assert.assertEquals(p.getProperty("key"), "");
+        
+        final String testFileAsString = Files.readString(testFile.toPath());
+
+        Assert.assertTrue(testFileAsString.contains("key"));
+        Assert.assertFalse(testFileAsString.contains("key="));
+    }
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list