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

Jiri Vanek jvanek at redhat.com
Fri Nov 28 09:52:09 UTC 2014


On 11/27/2014 10:16 PM, Jie Kang wrote:
>
>
> ----- 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

ok. I have overlooked this.

Fair enough then.

But please, be sure you restore
DeploymentConfiguration.KEY_USER_CACHE_DIR back to previous value after run.

J.

>
> +    }
> +
> +    @AfterClass
> +    public static void teardownDownloadServer() {
> +        downloadServer.stop();
> +
> +        CacheUtil.clearCache();
>
> Clears it afterwards.
>
> +    }
>
>>
>> J.
>>
>



More information about the distro-pkg-dev mailing list