public class MockUtil extends Object
Caution: This class is not thread-safe.
Upon construction, this class automatically loads test systems and credentials from resource files
TEST_SYSTEMS_RESOURCE_FILE
and CREDENTIALS_RESOURCE_FILE
(appending the file extensions defined by
CONFIG_FILE_EXTENSIONS
). For examples of such files, refer to loadTestSystems(File)
and
loadCredentials(File)
.
In addition, test systems and credentials are read from Java system properties PROPERTY_TEST_SYSTEMS
and
PROPERTY_CREDENTIALS
. Both properties can be used to specify either the path to or the direct content of a
configuration file. For example, these can be specified via
mvn clean install -Dtest.systems="..." -Dtest.credentials="..."
where "..."
corresponds to
either the path to a configuration file or the content of such a file.
When specifying paths to test systems and credentials files, the file extension can be omitted (e.g.,
test/resources/systems
). In this case, this class will scan for the existence of the following files:
test/resources/systems.json
test/resources/systems.yaml
test/resources/systems.yml
Note that the order is arbitrary here since, if more than one matching file is found, an exception is thrown demanding to specify exactly one file. If test systems or credentials are specified as Java system properties while configuration files exist simultaneously within the the test resources folder, only Java system properties are loaded, thereby overriding configuration from files in the test resources folder.
Constructor and Description |
---|
MockUtil()
Instantiates a new instance of
MockUtil , invalidates caches. |
Modifier and Type | Method and Description |
---|---|
void |
addCredentials(String systemAlias,
Credentials credentials)
Registers the given
Credentials to enable retrieval by its alias. |
void |
addDefaultErpSystem(ErpSystem erpSystem)
Adds and sets the default ERP system.
|
void |
addTestSystem(TestSystem<?> testSystem)
Registers the given
TestSystem to enable retrieval by its alias. |
void |
clearCredentials()
Clears all
Credentials . |
void |
clearDestinations()
Clears all previously mocked
Destination s. |
void |
clearKeyStores()
Clears all previously mocked
KeyStore s. |
void |
clearPrincipals()
Clears all previously mocked
Principal s. |
void |
clearSecretStores()
Clears all previously mocked
SecretStore s. |
void |
clearTenants()
Clears all previously mocked
Tenant s. |
void |
clearTestSystems()
Clears all
TestSystem s. |
Credentials |
getCredentials(String systemAlias)
Returns the credentials for the given alias.
|
Credentials |
getCredentials(TestSystem<?> testSystem) |
ErpSystem |
getErpSystem() |
ErpSystem |
getErpSystem(String systemAlias) |
TestSystem<?> |
getTestSystem(String systemAlias)
Returns the
TestSystem for the given alias. |
void |
loadCredentials(File file)
Loads credential configuration from the resource file with the given name.
|
void |
loadCredentials(String resourceFileName)
Delegates to
loadCredentials(File) and loads credential configuration from the resource file with the
given name. |
void |
loadTestSystems(File file)
Loads test system configuration from the given file.
|
void |
loadTestSystems(String resourceFileName)
Delegates to
loadTestSystems(File) and loads test system configuration from the resource file with the
given name. |
AuditLog |
mockAuditLog()
Mocks the
AuditLog , redirecting to DefaultLoggerAuditLog within tests. |
AuditLog |
mockAuditLog(AuditLog delegate)
|
CloudPlatform |
mockCurrentCloudPlatform()
Mocks the current
CloudPlatform using application name MOCKED_CLOUD_APP_NAME . |
CloudPlatform |
mockCurrentCloudPlatform(String applicationName)
Mocks the current
CloudPlatform using the given application name. |
void |
mockCurrentLocales()
|
void |
mockCurrentLocales(Locale currentLocale,
Locale... additionalLocales)
Mocks the current
Locale s with the given values. |
Principal |
mockCurrentPrincipal()
Mocks the current
Principal with principal identifier MOCKED_PRINCIPAL . |
Principal |
mockCurrentPrincipal(String principalId)
Mocks the current
Principal with the given identifier. |
Principal |
mockCurrentPrincipal(String principalId,
Collection<Authorization> authorizations,
Map<String,PrincipalAttribute> attributes)
Mocks the current
Principal . |
Tenant |
mockCurrentTenant()
Mocks the current
Tenant with tenant identifier MOCKED_TENANT . |
Tenant |
mockCurrentTenant(String tenantId)
Mocks a
Tenant with the given identifier. |
void |
mockDefaults()
Mocks common defaults for testing, in particular:
facades that are used to realize Cloud platform abstractions,
the current
CloudPlatform ,
the current Locale ,
the current Tenant ,
the current Principal
This method should be called as the first method of MockUtil in the test setup method annotated with
@BeforeClass . |
Destination |
mockDestination(DestinationType destinationType,
String destinationName,
Map<String,String> propertiesByName)
Mocks an
Destination for the given parameters. |
Destination |
mockDestination(MockDestination destination)
Mocks a destination based on the given
MockDestination . |
Destination |
mockDestination(String name,
String systemAlias)
Mocks a destination with a given name to the given system with the registered credentials.
|
Destination |
mockDestination(String name,
TestSystem<?> testSystem)
Mocks a destination with a given name to the given
TestSystem with the registered credentials. |
Destination |
mockDestination(String name,
URI uri)
Mocks a destination with a given name to redirect to the given
URI with no authentication. |
Destination |
mockDestination(String name,
URI uri,
AuthenticationType authenticationType,
Credentials credentials,
ProxyType proxyType,
ProxyConfiguration proxyConfiguration,
List<Header> headers,
KeyStore trustStore,
String trustStorePassword,
Boolean isTrustingAllCertificates,
KeyStore keyStore,
String keyStorePassword,
Map<String,String> propertiesByName)
Mocks a destination based on the given parameters.
|
Destination |
mockDestination(String name,
URI uri,
Credentials credentials)
Mocks a destination with a given name to redirect to the given
URI with the given Credentials . |
Destination |
mockDestination(String name,
URI uri,
Credentials credentials,
ProxyConfiguration proxyConfiguration)
Mocks a destination with a given name to redirect to the given
URI with the given Credentials . |
Destination |
mockErpDestination(MockErpDestination destination)
Mocks an ERP
Destination for the given MockErpDestination . |
Destination |
mockErpDestination(String destinationName,
ErpSystem erpSystem)
Mocks an ERP
Destination by redirecting to an actual ERP system for the given destination name. |
Destination |
mockErpDestination(String destinationName,
ErpSystem erpSystem,
Credentials credentials)
|
Destination |
mockErpDestination(String destinationName,
ErpSystem erpSystem,
Credentials credentials,
AuthenticationType authenticationType,
ProxyType proxyType,
ProxyConfiguration proxyConfiguration,
List<Header> headers,
KeyStore trustStore,
String trustStorePassword,
Boolean isTrustingAllCertificates,
KeyStore keyStore,
String keyStorePassword,
Map<String,String> propertiesByName)
Mocks an ERP
Destination for the given parameters. |
Destination |
mockErpDestination(String destinationName,
String systemAlias)
Mocks an ERP
Destination by redirecting to an actual ERP system for the given destination name. |
com.github.tomakehurst.wiremock.junit.WireMockRule |
mockErpServer(String destinationName)
Mocks an ERP destination and starts a mock server pointing all calls against the ERP destination towards the mock
server instance.
|
com.github.tomakehurst.wiremock.junit.WireMockRule |
mockErpServer(String destinationName,
SapClient sapClient)
Mocks an ERP destination and starts a mock server pointing all calls against the ERP destination towards the mock
server instance.
|
com.github.tomakehurst.wiremock.junit.WireMockRule |
mockErpServer(String destinationName,
SapClient sapClient,
String relativePath)
Mocks an ERP destination and starts a mock server pointing all calls against the ERP destination towards the mock
server instance.
|
com.github.tomakehurst.wiremock.junit.WireMockRule |
mockErpServer(String destinationName,
SapClient sapClient,
String relativePath,
com.github.tomakehurst.wiremock.core.WireMockConfiguration configuration)
Mocks an ERP destination and starts a mock server pointing all calls against the ERP destination towards the mock
server instance.
|
<T> T |
mockJndiLookup(Class<T> cls,
String name)
Mocks a JNDI lookup.
|
void |
mockJndiLookup(Object obj,
String name)
Mocks a JNDI lookup.
|
void |
mockKeyStore(String name,
SecretStore password,
KeyStore keyStore)
Mocks a
KeyStore for a given instance. |
KeyStore |
mockKeyStore(String name,
SecretStore password,
String keyStoreFileName,
String keyStoreType)
Mocks a
KeyStore from a key store resource file. |
void |
mockKeyStore(String name,
String password,
KeyStore keyStore)
Mocks a
KeyStore for a given instance. |
KeyStore |
mockKeyStore(String name,
String password,
String keyStoreFileName,
String keyStoreType)
Mocks a
KeyStore from a key store resource file. |
Principal |
mockPrincipal(String principalId)
Mocks a
Principal with the given name. |
Principal |
mockPrincipal(String principalId,
Collection<Authorization> authorizations,
Map<String,PrincipalAttribute> attributes)
Mocks a
Principal . |
Destination |
mockRfcDestination(MockRfcDestination destination)
Mocks an
Destination for the given MockRfcDestination . |
Destination |
mockRfcDestination(String destinationName,
ErpSystem erpSystem)
Mocks an
Destination by redirecting to an actual ERP system for the given destination name. |
Destination |
mockRfcDestination(String destinationName,
ErpSystem erpSystem,
Credentials credentials)
|
Destination |
mockRfcDestination(String destinationName,
ErpSystem erpSystem,
Credentials credentials,
Map<String,String> propertiesByName)
Mocks an
Destination for the given parameters. |
Destination |
mockRfcDestination(String destinationName,
String systemAlias)
Mocks an
Destination by redirecting to an actual ERP system for the given destination name. |
void |
mockSecretStore(String name,
SecretStore secretStore)
Mocks a
SecretStore for a given instance. |
SecretStore |
mockSecretStore(String name,
String password)
Mocks a
SecretStore for a given password. |
com.github.tomakehurst.wiremock.junit.WireMockRule |
mockServer(String destinationName)
Mocks a destination and starts a mock server pointing all calls against the destination towards the mock server
instance.
|
com.github.tomakehurst.wiremock.junit.WireMockRule |
mockServer(String destinationName,
String relativePath)
Mocks a destination and starts a mock server pointing all calls against the destination towards the mock server
instance.
|
com.github.tomakehurst.wiremock.junit.WireMockRule |
mockServer(String destinationName,
String relativePath,
com.github.tomakehurst.wiremock.core.WireMockConfiguration configuration)
Mocks a destination and starts a mock server pointing all calls against the destination towards the mock server
instance.
|
Tenant |
mockTenant(String tenantId)
Mocks a
Tenant with the given identifier. |
void |
removeCredentials(String systemAlias)
Unregisters the
Credentials for the given alias. |
void |
removeTestSystem(String systemAlias)
Unregisters the
TestSystem for the given alias. |
void |
removeTestSystem(TestSystem<?> testSystem)
Unregisters the given
TestSystem . |
void |
setCurrentPrincipal(String principalId)
Sets the current
Principal . |
void |
setCurrentTenant(String tenantId)
Sets the current
Tenant . |
MockUtil |
withProxy(ProxyConfiguration proxyConfiguration) |
public MockUtil()
MockUtil
, invalidates caches.
Note: To avoid potential side effects, only one instance of MockUtil should exist within a test class. It is
therefore recommended to maintain an instance of this class as a static member of the test class. Example usage:
private static final MockUtil mockUtil = new MockUtil();
@BeforeClass
public static void beforeClass()
{
mockUtil.mockDefaults();
}
@Nonnull public MockUtil withProxy(@Nullable ProxyConfiguration proxyConfiguration)
public void mockDefaults()
CloudPlatform
,Locale
,Tenant
,Principal
MockUtil
in the test setup method annotated with
@BeforeClass
.public void mockJndiLookup(Object obj, String name)
obj
- Object to be returned by the lookup.name
- Name that is used for the lookup.public <T> T mockJndiLookup(Class<T> cls, String name)
cls
- Class to be mocked.name
- Name that is used for the lookup.public void mockCurrentLocales()
public void mockCurrentLocales(Locale currentLocale, Locale... additionalLocales)
Locale
s with the given values.public AuditLog mockAuditLog()
AuditLog
, redirecting to DefaultLoggerAuditLog within tests.AuditLog
.public CloudPlatform mockCurrentCloudPlatform()
CloudPlatform
using application name MOCKED_CLOUD_APP_NAME
.public CloudPlatform mockCurrentCloudPlatform(String applicationName)
CloudPlatform
using the given application name.public void loadTestSystems(String resourceFileName)
loadTestSystems(File)
and loads test system configuration from the resource file with the
given name. The file is assumed to be in JSON format and expected to be located in src/test/resources/
.resourceFileName
- The name of the file to be loaded from the resources folder.public void loadTestSystems(File file)
"alias"
field must be unique.
Note: Configuration specified as Java system properties always overrides configuration loaded from files.
Example (YAML):
---
systems:
- alias: "ANY_SYSTEM"
uri: "https://any-system.com"
proxy: "http://my-proxy:8080"
erp:
default: "ERP_001"
systems:
- alias: "ERP_001"
uri: "https://my-erp.com"
systemId: "ERP" # optional, defaults to ""
sapClient: "001" # optional, defaults to default SAP client
locale: "en" # optional, defaults to English (US)
erpEdition: "cloud" # optional, defaults to "cloud"
proxy: "http://my-proxy:8080" # optional
applicationServer: "my-erp.com" # optional, defaults to URI host
instanceNumber: "00" # optional, defaults to "00"
Example (JSON):
{
"systems": [
{
"alias": "ANY_SYSTEM",
"uri": "https://any-system.com",
"proxy": "http://my-proxy:8080"
}
],
"erp": {
"default": "ERP_001",
"systems": [
{
"alias": "ERP_001",
"systemId": "ERP",
"sapClient": "001",
"locale": "en-US",
"erpEdition": "cloud",
"uri": "https://my-erp.com",
"proxy": "http://my-proxy:8080",
"applicationServer": "my-erp.com",
"instanceNumber": "00"
}
]
}
}
file
- The file to be loaded.public void addTestSystem(TestSystem<?> testSystem)
TestSystem
to enable retrieval by its alias. Replaces TestSystem
s that may
already exist for the given alias.public void removeTestSystem(TestSystem<?> testSystem)
TestSystem
.public void removeTestSystem(String systemAlias)
TestSystem
for the given alias.public TestSystem<?> getTestSystem(String systemAlias)
TestSystem
for the given alias. By default, TestSystem
s are loaded from the system
property PROPERTY_TEST_SYSTEMS
and the test resource file
TEST_SYSTEMS_RESOURCE_FILE
(with extension .json/.yml for JSON/YAML format). For registering
additional TestSystem
s, use loadTestSystems(String)
or addTestSystem(TestSystem)
.public void addDefaultErpSystem(ErpSystem erpSystem)
public ErpSystem getErpSystem()
public ErpSystem getErpSystem(String systemAlias)
ErpSystem
for the given alias. Delegates to getTestSystem(String)
.public void clearTestSystems()
TestSystem
s.public Credentials getCredentials(TestSystem<?> testSystem)
TestSystem
. Delegates to getCredentials(String)
.public Credentials getCredentials(String systemAlias)
Credentials
are loaded from the Java system
property PROPERTY_CREDENTIALS
and the test resource file
CREDENTIALS_RESOURCE_FILE
. For registering additional Credentials
, use
loadCredentials(String)
or addCredentials(String, Credentials)
.public void loadCredentials(String resourceFileName)
loadCredentials(File)
and loads credential configuration from the resource file with the
given name. The file is assumed to be in JSON format and expected to be located in /src/test/resources/
.resourceFileName
- The name of the file to be loaded from the resources folder.public void loadCredentials(File file)
Note: Configuration specified as Java system properties always overrides configuration loaded from files.
Example (YAML):
---
credentials:
- alias: "ABC_001"
username: "(username)"
password: "(password)"
Example (JSON):
{
"credentials": [
{
"alias": "ABC_001",
"username": "(username)",
"password": "(password)"
}
]
}
file
- The file to be loaded.public void addCredentials(String systemAlias, Credentials credentials)
Credentials
to enable retrieval by its alias. Replaces Credentials
that may
already exist for the given alias.public void removeCredentials(String systemAlias)
Credentials
for the given alias.public void clearCredentials()
Credentials
.public Tenant mockCurrentTenant()
Tenant
with tenant identifier MOCKED_TENANT
.public Tenant mockCurrentTenant(String tenantId)
Tenant
with the given identifier.public void setCurrentTenant(String tenantId)
public void clearTenants()
Tenant
s.public Principal mockPrincipal(String principalId)
Principal
with the given name.public Principal mockPrincipal(String principalId, Collection<Authorization> authorizations, Map<String,PrincipalAttribute> attributes)
Principal
.principalId
- Identifier of the principal.authorizations
- Optional authorizations of the principal.attributes
- Optional attributes of the principal.public Principal mockCurrentPrincipal()
Principal
with principal identifier MOCKED_PRINCIPAL
.public Principal mockCurrentPrincipal(String principalId)
Principal
with the given identifier.public Principal mockCurrentPrincipal(String principalId, Collection<Authorization> authorizations, Map<String,PrincipalAttribute> attributes)
Principal
.principalId
- Identifier of the principal.authorizations
- Optional authorizations of the principal.attributes
- Optional attributes of the principal.public void setCurrentPrincipal(String principalId)
public void clearPrincipals()
Principal
s.public void mockSecretStore(String name, SecretStore secretStore)
SecretStore
for a given instance.name
- The name of the SecretStore
.secretStore
- The instance of SecretStore
.public SecretStore mockSecretStore(String name, String password)
SecretStore
for a given password.name
- The name of the SecretStore
.password
- The password of the SecretStore
.public void mockKeyStore(String name, SecretStore password, KeyStore keyStore)
KeyStore
for a given instance.name
- The name of the KeyStore
.password
- The password of the KeyStore
as SecretStore
.keyStore
- The instance of KeyStore
.public void mockKeyStore(String name, String password, KeyStore keyStore)
KeyStore
for a given instance.public KeyStore mockKeyStore(String name, SecretStore password, String keyStoreFileName, String keyStoreType)
KeyStore
from a key store resource file.name
- The name of the KeyStore
.password
- The password of the KeyStore
as SecretStore
.keyStoreFileName
- The file name pointing to the KeyStore
to be loaded.keyStoreType
- The type of the KeyStore
to be loaded.public KeyStore mockKeyStore(String name, String password, String keyStoreFileName, String keyStoreType)
KeyStore
from a key store resource file.public void clearSecretStores()
SecretStore
s.public void clearKeyStores()
KeyStore
s.public com.github.tomakehurst.wiremock.junit.WireMockRule mockServer(String destinationName, String relativePath, com.github.tomakehurst.wiremock.core.WireMockConfiguration configuration)
destinationName
- The name of the destination to be mocked.relativePath
- An optional relative path to be appended to the ERP URI.configuration
- An optional configuration to customize mock server runtime.public com.github.tomakehurst.wiremock.junit.WireMockRule mockServer(String destinationName, String relativePath)
destinationName
- The name of the destination to be mocked.relativePath
- An optional relative path to be appended to the ERP URI.public com.github.tomakehurst.wiremock.junit.WireMockRule mockServer(String destinationName)
destinationName
- The name of the destination to be mocked.public com.github.tomakehurst.wiremock.junit.WireMockRule mockErpServer(String destinationName, SapClient sapClient, String relativePath, com.github.tomakehurst.wiremock.core.WireMockConfiguration configuration)
destinationName
- The name of the destination to be mocked.sapClient
- The SapClient
to be set as a destination property of the mocked destination. If null
,
SapClient.DEFAULT
is used.relativePath
- An optional relative path to be appended to the ERP URI.configuration
- An optional configuration to customize mock server runtime.public com.github.tomakehurst.wiremock.junit.WireMockRule mockErpServer(String destinationName, SapClient sapClient, String relativePath)
destinationName
- The name of the destination to be mocked.sapClient
- The SapClient
to be set as a destination property of the mocked destination. If null
,
SapClient.DEFAULT
is used.relativePath
- An optional relative path to be appended to the ERP URI.public com.github.tomakehurst.wiremock.junit.WireMockRule mockErpServer(String destinationName, SapClient sapClient)
destinationName
- The name of the destination to be mocked.sapClient
- The SapClient
to be set as a destination property of the mocked destination. If null
,
SapClient.DEFAULT
is used.public com.github.tomakehurst.wiremock.junit.WireMockRule mockErpServer(String destinationName)
destinationName
- The name of the destination to be mocked.public Destination mockDestination(DestinationType destinationType, String destinationName, Map<String,String> propertiesByName)
Destination
for the given parameters.
Note: This invalidates all caches via CacheManager to avoid stale entries.
destinationName
- The name of the mocked destination.propertiesByName
- Properties of the Destination
by their name.public Destination mockDestination(String name, String systemAlias)
Note: This invalidates all caches via CacheManager to avoid stale entries.
public Destination mockDestination(String name, TestSystem<?> testSystem)
TestSystem
with the registered credentials.
Note: This invalidates all caches via CacheManager to avoid stale entries.
public Destination mockDestination(String name, URI uri, AuthenticationType authenticationType, Credentials credentials, ProxyType proxyType, ProxyConfiguration proxyConfiguration, List<Header> headers, KeyStore trustStore, String trustStorePassword, Boolean isTrustingAllCertificates, KeyStore keyStore, String keyStorePassword, Map<String,String> propertiesByName)
Note: This invalidates all caches via CacheManager to avoid stale entries.
public Destination mockErpDestination(String destinationName, String systemAlias)
Destination
by redirecting to an actual ERP system for the given destination name.
Note: This invalidates all caches via CacheManager to avoid stale entries.
destinationName
- The name of the mocked destination.systemAlias
- The alias of the ErpSystem
that should be used. Must not be null
.public Destination mockErpDestination(String destinationName, ErpSystem erpSystem, Credentials credentials, AuthenticationType authenticationType, ProxyType proxyType, ProxyConfiguration proxyConfiguration, List<Header> headers, KeyStore trustStore, String trustStorePassword, Boolean isTrustingAllCertificates, KeyStore keyStore, String keyStorePassword, Map<String,String> propertiesByName)
Destination
for the given parameters.
Note: This invalidates all caches via CacheManager to avoid stale entries.
destinationName
- The name of the mocked destination.erpSystem
- The ErpSystem
to use for mocking. If null
, {getErpSystem()
is used.credentials
- The Credentials
to be used for accessing the system. If null
, they are resolved from
configuration files or explicit registration via addCredentials(String, Credentials)
.
Only adds the respective HTTP header for the given credentials if the header does not yet exist.authenticationType
- The AuthenticationType
to be used.proxyType
- The ProxyType
to be used. If not null
, overrides the ProxyType
inferred from
the ErpSystem
.proxyConfiguration
- The ProxyConfiguration
to be used.headers
- Header
s to be used.trustStore
- The trust store to be used.trustStorePassword
- The trust store password to be used.isTrustingAllCertificates
- Decides whether all certificates are trusted.keyStore
- The KeyStore
to be used.keyStorePassword
- The KeyStore
password to be used.propertiesByName
- Properties of the Destination
by their name. If a property with the respective name is
provided, it will override pre-configured properties such as "sap-client".public Destination mockRfcDestination(String destinationName, String systemAlias)
Destination
by redirecting to an actual ERP system for the given destination name.
Note: This invalidates all caches via CacheManager to avoid stale entries.
destinationName
- The name of the mocked destination.systemAlias
- The alias of the ErpSystem
that should be used. Must not be null
.public Destination mockRfcDestination(String destinationName, ErpSystem erpSystem, Credentials credentials, Map<String,String> propertiesByName)
Destination
for the given parameters.
Note: This invalidates all caches via CacheManager to avoid stale entries.
destinationName
- The name of the mocked destination.erpSystem
- The ErpSystem
to use for mocking. If null
, {getErpSystem()
is used.credentials
- The Credentials
to be used for accessing the system. If null
, they are resolved from
configuration files or explicit registration via addCredentials(String, Credentials)
.propertiesByName
- Properties of the Destination
by their name. If a property with the respective name is
provided, it will override pre-configured properties such as "sap-client".public void clearDestinations()
Destination
s.public Destination mockDestination(String name, URI uri)
URI
with no authentication.
Note: This invalidates all caches via CacheManager to avoid stale entries.
public Destination mockDestination(String name, URI uri, Credentials credentials)
URI
with the given Credentials
.
Note: This invalidates all caches via CacheManager to avoid stale entries.
public Destination mockDestination(String name, URI uri, Credentials credentials, ProxyConfiguration proxyConfiguration)
URI
with the given Credentials
.
Note: This invalidates all caches via CacheManager to avoid stale entries.
public Destination mockDestination(MockDestination destination)
MockDestination
.
Note: This invalidates all caches via CacheManager to avoid stale entries.
public Destination mockErpDestination(String destinationName, ErpSystem erpSystem)
Destination
by redirecting to an actual ERP system for the given destination name.
Note: This invalidates all caches via CacheManager to avoid stale entries.
destinationName
- The name of the mocked destination.erpSystem
- The ErpSystem
to use for mocking. If null
, {getErpSystem()
is used.public Destination mockErpDestination(String destinationName, ErpSystem erpSystem, Credentials credentials)
Destination
for the given destination name, ErpSystem
and Credentials
.
Note: This invalidates all caches via CacheManager to avoid stale entries.
destinationName
- The name of the mocked destination.erpSystem
- The ErpSystem
to use for mocking. If null
, {getErpSystem()
is used.credentials
- The Credentials
to be used for accessing the system. If null
, they are resolved from
configuration files or explicit registration via addCredentials(String, Credentials)
.
Only adds the respective HTTP header for the given credentials if the header does not yet exist.public Destination mockErpDestination(MockErpDestination destination)
Destination
for the given MockErpDestination
.
Note: This invalidates all caches via CacheManager to avoid stale entries.
public Destination mockRfcDestination(String destinationName, ErpSystem erpSystem)
Destination
by redirecting to an actual ERP system for the given destination name.
Note: This invalidates all caches via CacheManager to avoid stale entries.
destinationName
- The name of the mocked destination.erpSystem
- The ErpSystem
to use for mocking. If null
, {getErpSystem()
is used.public Destination mockRfcDestination(String destinationName, ErpSystem erpSystem, Credentials credentials)
Destination
for the given destination name, ErpSystem
and Credentials
.
Note: This invalidates all caches via CacheManager to avoid stale entries.
destinationName
- The name of the mocked destination.erpSystem
- The ErpSystem
to use for mocking. If null
, {getErpSystem()
is used.credentials
- The Credentials
to be used for accessing the system. If null
, they are resolved from
configuration files or explicit registration via addCredentials(String, Credentials)
.public Destination mockRfcDestination(MockRfcDestination destination)
Destination
for the given MockRfcDestination
.
Note: This invalidates all caches via CacheManager to avoid stale entries.
Copyright © 2019 SAP SE. All rights reserved.