Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Won't Fix
-
None
-
None
-
None
Description
The PropertyFileUtils class can load the properties file as follows :
String root = System.getProperty("user.dir"); String path = root + "/src/test/resources/myurlconfig.properties"; String urlPath = "file:/" + path; URL propertyFileUrl = new URL(urlPath); Poperties p = PropertyFileUtils.loadProperties(propertyFileUrl);
Using the following code to incorporate the properties does not work:
public class MyUrlCustomPropertyFileConfig implements PropertyFileConfig { @Override public String getPropertyFileName() { String root = System.getProperty("user.dir"); String path = root + "/src/test/resources/myurlconfig.properties"; return "file:/" + path; } @Override public boolean isOptional() { return false; } }
I get an exception as follows:
java.lang.IllegalStateException: com.example.MyUrlCustomPropertyFileConfig points to an invalid file: 'file:/D:\Dev\GIT\example-test/src/test/resources/myurlconfig.properties'
at org.apache.deltaspike.core.impl.config.ConfigurationExtension.createPropertyConfigSource(ConfigurationExtension.java:210)
at org.apache.deltaspike.core.impl.config.ConfigurationExtension.registerUserConfigSources(ConfigurationExtension.java:135)
at org.apache.deltaspike.core.impl.config.ConfigurationExtension$Proxy$_$$_WeldClientProxy.registerUserConfigSources(ConfigurationExtension$Proxy$_$$_WeldClientProxy.java)
By looking into the test code in DeltaSpike I do not see any usage of the URL mechanism as a property configuration source. This should be improved.
There should be a way to integrate easily configuration sources expressed as URLs. As user, I would like that the way to integrate URL paths as configuration sources is also documented (including those starting with file:/).