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

Jie Kang jkang at redhat.com
Thu Nov 27 21:16:13 UTC 2014



----- Original Message -----
> 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,
> >
> 
> oh - without the unrelated changes, with cleanCache before testrun, and
> (maybe) wit clean of the
> only downlaoded file - this sounds good (as it is now) to me also fo 1.5.
> 


Hello,


The current test uses a temporary directory for cache and clears the temporary directory afterwards [1]. It does not mess with the user's cache or anything. I think this should be enough, no?


[1]

+    @BeforeClass
+    public static void setupDownloadServer() throws IOException {
+        File dir = new File(System.getProperty("java.io.tmpdir"), "itw-down");
+        dir.mkdirs();
+        dir.deleteOnExit();
+        redirectErr();
+        downloadServer = ServerAccess.getIndependentInstance(dir.getAbsolutePath(), ServerAccess.findFreePort());
+        redirectErrBack();
+
+        JNLPRuntime.getConfiguration().setProperty(DeploymentConfiguration.KEY_USER_CACHE_DIR, System.getProperty("java.io.tmpdir") + File.separator + "tempcache");

Uses temporary directory as cache

+    }
+
+    @AfterClass
+    public static void teardownDownloadServer() {
+        downloadServer.stop();
+
+        CacheUtil.clearCache();

Clears it afterwards.

+    }

> 
> J.
> 

-- 

Jie Kang


More information about the distro-pkg-dev mailing list