public final class PersistingDownloadCache extends Object
DownloadCache
implementation that caches downloaded files in a configured directory.
Cached files that are older than the configured time-to-live Period
will be removed.Modifier and Type | Field and Description |
---|---|
protected org.slf4j.Logger |
log |
Constructor and Description |
---|
PersistingDownloadCache(Path path,
java.time.Period ttl) |
Modifier and Type | Method and Description |
---|---|
void |
afterTestSuccess() |
void |
before() |
Path |
getOrDownload(String url,
Path targetDir)
Returns either a cached or newly downloaded version of the given file.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
get
afterTestFailure, apply
public PersistingDownloadCache(Path path, java.time.Period ttl)
public void before() throws IOException
before
in interface ExternalResource
IOException
public void afterTestSuccess()
afterTestSuccess
in interface ExternalResource
public Path getOrDownload(String url, Path targetDir) throws IOException
DownloadCache
getOrDownload
in interface DownloadCache
url
- File/directory to downloadtargetDir
- directory to place file inIOException
- if any IO operation failsCopyright © 2014–2023 The Apache Software Foundation. All rights reserved.