public class MockResourceAccessor extends AbstractResourceAccessor
ResourceAccessor.NotFoundResource
Constructor and Description |
---|
MockResourceAccessor() |
MockResourceAccessor(Map<String,String> contentByFileName) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
List<String> |
describeLocations()
Returns a description of the places this classloader will look for paths.
|
List<Resource> |
getAll(String path)
Returns all
Resource s at the given path. |
List<Resource> |
search(String path,
boolean recursive)
Returns the path to all resources contained in the given path.
|
void |
setContent(String fileName,
String content) |
clone, describe, equals, get, get, get, getAttributes, getFieldValue, getObjectMetaData, getValuePath, has, hashCode, set, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
get, getExisting, list, openStream, openStreams
public List<Resource> getAll(String path) throws IOException
ResourceAccessor
Resource
s at the given path.
For many resource accessors (such as a file system), only one resource can exist at a given spot,
but some accessors (such as CompositeResourceAccessor
or ClassLoaderResourceAccessor
) can have multiple resources for a single path.
If the resourceAccessor returns multiple values, the returned List should be considered sorted for that resource accessor.
For example, ClassLoaderResourceAccessor
returns them in order based on the configured classloader.
Order is important to pay attention to, because users may set GlobalConfiguration.DUPLICATE_FILE_MODE
to pick the "best" file which is defined as
"the first file from this function".
IOException
- if there is an unexpected error determining what is at the pathpublic List<Resource> search(String path, boolean recursive) throws IOException
ResourceAccessor
path
- The path to lookup resources in.recursive
- Set to true and will return paths to contents in subdirectories as well.IOException
- if there is an error searching the system.public List<String> describeLocations()
ResourceAccessor
Copyright © 2023 Liquibase.org. All rights reserved.