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

public abstract class TestUtils extends Object
Author:
Mark Fisher, Iwein Fuld, Oleg Zhurakousky, Artem Bilan, Gary Russell
  • Constructor Details

    • TestUtils

      public TestUtils()
  • Method Details

    • getPropertyValue

      public static <T> T getPropertyValue(Object root, String propertyPath, 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:
    • getPropertyValue

      public static Object getPropertyValue(Object root, 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:
    • 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 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 Properties locateComponentInHistory(List<Properties> history, 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 String applySystemFileSeparator(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(String methodName, List<Class<?>> classes, List<String> categories, org.apache.logging.log4j.Level level)
    • revertLogLevels

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