Class ConnectorTest
- java.lang.Object
-
- com.boomi.connector.testutil.junit.ConnectorTest
-
- Direct Known Subclasses:
BrowserTest
,OperationTest
public abstract class ConnectorTest extends Object
Base test class to useConnectorTester
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.
-
-
Field Summary
Fields Modifier and Type Field Description protected ConnectorTester
connectorTester
Connector tester instance available to all tests.protected ConnectorTestContext
testContext
This serves as both theOperationContext
andBrowseContext
for all tests.
-
Constructor Summary
Constructors Constructor Description ConnectorTest()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected ObjectDefinitions
browseProfile(String objectTypeId, OperationType operationType)
Helper method to get the object definitions for an operation and object typeprotected ObjectTypes
browseTypes(OperationType operationType)
Helper method to get the available types for an operationstatic void
clearObjectDefinitionCache()
Setup method for connector test classesprotected BrowseContext
getBrowseContext()
Helper method to get the browse context for the testprotected abstract ConnectorTestContext
getConnectorTestContext()
Abstract method that allows subclasses to specify the context and connector class for their testsprotected OperationContext
getOperationContext()
Helper method to get the operation context for the testvoid
setupConnectorTester()
Setup method for all connector tests
-
-
-
Field Detail
-
connectorTester
protected ConnectorTester connectorTester
Connector tester instance available to all tests. Implementation of predefined test classes is preferred over direct interaction with the tester.
-
testContext
protected ConnectorTestContext testContext
This serves as both theOperationContext
andBrowseContext
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.
-
-
Method Detail
-
clearObjectDefinitionCache
public static void clearObjectDefinitionCache()
Setup method for connector test classesThis 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.
-
setupConnectorTester
public final void setupConnectorTester()
Setup method for all connector testsInitializes the tester and connector with the context provided by the implementing class
-
browseTypes
protected final ObjectTypes browseTypes(OperationType operationType)
Helper method to get the available types for an operationThis exists in the base class instead of
BrowserTest
for operation tests that require browsing- Parameters:
operationType
- the operation to browse- Returns:
ObjectTypes
instance representing the objects available for the selected operation
-
browseProfile
protected final ObjectDefinitions browseProfile(String objectTypeId, OperationType operationType)
Helper method to get the object definitions for an operation and object typeThis 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, thenclearObjectDefinitionCache()
should be called prior to the test to guarantee it.- Parameters:
objectTypeId
- object type id for the requested definitionsoperationType
- operation type for the requested definitions- Returns:
ObjectDefinitions
instance representing the profile for the selected object and operation
-
getOperationContext
protected final OperationContext getOperationContext()
Helper method to get the operation context for the test- Returns:
ConnectorTestContext
implementation ofOperationContext
-
getBrowseContext
protected final BrowseContext getBrowseContext()
Helper method to get the browse context for the test- Returns:
ConnectorTestContext
implementation ofBrowseContext
-
getConnectorTestContext
protected abstract ConnectorTestContext getConnectorTestContext()
Abstract method that allows subclasses to specify the context and connector class for their tests- Returns:
ConnectorTestContext
instance defined by the implementing class
-
-