public abstract class ConnectorTest extends Object
ConnectorTester
in JUnit tests.
This class will initialize the tester with the appropriate context prior to running each test. Implementing classes
are required to provide an implementation of ConnectorTestContext
which, at a minimum, provides the connector
class name for the connector being tested.
To create tests for specific operations, you should extend the operation specific subclasses instead of implementing this directly.
Modifier and Type | Field and Description |
---|---|
protected ConnectorTester |
connectorTester
Connector tester instance available to all tests.
|
protected ConnectorTestContext |
testContext
This serves as both the
OperationContext and BrowseContext for all tests. |
Constructor and Description |
---|
ConnectorTest() |
Modifier and Type | Method and Description |
---|---|
protected ObjectDefinitions |
browseProfile(String objectTypeId,
OperationType operationType)
Helper method to get the object definitions for an operation and object type
|
protected ObjectTypes |
browseTypes(OperationType operationType)
Helper method to get the available types for an operation
|
static void |
clearObjectDefinitionCache()
Setup method for connector test classes
|
protected BrowseContext |
getBrowseContext()
Helper method to get the browse context for the test
|
protected abstract ConnectorTestContext |
getConnectorTestContext()
Abstract method that allows subclasses to specify the context and connector class for their tests
|
protected OperationContext |
getOperationContext()
Helper method to get the operation context for the test
|
void |
setupConnectorTester()
Setup method for all connector tests
|
protected ConnectorTester connectorTester
protected ConnectorTestContext testContext
OperationContext
and BrowseContext
for all tests. Any properties, etc.
needed in either context for a test can be added here. The setup method will reset the context prior to each
test.public static void clearObjectDefinitionCache()
This method will clear the definitionCache
. By default, it is executed prior to running any tests in a
test class but can be called before each test if individual tests require the object definitions to be rebuilt.
public final void setupConnectorTester()
Initializes the tester and connector with the context provided by the implementing class
protected final ObjectTypes browseTypes(OperationType operationType)
This exists in the base class instead of BrowserTest
for operation tests that require browsing
operationType
- the operation to browseObjectTypes
instance representing the objects available for the selected operationprotected final ObjectDefinitions browseProfile(String objectTypeId, OperationType operationType)
This exists in the base class instead of BrowserTest
for operation tests that require browsing. This
method caches object definitions to avoid unnecessary lookups. The cache is cleared for each test class. If
individual tests in a test class require a new call, then clearObjectDefinitionCache()
should be called
prior to the test to guarantee it.
objectTypeId
- object type id for the requested definitionsoperationType
- operation type for the requested definitionsObjectDefinitions
instance representing the profile for the selected object and operationprotected final OperationContext getOperationContext()
ConnectorTestContext
implementation of OperationContext
protected final BrowseContext getBrowseContext()
ConnectorTestContext
implementation of BrowseContext
protected abstract ConnectorTestContext getConnectorTestContext()
ConnectorTestContext
instance defined by the implementing class