Announcement Announcement Module
Collapse
No announcement yet.
File Copy Demo Doesn't Copy Files Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • File Copy Demo Doesn't Copy Files

    This may sound like a bit of a dumb question, but why doesn't the File Copy Demo actually copy any files?
    I just git cloned the samples and tried to run org.springframework.integration.samples.filecopy.T extFileCopyTest

    This then just displays the directories.
    Surely something called .filecopy.TextFileCopyTest should actually copy a file right?

    The second problem that I am having is that the directories it displays are not as expected.
    The output I get is:
    Code:
    Input directory is: D:\home\myuser\AppData\Local\Temp\spring-integration-samples\input
    Output directory is: D:\home\myuser\AppData\Local\Temp\spring-integration-samples\output
    ===================================================
    Why is it outputting that Temp dir and not referencing my project directory?

  • #2
    You can change the directory, but by default it's using the temp directory. Notice the "directory" attributes in this file:
    https://github.com/SpringSource/spri...yDemo-text.xml

    Comment


    • #3
      Thanks.
      It was due to Intellij IDEA being not so intelligent and changing "file:${java.io.tmpdir}/spri...." to look like ""file:$../spri...." !!

      I'm still a bit surprised that the test doesn't actually copy any files though.

      For what its worth, org.springframework.integration.samples.filecopy.H andler is a bit too generic of a name.
      And there is no javadocs on any of the methods, which makes it harder to try and work out what is supposed to happen (even thought the code is really simple).
      Is this class supposed to just return the upper case of a file name?
      Why is it in a package called filecopy then?

      It doesn't get called by any of the tests either, which is more confusing.

      Comment


      • #4
        It's becoming a little clearer now.
        Since nothing was being copied when I first ran the tests, it wasn't immediately clear that it was the spring magic beans that was doing the copying.
        It looked like the Handler and the FileCopyDemoCommon classes were supposed to be doing it!

        The readme file should clarify this with some text like: "Copy the ..\samples\basic\file\input directory to %TEMP%\spring-integration-samples and create a directory named 'output' next to it".

        I also noticed that org.springframework.integration.samples.filecopy.F ileBasedFileCopyTest#testFileBasedCopy has a Thread Sleep for 5 seconds, however, the input poller (in /META-INF/spring/integration/fileCopyDemo-file.xml) also has a poll time of 5 seconds.
        This means that not all the files are copied in the test.

        The poller needs to have a poll time of 1 second (or less) since there are 5 files in the sample input directory.

        Comment

        Working...
        X