Skip navigation links


org.identityconnectors.test.common
Class TestHelpers

java.lang.Object
  extended by org.identityconnectors.test.common.TestHelpers


public final class TestHelpers
extends java.lang.Object

Bag of utility methods useful to connector tests.


Method Summary
static ConnectorMessages createDummyMessages()
          Creates an dummy message catalog ideal for unit testing.
static APIConfiguration createTestConfiguration(java.lang.Class<? extends Connector> clazz, Configuration config)
          Method for convenient testing of local connectors.
static void fillConfiguration(Configuration config, java.util.Map<java.lang.String,? extends java.lang.Object> configData)
          Fills a configuration bean with data from the given map.
static PropertyBag getProperties(java.lang.Class<?> clazz)
          Loads Property bag for the specified class.
static void search(SearchOp<?> search, ObjectClass oclass, Filter filter, ResultsHandler handler, OperationOptions options)
          Performs a raw, unfiltered search at the SPI level, eliminating duplicates from the result set.
static java.util.List<ConnectorObject> searchToList(SearchApiOp search, ObjectClass oclass, Filter filter)
           
static java.util.List<ConnectorObject> searchToList(SearchApiOp search, ObjectClass oclass, Filter filter, OperationOptions options)
           
static java.util.List<ConnectorObject> searchToList(SearchOp<?> search, ObjectClass oclass, Filter filter)
          Performs a raw, unfiltered search at the SPI level, eliminating duplicates from the result set.
static java.util.List<ConnectorObject> searchToList(SearchOp<?> search, ObjectClass oclass, Filter filter, OperationOptions options)
          Performs a raw, unfiltered search at the SPI level, eliminating duplicates from the result set.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Method Detail

createTestConfiguration

public static APIConfiguration createTestConfiguration(java.lang.Class<? extends Connector> clazz,
                                                       Configuration config)
Method for convenient testing of local connectors.

fillConfiguration

public static void fillConfiguration(Configuration config,
                                     java.util.Map<java.lang.String,? extends java.lang.Object> configData)
Fills a configuration bean with data from the given map. The map keys are configuration property names and the values are configuration property values.
Parameters:
config - the configuration bean.
configData - the map with configuration data.

createDummyMessages

public static ConnectorMessages createDummyMessages()
Creates an dummy message catalog ideal for unit testing. All messages are formatted as follows:

message-key: arg0.toString(), ..., argn.toString

Returns:
A dummy message catalog.

searchToList

public static java.util.List<ConnectorObject> searchToList(SearchApiOp search,
                                                           ObjectClass oclass,
                                                           Filter filter)

searchToList

public static java.util.List<ConnectorObject> searchToList(SearchApiOp search,
                                                           ObjectClass oclass,
                                                           Filter filter,
                                                           OperationOptions options)

searchToList

public static java.util.List<ConnectorObject> searchToList(SearchOp<?> search,
                                                           ObjectClass oclass,
                                                           Filter filter)
Performs a raw, unfiltered search at the SPI level, eliminating duplicates from the result set.
Parameters:
search - The search SPI
oclass - 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 on
Returns:
The list of results.

searchToList

public static java.util.List<ConnectorObject> searchToList(SearchOp<?> search,
                                                           ObjectClass oclass,
                                                           Filter filter,
                                                           OperationOptions options)
Performs a raw, unfiltered search at the SPI level, eliminating duplicates from the result set.
Parameters:
search - The search SPI
oclass - 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 on
options - The options - may be null - will be cast to an empty OperationOptions
Returns:
The list of results.

search

public static void search(SearchOp<?> search,
                          ObjectClass oclass,
                          Filter filter,
                          ResultsHandler handler,
                          OperationOptions options)
Performs a raw, unfiltered search at the SPI level, eliminating duplicates from the result set.
Parameters:
search - The search SPI
oclass - 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 on
handler - The result handler
options - The options - may be null - will be cast to an empty OperationOptions

getProperties

public static PropertyBag getProperties(java.lang.Class<?> clazz)
Loads Property bag for the specified class. The properties are loaded as classpath resources using the class argument as root prefix. Optional system property 'testConfig' is used to specify another configuration path for properties. The following algorithm is used to load the properties in bag Context classloader is used to load the resources.
Parameters:
clazz - Class which FQN is used as root prefix for loading of properties
Returns:
Bag of properties for specified class and optionally passed configuration
Throws:
java.lang.IllegalStateException - if context classloader is null

Skip navigation links


Copyright © 2012, Oracle and/or its affiliates. All rights reserved.