public class ElementTestUtils extends Object
Constructor and Description |
---|
ElementTestUtils() |
Modifier and Type | Method and Description |
---|---|
static XMessageContext |
getBasicMessageContext(org.springframework.context.ApplicationContext applicationContext)
This method can be used to retrieve an instance of
XMessageContext with only the global scope and
XPlatform set. |
static Optional<String> |
getMessageProperty(XMessageView messageView,
String propertyKey)
This method can be used to retrieve the message property with the given
propertyKey from the given
messageView |
static IntegrationFlow |
getMockIntegrationFlow()
Returns a mock instance of
IntegrationFlow with the flow name "sample-flow" and belongs to a mock project
created with getMockProject() method |
static IntegrationFlow |
getMockIntegrationFlow(Project project)
Returns a mock instance of
IntegrationFlow with the flow name "sample-flow" and belongs to the provided
project |
static IntegrationFlow |
getMockIntegrationFlow(Project project,
String flowName)
Returns a mock instance of
IntegrationFlow with the flow name "sample-flow" and belongs to the provided
project |
static Project |
getMockProject()
Returns a mock instance of
Project with the following basic properties set
Project ID : 1
Project Name : sample-project
Project Version : 1.0
|
static Optional<String> |
getTransportHeader(XMessageView messageView,
String headerKey)
This method can be used to retrieve the transport header with the given
headerKey from the given
messageView |
static boolean |
hasMessageProperty(XMessageView messageView,
String propertyKey)
This method can be used to check whether the given
messageView has a message property with the given
propertyKey |
static boolean |
hasTransportHeader(XMessageView messageView,
String headerKey)
This method can be used to check whether the given
messageView has a transport header with the given
headerKey |
public static XMessageContext getBasicMessageContext(org.springframework.context.ApplicationContext applicationContext)
XMessageContext
with only the global scope and
XPlatform
set. It also contains an instance of XMessage
with empty payload.
The concrete test class is responsible for setting all the necessary properties to both XMessageContext and XMessage before using them in a test.
applicationContext
- the spring application context to create a new message contextXMessageContext
public static boolean hasTransportHeader(XMessageView messageView, String headerKey)
messageView
has a transport header with the given
headerKey
messageView
- instance of XMessageView
to be checked for the transport headerheaderKey
- key of the header as String
to be checkedtrue
if present, false
otherwisepublic static Optional<String> getTransportHeader(XMessageView messageView, String headerKey)
headerKey
from the given
messageView
messageView
- instance of XMessageView
from which the transport header should be retrievedheaderKey
- key of the header as String
to be retrievedOptional
of type String
containing the header value if present,
Optional.EMPTY
otherwisepublic static boolean hasMessageProperty(XMessageView messageView, String propertyKey)
messageView
has a message property with the given
propertyKey
messageView
- instance of XMessageView
to be checked for the message propertypropertyKey
- key of the message property as String
to be checkedtrue
if present, false
otherwisepublic static Optional<String> getMessageProperty(XMessageView messageView, String propertyKey)
propertyKey
from the given
messageView
messageView
- instance of XMessageView
from which the message property should be retrievedpropertyKey
- key of the message property as String
to be retrievedOptional
of type String
containing the message property value if present,
Optional.EMPTY
otherwisepublic static Project getMockProject()
Project
with the following basic properties set
Project
public static IntegrationFlow getMockIntegrationFlow()
IntegrationFlow
with the flow name "sample-flow" and belongs to a mock project
created with getMockProject()
methodIntegrationFlow
belongs to a mock projectpublic static IntegrationFlow getMockIntegrationFlow(Project project)
IntegrationFlow
with the flow name "sample-flow" and belongs to the provided
projectproject
- instance of Project
to which this integration flow should belong toIntegrationFlow
belongs to the given projectpublic static IntegrationFlow getMockIntegrationFlow(Project project, String flowName)
IntegrationFlow
with the flow name "sample-flow" and belongs to the provided
projectproject
- instance of Project
to which this integration flow should belong toflowName
- name of the integration flowIntegrationFlow
with the given name and belongs to the given projectCopyright © 2016–2019 AdroitLogic. All rights reserved.