public class TestContext extends Object
| Modifier and Type | Field and Description |
|---|---|
protected Map<String,Object> |
variables
Local variables
|
| Constructor and Description |
|---|
TestContext()
Default constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
addVariables(Map<String,Object> variablesToSet)
Add several new variables to test context.
|
void |
clear()
Clears variables in this test context.
|
org.springframework.context.ApplicationContext |
getApplicationContext()
Gets the Spring bean application context.
|
EndpointFactory |
getEndpointFactory()
Gets the endpoint factory.
|
FunctionRegistry |
getFunctionRegistry()
Get the current function registry.
|
Map<String,Object> |
getGlobalVariables()
Set global variables.
|
MessageConstructionInterceptors |
getMessageConstructionInterceptors()
Gets the message construction interceptors.
|
MessageListeners |
getMessageListeners()
Gets the message listeners.
|
MessageValidatorRegistry |
getMessageValidatorRegistry()
Get the message validator registry.
|
NamespaceContextBuilder |
getNamespaceContextBuilder()
Gets the namespace context builder.
|
TestListeners |
getTestListeners()
Gets the test listeners.
|
ValidationMatcherRegistry |
getValidationMatcherRegistry()
Get the current validation matcher registry
|
String |
getVariable(String variableExpression)
Gets the value for the given variable expression.
|
Object |
getVariableObject(String variableExpression)
Gets the value for the given variable as object representation.
|
Map<String,Object> |
getVariables()
Getter for test variables in this context.
|
CitrusRuntimeException |
handleError(String testName,
String packageName,
String message,
Exception cause)
Handles error creating a new CitrusRuntimeException and
informs test listeners.
|
boolean |
hasVariables()
Checks if variables are present right now.
|
void |
onInboundMessage(Message receivedMessage)
Informs message listeners if present that inbound message was received.
|
void |
onOutboundMessage(Message message)
Informs message listeners if present that new outbound message is about to be sent.
|
String |
replaceDynamicContentInString(String str)
Method replacing variable declarations and place holders as well as
function expressions in a string
|
String |
replaceDynamicContentInString(String str,
boolean enableQuoting)
Method replacing variable declarations and functions in a string, optionally
the variable values get surrounded with single quotes.
|
String |
resolveDynamicValue(String expression)
Checks weather the given expression is a variable or function and resolves the value
accordingly
|
List<String> |
resolveDynamicValuesInList(List<String> list)
Replaces variables and functions in a list with respective values and
returns the new list representation.
|
Map<String,Object> |
resolveDynamicValuesInMap(Map<String,Object> map)
Replaces variables and functions inside a map with respective values and returns a new
map representation.
|
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
Sets the Spring bean application context.
|
void |
setEndpointFactory(EndpointFactory endpointFactory)
Sets the endpoint factory.
|
void |
setFunctionRegistry(FunctionRegistry functionRegistry)
Set the function registry.
|
void |
setGlobalVariables(GlobalVariables globalVariables)
Get global variables.
|
void |
setMessageConstructionInterceptors(MessageConstructionInterceptors messageConstructionInterceptors)
Sets the messsage construction interceptors.
|
void |
setMessageListeners(MessageListeners messageListeners)
Set the message listeners.
|
void |
setMessageValidatorRegistry(MessageValidatorRegistry messageValidatorRegistry)
Set the message validator registry.
|
void |
setNamespaceContextBuilder(NamespaceContextBuilder namespaceContextBuilder)
Sets the namespace context builder.
|
void |
setTestListeners(TestListeners testListeners)
Set the test listeners.
|
void |
setValidationMatcherRegistry(ValidationMatcherRegistry validationMatcherRegistry)
Set the validation matcher registry
|
void |
setVariable(String variableName,
Object value)
Creates a new variable in this test context with the respective value.
|
void |
setVariables(Map<String,Object> variables)
Setter for test variables in this context.
|
public String getVariable(String variableExpression)
variableExpression - expression to search for.CitrusRuntimeExceptionpublic Object getVariableObject(String variableExpression)
variableExpression - expression to search for.CitrusRuntimeExceptionpublic void setVariable(String variableName, Object value)
variableName - the name of the new variablevalue - the new variable valueCitrusRuntimeExceptionpublic void addVariables(Map<String,Object> variablesToSet)
variablesToSet - the list of variables to set.public Map<String,Object> resolveDynamicValuesInMap(Map<String,Object> map)
map - optionally having variable entries.public List<String> resolveDynamicValuesInList(List<String> list)
list - having optional variable entries.public void clear()
public boolean hasVariables()
public String replaceDynamicContentInString(String str)
str - the string to parse.public String replaceDynamicContentInString(String str, boolean enableQuoting)
str - the string to parse for variable place holders.enableQuoting - flag marking surrounding quotes should be added or not.public String resolveDynamicValue(String expression)
expression - the expression to resolvepublic CitrusRuntimeException handleError(String testName, String packageName, String message, Exception cause)
testName - packageName - message - cause - public void setVariables(Map<String,Object> variables)
variables - public Map<String,Object> getVariables()
public void setGlobalVariables(GlobalVariables globalVariables)
globalVariables - public Map<String,Object> getGlobalVariables()
public FunctionRegistry getFunctionRegistry()
public void setFunctionRegistry(FunctionRegistry functionRegistry)
functionRegistry - the functionRegistry to setpublic void setMessageValidatorRegistry(MessageValidatorRegistry messageValidatorRegistry)
messageValidatorRegistry - the messageValidatorRegistry to setpublic MessageValidatorRegistry getMessageValidatorRegistry()
public ValidationMatcherRegistry getValidationMatcherRegistry()
public void setValidationMatcherRegistry(ValidationMatcherRegistry validationMatcherRegistry)
validationMatcherRegistry - public MessageListeners getMessageListeners()
public void setMessageListeners(MessageListeners messageListeners)
messageListeners - public TestListeners getTestListeners()
public void setTestListeners(TestListeners testListeners)
testListeners - public MessageConstructionInterceptors getMessageConstructionInterceptors()
public void setMessageConstructionInterceptors(MessageConstructionInterceptors messageConstructionInterceptors)
messageConstructionInterceptors - public EndpointFactory getEndpointFactory()
public void setEndpointFactory(EndpointFactory endpointFactory)
endpointFactory - public void setNamespaceContextBuilder(NamespaceContextBuilder namespaceContextBuilder)
namespaceContextBuilder - public NamespaceContextBuilder getNamespaceContextBuilder()
public org.springframework.context.ApplicationContext getApplicationContext()
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
applicationContext - public void onInboundMessage(Message receivedMessage)
receivedMessage - public void onOutboundMessage(Message message)
message - Copyright © 2008–2015 ConSol* Consulting&Solutions GmbH. All rights reserved.