public abstract class TestUtils extends Object
Modifier and Type | Class and 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 and Description |
---|
TestUtils() |
Modifier and Type | Method and 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 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 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) |
public static Object getPropertyValue(Object root, String propertyPath)
root
- the object to obtain the property valuepropertyPath
- the property name to obtain a value.
Can be nested path defined by the period.DirectFieldAccessor
public static <T> T getPropertyValue(Object root, String propertyPath, Class<T> type)
T
- the expected value type.
Can be nested path defined by the period.root
- the object to obtain the property valuepropertyPath
- the property name to obtain a value.type
- the expected value type.DirectFieldAccessor
public static TestUtils.TestApplicationContext createTestApplicationContext()
TestUtils.TestApplicationContext
instance
supplied with the basic Spring Integration infrastructure.TestUtils.TestApplicationContext
instancepublic static ThreadPoolTaskScheduler createTaskScheduler(int poolSize)
ThreadPoolTaskScheduler
instances based on the provided poolSize
.poolSize
- the size for the ThreadPoolTaskScheduler
ThreadPoolTaskScheduler
instance.public static Properties locateComponentInHistory(List<Properties> history, String componentName, int startingIndex)
history
- a message historycomponentName
- the name of a component to scan forstartingIndex
- the index to start scanningpublic static String applySystemFileSeparator(String s)
s
- The file path containing '/'.public static TestUtils.LevelsContainer adjustLogLevels(String methodName, List<Class<?>> classes, List<String> categories, org.apache.logging.log4j.Level level)
public static void revertLogLevels(String methodName, TestUtils.LevelsContainer container)