[
https://issues.jboss.org/browse/SHRINKWRAP-496?page=com.atlassian.jira.pl...
]
Andrew Rubinger commented on SHRINKWRAP-496:
--------------------------------------------
There be dragons here. :)
While I can see sharing a cache scoped to a particular object, I wouldn't implement a
cache in the ShrinkWrap API itself to be shared between objects. Especially in testing,
calls should be idempotent so that each run of the test class does the same thing each
time. Contents behind a URL can change over time, so if machine A and machine B have
different caches at time X, they'll return different things.
Of course a user is free to implement whatever Asset type they want and extend ShrinkWrap
in that way.
So +1 to some impl of UrlAsset which caches the content, but I would scope the cache to
that object only. Pull requests welcome.
Also, a version of this which uses a mem-based cache would be good too (basically wrapping
ByteArrayAsset)
Implement CacheUrlAsset
-----------------------
Key: SHRINKWRAP-496
URL:
https://issues.jboss.org/browse/SHRINKWRAP-496
Project: ShrinkWrap
Issue Type: Feature Request
Components: api
Affects Versions: 1.2.3
Reporter: Alex Soto
Priority: Minor
In ShrinkWrap UrlAsset downloaded an asset from a URL, which can be external and then it
creates the Archive element with that info. The problem is that sometimes you might want
to download a big file (2MB) to put inside an Archive, and this means that for each test
class that you execute you end up by downloading this file.
A possible solution could be create a CacheUrlAsset that downloads the content and stores
it in {java.io.tmp}/shrinkwrap so in successive calls before downloading the file again,
it can take it directly from cache directory.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)