Package org.mongounit.config
Class MongoUnitConfigurationUtil
java.lang.Object
org.mongounit.config.MongoUnitConfigurationUtil
MongoUnitConfigurationUtil
class provides utility methods to make accessing
'mongounit.properties' file and its property values easier.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.mongodb.MongoClientURI
generateNewMongoClientURI
(String baseUri, boolean baseUriKeepAsIs, String timeZoneId) static com.mongodb.MongoClientURI
generateNewMongoClientURI
(org.springframework.core.env.Environment environment) Returns newMongoClientURI
instance that contains newly generated URI, based on 'mongounit.properties'.static MongoUnitProperties
-
Constructor Details
-
MongoUnitConfigurationUtil
public MongoUnitConfigurationUtil()
-
-
Method Details
-
generateNewMongoClientURI
public static com.mongodb.MongoClientURI generateNewMongoClientURI(org.springframework.core.env.Environment environment) Returns newMongoClientURI
instance that contains newly generated URI, based on 'mongounit.properties'.- Parameters:
environment
- Spring environment to look up existing properties already set, if needed.- Returns:
- New
MongoClientURI
instance that contains newly generated URI, based on mongounit.properties.
-
generateNewMongoClientURI
public static com.mongodb.MongoClientURI generateNewMongoClientURI(String baseUri, boolean baseUriKeepAsIs, String timeZoneId) throws MongoUnitException - Parameters:
baseUri
- URI that works as is, but its database name is potentially added to, depending on the 'baseUriKeepAsIs' argument. Can not be 'null'.baseUriKeepAsIs
- Flag to indicate if additional things should be appended to the database name, i.e., the username of the user executing the program and a one-time hash.timeZoneId
- Time zone ID to use in the database name pad.- Returns:
MongoClientURI
which is based on the provided 'baseUri'. If 'baseUriKeepAsIs' is false, the username of the user executing the program and a one-time hash is appended to the end of the database name.- Throws:
MongoUnitException
- If the provided 'baseUri' is not properly formatted such that its database name is not properly configured or the provided 'timeZoneId' can't be parsed.
-
loadMongoUnitProperties
- Returns:
- Loaded
MongoUnitProperties
.
-