We should test for the copying of a file from a local file system and from a remote file system. In both cases the approach should be that we will create a local temporary directory where we will create the new copied files, and we will create temporary unique files on both the local and remote system which we will use as the source of our copy operations. After a file is copied we can check that it exists and that it has the proper contents. Upon testing completion we should remove our temporary files and temporary directory.
Open up a Browser on the FileListTest class. Let's build up some additional support mehods. First, select the #createTempFile method. Let's change it by making a new method where we can pass in the directory we want to use.
| time fname fstream |
time := Time now.
fname := time hhmm24 , time seconds printString , '.tmp'.
(aDirectory fileExists: fname)
ifTrue: [ aDirectory deleteFileNamed: fname].
fstream := aDirectory forceNewFileNamed: fname.
fstream nextPutAll: self tempFileContents.
Select the old #createTempFile method again and find all senders. We changed the signature of the method as well as the object returned. So the only sender (#testFileNameOperations) will need to be modified this way:
Continue on to the next page of second FileList enhancement.
Back to the beginning of this example.productivity toward