|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.kuali.rice.testtools.common.PropertiesUtils
public class PropertiesUtils
Util Properties methods which have come from refactoring test generation using freemarker, providing overriding of file properties from System Properties as well as setting file properties as System Properties, as well as turning numbered properties to a List.
Constructor Summary | |
---|---|
PropertiesUtils()
|
Method Summary | |
---|---|
Properties |
loadProperties(InputStream inputStream)
Plain load Properties from the given inputStream. |
Properties |
loadProperties(String location)
Read Properties from given Loaction |
Properties |
loadProperties(String fileLocation,
String resourceLocation)
Deprecated. loadProperties(String) |
Properties |
loadPropertiesWithSystemAndOverrides(String location)
|
Properties |
loadPropertiesWithSystemAndOverridesIntoSystem(String location)
Beware of classloader/timing issues! Sometimes properties get added to the System properties after the point you might expect. |
Properties |
loadPropertiesWithSystemOverrides(InputStream inputStream)
Read the properties from an inputStream overridding keys defined as JVM arguments. |
Properties |
loadPropertiesWithSystemOverrides(String location)
|
Properties |
loadPropertiesWithSystemOverridesAndNumberedPropertiesToList(InputStream inputStream)
Read the properties from an inputStream overridding keys defined as JVM arguments and transforming numbered keys into a list. |
String |
removeNumber(String numberedKey)
Given a key that ends in a number, remove the number. |
Properties |
systemPropertiesAndOverride(Properties props)
|
Properties |
systemPropertiesAndOverride(Properties props,
String arg)
In addition to overriding file properties from System Properties, System properties are added to the returned Properties. |
Properties |
systemPropertiesOverride(Properties props)
Override the given Properties with JVM argument -Dkey=value . |
Properties |
systemPropertiesOverride(Properties props,
String arg)
Override the given Properties with JVM argument -Darg.key=value . |
Properties |
transformNumberedPropertiesToList(Properties props)
Transform the given Properties keys which end in numbers to a List placed in a Map with the map key being the unumbered part of the Properties key with an s appended to it. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PropertiesUtils()
Method Detail |
---|
public Properties loadProperties(InputStream inputStream) throws IOException
Plain load Properties from the given inputStream.
inputStream
- to read properties from
IOException
public Properties loadProperties(String fileLocation, String resourceLocation) throws IOException
loadProperties(String)
Read Properties from given Inputstream or Resource Loaction if the InputStream is null.
If a FileNotFoundException is thrown opening the InputStream an attempt will be made to read as a resource.
fileLocation
- null means use resourceLocationresourceLocation
- load resource as a stream getClass().getClassLoader().getResourceAsStream(resourceLocation);
IOException
public Properties loadProperties(String location) throws IOException
Read Properties from given Loaction
If a FileNotFoundException is thrown opening the InputStream an attempt will be made to read as a resource.
location
-
IOException
public Properties loadPropertiesWithSystemAndOverrides(String location) throws IOException
IOException
public Properties loadPropertiesWithSystemAndOverridesIntoSystem(String location) throws IOException
Beware of classloader/timing issues! Sometimes properties get added to the System properties after the point you might expect. Resulting in the System property not really being set for when you expected, such as with settign statics. Looks like WebDriverLegacyITBase has this going on with public.remote.url
location
- file or resource to load properties from, file is attempted first
IOException
public Properties loadPropertiesWithSystemOverrides(String location) throws IOException
IOException
public Properties loadPropertiesWithSystemOverrides(InputStream inputStream) throws IOException
Read the properties from an inputStream overridding keys defined as JVM arguments.
systemPropertiesOverride(java.util.Properties)
inputStream
- to read properties from
IOException
public Properties loadPropertiesWithSystemOverridesAndNumberedPropertiesToList(InputStream inputStream) throws IOException
Read the properties from an inputStream overridding keys defined as JVM arguments and transforming numbered keys into a list.
systemPropertiesOverride(java.util.Properties)
transformNumberedPropertiesToList(java.util.Properties)
inputStream
-
IOException
public String removeNumber(String numberedKey)
Given a key that ends in a number, remove the number.
numberedKey
- in the form of some.key.number
public Properties systemPropertiesAndOverride(Properties props)
public Properties systemPropertiesOverride(Properties props)
Override the given Properties with JVM argument -Dkey=value
.
props
- properties to update with System.getProperty overrides.public Properties systemPropertiesAndOverride(Properties props, String arg)
In addition to overriding file properties from System Properties, System properties are added to the returned Properties.
systemPropertiesOverride(java.util.Properties)
props
- Properties with System Properties added and Overriding file propertiesarg
- filter System Properties added to Properties by the Property key starting with arg
public Properties systemPropertiesOverride(Properties props, String arg)
Override the given Properties with JVM argument -Darg.key=value
.
-Dkey.propertyname= to override the property value for propertyname.
props
- properties to update with System.getProperty overrides.arg
- optional value that the property names will be appended to.public Properties transformNumberedPropertiesToList(Properties props)
Transform the given Properties keys which end in numbers to a List placed in a Map with the map key being the unumbered part of the Properties key with an s appended to it.
props
- Properties to have keys ending in
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |