Class ConnectorTester
- java.lang.Object
-
- com.boomi.connector.testutil.ConnectorTester
-
public class ConnectorTester extends Object
Test harness for a Connector. Facilitates setting up an environment in which a Connector implementation can be executed and the results analyzed.Typically, one would configure this tester with the relevant connector and the necessary context objects and then run one or more of the test methods.
-
-
Constructor Summary
Constructors Constructor Description ConnectorTester()
Creates a new ConnectorTester with a default AtomConfig.ConnectorTester(Connector connector)
Creates a new ConnectorTester for the given connector with a default AtomConfig.ConnectorTester(Connector connector, APIVersion apiVersion)
Creates a new ConnectorTester for the given connector with a default AtomConfig and the provided API version.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
browseProfiles(String objTypeId)
Browses for object type profiles.String
browseTypes()
Browses for object types.List<SimpleOperationResult>
executeCreateOperation(List<InputStream> inputs)
Executes an CREATE operation.List<SimpleOperationResult>
executeCreateOperationWithTrackedData(List<SimpleTrackedData> inputs)
Executes an CREATE operation.List<SimpleOperationResult>
executeDeleteOperation(List<String> objectIds)
Executes a DELETE operation.List<SimpleOperationResult>
executeDeleteOperationWithTrackedData(List<SimpleTrackedData> inputs)
Executes a DELETE operation.List<SimpleOperationResult>
executeExecuteOperation(List<InputStream> inputs)
Executes an EXECUTE operation.List<SimpleOperationResult>
executeExecuteOperationWithTrackedData(List<SimpleTrackedData> inputs)
Executes an EXECUTE operation.List<SimpleOperationResult>
executeGetOperation(String objectId)
Executes a GET operation.List<SimpleOperationResult>
executeGetOperationWithTrackedData(SimpleTrackedData input)
Executes a GET operation.List<SimpleOperationResult>
executeOperation(OperationRequest request, SimpleOperationResponse response, OperationType expectedType)
Executes an operation.List<SimpleOperationResult>
executeQueryOperation(QueryFilter filter)
Executes a QUERY operation.List<SimpleOperationResult>
executeQueryOperationWithTrackedData(SimpleTrackedData input)
Executes a QUERY operation.List<SimpleOperationResult>
executeUpdateOperation(List<InputStream> inputs)
Executes an UPDATE operation.List<SimpleOperationResult>
executeUpdateOperationWithTrackedData(List<SimpleTrackedData> inputs)
Executes an UPDATE operation.List<SimpleOperationResult>
executeUpsertOperation(List<InputStream> inputs)
Executes an UPSERT operation.List<SimpleOperationResult>
executeUpsertOperationWithTrackedData(List<SimpleTrackedData> inputs)
Executes an UPSERT operation.BrowseContext
getBrowseContext()
Returns the currently configured BrowseContext.AtomConfig
getConfig()
Returns the currently configured AtomConfig.Connector
getConnector()
Returns the currently configured Connector.OperationContext
getOperationContext()
Returns the currently configured OperationContext.void
initializeConnector()
Initializes the currently configured connector.void
setAPIVersion(APIVersion apiVersion)
Sets the API version.void
setBrowseContext(BrowseContext newBrowseContext)
Sets the BrowseContext to the given instance.void
setBrowseContext(OperationType opType, Map<String,Object> connProps, Map<String,Object> opProps)
Sets the BrowseContext to a new instance of SimpleBrowseContext with the given arguments.void
setConfig(int maxPageSize, int maxNumObjects, int maxCookieLength)
Sets the AtomConfig to a new instance of SimpleAtomConfig with the given arguments.void
setConfig(AtomConfig newConfig)
Sets the AtomConfig to the given instance.void
setConnector(Connector newConnector)
Sets the Connector to the given instance.void
setOperationContext(OperationContext newOperationContext)
Sets the OperationContext to the given instance.void
setOperationContext(OperationType opType, Map<String,Object> connProps, Map<String,Object> opProps, String objectTypeId, Map<ObjectDefinitionRole,String> cookies)
Sets the OperationContext to a new instance of SimpleOperationContext with the given arguments..void
setProxyConfig(AtomProxyConfig newProxyConfig)
Sets the AtomProxyConfig value within SimpleAtomConfig instance.void
testBrowseProfiles(String objTypeId, String expectedDefDoc)
Tests browsing for object type profiles.void
testBrowseTypes(String expectedTypeDoc)
Tests browsing for object types.void
testExecuteCreateOperation(List<InputStream> inputs, List<SimpleOperationResult> expectedResults)
Tests executing a CREATE operation.void
testExecuteCreateOperationWithTrackedData(List<SimpleTrackedData> inputs, List<SimpleOperationResult> expectedResults)
Tests executing a CREATE operation.void
testExecuteDeleteOperation(List<String> objectIds, List<SimpleOperationResult> expectedResults)
Tests executing a DELETE operation.void
testExecuteDeleteOperationWithTrackedData(List<SimpleTrackedData> inputs, List<SimpleOperationResult> expectedResults)
Tests executing a DELETE operation.void
testExecuteExecuteOperation(List<InputStream> inputs, List<SimpleOperationResult> expectedResults)
Tests executing an EXECUTE operation.void
testExecuteGetOperation(String objectId, List<SimpleOperationResult> expectedResults)
Tests executing a GET operation.void
testExecuteGetOperationWithTrackedData(SimpleTrackedData input, List<SimpleOperationResult> expectedResults)
Tests executing a GET operation.void
testExecuteOperation(OperationRequest request, SimpleOperationResponse response, OperationType expectedType, List<SimpleOperationResult> expectedResults)
Tests executing an operation.void
testExecuteQueryOperation(QueryFilter filter, List<SimpleOperationResult> expectedResults)
Tests executing a QUERY operation.void
testExecuteQueryOperationWithTrackedData(SimpleTrackedData input, List<SimpleOperationResult> expectedResults)
Tests executing a QUERY operation.void
testExecuteUpdateOperation(List<InputStream> inputs, List<SimpleOperationResult> expectedResults)
Tests executing a UPDATE operation.void
testExecuteUpdateOperationWithTrackedData(List<SimpleTrackedData> inputs, List<SimpleOperationResult> expectedResults)
Tests executing a UPDATE operation.void
testExecuteUpsertOperation(List<InputStream> inputs, List<SimpleOperationResult> expectedResults)
Tests executing an UPSERT operation.void
testExecuteUpsertOperationWithTrackedData(List<SimpleTrackedData> inputs, List<SimpleOperationResult> expectedResults)
Tests executing an UPSERT operation.
-
-
-
Constructor Detail
-
ConnectorTester
public ConnectorTester()
Creates a new ConnectorTester with a default AtomConfig.
-
ConnectorTester
public ConnectorTester(Connector connector)
Creates a new ConnectorTester for the given connector with a default AtomConfig.
-
ConnectorTester
public ConnectorTester(Connector connector, APIVersion apiVersion)
Creates a new ConnectorTester for the given connector with a default AtomConfig and the provided API version.
-
-
Method Detail
-
getConfig
public AtomConfig getConfig()
Returns the currently configured AtomConfig.
-
setConfig
public void setConfig(int maxPageSize, int maxNumObjects, int maxCookieLength)
Sets the AtomConfig to a new instance of SimpleAtomConfig with the given arguments.- Parameters:
maxPageSize
- maximum batch size for paging operationsmaxNumObjects
- maximum number of objects that can be returned from a browsing requestmaxCookieLength
- maximum length of a cookie stored in an ObjectDefinition
-
setConfig
public void setConfig(AtomConfig newConfig)
Sets the AtomConfig to the given instance.
-
setProxyConfig
public void setProxyConfig(AtomProxyConfig newProxyConfig)
Sets the AtomProxyConfig value within SimpleAtomConfig instance. Primarily used to overwrite the default implementation of SimpleAtomProxyConfig. A new instance can be obtained by using the builder method as follows :new SimpleAtomProxyConfig("exampleProxyHost","exampleProxyPort") .withProxyUser("exampleUsername").withProxyPassword("*******");
- Parameters:
newProxyConfig
-
-
getBrowseContext
public BrowseContext getBrowseContext()
Returns the currently configured BrowseContext.
-
setBrowseContext
public void setBrowseContext(OperationType opType, Map<String,Object> connProps, Map<String,Object> opProps)
Sets the BrowseContext to a new instance of SimpleBrowseContext with the given arguments. Uses the currently configured AtomConfig.- Parameters:
opType
- the type of operation for which browsing is being requestedconnProps
- the connection properties for the browse request, may benull
opProps
- the operation properties for the browse request, may benull
-
setBrowseContext
public void setBrowseContext(BrowseContext newBrowseContext)
Sets the BrowseContext to the given instance.
-
getOperationContext
public OperationContext getOperationContext()
Returns the currently configured OperationContext.
-
setOperationContext
public void setOperationContext(OperationType opType, Map<String,Object> connProps, Map<String,Object> opProps, String objectTypeId, Map<ObjectDefinitionRole,String> cookies)
Sets the OperationContext to a new instance of SimpleOperationContext with the given arguments.. Uses the currently configured AtomConfig.- Parameters:
opType
- the type of operation being executedconnProps
- the connection properties for the operation execution, may benull
opProps
- the operation properties for the operation execution, may benull
objectTypeId
- the type of the object on which the operation is being executedcookies
- any cookies from the ObjectDefinition for the relevant object type, may benull
-
setOperationContext
public void setOperationContext(OperationContext newOperationContext)
Sets the OperationContext to the given instance.
-
getConnector
public Connector getConnector()
Returns the currently configured Connector.
-
setConnector
public void setConnector(Connector newConnector)
Sets the Connector to the given instance.
-
setAPIVersion
public void setAPIVersion(APIVersion apiVersion)
Sets the API version.
-
initializeConnector
public void initializeConnector()
Initializes the currently configured connector.Prerequisites:
- Valid AtomConfig
- Valid Connector
-
testBrowseTypes
public void testBrowseTypes(String expectedTypeDoc)
Tests browsing for object types.Prerequisites:
- Valid AtomConfig
- Valid Connector
- Valid BrowseContext
- Parameters:
expectedTypeDoc
- xml document string representing the expected output
-
browseTypes
public String browseTypes()
Browses for object types.Prerequisites:
- Valid AtomConfig
- Valid Connector
- Valid BrowseContext
- Returns:
- the types document
-
testBrowseProfiles
public void testBrowseProfiles(String objTypeId, String expectedDefDoc)
Tests browsing for object type profiles.Prerequisites:
- Valid AtomConfig
- Valid Connector
- Valid BrowseContext
- Parameters:
objTypeId
- the type id of the object type for which to create the profilesexpectedDefDoc
- xml document string representing the expected output
-
browseProfiles
public String browseProfiles(String objTypeId)
Browses for object type profiles.Prerequisites:
- Valid AtomConfig
- Valid Connector
- Valid BrowseContext
- Parameters:
objTypeId
- the type id of the object type for which to create the profiles- Returns:
- the definitions document
-
testExecuteGetOperation
public void testExecuteGetOperation(String objectId, List<SimpleOperationResult> expectedResults)
Tests executing a GET operation.Prerequisites:
- Valid AtomConfig
- Valid Connector
- Valid OperationContext (configured for a GET operation)
- Parameters:
objectId
- the id of the object to retrieveexpectedResults
- the expected output of the operation
-
testExecuteGetOperationWithTrackedData
public void testExecuteGetOperationWithTrackedData(SimpleTrackedData input, List<SimpleOperationResult> expectedResults)
Tests executing a GET operation.Prerequisites:
- Valid AtomConfig
- Valid Connector
- Valid OperationContext (configured for a GET operation)
- Parameters:
input
- the object to retrieveexpectedResults
- the expected output of the operation
-
executeGetOperation
public List<SimpleOperationResult> executeGetOperation(String objectId)
Executes a GET operation.Prerequisites:
- Valid AtomConfig
- Valid Connector
- Valid OperationContext (configured for a GET operation)
- Parameters:
objectId
- the id of the object to retrieve- Returns:
- the response results
-
executeGetOperationWithTrackedData
public List<SimpleOperationResult> executeGetOperationWithTrackedData(SimpleTrackedData input)
Executes a GET operation.Prerequisites:
- Valid AtomConfig
- Valid Connector
- Valid OperationContext (configured for a GET operation)
- Parameters:
input
- the object to retrieve- Returns:
- the response results
-
testExecuteQueryOperation
public void testExecuteQueryOperation(QueryFilter filter, List<SimpleOperationResult> expectedResults)
Tests executing a QUERY operation.Prerequisites:
- Valid AtomConfig
- Valid Connector
- Valid OperationContext (configured for a QUERY operation)
- Parameters:
filter
- the query filter for the requestexpectedResults
- the expected output of the operation
-
testExecuteQueryOperationWithTrackedData
public void testExecuteQueryOperationWithTrackedData(SimpleTrackedData input, List<SimpleOperationResult> expectedResults)
Tests executing a QUERY operation.Prerequisites:
- Valid AtomConfig
- Valid Connector
- Valid OperationContext (configured for a QUERY operation)
- Parameters:
input
- the tracked data containing the query inputexpectedResults
- the expected output of the operation
-
executeQueryOperation
public List<SimpleOperationResult> executeQueryOperation(QueryFilter filter)
Executes a QUERY operation.Prerequisites:
- Valid AtomConfig
- Valid Connector
- Valid OperationContext (configured for a QUERY operation)
- Parameters:
filter
- the query filter for the request- Returns:
- the response results
-
executeQueryOperationWithTrackedData
public List<SimpleOperationResult> executeQueryOperationWithTrackedData(SimpleTrackedData input)
Executes a QUERY operation.Prerequisites:
- Valid AtomConfig
- Valid Connector
- Valid OperationContext (configured for a QUERY operation)
- Parameters:
input
- the query object for the request- Returns:
- the response results
-
testExecuteDeleteOperation
public void testExecuteDeleteOperation(List<String> objectIds, List<SimpleOperationResult> expectedResults)
Tests executing a DELETE operation.Prerequisites:
- Valid AtomConfig
- Valid Connector
- Valid OperationContext (configured for a DELETE operation)
- Parameters:
objectIds
- ids of the objects to be deletedexpectedResults
- the expected output of the operation
-
testExecuteDeleteOperationWithTrackedData
public void testExecuteDeleteOperationWithTrackedData(List<SimpleTrackedData> inputs, List<SimpleOperationResult> expectedResults)
Tests executing a DELETE operation.Prerequisites:
- Valid AtomConfig
- Valid Connector
- Valid OperationContext (configured for a DELETE operation)
- Parameters:
inputs
- objects to be deletedexpectedResults
- the expected output of the operation
-
executeDeleteOperation
public List<SimpleOperationResult> executeDeleteOperation(List<String> objectIds)
Executes a DELETE operation.Prerequisites:
- Valid AtomConfig
- Valid Connector
- Valid OperationContext (configured for a DELETE operation)
- Parameters:
objectIds
- ids of the objects to be deleted- Returns:
- the response results
-
executeDeleteOperationWithTrackedData
public List<SimpleOperationResult> executeDeleteOperationWithTrackedData(List<SimpleTrackedData> inputs)
Executes a DELETE operation.Prerequisites:
- Valid AtomConfig
- Valid Connector
- Valid OperationContext (configured for a DELETE operation)
- Parameters:
inputs
- the objects to be deleted- Returns:
- the response results
-
testExecuteUpdateOperation
public void testExecuteUpdateOperation(List<InputStream> inputs, List<SimpleOperationResult> expectedResults)
Tests executing a UPDATE operation.Prerequisites:
- Valid AtomConfig
- Valid Connector
- Valid OperationContext (configured for a UPDATE operation)
- Parameters:
inputs
- the objects to be updatedexpectedResults
- the expected output of the operation
-
testExecuteUpdateOperationWithTrackedData
public void testExecuteUpdateOperationWithTrackedData(List<SimpleTrackedData> inputs, List<SimpleOperationResult> expectedResults)
Tests executing a UPDATE operation.Prerequisites:
- Valid AtomConfig
- Valid Connector
- Valid OperationContext (configured for a UPDATE operation)
- Parameters:
inputs
- the objects to be updatedexpectedResults
- the expected output of the operation
-
executeUpdateOperation
public List<SimpleOperationResult> executeUpdateOperation(List<InputStream> inputs)
Executes an UPDATE operation.Prerequisites:
- Valid AtomConfig
- Valid Connector
- Valid OperationContext (configured for a UPDATE operation)
- Parameters:
inputs
- the objects to be updated- Returns:
- the response results
-
executeUpdateOperationWithTrackedData
public List<SimpleOperationResult> executeUpdateOperationWithTrackedData(List<SimpleTrackedData> inputs)
Executes an UPDATE operation.Prerequisites:
- Valid AtomConfig
- Valid Connector
- Valid OperationContext (configured for a UPDATE operation)
- Parameters:
inputs
- the objects to be updated- Returns:
- the response results
-
testExecuteCreateOperation
public void testExecuteCreateOperation(List<InputStream> inputs, List<SimpleOperationResult> expectedResults)
Tests executing a CREATE operation.Prerequisites:
- Valid AtomConfig
- Valid Connector
- Valid OperationContext (configured for a CREATE operation)
- Parameters:
inputs
- the objects to be createdexpectedResults
- the expected output of the operation
-
testExecuteCreateOperationWithTrackedData
public void testExecuteCreateOperationWithTrackedData(List<SimpleTrackedData> inputs, List<SimpleOperationResult> expectedResults)
Tests executing a CREATE operation.Prerequisites:
- Valid AtomConfig
- Valid Connector
- Valid OperationContext (configured for a CREATE operation)
- Parameters:
inputs
- the objects to be createdexpectedResults
- the expected output of the operation
-
executeCreateOperation
public List<SimpleOperationResult> executeCreateOperation(List<InputStream> inputs)
Executes an CREATE operation.Prerequisites:
- Valid AtomConfig
- Valid Connector
- Valid OperationContext (configured for a CREATE operation)
- Parameters:
inputs
- the objects to be created- Returns:
- the response results
-
executeCreateOperationWithTrackedData
public List<SimpleOperationResult> executeCreateOperationWithTrackedData(List<SimpleTrackedData> inputs)
Executes an CREATE operation.Prerequisites:
- Valid AtomConfig
- Valid Connector
- Valid OperationContext (configured for a CREATE operation)
- Parameters:
inputs
- the objects to be created- Returns:
- the response results
-
testExecuteUpsertOperation
public void testExecuteUpsertOperation(List<InputStream> inputs, List<SimpleOperationResult> expectedResults)
Tests executing an UPSERT operation.Prerequisites:
- Valid AtomConfig
- Valid Connector
- Valid OperationContext (configured for a UPSERT operation)
- Parameters:
inputs
- the objects to be upsertedexpectedResults
- the expected output of the operation
-
testExecuteUpsertOperationWithTrackedData
public void testExecuteUpsertOperationWithTrackedData(List<SimpleTrackedData> inputs, List<SimpleOperationResult> expectedResults)
Tests executing an UPSERT operation.Prerequisites:
- Valid AtomConfig
- Valid Connector
- Valid OperationContext (configured for a UPSERT operation)
- Parameters:
inputs
- the objects to be upsertedexpectedResults
- the expected output of the operation
-
executeUpsertOperation
public List<SimpleOperationResult> executeUpsertOperation(List<InputStream> inputs)
Executes an UPSERT operation.Prerequisites:
- Valid AtomConfig
- Valid Connector
- Valid OperationContext (configured for a UPSERT operation)
- Parameters:
inputs
- the objects to be upserted- Returns:
- the response results
-
executeUpsertOperationWithTrackedData
public List<SimpleOperationResult> executeUpsertOperationWithTrackedData(List<SimpleTrackedData> inputs)
Executes an UPSERT operation.Prerequisites:
- Valid AtomConfig
- Valid Connector
- Valid OperationContext (configured for a UPSERT operation)
- Parameters:
inputs
- the objects to be upserted- Returns:
- the response results
-
testExecuteExecuteOperation
public void testExecuteExecuteOperation(List<InputStream> inputs, List<SimpleOperationResult> expectedResults)
Tests executing an EXECUTE operation.Prerequisites:
- Valid AtomConfig
- Valid Connector
- Valid OperationContext (configured for a EXECUTE operation)
- Parameters:
inputs
- the objects to be executeedexpectedResults
- the expected output of the operation
-
executeExecuteOperation
public List<SimpleOperationResult> executeExecuteOperation(List<InputStream> inputs)
Executes an EXECUTE operation.Prerequisites:
- Valid AtomConfig
- Valid Connector
- Valid OperationContext (configured for a EXECUTE operation)
- Parameters:
inputs
- the objects to be executed- Returns:
- the response results
-
executeExecuteOperationWithTrackedData
public List<SimpleOperationResult> executeExecuteOperationWithTrackedData(List<SimpleTrackedData> inputs)
Executes an EXECUTE operation.Prerequisites:
- Valid AtomConfig
- Valid Connector
- Valid OperationContext (configured for a EXECUTE operation)
- Parameters:
inputs
- the objects to be executed- Returns:
- the response results
-
testExecuteOperation
public void testExecuteOperation(OperationRequest request, SimpleOperationResponse response, OperationType expectedType, List<SimpleOperationResult> expectedResults)
Tests executing an operation.Prerequisites:
- Valid AtomConfig
- Valid Connector
- Valid OperationContext (configured for a UPSERT operation)
- Parameters:
request
- required request informationresponse
- response trackerexpectedType
- the expected type of the operation being executedexpectedResults
- the expected output of the operation
-
executeOperation
public List<SimpleOperationResult> executeOperation(OperationRequest request, SimpleOperationResponse response, OperationType expectedType)
Executes an operation.Prerequisites:
- Valid AtomConfig
- Valid Connector
- Valid OperationContext (configured for a UPSERT operation)
- Parameters:
request
- required request informationresponse
- response trackerexpectedType
- the expected type of the operation being executed- Returns:
- the response results
-
-