Class TestUtils
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 classTestUtils.LevelsContainerstatic classTestUtils.TestApplicationContextAGenericApplicationContextextension 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.LevelsContaineradjustLogLevels(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.StringapplySystemFileSeparator(java.lang.String s)Update file path by replacing any '/' with the system's file separator.static org.springframework.scheduling.concurrent.ThreadPoolTaskSchedulercreateTaskScheduler(int poolSize)A factory for theThreadPoolTaskSchedulerinstances based on the providedpoolSize.static TestUtils.TestApplicationContextcreateTestApplicationContext()Create aTestUtils.TestApplicationContextinstance supplied with the basic Spring Integration infrastructure.static java.lang.ObjectgetPropertyValue(java.lang.Object root, java.lang.String propertyPath)Obtain a value for the property from the provide object.static <T> TgetPropertyValue(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.PropertieslocateComponentInHistory(java.util.List<java.util.Properties> history, java.lang.String componentName, int startingIndex)static voidrevertLogLevels(java.lang.String methodName, TestUtils.LevelsContainer container)
-
Constructor Details
-
TestUtils
public TestUtils()
-
-
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 valuepropertyPath- 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 valuepropertyPath- the property name to obtain a value.type- the expected value type.- Returns:
- the value of the property or null
- See Also:
DirectFieldAccessor
-
createTestApplicationContext
Create aTestUtils.TestApplicationContextinstance supplied with the basic Spring Integration infrastructure.- Returns:
- the
TestUtils.TestApplicationContextinstance
-
createTaskScheduler
public static org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler createTaskScheduler(int poolSize)A factory for theThreadPoolTaskSchedulerinstances based on the providedpoolSize.- Parameters:
poolSize- the size for theThreadPoolTaskScheduler- Returns:
- the
ThreadPoolTaskSchedulerinstance.
-
locateComponentInHistory
public static java.util.Properties locateComponentInHistory(java.util.List<java.util.Properties> history, java.lang.String componentName, int startingIndex)- Parameters:
history- a message historycomponentName- the name of a component to scan forstartingIndex- 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)
-