Package com.logicaldoc.core.store

# Class MockStore

java.lang.Object
com.logicaldoc.core.store.AbstractStore
com.logicaldoc.core.store.FSStore
com.logicaldoc.core.store.MockStore

All Implemented Interfaces:
  `Store`, `Comparable<Store>`

public class MockStore extends FSStore
This is basically a `FSStore` but with a flag that if active makes the store method to return an exception

Since:
  8.4.2
Author:
  Marco Meschieri - LogicalDOC

## Constructor Summary

Constructors
Constructor
Description
`MockStore()`

## Method Summary

Modifier and Type
Method
Description
`File`
`getDummyFile()`
`InputStream`
`getStream(StoreResource resource)`
Obtains the document's content for the specified resource
`boolean`
`isRaiseError()`
`boolean`
`isUseDummyFile()`
`int`
`moveResourcesToStore(long docId, int targetStoreId)`
Moves all the resources of a document from it's original location to a different store
`void`
`setDummyFile(File dummyFile)`
`void`
`setErrorOnStore(boolean errorOnStore)`
`void`
`setUseDummyFile(boolean useDummyFile)`
`void`
`store(File file, StoreResource resource)`
Stores a file
`void`
`store(InputStream stream, StoreResource resource)`
This method has to store a resource in the document's container.

### Methods inherited from class com.logicaldoc.core.store.FSStore

`delete, delete, exists, getBytes, getContainer, getParameterNames, getRoot, getTotalSize, listResources, size, writeToFile`

### Methods inherited from class com.logicaldoc.core.store.AbstractStore

`compareTo, destroy, equals, getBytes, getConfig, getId, getParameters, getStoreDefinitions, getString, hashCode, init, isEnabled, newStore, setConfig, setId, test, toString, writeToStream, writeToStream`

### Methods inherited from class java.lang.Object

`getClass, notify, notifyAll, wait, wait, wait`

## Constructor Details

### MockStore

public MockStore()

## Method Details

### isRaiseError

public boolean isRaiseError()

### setErrorOnStore

public void setErrorOnStore(boolean errorOnStore)

### store

public void store(File file, StoreResource resource) throws IOException
Description copied from interface: `Store`
Stores a file

Specified by:
  `store` in interface `Store`
Overrides:
  `store` in class `FSStore`
Parameters:
  `file` - the file to store
  `resource` - Resource to be stored, make sure to provide the right document's ID
Throws:
  `IOException` - the content cannot be stored

### store

public void store(InputStream stream, StoreResource resource) throws IOException
Description copied from interface: `Store`
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 `Store`
Overrides:
  `store` in class `FSStore`
Parameters:
  `stream` - Document as InputStream
  `resource` - Resource to be stored, make sure to provide the right document's ID
Throws:
  `IOException` - the content cannot be stored

### getStream

public InputStream getStream(StoreResource resource) throws IOException
Description copied from interface: `Store`
Obtains the document's content for the specified resource

Specified by:
  `getStream` in interface `Store`
Overrides:
  `getStream` in class `FSStore`
Parameters:
  `resource` - 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 targetStoreId) throws IOException
Description copied from interface: `Store`
Moves all the resources of a document from it's original location to a different store

Specified by:
  `moveResourcesToStore` in interface `Store`
Overrides:
  `moveResourcesToStore` in class `FSStore`
Parameters:
  `docId` - identifier of the document to process
  `targetStoreId` - identifier of the store 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)