java.lang.Object
org.springframework.integration.test.util.TestUtils

public abstract class TestUtils
extends java.lang.Object
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static class  TestUtils.LevelsContainer  
    static class  TestUtils.TestApplicationContext
    A GenericApplicationContext extension with some support methods to register Spring Integration beans in the application context at runtime.
  • Constructor Summary

    Constructors 
    Constructor Description
    TestUtils()  
  • Method Summary

    Modifier and Type Method Description
    static TestUtils.LevelsContainer adjustLogLevels​(java.lang.String methodName, java.util.List<java.lang.Class<?>> classes, java.util.List<java.lang.String> categories, org.apache.logging.log4j.Level level)  
    static java.lang.String applySystemFileSeparator​(java.lang.String s)
    Update file path by replacing any '/' with the system's file separator.
    static org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler createTaskScheduler​(int poolSize)
    A factory for the ThreadPoolTaskScheduler instances based on the provided poolSize.
    static TestUtils.TestApplicationContext createTestApplicationContext()
    Create a TestUtils.TestApplicationContext instance supplied with the basic Spring Integration infrastructure.
    static java.lang.Object getPropertyValue​(java.lang.Object root, java.lang.String propertyPath)
    Obtain a value for the property from the provide object.
    static <T> T getPropertyValue​(java.lang.Object root, java.lang.String propertyPath, java.lang.Class<T> type)
    Obtain a value for the property from the provide object and try to cast it to the provided type.
    static java.util.Properties locateComponentInHistory​(java.util.List<java.util.Properties> history, java.lang.String componentName, int startingIndex)  
    static void revertLogLevels​(java.lang.String methodName, TestUtils.LevelsContainer container)  

    Methods inherited from class java.lang.Object

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

  • Method Details

    • getPropertyValue

      public static java.lang.Object getPropertyValue​(java.lang.Object root, java.lang.String propertyPath)
      Obtain a value for the property from the provide object. Supports nested properties via period delimiter.
      Parameters:
      root - the object to obtain the property value
      propertyPath - the property name to obtain a value. Can be nested path defined by the period.
      Returns:
      the value of the property or null
      See Also:
      DirectFieldAccessor
    • getPropertyValue

      public static <T> T getPropertyValue​(java.lang.Object root, java.lang.String propertyPath, java.lang.Class<T> type)
      Obtain a value for the property from the provide object and try to cast it to the provided type. Supports nested properties via period delimiter.
      Type Parameters:
      T - the expected value type. Can be nested path defined by the period.
      Parameters:
      root - the object to obtain the property value
      propertyPath - the property name to obtain a value.
      type - the expected value type.
      Returns:
      the value of the property or null
      See Also:
      DirectFieldAccessor
    • createTestApplicationContext

      public static TestUtils.TestApplicationContext createTestApplicationContext()
      Create a TestUtils.TestApplicationContext instance supplied with the basic Spring Integration infrastructure.
      Returns:
      the TestUtils.TestApplicationContext instance
    • createTaskScheduler

      public static org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler createTaskScheduler​(int poolSize)
      A factory for the ThreadPoolTaskScheduler instances based on the provided poolSize.
      Parameters:
      poolSize - the size for the ThreadPoolTaskScheduler
      Returns:
      the ThreadPoolTaskScheduler instance.
    • locateComponentInHistory

      public static java.util.Properties locateComponentInHistory​(java.util.List<java.util.Properties> history, java.lang.String componentName, int startingIndex)
      Parameters:
      history - a message history
      componentName - the name of a component to scan for
      startingIndex - the index to start scanning
      Returns:
      the properties provided by the named component or null if none available
    • applySystemFileSeparator

      public static java.lang.String applySystemFileSeparator​(java.lang.String s)
      Update file path by replacing any '/' with the system's file separator.
      Parameters:
      s - The file path containing '/'.
      Returns:
      The updated file path (if necessary).
    • adjustLogLevels

      public static TestUtils.LevelsContainer adjustLogLevels​(java.lang.String methodName, java.util.List<java.lang.Class<?>> classes, java.util.List<java.lang.String> categories, org.apache.logging.log4j.Level level)
    • revertLogLevels

      public static void revertLogLevels​(java.lang.String methodName, TestUtils.LevelsContainer container)