Class ConnectorHelper

java.lang.Object
org.identityconnectors.contract.test.ConnectorHelper

public class ConnectorHelper extends Object
Class holding various helper methods used by contract test suite
Author:
Dan Vernon, Tomas Knappek, Zdenek Louzensky
  • Constructor Details

    • ConnectorHelper

      public ConnectorHelper()
  • Method Details

    • createDataProvider

      public static DataProvider createDataProvider()
    • getConfigurationProperties

      public static ConfigurationProperties getConfigurationProperties(DataProvider dataProvider)
      Gets ConfigurationProperties for the connector
      Parameters:
      dataProvider -
      Returns:
    • createConnectorFacadeWithWrongConfiguration

      public static ConnectorFacade createConnectorFacadeWithWrongConfiguration(DataProvider dataProvider, Map<?,?> wrongPropertyMap)
      Creates connector facade with wrong configuration.
      Parameters:
      wrongPropertyMap - wrong configuration
    • createConnectorFacade

      public static ConnectorFacade createConnectorFacade(DataProvider dataProvider)
      Creates connector facade, initializes connector configuration from dataProvider and validates configuration and/or tests connection.
    • search

      public static List<ConnectorObject> search(ConnectorFacade connectorFacade, ObjectClass objClass, Filter filter, OperationOptions opOptions)
      Performs search on connector facade with specified object class, filter and operation options.
      Returns:
      list of found objects.
    • search2Map

      public static Map<Uid,ConnectorObject> search2Map(ConnectorFacade connectorFacade, ObjectClass objClass, Filter filter, OperationOptions opOptions)
      Performs search on connector facade with specified object class, filter and operation options.
      Returns:
      Map of Uids to ConnectorObjects that were found.
    • livesync

      public static List<LiveSyncDelta> livesync(ConnectorFacade connectorFacade, ObjectClass objClass, OperationOptions opOptions)
      Performs livesync on connector facade.
    • sync

      public static List<SyncDelta> sync(ConnectorFacade connectorFacade, ObjectClass objClass, SyncToken token, OperationOptions opOptions)
      Performs sync on connector facade.
    • deleteObject

      public static boolean deleteObject(ConnectorFacade connectorFacade, ObjectClass objClass, Uid uid, boolean failOnError, OperationOptions opOptions)
      Performs deletion of object specified by uid. Fails in case failOnError is true and object wasn't deleted during delete call.
    • checkObject

      public static boolean checkObject(ObjectClassInfo objectClassInfo, ConnectorObject connectorObj, Set<Attribute> requestedAttributes)
      Checks if object has expected attributes and values. All readable or non-special attributes are checked.
    • checkObject

      public static boolean checkObject(ObjectClassInfo objectClassInfo, ConnectorObject connectorObj, Set<Attribute> requestedAttributes, boolean checkNotReturnedByDefault)
      Checks if object has expected attributes and values. All readable or non-special attributes are checked.
      Parameters:
      checkNotReturnedByDefault - if true then also attributes not returned by default are checked
    • checkObjectByAttrDelta

      public static boolean checkObjectByAttrDelta(ObjectClassInfo objectClassInfo, ConnectorObject connectorObj, Set<AttributeDelta> requestedAttributesDelta)
      Checks if object has expected attributesDelta and values. All readable or non-special attributesDelta are checked.
    • checkObjectByAttrDelta

      public static boolean checkObjectByAttrDelta(ObjectClassInfo objectClassInfo, ConnectorObject connectorObj, Set<AttributeDelta> requestedAttributesDelta, boolean checkNotReturnedByDefault)
      Checks if object has expected attributesDelta and values. All readable or non-special attributes are checked.
      Parameters:
      checkNotReturnedByDefault - if true then also attributes not returned by default are checked
    • checkLiveSyncDelta

      public static void checkLiveSyncDelta(ObjectClassInfo ocInfo, LiveSyncDelta delta, Uid uid, Set<Attribute> attributes, boolean checkNotReturnedByDefault)
      Check that passed SyncDelta has expected values.
    • checkSyncDelta

      public static void checkSyncDelta(ObjectClassInfo ocInfo, SyncDelta delta, Uid uid, Set<Attribute> attributes, SyncDeltaType deltaType, boolean checkNotReturnedByDefault)
      Check that passed SyncDelta has expected values.
    • isReadable

      public static boolean isReadable(ObjectClassInfo objectClassInfo, Attribute attribute)
      Whether is attribute readable.
    • isRequired

      public static boolean isRequired(ObjectClassInfo objectClassInfo, Attribute attribute)
      Whether is attribute required.
    • isCreateable

      public static boolean isCreateable(ObjectClassInfo objectClassInfo, Attribute attribute)
      Whether is attribute Createable.
    • isUpdateable

      public static boolean isUpdateable(ObjectClassInfo objectClassInfo, Attribute attribute)
      Whether is attribute readable.
    • isReturnedByDefault

      public static boolean isReturnedByDefault(ObjectClassInfo objectClassInfo, Attribute attribute)
      Whether is attribute returnedByDefault.
    • isMultiValue

      public static boolean isMultiValue(ObjectClassInfo objectClassInfo, String attribute)
      Whether is attribute multiValue.
    • isCRU

      public static boolean isCRU(ObjectClassInfo oinfo, String attribute)
      Whether is attribute creatable, updateable and readable.
    • isReadable

      public static boolean isReadable(ObjectClassInfo oinfo, String attribute)
      Whether is attribute readable.
    • isAttrSupported

      public static boolean isAttrSupported(ObjectClassInfo oinfo, String attribute)
      Whether is attribute supported.
    • getUpdateableAttributes

      public static Set<Attribute> getUpdateableAttributes(DataProvider dataProvider, ObjectClassInfo objectClassInfo, String testName, String qualifier, int sequenceNumber, boolean checkRequired, boolean onlyMultiValue)
      Get updateable attributes' values. Generate new values for updateable attributes based on contract test properties prefixed by qualifier
      Parameters:
      qualifier - the prefix for values used in update.
    • getUpdateableAttributesDelta

      public static Set<AttributeDelta> getUpdateableAttributesDelta(DataProvider dataProvider, ObjectClassInfo objectClassInfo, String testName, String qualifier, int sequenceNumber, boolean checkRequired, boolean isMultiValue, boolean isAddOrRemoveValues)
      Get updateable attributes' values. Generate new values for updateable attributes based on contract test properties prefixed by qualifier
      Parameters:
      qualifier - the prefix for values used in update.
    • getCreateableAttributes

      public static Set<Attribute> getCreateableAttributes(DataProvider dataProvider, ObjectClassInfo objectClassInfo, String testName, int sequenceNumber, boolean checkRequired, boolean onlyMultiValue)
      Get createable attributes' values.
    • getReadableAttributesNames

      public static Set<String> getReadableAttributesNames(ObjectClassInfo ocInfo)
      Returns set of attributes' names which are readable.
    • getAttributes

      public static Set<Attribute> getAttributes(DataProvider dataProvider, ObjectClassInfo objectClassInfo, String testName, String qualifier, int sequenceNumber, boolean checkRequired, boolean onlyMultiValue, boolean onlyCreateable, boolean onlyUpdateable) throws ObjectNotFoundException
      get attribute values (concatenates the qualifier with the name)
      Parameters:
      dataProvider -
      objectClassInfo -
      testName -
      qualifier -
      sequenceNumber -
      checkRequired -
      Returns:
      Throws:
      ObjectNotFoundException
    • getAttributesDelta

      public static Set<AttributeDelta> getAttributesDelta(DataProvider dataProvider, ObjectClassInfo objectClassInfo, String testName, String qualifier, int sequenceNumber, boolean checkRequired, boolean isMultiValue, boolean isAddValues, boolean onlyCreateable, boolean onlyUpdateable) throws ObjectNotFoundException
      Get attributeDelta values (concatenates the qualifier with the name).
      Parameters:
      dataProvider -
      objectClassInfo -
      testName -
      qualifier -
      sequenceNumber -
      checkRequired -
      Returns:
      Throws:
      ObjectNotFoundException
    • createObject

      public static Uid createObject(ConnectorFacade connectorFacade, DataProvider dataProvider, ObjectClassInfo objectClassInfo, String testName, String qualifier, int sequenceNumber, OperationOptions opOptions) throws ObjectNotFoundException
      gets the attributes for you, appending the qualifier to the attribute name
      Parameters:
      connectorFacade -
      dataProvider -
      objectClassInfo -
      testName -
      qualifier -
      sequenceNumber -
      Returns:
      Throws:
      ObjectNotFoundException
    • createObject

      public static Uid createObject(ConnectorFacade connectorFacade, DataProvider dataProvider, ObjectClassInfo objectClassInfo, String testName, int sequenceNumber, OperationOptions opOptions) throws ObjectNotFoundException
      gets the attributes for you
      Parameters:
      connectorFacade -
      dataProvider -
      objectClassInfo -
      testName -
      sequenceNumber -
      Returns:
      Throws:
      ObjectNotFoundException
    • operationSupported

      public static boolean operationSupported(ConnectorFacade connectorFacade, ObjectClass oClass, Class<? extends APIOperation> operation)
      check to see if a particular objectclass supports a particular operation
      Parameters:
      connectorFacade -
      oClass -
      operation -
      Returns:
    • operationSupported

      public static boolean operationSupported(ConnectorFacade connectorFacade, ObjectClass oClass, Class<? extends APIOperation> operation1, Class<? extends APIOperation> operation2)
      check to see if a particular objectclass supports a particular operations
      Parameters:
      connectorFacade -
      oClass -
      operation1 -
      operation2 -
      Returns:
    • operationsSupported

      public static boolean operationsSupported(ConnectorFacade connectorFacade, ObjectClass oClass, Set<Class<? extends APIOperation>> operations)
      check to see if a particular objectclass supports a particular operations To succeed all the operations must be supported.
      Parameters:
      connectorFacade -
      oClass -
      operations -
      Returns:
    • operationSupported

      public static boolean operationSupported(ConnectorFacade connectorFacade, Class<? extends APIOperation> operation)
      check to see if ANY objectclass supports a particular operation
      Parameters:
      connectorFacade -
      operation -
      Returns:
    • operationSupported

      public static boolean operationSupported(ConnectorFacade connectorFacade, Class<? extends APIOperation> operations1, Class<? extends APIOperation> operations2)
      check to see if ANY objectclass supports a particular operation
      Parameters:
      connectorFacade -
      operations1 -
      operations2 -
      Returns:
    • operationsSupported

      public static boolean operationsSupported(ConnectorFacade connectorFacade, Set<Class<? extends APIOperation>> operations)
      check to see if ANY objectclass supports a particular operations
      Parameters:
      connectorFacade -
      operations -
      Returns:
    • getInfoManager

      public static ConnectorInfoManager getInfoManager(DataProvider dataProvider)
      Tries to create remote or local manager. Remote manager is created in case all connectorserver properties are set. If connectorserver properties are missing or remote manager creation fails then tries to create local manager.
    • getDefaultConfigurationProperties

      public static APIConfiguration getDefaultConfigurationProperties(DataProvider dataProvider, ConnectorInfoManager manager) throws ObjectNotFoundException
      Throws:
      ObjectNotFoundException
    • getString

      public static String getString(DataProvider dataProvider, String componentName, String name, String objectClassName) throws ObjectNotFoundException
      no sequence number or qualifier, appends objectclass to name
      Parameters:
      dataProvider -
      componentName -
      name -
      objectClassName -
      Returns:
      Throws:
      ObjectNotFoundException
    • get

      public static Object get(DataProvider dataProvider, String componentName, Class<?> dataTypeName, String name, String objectClassName, int sequenceNumber, boolean isMultivalue) throws ObjectNotFoundException
      Throws:
      ObjectNotFoundException
    • get

      public static Object get(DataProvider dataProvider, String componentName, Class<?> dataTypeName, String name, String qualifier, String objectClassName, int sequenceNumber, boolean isMultivalue) throws ObjectNotFoundException
      Throws:
      ObjectNotFoundException
    • getObjectClassFromObjectClassInfo

      public static ObjectClass getObjectClassFromObjectClassInfo(ObjectClassInfo objectClassInfo)
      Returns object class based on object class info.