Class 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 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 operations
        maxNumObjects - maximum number of objects that can be returned from a browsing request
        maxCookieLength - 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("*******");
          
         
        If either of the setConfig() methods is used, a default implementation of AtomProxyConfig with null values will be included and you lose out on the opportunity to set Atom's proxy configuration values. Expectation is to include proxy configuration values in every AtomConfig instance.
        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 requested
        connProps - the connection properties for the browse request, may be null
        opProps - the operation properties for the browse request, may be null
      • 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 executed
        connProps - the connection properties for the operation execution, may be null
        opProps - the operation properties for the operation execution, may be null
        objectTypeId - the type of the object on which the operation is being executed
        cookies - any cookies from the ObjectDefinition for the relevant object type, may be null
      • 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 profiles
        expectedDefDoc - 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 retrieve
        expectedResults - 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 retrieve
        expectedResults - 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 request
        expectedResults - 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 input
        expectedResults - 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 deleted
        expectedResults - 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 deleted
        expectedResults - 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 updated
        expectedResults - 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 updated
        expectedResults - 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 created
        expectedResults - 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 created
        expectedResults - 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 upserted
        expectedResults - 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 upserted
        expectedResults - 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 executeed
        expectedResults - 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 information
        response - response tracker
        expectedType - the expected type of the operation being executed
        expectedResults - 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 information
        response - response tracker
        expectedType - the expected type of the operation being executed
        Returns:
        the response results