Class CamelSpringTestContextLoader

java.lang.Object
org.springframework.test.context.support.AbstractContextLoader
org.apache.camel.test.spring.CamelSpringTestContextLoader
All Implemented Interfaces:
org.springframework.test.context.ContextLoader, org.springframework.test.context.SmartContextLoader

@Deprecated public class CamelSpringTestContextLoader extends org.springframework.test.context.support.AbstractContextLoader
Deprecated.
Replacement for the default GenericXmlContextLoader that provides hooks for processing some class level Camel related test annotations.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected org.springframework.context.support.GenericApplicationContext
    createContext(Class<?> testClass, org.springframework.test.context.MergedContextConfiguration mergedConfig)
    Deprecated.
    Creates and starts the Spring context while optionally starting any loaded Camel contexts.
    Deprecated.
    Returns "-context.xml".
    protected Class<?>
    Deprecated.
    Returns the class under test in order to enable inspection of annotations while the Spring context is being created.
    protected Method
    Deprecated.
    Returns the test method under test.
    protected void
    loadBeanDefinitions(org.springframework.context.support.GenericApplicationContext context, String... locations)
    Deprecated.
     
    protected void
    loadBeanDefinitions(org.springframework.context.support.GenericApplicationContext context, org.springframework.test.context.MergedContextConfiguration mergedConfig)
    Deprecated.
     
    org.springframework.context.ApplicationContext
    loadContext(String... locations)
    Deprecated.
    Modeled after the Spring implementation in AbstractGenericContextLoader, this method creates and refreshes the application context while providing for processing of additional Camel specific post-refresh actions.
    protected org.springframework.context.ApplicationContext
    loadContext(org.springframework.context.support.GenericApplicationContext context, Class<?> testClass)
    Deprecated.
    Performs the bulk of the Spring application context loading/customization.
    org.springframework.context.ApplicationContext
    loadContext(org.springframework.test.context.MergedContextConfiguration mergedConfig)
    Deprecated.
    Modeled after the Spring implementation in AbstractGenericContextLoader, this method creates and refreshes the application context while providing for processing of additional Camel specific post-refresh actions.

    Methods inherited from class org.springframework.test.context.support.AbstractContextLoader

    customizeContext, generateDefaultLocations, getResourceSuffixes, isGenerateDefaultLocations, modifyLocations, prepareContext, processContextConfiguration, processLocations

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CamelSpringTestContextLoader

      public CamelSpringTestContextLoader()
      Deprecated.
  • Method Details

    • loadContext

      public org.springframework.context.ApplicationContext loadContext(org.springframework.test.context.MergedContextConfiguration mergedConfig) throws Exception
      Deprecated.
      Modeled after the Spring implementation in AbstractGenericContextLoader, this method creates and refreshes the application context while providing for processing of additional Camel specific post-refresh actions. We do not provide the pre-post hooks for customization seen in AbstractGenericContextLoader because they probably are unnecessary for 90+% of users.

      For some functionality, we cannot use TestExecutionListener because we need to both produce the desired outcome during application context loading, and also cleanup after ourselves even if the test class never executes. Thus the listeners, which only run if the application context is successfully initialized are insufficient to provide the behavior described above.

      Throws:
      Exception
    • loadContext

      public org.springframework.context.ApplicationContext loadContext(String... locations) throws Exception
      Deprecated.
      Modeled after the Spring implementation in AbstractGenericContextLoader, this method creates and refreshes the application context while providing for processing of additional Camel specific post-refresh actions. We do not provide the pre-post hooks for customization seen in AbstractGenericContextLoader because they probably are unnecessary for 90+% of users.

      For some functionality, we cannot use TestExecutionListener because we need to both produce the desired outcome during application context loading, and also cleanup after ourselves even if the test class never executes. Thus the listeners, which only run if the application context is successfully initialized are insufficient to provide the behavior described above.

      Throws:
      Exception
    • getResourceSuffix

      public String getResourceSuffix()
      Deprecated.
      Returns "-context.xml".
      Specified by:
      getResourceSuffix in class org.springframework.test.context.support.AbstractContextLoader
    • loadContext

      protected org.springframework.context.ApplicationContext loadContext(org.springframework.context.support.GenericApplicationContext context, Class<?> testClass) throws Exception
      Deprecated.
      Performs the bulk of the Spring application context loading/customization.
      Parameters:
      context - the partially configured context. The context should have the bean definitions loaded, but nothing else.
      testClass - the test class being executed
      Returns:
      the initialized (refreshed) Spring application context
      Throws:
      Exception - if there is an error during initialization/customization
    • loadBeanDefinitions

      protected void loadBeanDefinitions(org.springframework.context.support.GenericApplicationContext context, org.springframework.test.context.MergedContextConfiguration mergedConfig)
      Deprecated.
    • loadBeanDefinitions

      protected void loadBeanDefinitions(org.springframework.context.support.GenericApplicationContext context, String... locations)
      Deprecated.
    • createContext

      protected org.springframework.context.support.GenericApplicationContext createContext(Class<?> testClass, org.springframework.test.context.MergedContextConfiguration mergedConfig)
      Deprecated.
      Creates and starts the Spring context while optionally starting any loaded Camel contexts.
      Parameters:
      testClass - the test class that is being executed
      Returns:
      the loaded Spring context
    • getTestClass

      protected Class<?> getTestClass()
      Deprecated.
      Returns the class under test in order to enable inspection of annotations while the Spring context is being created.
      Returns:
      the test class that is being executed
      See Also:
    • getTestMethod

      protected Method getTestMethod()
      Deprecated.
      Returns the test method under test.
      Returns:
      the method that is being executed
      See Also: