Oracle® Fusion Middleware .NET API Reference for Identity Connector Framework  E57662-01
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties
Static Public Member Functions | Static Package Functions | Package Attributes | List of all members
Org.IdentityConnectors.Test.Common.TestHelpers Class Reference

Bag of utility methods useful to connector tests. More...

Static Public Member Functions

static APIConfiguration CreateTestConfiguration (SafeType< Connector > clazz, Configuration config)
 Method for convenient testing of local connectors. More...
 
static void FillConfiguration (Configuration config, IDictionary< string, object > configData)
 Fills a configuration bean with data from the given map. More...
 
static ConnectorMessages CreateDummyMessages ()
 Creates an dummy message catalog ideal for unit testing. More...
 
static IList< ConnectorObjectSearchToList (SearchApiOp search, ObjectClass oclass, Filter filter)
 
static IList< ConnectorObjectSearchToList (SearchApiOp search, ObjectClass oclass, Filter filter, OperationOptions options)
 
static IList< ConnectorObjectSearchToList< T > (SearchOp< T > search, ObjectClass oclass, Filter filter)
 Performs a raw, unfiltered search at the SPI level, eliminating duplicates from the result set. More...
 
static IList< ConnectorObjectSearchToList< T > (SearchOp< T > search, ObjectClass oclass, Filter filter, OperationOptions options)
 Performs a raw, unfiltered search at the SPI level, eliminating duplicates from the result set. More...
 
static void Search< T > (SearchOp< T > search, ObjectClass oclass, Filter filter, ResultsHandler handler, OperationOptions options)
 Performs a raw, unfiltered search at the SPI level, eliminating duplicates from the result set. More...
 
static PropertyBag GetProperties (Type type, Assembly assembly)
 Gets the configuration properties for the specified type from the provided assembly . More...
 
static PropertyBag GetProperties (Type type)
 Gets the configuration properties for the specified type from the calling assembly. More...
 

Static Package Functions

static IDictionary< string,
string > 
ReadConfiguration (Stream configStream)
 Reads the configuration properties from the provided configStream stream. More...
 

Package Attributes

const string TestConfigEVName = "TEST_CONFIG"
 The name of the environment variable that contains the name of a certain configuration from which the test configuration properties to be loaded besides the general properties. More...
 
const string PrivateConfigRootEVName = "PRIVATE_CONFIG_ROOT"
 The name of the environment variable that contains the path of the root directory to the private configurations. More...
 
const string UserProfileEVName = "USERPROFILE"
 The name of the environment variable, the value of which is the location of the current user's profile directory. More...
 

Detailed Description

Bag of utility methods useful to connector tests.

Member Function Documentation

static ConnectorMessages Org.IdentityConnectors.Test.Common.TestHelpers.CreateDummyMessages ( )
static

Creates an dummy message catalog ideal for unit testing.

All messages are formatted as follows:

<i>message-key</i>: <i>arg0.toString()</i>, ..., <i>argn.toString</i>
Returns
A dummy message catalog.
static APIConfiguration Org.IdentityConnectors.Test.Common.TestHelpers.CreateTestConfiguration ( SafeType< Connector clazz,
Configuration  config 
)
static

Method for convenient testing of local connectors.

static void Org.IdentityConnectors.Test.Common.TestHelpers.FillConfiguration ( Configuration  config,
IDictionary< string, object >  configData 
)
static

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
configthe configuration bean.
configDatathe map with configuration data.
static PropertyBag Org.IdentityConnectors.Test.Common.TestHelpers.GetProperties ( Type  type,
Assembly  assembly 
)
static

Gets the configuration properties for the specified type from the provided assembly .

<overloads> Gets the configuration properties for a specified type. </overloads>

Parameters
typeThe type, the fully qualified name (FQN) of which to be used to identify the configuration.
assemblyThe assembly, that contains the public configuration properties. Recommended to be the test project.
Returns
Bag of properties for the specified type and optionally set configuration.

The properties are loaded from public and private configuration files, the former as manifest resources, the latter as file system entries by using the specified type as root prefix. Optionally, a certain test setup can be used by defining the "TEST_CONFIG" environment variable that can be used to override the general configuration properties. Both public and private configurations can be overridden with a certain test setup.

Public configuration properties are loaded as manifest resources from the specified assembly according to the following:

  1. Load the general properties from a resource, the name of which is constructed as follows:
    type.FullName + ".config.config.xml"
    . To achieve this, you need to create a new folder in your test project named as the FQN of the specified type , then create a folder called "config", at last add the configuration file called "config.xml" to this folder and set its "Build Action" property to "Embedded Resource".
  2. Load the configuration specific properties from a resource, the name of which is constructed as follows:
    type.FullName + ".config."+ Environment.GetEnvironmentVariable("TEST_CONFIG") + ".config.xml"
    . To achieve this, you need to create a new folder underneath the previously created "config" folder, its name is defined by the configuration name and add the "config.xml" to this particular folder with "Build Action" property set to "Embedded Resource".

