On Fri, Mar 26, 2010 at 9:46 AM, Jim Talbut <jtal...@spudsoft.co.uk> wrote:
> On 26/03/2010 08:12, Claus Ibsen wrote:
>>
>> Its your stupidity to store files you want to keep in the TEMP folder.
>>
>
> I don't see much point in hurling abuse about it: you accept that your code
> shouldn't delete files that it didn't create and I'll accept that I ought to
> organise my files better.
> Deal?
> At least I have a clean slate to work from now :)
>
>> The test is supposed to be run manually and the test was disabled. But
>> unfortunately JUnit is so lame that it fails if a Test class have no
>> testXXX method and thus a testDummy was added. Which causes it to run
>> the setup method. I have fixed that so it wont delete the TEMP folder.
>>
>
> Although it is much less likely to affect anyone your fix is still making
> assumptions and absolutely deleting a hardcoded path (and then not deleting
> the path it creates after its finished).
> You've also still got possible permissions problems because of the hardcoded
> path (though again, less likely to be affected because default permissions
> on Windows will allow you to create C:\Tmp even though they shouldn't).
> I prefer something like this:
>
>    private String getUniqueTempDir( ) {
>        try {
>            File tempFile = java.io.File.createTempFile(
> "FileConsumerAbsoluteRootPathDefaultMoveTest", null );
>            tempFile.delete();
>            return tempFile.getAbsolutePath();
>        } catch( Exception ex ) {
>            return null;
>        }
>    }
>
>   �...@override
>    protected void setUp() throws Exception {
>        base = getUniqueTempDir();
>        deleteDirectory(base);
>        super.setUp();
>    }
>
>   �...@override
>    protected void tearDown() throws Exception {
>        super.tearDown();
>        deleteDirectory(base);
>    }
>
> Jim
>
>

The test is a manual test to test issues on Windows about using absolute path.
The test is only supposed to be run manually when we got reports about
issues on Windows with the file component.



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Reply via email to