[rfc][icedtea-web] Download Resource Unit Test for ResourceTracker

Jiri Vanek jvanek at redhat.com
Fri Nov 14 13:51:23 UTC 2014

On 11/10/2014 09:09 PM, Jie Kang wrote:
> Hello,
> This patch adds a simple test to cover ResourceTracker's ability to download a file into the cache system.
> How does it look?
> Regards,

Well - this is ok, but I got little bit more in mind.

Please no unrelated changes like import reordering, static import and so on... unless necesary.

Afaik cache management allows you to clean only  one downloaded resource - so you may think about 
this instead of clearcache. Also I think you need to clean cache in @beforeclass. Otherwise 
rt.getCacheFile will return cached file (if any) and so not verifing that the new one actually was 

Also you are testing only downloading of simple resource.. well I guess it is ok. but what I had in 
mind, were atomic tests also for

+    private URLConnection getDownloadConnection(URL location) throws IOException {
+    private void downloadGZipFile(Resource resource, URLConnection connection, URL downloadFrom,
+    private void downloadFile(Resource resource, URLConnection connection, URL downloadFrom)
+    private void storeEntryFields(CacheEntry entry, long contentLength, long lastModified) {
+    private void writeDownloadToFile(Resource resource, URL downloadLocation, InputStream in)
+    private void uncompressGzip(URL compressedLocation, URL uncompressedLocation)
+    private void uncompressPackGz(URL compressedLocation, URL uncompressedLocation) throws

new methods.


Note - in patch as it is now, I would not allow the unrelated chnages. However, if you will test all 
the new methods, then they may become really handy and it will be ok from my side.

More information about the distro-pkg-dev mailing list