On Mar 13, 2009, at 12:01 PM, Thomas Mortagne wrote: > On Fri, Mar 13, 2009 at 11:46, Vincent Massol <[email protected]> > wrote: >> >> On Mar 13, 2009, at 11:31 AM, Sergiu Dumitriu wrote: >> >>> Vincent Massol wrote: >>>> Hi Sergiu, >>>> >>>> On Mar 13, 2009, at 12:38 AM, sdumitriu (SVN) wrote: >>>> >>>>> Author: sdumitriu >>>>> Date: 2009-03-13 00:38:08 +0100 (Fri, 13 Mar 2009) >>>>> New Revision: 17602 >>>>> >>>>> Modified: >>>>> platform/core/trunk/xwiki-cache/xwiki-cache-tests/src/main/java/ >>>>> org/xwiki/cache/tests/AbstractTestCache.java >>>>> platform/core/trunk/xwiki-containers/xwiki-container-api/src/ >>>>> main/ >>>>> java/org/xwiki/container/ApplicationContext.java >>>>> platform/core/trunk/xwiki-containers/xwiki-container-portlet/src/ >>>>> main/java/org/xwiki/container/portlet/ >>>>> PortletApplicationContext.java >>>>> platform/core/trunk/xwiki-containers/xwiki-container-servlet/src/ >>>>> main/java/org/xwiki/container/servlet/ >>>>> ServletApplicationContext.java >>>>> platform/core/trunk/xwiki-core/src/test/java/com/xpn/xwiki/test/ >>>>> TestApplicationContext.java >>>>> Log: >>>>> XWIKI-3312: Add a getTemporaryDirectory() method to >>>>> ApplicationContext >>>>> Done. >>>>> Patch submitted by Dan Miron, enhanced and extended. >>>>> >>>>> >>>>> Modified: platform/core/trunk/xwiki-cache/xwiki-cache-tests/src/ >>>>> main/ >>>>> java/org/xwiki/cache/tests/AbstractTestCache.java >>>>> = >>>>> ================================================================== >>>>> --- platform/core/trunk/xwiki-cache/xwiki-cache-tests/src/main/ >>>>> java/ >>>>> org/xwiki/cache/tests/AbstractTestCache.java 2009-03-12 >>>>> 23:03:56 UTC >>>>> (rev 17601) >>>>> +++ platform/core/trunk/xwiki-cache/xwiki-cache-tests/src/main/ >>>>> java/ >>>>> org/xwiki/cache/tests/AbstractTestCache.java 2009-03-12 >>>>> 23:38:08 UTC >>>>> (rev 17602) >>>>> @@ -19,6 +19,7 @@ >>>>> */ >>>>> package org.xwiki.cache.tests; >>>>> >>>>> +import java.io.File; >>>>> import java.io.InputStream; >>>>> import java.net.MalformedURLException; >>>>> import java.net.URL; >>>>> @@ -130,6 +131,21 @@ >>>>> } >>>>> >>>>> /** >>>>> + * {...@inheritdoc} >>>>> + * >>>>> + * @see >>>>> org.xwiki.container.ApplicationContext#getTemporaryDirectory() >>>>> + */ >>>>> + public File getTemporaryDirectory() >>>>> + { >>>>> + try { >>>>> + // The system temporary directory is a good place for >>>>> temporary test data. >>>>> + return new >>>>> File(System.getProperty("java.io.tmpdir")); >>>>> + } catch (SecurityException e) { >>>>> + return new File("."); >>>>> + } >>>>> + } >>>> >>>> I don't understand why you had to modify the cache module. >>> >>> Because it implements ApplicationContext, don't ask me why it does >>> that... I was pretty surprised by this also. >> >> Thomas? This looks wrong and it certainly is since there's code >> duplication. > > The cache test implement ApplicationContext because cache components > use it to get configuration files, it's a mock.
Sergiu, I suggest to throw a runtime exception saying "not implemented" instead, wdyt? Thanks -Vincent _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs

