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 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(String methodName, List<Class<?>> classes, List<String> categories, org.apache.logging.log4j.Level level)static StringapplySystemFileSeparator(String s)Update file path by replacing any '/' with the system's file separator.static 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 StringdockerRegistryFromEnv()Deprecated.since 5.5.13 in favor of standardTESTCONTAINERS_HUB_IMAGE_NAME_PREFIXENV varstatic ObjectgetPropertyValue(Object root, String propertyPath)Obtain a value for the property from the provide object.static <T> TgetPropertyValue(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 PropertieslocateComponentInHistory(List<Properties> history, String componentName, int startingIndex)static voidrevertLogLevels(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.TestApplicationContextinstance supplied with the basic Spring Integration infrastructure.- Returns:
- the
TestUtils.TestApplicationContextinstance
-
createTaskScheduler
A factory for theThreadPoolTaskSchedulerinstances based on the providedpoolSize.- Parameters:
poolSize- the size for theThreadPoolTaskScheduler- Returns:
- the
ThreadPoolTaskSchedulerinstance.
-
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
-
dockerRegistryFromEnv
Deprecated.since 5.5.13 in favor of standardTESTCONTAINERS_HUB_IMAGE_NAME_PREFIXENV varTake a Docker Hub url from ENV var.- Returns:
- a Docker Hub url from ENV var.
-