Class TestUtils
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
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TestUtils.LevelsContainer
static class
TestUtils.TestApplicationContext
AGenericApplicationContext
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(String methodName, List<Class<?>> classes, List<String> categories, org.apache.logging.log4j.Level level)
static String
applySystemFileSeparator(String s)
Update file path by replacing any '/' with the system's file separator.static ThreadPoolTaskScheduler
createTaskScheduler(int poolSize)
A factory for theThreadPoolTaskScheduler
instances based on the providedpoolSize
.static TestUtils.TestApplicationContext
createTestApplicationContext()
Create aTestUtils.TestApplicationContext
instance supplied with the basic Spring Integration infrastructure.static Object
getPropertyValue(Object root, String propertyPath)
Obtain a value for the property from the provide object.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.static Properties
locateComponentInHistory(List<Properties> history, String componentName, int startingIndex)
static void
revertLogLevels(String methodName, TestUtils.LevelsContainer container)
-
Constructor Details
-
TestUtils
public TestUtils()
-
-
Method Details
-
getPropertyValue
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
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.TestApplicationContext
instance supplied with the basic Spring Integration infrastructure.- Returns:
- the
TestUtils.TestApplicationContext
instance
-
createTaskScheduler
A factory for theThreadPoolTaskScheduler
instances based on the providedpoolSize
.- Parameters:
poolSize
- the size for theThreadPoolTaskScheduler
- Returns:
- the
ThreadPoolTaskScheduler
instance.
-
locateComponentInHistory
public static Properties locateComponentInHistory(List<Properties> history, 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
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
-
revertLogLevels
-