Class CitrusContext

java.lang.Object
org.citrusframework.CitrusContext
All Implemented Interfaces:
MessageListenerAware, TestActionListenerAware, TestListenerAware, TestReporterAware, TestSuiteListenerAware, ReferenceRegistry

Default Citrus context implementation holds basic components used in Citrus.
  • Constructor Details

    • CitrusContext

      protected CitrusContext(CitrusContext.Builder builder)
      Protected constructor using given builder to construct this instance.
      Parameters:
      builder - the instance builder.
  • Method Details

    • create

      public static CitrusContext create()
      Initializing method loads default configuration class and reads component definitions such as test listeners and test context factory.
      Returns:
    • parseConfiguration

      public void parseConfiguration(Class<?> configClass)
      Parse given configuration class and bind annotated fields, methods to reference registry.
      Parameters:
      configClass -
    • parseConfiguration

      public void parseConfiguration(Object configuration)
      Parse given configuration class and bind annotated fields, methods to reference registry.
      Parameters:
      configuration -
    • createTestContext

      public TestContext createTestContext()
      Creates a new test context.
      Returns:
      the new citrus test context.
    • addTestSuiteListener

      public void addTestSuiteListener(TestSuiteListener suiteListener)
      Specified by:
      addTestSuiteListener in interface TestSuiteListenerAware
    • addTestListener

      public void addTestListener(TestListener testListener)
      Specified by:
      addTestListener in interface TestListenerAware
    • addTestActionListener

      public void addTestActionListener(TestActionListener testActionListener)
      Specified by:
      addTestActionListener in interface TestActionListenerAware
    • addTestReporter

      public void addTestReporter(TestReporter testReporter)
      Specified by:
      addTestReporter in interface TestReporterAware
    • addMessageListener

      public void addMessageListener(MessageListener listener)
      Specified by:
      addMessageListener in interface MessageListenerAware
    • close

      public void close()
      Closes the context and all its components.
    • getAfterSuite

      public List<AfterSuite> getAfterSuite()
      Gets list of after suite actions in this context.
      Returns:
    • getBeforeSuite

      public List<BeforeSuite> getBeforeSuite()
      Gets list of before suite actions in this context.
      Returns:
    • getTestListeners

      public TestListeners getTestListeners()
      Gets test listeners in this context.
      Returns:
    • getTestActionListeners

      public TestActionListeners getTestActionListeners()
      Gets the test action listeners in this context.
      Returns:
    • getTestSuiteListeners

      public TestSuiteListeners getTestSuiteListeners()
      Gets test suite listeners in this context.
      Returns:
    • getFunctionRegistry

      public FunctionRegistry getFunctionRegistry()
      Obtains the functionRegistry.
      Returns:
    • getValidationMatcherRegistry

      public ValidationMatcherRegistry getValidationMatcherRegistry()
      Obtains the validationMatcherRegistry.
      Returns:
    • getGlobalVariables

      public GlobalVariables getGlobalVariables()
      Obtains the globalVariables.
      Returns:
    • getMessageValidatorRegistry

      public MessageValidatorRegistry getMessageValidatorRegistry()
      Obtains the messageValidatorRegistry.
      Returns:
    • getMessageListeners

      public MessageListeners getMessageListeners()
      Obtains the messageListeners.
      Returns:
    • getEndpointFactory

      public EndpointFactory getEndpointFactory()
      Obtains the endpointFactory.
      Returns:
    • getReferenceResolver

      public ReferenceResolver getReferenceResolver()
      Obtains the referenceResolver.
      Returns:
    • getMessageProcessors

      public MessageProcessors getMessageProcessors()
      Obtains the messageProcessors.
      Returns:
    • getNamespaceContextBuilder

      public NamespaceContextBuilder getNamespaceContextBuilder()
      Obtains the namespaceContextBuilder.
      Returns:
    • getTypeConverter

      public TypeConverter getTypeConverter()
      Obtains the typeConverter.
      Returns:
    • getLogModifier

      public LogModifier getLogModifier()
      Gets the logModifier.
      Returns:
    • getTestContextFactory

      public TestContextFactory getTestContextFactory()
      Obtains the testContextFactory.
      Returns:
    • bind

      public void bind(String name, Object value)
      Specified by:
      bind in interface ReferenceRegistry
    • getTestResults

      public TestResults getTestResults()
    • handleTestResults

      public void handleTestResults(TestResults testResults)
    • addComponent

      public void addComponent(String name, Object component)