[java-idp-integration-tests] 02/02: Read messages.properties from either classpath (V4) or filesystem (V3)
Tom Zeller
tzeller at dragonacea.biz
Wed Aug 5 17:39:31 UTC 2020
This is an automated email from the git hooks/post-receive script.
tzeller pushed a commit to branch master
in repository java-idp-integration-tests.
View the commit online:
http://git.shibboleth.net/view/?p=java-idp-integration-tests.git;a=commit;h=7407763a2e225033525c02f8e9e8fc67f98a0968
commit 7407763a2e225033525c02f8e9e8fc67f98a0968
Author: Tom Zeller <tzeller at dragonacea.biz>
AuthorDate: Wed Aug 5 12:39:13 2020 -0500
Read messages.properties from either classpath (V4) or filesystem (V3)
---
.../net/shibboleth/idp/test/BaseIntegrationTest.java | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java b/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
index 1304737..b54d7b6 100644
--- a/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
+++ b/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
@@ -279,7 +279,7 @@ public abstract class BaseIntegrationTest
/** Path to conf/ldap.properties. */
@NonnullAfterInit protected Path pathToLDAPProperties;
- /** Resource to net/shibboleth/idp/messages/messages.properties.*/
+ /** Resource to messages.properties.*/
@NonnullAfterInit protected Resource messagesPropertiesResource;
/** Path to jetty.base. */
@@ -415,9 +415,16 @@ public abstract class BaseIntegrationTest
pathToLDAPProperties = Paths.get(pathToIdPHome.toAbsolutePath().toString(), "conf", "ldap.properties");
Assert.assertTrue(pathToLDAPProperties.toFile().exists(), "Path to conf/ldap.properties not found");
- //Classpath messages.properties resource
- messagesPropertiesResource = new ClassPathResource("/net/shibboleth/idp/messages/messages.properties");
- Assert.assertTrue(messagesPropertiesResource.exists(), "Path to message properties not found");
+ if (idpVersion.startsWith("3")) {
+ // Path to system/messages/message.properties
+ final Path messagesProperties = pathToIdPHome.resolve(Paths.get("system", "messages","messages.properties"));
+ Assert.assertTrue(messagesProperties.toFile().exists(), "Path system/messages/messages.properties not found");
+ messagesPropertiesResource = new FileSystemResource(messagesProperties.toAbsolutePath().toString());
+ } else {
+ // Classpath messages.properties
+ messagesPropertiesResource = new ClassPathResource("/net/shibboleth/idp/messages/messages.properties");
+ Assert.assertTrue(messagesPropertiesResource.exists(), "Classpath resource messages.properties not found");
+ }
log.debug("Path to message properties '{}'", messagesPropertiesResource);
}
@@ -923,7 +930,7 @@ public abstract class BaseIntegrationTest
}
/**
- * Get a message value from the default <code>system/messages/messages.properties</code> file relating to the <code>key</code> argument.
+ * Get a message value from <code>messages.properties</code> relating to the <code>key</code> argument.
* <p> Can NOT be used to get messages for different languages, only the default system message bundle.<p>
*
* @param key the key used to lookup the value.
@@ -935,7 +942,7 @@ public abstract class BaseIntegrationTest
protected String getMessage(@Nonnull @NotEmpty final String key) throws IOException {
Constraint.isNotNull(StringSupport.trimOrNull(key), "Replacement property key cannot be null nor empty");
- log.debug("Finding message property '{}' in file '{}'", key, messagesPropertiesResource);
+ log.debug("Finding message property '{}' in resource '{}'", key, messagesPropertiesResource);
final Properties props = new Properties();
props.load(messagesPropertiesResource.getInputStream());
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list