public abstract class TestContextResourceUtils extends Object
ResourceUtils,
Resource,
ClassPathResource,
FileSystemResource,
UrlResource,
ResourceLoader| Constructor and Description |
|---|
TestContextResourceUtils() |
| Modifier and Type | Method and Description |
|---|---|
static String[] |
convertToClasspathResourcePaths(Class<?> clazz,
boolean preservePlaceholders,
String... paths)
Convert the supplied paths to classpath resource paths.
|
static String[] |
convertToClasspathResourcePaths(Class<?> clazz,
String... paths)
Convert the supplied paths to classpath resource paths.
|
static List<Resource> |
convertToResourceList(ResourceLoader resourceLoader,
String... paths)
Convert the supplied paths to a list of
Resource handles using
the given ResourceLoader. |
static Resource[] |
convertToResources(ResourceLoader resourceLoader,
String... paths)
Convert the supplied paths to an array of
Resource handles using
the given ResourceLoader. |
public static String[] convertToClasspathResourcePaths(Class<?> clazz, String... paths)
Delegates to convertToClasspathResourcePaths(Class, boolean, String...)
with false supplied for the preservePlaceholders flag.
clazz - the class with which the paths are associatedpaths - the paths to be convertedconvertToResources(org.springframework.core.io.ResourceLoader, java.lang.String...)public static String[] convertToClasspathResourcePaths(Class<?> clazz, boolean preservePlaceholders, String... paths)
For each of the supplied paths:
"context.xml" — will
be treated as a classpath resource that is relative to the package in
which the specified class is defined. Such a path will be prepended with
the classpath: prefix and the path to the package for the class.
"/org/example/schema.sql".
Such a path will be prepended with the classpath: prefix.
classpath:, file:, http:, etc.) will not have its
protocol modified.
Each path will then be cleaned,
unless the preservePlaceholders flag is true and the path
contains one or more placeholders in the form ${placeholder.name}.
clazz - the class with which the paths are associatedpreservePlaceholders - true if placeholders should be preservedpaths - the paths to be convertedconvertToResources(org.springframework.core.io.ResourceLoader, java.lang.String...),
ResourceUtils.CLASSPATH_URL_PREFIX,
ResourceUtils.FILE_URL_PREFIXpublic static Resource[] convertToResources(ResourceLoader resourceLoader, String... paths)
Resource handles using
the given ResourceLoader.resourceLoader - the ResourceLoader to use to convert the pathspaths - the paths to be convertedconvertToResourceList(ResourceLoader, String...),
convertToClasspathResourcePaths(java.lang.Class<?>, java.lang.String...)public static List<Resource> convertToResourceList(ResourceLoader resourceLoader, String... paths)
Resource handles using
the given ResourceLoader.resourceLoader - the ResourceLoader to use to convert the pathspaths - the paths to be convertedconvertToResources(ResourceLoader, String...),
convertToClasspathResourcePaths(java.lang.Class<?>, java.lang.String...)