The private configuration properties are loaded from the file system as follows:

  1. Load the general properties from a file, the path of which is constructed as follows:
    Environment.GetEnvironmentVariable("PRIVATE_CONFIG_ROOT") + "\config\" + type.FullName + "\config-private\config.xml"
  2. Load the configuration specific properties from a file, the path of which is constructed as follows:
    Environment.GetEnvironmentVariable("PRIVATE_CONFIG_ROOT") + "\config\" + type.FullName + "\config-private\" +
    Environment.GetEnvironmentVariable("TEST_CONFIG") + "\config.xml"

NOTE that if the "PRIVATE_CONFIG_ROOT" environment variable is not defined, it will be replaced in the path with the default root which points to a directory of the current user's profile container, the path of which is constructed as follows:

Environment.GetEnvironmentVariable("USERPROFILE") + "\.connectors\" + type.Assembly.GetName().Name

For example: c:.connectors</example>

Exceptions
InvalidOperationExceptionThrown when the root directory of the private configuration cannot be determined.
static PropertyBag Org.IdentityConnectors.Test.Common.TestHelpers.GetProperties ( Type  type)
static

Gets the configuration properties for the specified type from the calling assembly.

Parameters
typeThe type, the fully qualified name (FQN) of which to be used to identify the configuration.
Returns
Bag of properties for the specified type and optionally set configuration.

See M:GetProperties(Type, Assembly) for details of the property loading mechanism.

static IDictionary<string, string> Org.IdentityConnectors.Test.Common.TestHelpers.ReadConfiguration ( Stream  configStream)
staticpackage

Reads the configuration properties from the provided configStream stream.

Parameters
configStreamThe stream containing the configuration properties.
Returns
A property name-value pair collection representing the configuration.

The configuration properties are stored in XML format. The stream, that is opened for reading or it can be read, has to contain the configuration properties in XML that adheres to the config.xsd schema embedded to the assembly of this project.

For example: <![CDATA[ <?xml version="1.0" encoding="utf-8" ?> <config> <property name="foo" value="bar"> <config> ]]>

Exceptions
InvalidOperationExceptionThrown when the XSD used for validating the configuration is not found in the manifest.
XmlSchemaValidationExceptionThrown when the configStream contains XML that does not adhere to the schema.
static void Org.IdentityConnectors.Test.Common.TestHelpers.Search< T > ( SearchOp< T >  search,
ObjectClass  oclass,
Filter  filter,
ResultsHandler  handler,
OperationOptions  options 
)
static

Performs a raw, unfiltered search at the SPI level, eliminating duplicates from the result set.

Parameters
searchThe search SPI
oclassThe 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)
filterThe filter to search on
handlerThe result handler
optionsThe options - may be null - will be cast to an empty OperationOptions
Type Constraints
T :class 
static IList<ConnectorObject> Org.IdentityConnectors.Test.Common.TestHelpers.SearchToList< T > ( SearchOp< T >  search,
ObjectClass  oclass,
Filter  filter 
)
static

Performs a raw, unfiltered search at the SPI level, eliminating duplicates from the result set.

Parameters
searchThe search SPI
oclassThe 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)
filterThe filter to search on
optionsThe options - may be null - will be cast to an empty OperationOptions
Returns
The list of results.
Type Constraints
T :class 
static IList<ConnectorObject> Org.IdentityConnectors.Test.Common.TestHelpers.SearchToList< T > ( SearchOp< T >  search,
ObjectClass  oclass,
Filter  filter,
OperationOptions  options 
)
static

Performs a raw, unfiltered search at the SPI level, eliminating duplicates from the result set.

Parameters
searchThe search SPI
oclassThe 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)
filterThe filter to search on
optionsThe options - may be null - will be cast to an empty OperationOptions
Returns
The list of results.
Type Constraints
T :class 

Member Data Documentation

const string Org.IdentityConnectors.Test.Common.TestHelpers.PrivateConfigRootEVName = "PRIVATE_CONFIG_ROOT"
package

The name of the environment variable that contains the path of the root directory to the private configurations.

const string Org.IdentityConnectors.Test.Common.TestHelpers.TestConfigEVName = "TEST_CONFIG"
package

The name of the environment variable that contains the name of a certain configuration from which the test configuration properties to be loaded besides the general properties.

const string Org.IdentityConnectors.Test.Common.TestHelpers.UserProfileEVName = "USERPROFILE"
package

The name of the environment variable, the value of which is the location of the current user's profile directory.


The documentation for this class was generated from the following file: