public abstract class ConnectorTestContext extends SimpleAtomContext implements OperationContext
OperationContext
implementation for use with the ConnectorTester
junit tests.
All test classes must provide a concrete implementation of this class
Constructor and Description |
---|
ConnectorTestContext()
Creates a new context with the default
SimpleAtomConfig and an instance of the connector specified by the
implementing class |
Modifier and Type | Method and Description |
---|---|
void |
addConnectionProperty(String key,
Object value)
Method to add a connection property to the context
|
void |
addCookie(ObjectDefinitionRole role,
String cookie)
Method to add a cookie to the context
|
void |
addOperationProperty(String key,
Object value)
Method to add an operation property to the context
|
void |
addSelectableField(String field)
Method to add a selectable field to the context
|
void |
addToCache(Object key,
Object value)
Method to add a key/value pair to the connector cache
|
PayloadMetadata |
createMetadata() |
APIVersion |
getAPIVersion()
Get the
APIVersion for the test |
BrowseContext |
getBrowseContext()
Getter for the browse context
|
PropertyMap |
getConnectionProperties()
Returns the relevant connection properties if this connector has the
requireConnectionForBrowse flag
enabled in the connector's descriptor. |
Connector |
getConnector()
Returns the connector instance with which this context is associated.
|
ConcurrentMap<Object,Object> |
getConnectorCache()
Returns the current connector cache.
|
protected abstract Class<? extends Connector> |
getConnectorClass()
This method should return the
Class of the connector under test |
String |
getCustomOperationType()
Returns the custom type of the operation that is currently being configured.
|
String |
getObjectDefinitionCookie(ObjectDefinitionRole role)
Returns an object definition cookie constructed by the object profile retrieval during a browsing request.
|
String |
getObjectTypeId()
Returns the id of the object type for which this operation is being executed.
|
PropertyMap |
getOperationProperties()
Returns any operation properties flagged as
includeInBrowse for the current OperationType in the
connector's descriptor. |
OperationType |
getOperationType()
Returns the currently configured OperationType
|
List<String> |
getSelectedFields()
Returns a field list describing the fields to be retrieved.
|
SSLContext |
getSSLContext(PublicKeyStore publicKeyStore,
PrivateKeyStore privateKeyStore)
TODO CON-601 pull up in 2.1
Returns a
SSLContext . |
boolean |
hasCookie(ObjectDefinitionRole role)
Method to determine if the context contains a cookie for an
ObjectDefinitionRole |
boolean |
isCookieRequired()
This flag indicates whether or not the operation under test requires that a cookie be added to the connector
cache
|
void |
setCookieRequired(boolean cookieRequired)
Setter method for cookie flag
|
void |
setObjectTypeId(String objectTypeId)
Getter for the object type id
|
void |
setOperationCustomType(String customOperationType)
Setter for the operation custom type
|
void |
setOperationType(OperationType operationType)
Setter for the operation type
|
createSSLContext, createTempOutputStream, getConfig, tempOutputStreamToInputStream, tempOutputStreamToPayload
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createTempOutputStream, getConfig, tempOutputStreamToInputStream, tempOutputStreamToPayload
public ConnectorTestContext()
SimpleAtomConfig
and an instance of the connector specified by the
implementing classpublic APIVersion getAPIVersion()
APIVersion
for the testAPIVersion
valuepublic Connector getConnector()
ConnectorContext
getConnector
in interface ConnectorContext
public ConcurrentMap<Object,Object> getConnectorCache()
ConnectorContext
getConnectorCache
in interface ConnectorContext
public OperationType getOperationType()
BrowseContext
getOperationType
in interface BrowseContext
public String getCustomOperationType()
BrowseContext
getCustomOperationType
in interface BrowseContext
public PropertyMap getConnectionProperties()
ConnectorContext
requireConnectionForBrowse
flag
enabled in the connector's descriptor.getConnectionProperties
in interface ConnectorContext
public PropertyMap getOperationProperties()
BrowseContext
includeInBrowse
for the current OperationType in the
connector's descriptor.getOperationProperties
in interface BrowseContext
public String getObjectTypeId()
OperationContext
getObjectTypeId
in interface OperationContext
public String getObjectDefinitionCookie(ObjectDefinitionRole role)
OperationContext
getObjectDefinitionCookie
in interface OperationContext
role
- the role identifying the profile for which the profile is desirednull
if no cookie was stored for the profilepublic List<String> getSelectedFields()
OperationContext
null
, indicating that all fields
should be retrievedgetSelectedFields
in interface OperationContext
public PayloadMetadata createMetadata()
createMetadata
in interface PayloadMetadataFactory
public SSLContext getSSLContext(PublicKeyStore publicKeyStore, PrivateKeyStore privateKeyStore) throws GeneralSecurityException
BrowseContext
SSLContext
. Passing null
for public and private key stores will make an attempt to
configure it to use trusted JVM and deployed atom certificates if called during an operation execution.getSSLContext
in interface BrowseContext
GeneralSecurityException
public BrowseContext getBrowseContext()
public void setOperationType(OperationType operationType)
operationType
- the operationType to setpublic void setOperationCustomType(String customOperationType)
customOperationType
- the custom operation id to setpublic void setObjectTypeId(String objectTypeId)
objectTypeId
- the objectTypeId to setpublic boolean hasCookie(ObjectDefinitionRole role)
ObjectDefinitionRole
role
- the role to verifypublic void addCookie(ObjectDefinitionRole role, String cookie)
role
- ObjectDefinitionRole
associated to the cookiecookie
- the cookiepublic void addToCache(Object key, Object value)
key
- the key for the entryvalue
- the value for the entrypublic void addConnectionProperty(String key, Object value)
key
- the key for the propertyvalue
- the value for the propertypublic void addOperationProperty(String key, Object value)
key
- the key for the propertyvalue
- the value for the propertypublic void addSelectableField(String field)
field
- the name of the fieldpublic boolean isCookieRequired()
public void setCookieRequired(boolean cookieRequired)
cookieRequired
- the cookieRequired to set