Interface IConfigurationPropertyStoreService
Used to gain access to properties in the Configuration Property Store
The framework will be configured with a single Configuration Property Store where all the global properties are kept. However, for test runs, an override property store will also be used to provide run specific properties.
etcd3 is the preferred property store for Galasa
An IConfigurationPropertyStore
can be obtained from
IFramework.getCertificateStoreService()
.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
deleteProperty
(@NotNull String name) Removes a string property from the Configuration Property Store within the namespace for this object.Retrieves all possible different properties set from a namespaceReturn all namespaces which have properties setgetPrefixedProperties
(@NotNull String prefix) Retrieves the properties for the namespace using the supplied prefix.@Null String
getProperty
(@NotNull String prefix, @NotNull String suffix, String... infixes) Retrieves a string property from the Configuration Property Store within the namespace for this object.String[]
reportPropertyVariants
(@NotNull String prefix, @NotNull String suffix, String... infixes) Retrieves all possible different property variations that would be searched, in the search order.reportPropertyVariantsString
(@NotNull String prefix, @NotNull String suffix, String... infixes) Retrieves all possible different property variations that would be searched, in the search order.void
setProperty
(@NotNull String name, @NotNull String value) Sets a string property from the Configuration Property Store within the namespace for this object.
-
Method Details
-
getProperty
@Null @Null String getProperty(@NotNull @NotNull String prefix, @NotNull @NotNull String suffix, String... infixes) throws ConfigurationPropertyStoreException Retrieves a string property from the Configuration Property Store within the namespace for this object.
getProperty will search the Override Configuration Store first per property iteration and then the standard Configuration Property Store.
As an example, if we called getProperty("image", "credentialid", "PLEXMA", "MVMA") within the zos namespace, then the following properties will be searched for:-
zos.image.PLEXMA.MVMA.credentialid in the OCPS
zos.image.PLEXMA.MVMA.credentialid in the CPS
zos.image.PLEXMA.credentialid in the OCPS
zos.image.PLEXMA.credentialid in the CPS
zos.image.credentialid in the OCPS
zos.image.credentialid in the CPSIf a property is not found, null will be returned.
Retrieved properties and their values will be saved in the Result Archive for diagnostic purposes to understand how the properties should be configured for Managers
- Parameters:
prefix
- The prefix of the property name within the namespace.suffix
- The suffix of the property name.infixes
- Any optional infixes of the property name.- Returns:
- Throws:
ConfigurationPropertyStoreException
-
getPrefixedProperties
@NotNull @NotNull Map<String,String> getPrefixedProperties(@NotNull @NotNull String prefix) throws ConfigurationPropertyStoreException Retrieves the properties for the namespace using the supplied prefix. getProperty will search the Override Configuration Store first.- Parameters:
prefix
- - the prefix to use- Returns:
- A map of the properties and the values
- Throws:
ConfigurationPropertyStoreException
- - If there is a problem with the fetch
-
setProperty
@Null void setProperty(@NotNull @NotNull String name, @NotNull @NotNull String value) throws ConfigurationPropertyStoreException Sets a string property from the Configuration Property Store within the namespace for this object.
setProperty will set the property in the standard Configuration Property Store.
As an example, if we called setProperty("image.PLEXMA.credentialid", "PLEXMACREDS") within the zos namespace, then the following property will be set:-
zos.image.PLEXMA.credentialid=PLEXMACREDSIf a property is not set, a ConfigurationPropertyStoreException is thrown .
Set properties and their values will be saved in the Result Archive for diagnostic purposes to understand how the properties should be configured for Managers
- Parameters:
name
- The property name within the namespace.value
- The value of the property.- Throws:
ConfigurationPropertyStoreException
-
deleteProperty
Removes a string property from the Configuration Property Store within the namespace for this object.
deleteProperty will delete the property from the standard Configuration Property Store.
As an example, if we called deleteProperty("image.PLEXMA.credentialid") within the zos namespace, then the following property will be deleted:-
zos.image.PLEXMA.credentialid=VALUEIf a property could not be deleted, a ConfigurationPropertyStoreException is thrown.
- Parameters:
name
- The property name within the namespace.- Throws:
ConfigurationPropertyStoreException
-
getAllProperties
Retrieves all possible different properties set from a namespace- Returns:
- Map of names and values of all properties
- Throws:
ConfigurationPropertyStoreException
- - Something went wrong accessing the persistent property store
-
reportPropertyVariants
String[] reportPropertyVariants(@NotNull @NotNull String prefix, @NotNull @NotNull String suffix, String... infixes) Retrieves all possible different property variations that would be searched, in the search order. If a manager cant get a property, it can report all the properties you could set to get a resolve the problem- Parameters:
prefix
- - The prefix of the property name within the namespace.suffix
- - The suffix of the property name.infixes
- - Any optional infixes of the property name.- Returns:
- array of property names
-
reportPropertyVariantsString
String reportPropertyVariantsString(@NotNull @NotNull String prefix, @NotNull @NotNull String suffix, String... infixes) Retrieves all possible different property variations that would be searched, in the search order.
If a manager cant get a property, it can report all the properties you could set to get a resolve the problem
- Parameters:
prefix
- - The prefix of the property name within the namespace.suffix
- - The suffix of the property name.infixes
- - Any optional infixes of the property name.- Returns:
- comma separated property names
-
getCPSNamespaces
Return all namespaces which have properties set
- Returns:
- List all namespaces with properties set
- Throws:
ConfigurationPropertyStoreException
- - Something went wrong accessing the persistent property store
-