A number of the MIM Test providers have shared functionality. This document describes common elements of working with providers, fixtures and assertions.
Value Rules
Most fixture and assertion types allow templated fields. If a field can be templated it will have a '?' icon for the rule helper.
Values may be inserted by enclosing the entire portion in square braces:
[$"rule engine {Count} formatting"]
Or only a portion:
Description with ["inserted string"]
This value handling is done by a shared HandleVal function in the provider base class. In addition to the standard templating rules as might be found in the workflow engine, there are a few special cases:
1. Assertion values
Many assertion types have a list of Attributes, multi-attributes, or both. This is essentially a collection of operations to inspect attribute values on a given object. It is also possible to have more than one directive for the same attribute, for example:
- Attribute: mail, Value: ^.*domain.com$
- Attribute: mail, Value: Contains(Memo("givenName"))
- Attribute: mail, Value: [Memo("mail")]j
Each Assertion field takes an attribute name, a type, and a value. The three types are:
- Value – Performs a direct value equality comparison (with automatic type coercion). Value rules may use templating to get the value from a Memo or construct it
- Regex – Tests if a value matches a given regular expression after conversion to a string
- Rule – Runs the given rule against the object and checks if it returns true or false. NOTE: The rule is executed in the context of the ENTIRE object not just the named attribute, and the rule does NOT require templating.
2. Provider specific formatting
Some providers have additional formatting rules that get processed before the rule engine. For example,
The AD Provider does automatic substitution of [dnRoot] with a string from the connection settings.
The Portal Provider has special use handling for inserting rules in large XML statements, and for resolving XPath filters to resource IDs
Result Memos
A few assertion types (AD, SQL, Portal) support Result Memos. Regular memos are processed at the beginning of the fixture or assertion and produce calculated values. Result Memos are processed at the end of the assertion, and execute rules in the context of the object being evaluated. Essentially, they provide a way to save values (such as an objectSid) from the object for use in later assertions, fixtures, or even cases later in the suite.
Wrapper Objects
In order to give a standard interface for rule engine assertions, any provider that allows asserting against attributes implements a typed wrapper object. If you search the MIM Test codebase you will find ADWrapper, SQLWrapper, etc.
A wrapper object is a simple string key indexed wrapper that takes the underlying DirectoryEntry, RmResource, SqlDataReader, or other type, and presents it as something like a simplified Dictionary. All wrappers implement the EntryWrapper abstract class. Although something like an ObjectRecord, entry wrappers are far simpler.
Comments
0 comments
Please sign in to leave a comment.