Test script
A test script tests the connection to the external resource to ensure that the other operations that are provided by the connector can succeed.
A sample test script for an SQL database is provided in openidm/samples/scripted-sql-with-mysql/tools/TestScript.groovy
.
- Input variables
-
The following variables are available to the test script:
- configuration
-
A handler to the connector’s configuration object.
- operation
-
An OperationType that corresponds to the action (
TEST
). - log
-
A logger instance for the connector.
- Returns
-
Nothing, if the test is successful. The script can throw any exception if it fails.
Test Script
import org.identityconnectors.common.logging.Log
import org.forgerock.openicf.connectors.groovy.OperationType
import org.forgerock.openicf.misc.scriptedcommon.ScriptedConfiguration
def operation = operation as OperationType
def configuration = configuration as ScriptedConfiguration
def log = log as Log
log.info("This is a TestScript")
throw new MissingResourceException("Test Failed", operation.name(), "")