Class FilesystemTestResourceProvider

  • All Implemented Interfaces:
    TestResourceProvider

    public class FilesystemTestResourceProvider
    extends AbstractTestResourceProvider
    A resource provider which reads test files from the filesystem, either from one or more flat directories or optionally in a recursive way.
    Author:
    Rene Schneider - initial API and implementation
    • Constructor Detail

      • FilesystemTestResourceProvider

        public FilesystemTestResourceProvider()
    • Method Detail

      • addRecursively

        public void addRecursively​(java.io.File aResourceFile)
        Adds the given resource recursively, that is if it is a directory all enclosed directories and files are recursively included as well.
        Parameters:
        aResourceFile - Resource to be added.
      • addAllRecursively

        public void addAllRecursively​(java.util.Collection<? extends java.io.File> someResourceFiles)
        Adds the given resources recursively, that is if one of them is a directory all enclosed directories and files of it are recursively included as well.
        Parameters:
        someResourceFiles - Resources to be added.
      • addFile

        public void addFile​(java.io.File aResourceFile)
        Adds the given resource if it is a file.
        Parameters:
        aResourceFile -
      • openResource

        public java.io.InputStream openResource​(TestResource aResourceName)
        Description copied from interface: TestResourceProvider
        Opens a specific named resource. This should return an InputStream at the start of the data of the respective resources, and it is only expected to work if the resource is one of those enumerated by a call to TestResourceProvider.getResourceNames().
        Parameters:
        aResourceName - the resource to be opened
        Returns:
        an InputStream to read the resource
      • closeResource

        public void closeResource​(TestResource aResourceName,
                                  java.io.InputStream aResourceStream)
                           throws java.io.IOException
        Description copied from interface: TestResourceProvider
        Closes a specified resources' stream (and all the stuff opened for this stream in the background).
        Parameters:
        aResourceName - the resource to be closed
        aResourceStream - the resource stream to close
        Throws:
        java.io.IOException