Class MockStorer

All Implemented Interfaces:
Storer, Comparable<Storer>

public class MockStorer extends FSStorer
This is basically a FSStorer but with a flag that if active makes the store method to return an exception
Since:
8.4.2
Author:
Marco Meschieri - LogicalDOC
  • Constructor Details

    • MockStorer

      public MockStorer()
  • Method Details

    • isRaiseError

      public boolean isRaiseError()
    • setErrorOnStore

      public void setErrorOnStore(boolean errorOnStore)
    • store

      public void store(File file, long docId, String resource) throws IOException
      Description copied from interface: Storer
      Stores a file
      Specified by:
      store in interface Storer
      Overrides:
      store in class FSStorer
      Parameters:
      file - the file to store
      docId - identifier of the document
      resource - name of the resource
      Throws:
      IOException - the content cannot be stored
      See Also:
    • store

      public void store(InputStream stream, long docId, String resource) throws IOException
      Description copied from interface: Storer
      This method has to store a resource in the document's container. The location where (DBMS, Filesystem, other) the document should be stored is defined by the concrete implementation. It is possible to store a new document or a new version of an existing document.
      Specified by:
      store in interface Storer
      Overrides:
      store in class FSStorer
      Parameters:
      stream - Document as InputStream
      docId - The document identifier
      resource - Name of the resource to be stored
      Throws:
      IOException - the content cannot be stored
    • getStream

      public InputStream getStream(long docId, String resource) throws IOException
      Description copied from interface: Storer
      Obtains the document's content for the specified resource
      Specified by:
      getStream in interface Storer
      Overrides:
      getStream in class FSStorer
      Parameters:
      docId - The document's identifier
      resource - Name of the resource
      Returns:
      The document file's content
      Throws:
      IOException - cannot open the stream
    • isUseDummyFile

      public boolean isUseDummyFile()
    • setUseDummyFile

      public void setUseDummyFile(boolean useDummyFile)
    • moveResourcesToStore

      public int moveResourcesToStore(long docId, int targetStorageId) throws IOException
      Description copied from interface: Storer
      Moves all the resources of a document from it's original location to a different storage
      Specified by:
      moveResourcesToStore in interface Storer
      Overrides:
      moveResourcesToStore in class FSStorer
      Parameters:
      docId - identifier of the document to process
      targetStorageId - identifier of the storage that will receive the files
      Returns:
      number of moved resources
      Throws:
      IOException - In case of error during the process
    • getDummyFile

      public File getDummyFile()
    • setDummyFile

      public void setDummyFile(File dummyFile)