Class TestUtils
java.lang.Object
org.springframework.integration.test.util.TestUtils
- Author:
- Mark Fisher, Iwein Fuld, Oleg Zhurakousky, Artem Bilan, Gary Russell
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final record
static class
AGenericApplicationContext
extension with some support methods to register Spring Integration beans in the application context at runtime. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic TestUtils.LevelsContainer
adjustLogLevels
(String methodName, List<Class<?>> classes, List<String> categories, org.apache.logging.log4j.Level level) static String
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
.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 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:
-
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:
-
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
-