[java-identity-provider] 01/02: IDP-1905 Ignore keys without values
Rod Widdowson
rdw at steadingsoftware.com
Fri Mar 4 14:01:40 UTC 2022
This is an automated email from the git hooks/post-receive script.
rdw 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=58fdd59219f48f22bc6fe0187c150bd86e91afb1
commit 58fdd59219f48f22bc6fe0187c150bd86e91afb1
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Fri Mar 4 13:35:00 2022 +0000
IDP-1905 Ignore keys without values
https://shibboleth.atlassian.net/browse/IDP-1905
Extends tests
---
.../idp/installer/TestPropertiesWithComments.java | 24 +++++++++++++++++++---
.../net/shibboleth/idp/installer/file.properties | 3 +++
2 files changed, 24 insertions(+), 3 deletions(-)
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 81f6c50c8..1dd583e7c 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
@@ -79,7 +79,7 @@ public class TestPropertiesWithComments {
p.load(new FileInputStream(testFile));
- Assert.assertEquals(p.stringPropertyNames().size(), 4);
+ Assert.assertEquals(p.stringPropertyNames().size(), 6);
Assert.assertEquals(p.getProperty("p"), "321");
Assert.assertEquals(p.getProperty("nn"), "123");
Assert.assertEquals(p.getProperty("yy"), "123321");
@@ -136,13 +136,13 @@ public class TestPropertiesWithComments {
p.load(new FileInputStream(testFile));
- Assert.assertEquals(p.stringPropertyNames().size(), 2);
+ Assert.assertEquals(p.stringPropertyNames().size(), 4);
Assert.assertEquals(p.getProperty("p"), "123");
Assert.assertEquals(p.getProperty("elephantName"), "elephants");
}
- @Test( enabled=false ) public void testBareKey() throws FileNotFoundException, IOException {
+ @Test( enabled=true ) public void testBareKey() throws FileNotFoundException, IOException {
final PropertiesWithComments pwc = new PropertiesWithComments();
final String bareKey = "key";
pwc.load(new ByteArrayInputStream(bareKey.getBytes()));
@@ -159,4 +159,22 @@ public class TestPropertiesWithComments {
Assert.assertTrue(testFileAsString.contains("key"));
Assert.assertFalse(testFileAsString.contains("key="));
}
+
+ @Test( enabled=true ) public void testBareModules() throws FileNotFoundException, IOException {
+ final PropertiesWithComments pwc = new PropertiesWithComments();
+ pwc.load(new ByteArrayInputStream("--module=Foo\n--module=BAR".getBytes()));
+
+ pwc.store(new FileOutputStream(testFile));
+
+ final Properties p = new Properties();
+ p.load(new FileInputStream(testFile));
+
+ Assert.assertEquals(p.size(), 1);
+ Assert.assertTrue("Foo".equals(p.get("--module")) || "BAR".equals(p.get("--module")));
+
+
+ final String testFileAsString = Files.readString(testFile.toPath());
+ Assert.assertTrue(testFileAsString.contains("--module=Foo") && testFileAsString.contains("--module=BAR"));
+ }
+
}
diff --git a/idp-installer/src/test/resources/net/shibboleth/idp/installer/file.properties b/idp-installer/src/test/resources/net/shibboleth/idp/installer/file.properties
index e08a078cc..799a0b43f 100644
--- a/idp-installer/src/test/resources/net/shibboleth/idp/installer/file.properties
+++ b/idp-installer/src/test/resources/net/shibboleth/idp/installer/file.properties
@@ -2,4 +2,7 @@
# yy = elephant and put in some more crap about yy
p=123
q=elephants
+--module=wumpus
+--module=ISmellA
+/etc/path/foo.sml
#End with a Comment
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list