public final class TestHelpers extends Object
Modifier and Type | Method and Description |
---|---|
static ConnectorMessages |
createDummyMessages()
Creates an dummy message catalog ideal for unit testing.
|
static APIConfiguration |
createTestConfiguration(Class<? extends Connector> clazz,
Configuration config)
Method for convenient testing of local connectors.
|
static APIConfiguration |
createTestConfiguration(Class<? extends Connector> clazz,
PropertyBag configData,
String prefix)
Method for convenient testing of local connectors.
|
static void |
fillConfiguration(Configuration config,
Map<String,? extends Object> configData)
Fills a configuration bean with data from the given map.
|
static PropertyBag |
getProperties(Class<?> clazz)
Loads Property bag for the specified class.
|
static PropertyBag |
getProperties(Class<?> clazz,
String environment)
Loads Property bag for the specified class.
|
static void |
search(SearchOp<?> search,
ObjectClass objectClass,
Filter filter,
ResultsHandler handler,
OperationOptions options)
Performs a raw, unfiltered search at the SPI level, eliminating
duplicates from the result set.
|
static List<ConnectorObject> |
searchToList(SearchApiOp search,
ObjectClass objectClass,
Filter filter) |
static List<ConnectorObject> |
searchToList(SearchApiOp search,
ObjectClass objectClass,
Filter filter,
OperationOptions options) |
static List<ConnectorObject> |
searchToList(SearchOp<?> search,
ObjectClass objectClass,
Filter filter)
Performs a raw, unfiltered search at the SPI level, eliminating
duplicates from the result set.
|
static List<ConnectorObject> |
searchToList(SearchOp<?> search,
ObjectClass objectClass,
Filter filter,
OperationOptions options)
Performs a raw, unfiltered search at the SPI level, eliminating
duplicates from the result set.
|
public static APIConfiguration createTestConfiguration(Class<? extends Connector> clazz, Configuration config)
public static APIConfiguration createTestConfiguration(Class<? extends Connector> clazz, PropertyBag configData, String prefix)
public static void fillConfiguration(Configuration config, Map<String,? extends Object> configData)
config
- the configuration bean.configData
- the map with configuration data.public static ConnectorMessages createDummyMessages()
message-key: arg0.toString(), ..., argn.toString
public static List<ConnectorObject> searchToList(SearchApiOp search, ObjectClass objectClass, Filter filter)
public static List<ConnectorObject> searchToList(SearchApiOp search, ObjectClass objectClass, Filter filter, OperationOptions options)
public static List<ConnectorObject> searchToList(SearchOp<?> search, ObjectClass objectClass, Filter filter)
search
- The search SPIobjectClass
- The object class - passed through to connector so it may be
null if the connecor allowing it to be null. (This is
convenient for unit tests, but will not be the case in
general)filter
- The filter to search onpublic static List<ConnectorObject> searchToList(SearchOp<?> search, ObjectClass objectClass, Filter filter, OperationOptions options)
search
- The search SPIobjectClass
- The object class - passed through to connector so it may be
null if the connecor allowing it to be null. (This is
convenient for unit tests, but will not be the case in
general)filter
- The filter to search onoptions
- The options - may be null - will be cast to an empty
OperationOptionspublic static void search(SearchOp<?> search, ObjectClass objectClass, Filter filter, ResultsHandler handler, OperationOptions options)
search
- The search SPIobjectClass
- The object class - passed through to connector so it may be
null if the connecor allowing it to be null. (This is
convenient for unit tests, but will not be the case in
general)filter
- The filter to search onhandler
- The result handleroptions
- The options - may be null - will be cast to an empty
OperationOptionspublic static PropertyBag getProperties(Class<?> clazz)
loader.getResource(prefix + "/config/config.groovy")
loader.getResource(prefix + "/config/" + cfg + "/config.groovy")
optionally where cfg is passed configuration loader.getResource(prefix + "/config-private/config.groovy")
loader.getResource(prefix + "/config-private/" + cfg + "/config.groovy")
optionally where cfg is passed configurationclazz
- Class which FQN is used as root prefix for loading of
propertiesIllegalStateException
- if context classloader is nullpublic static PropertyBag getProperties(Class<?> clazz, String environment)
loader.getResource(prefix + "/config/config.groovy")
loader.getResource(prefix + "/config/" + cfg + "/config.groovy")
optionally where cfg is passed configuration loader.getResource(prefix + "/config-private/config.groovy")
loader.getResource(prefix + "/config-private/" + cfg + "/config.groovy")
optionally where cfg is passed configurationclazz
- Class which FQN is used as root prefix for loading of
propertiesenvironment
- Environment name (Optional)IllegalStateException
- if context classloader is nullCopyright © 2019. All rights reserved.