Package com.attivio.sdk.service
Class MockIngestApi
- java.lang.Object
-
- com.attivio.sdk.service.MockIngestApi
-
- All Implemented Interfaces:
IngestApi
public class MockIngestApi extends java.lang.Object implements IngestApi
A mock implementation ofIngestApi
that keeps a list of all messages sent to it. Messages may be retrieved withgetMessage(Class)
and the list may be reset withreset()
. If a MockIngestApi is in use via a standardContentFeeder
, you can get the mock api in use viaServiceFactory.getService(MockIngestApi.class)
.The public member
msgs
can also be accessed directly. Any test which is usingmsgs
to check test conditions should callreset()
at the beginning of the test as the instance retrieved by the test may have side-effects from previous tests.This class simulates the processing of messages by posting CREATED and COMPLETED audit records for each documents. This allows it to be used by a ContentFeeder. The
getCompletionDelay()
field controls the number of milliseconds to delay the posting of the COMPLETED audit record after the CREATED is posted. The completion delay is set to0
whenever thereset()
method is called.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MockIngestApi.MockAuditDetail
-
Field Summary
Fields Modifier and Type Field Description java.util.ArrayList<PlatformMessage>
msgs
-
Constructor Summary
Constructors Constructor Description MockIngestApi()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
feed(PlatformMessage msg)
long
getCompletionDelay()
<T> T
getMessage(java.lang.Class<T> clazz)
Get the first message of the typeclazz
java.util.List<PlatformMessage>
getMessages()
void
reset()
void
setCompletionDelay(long completionDelay)
Sets the new delay.
-
-
-
Field Detail
-
msgs
public java.util.ArrayList<PlatformMessage> msgs
-
-
Constructor Detail
-
MockIngestApi
public MockIngestApi() throws AttivioException
- Throws:
AttivioException
-
-
Method Detail
-
feed
public void feed(PlatformMessage msg) throws AttivioException
- Specified by:
feed
in interfaceIngestApi
- Throws:
AttivioException
-
getMessage
public <T> T getMessage(java.lang.Class<T> clazz)
Get the first message of the typeclazz
- Parameters:
clazz
-- Returns:
-
getMessages
public java.util.List<PlatformMessage> getMessages()
-
reset
public void reset()
-
getCompletionDelay
public long getCompletionDelay()
- Returns:
- the number of milliseconds before messages are COMPLETED.
-
setCompletionDelay
public void setCompletionDelay(long completionDelay)
Sets the new delay. Note, the delay is reset to 0 wheneverreset()
is called.- Parameters:
completionDelay
-
-
-