Class CitrusContext

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

public class CitrusContext extends Object implements org.citrusframework.report.TestListenerAware, org.citrusframework.report.TestActionListenerAware, org.citrusframework.report.TestSuiteListenerAware, org.citrusframework.report.TestReporterAware, org.citrusframework.report.MessageListenerAware, org.citrusframework.spi.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 org.citrusframework.context.TestContext createTestContext()
      Creates a new test context.
      Returns:
      the new citrus test context.
    • addTestSuiteListener

      public void addTestSuiteListener(org.citrusframework.report.TestSuiteListener suiteListener)
      Specified by:
      addTestSuiteListener in interface org.citrusframework.report.TestSuiteListenerAware
    • addTestListener

      public void addTestListener(org.citrusframework.report.TestListener testListener)
      Specified by:
      addTestListener in interface org.citrusframework.report.TestListenerAware
    • addTestActionListener

      public void addTestActionListener(org.citrusframework.report.TestActionListener testActionListener)
      Specified by:
      addTestActionListener in interface org.citrusframework.report.TestActionListenerAware
    • addTestReporter

      public void addTestReporter(org.citrusframework.report.TestReporter testReporter)
      Specified by:
      addTestReporter in interface org.citrusframework.report.TestReporterAware
    • addMessageListener

      public void addMessageListener(org.citrusframework.report.MessageListener listener)
      Specified by:
      addMessageListener in interface org.citrusframework.report.MessageListenerAware
    • close

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

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

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

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

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

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

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

      public org.citrusframework.validation.matcher.ValidationMatcherRegistry getValidationMatcherRegistry()
      Obtains the validationMatcherRegistry.
      Returns:
    • getGlobalVariables

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

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

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

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

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

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

      public org.citrusframework.xml.namespace.NamespaceContextBuilder getNamespaceContextBuilder()
      Obtains the namespaceContextBuilder.
      Returns:
    • getTypeConverter

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

      public org.citrusframework.log.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 org.citrusframework.spi.ReferenceRegistry
    • getTestResults

      public org.citrusframework.report.TestResults getTestResults()
    • handleTestResults

      public void handleTestResults(org.citrusframework.report.TestResults testResults)
    • addComponent

      public void addComponent(String name, Object component)