Class MockIngestClient
- java.lang.Object
-
- com.attivio.sdk.test.MockIngestClient
-
- All Implemented Interfaces:
DocumentOutputClient
,SecurityFeeder
public class MockIngestClient extends java.lang.Object implements DocumentOutputClient
-
-
Constructor Summary
Constructors Constructor Description MockIngestClient()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
bulkUpdate(BulkUpdate message)
Sendmessage
to AIE.void
clear()
boolean
containsDocumentWithId(java.lang.String docId)
void
delete(java.lang.String... ids)
Delete a series of documents from AIE by document id.void
delete(java.util.Collection<java.lang.String> ids)
SeeDocumentOutputClient.delete(String...)
for documentation.void
deleteByQuery(java.lang.String queryWorkflows, Query query)
Delete all documents that match theQuery
.void
deletePrincipal(AttivioPrincipalKey key)
Deletes a principal from the index.void
endMessageGroup()
Ends the current message group (if any).void
feed(IngestDocument... docs)
Senddocs
to AIE.void
feed(IngestDocument doc, AttivioAcl acl)
Sendsdoc
to the document receiver with the given ACL.void
feed(AttivioPrincipal principal)
Ingests an AttivioPrincipal.void
feed(java.lang.Iterable<IngestDocument> docs)
Senddocs
to AIE.java.util.List<BulkUpdate>
getBulkList()
java.util.List<IngestDocument>
getDocumentList()
long
getDocumentsSent()
IngestDocument
getDocumentWithId(java.lang.String docId)
boolean
isMessageGroupInProgress()
void
startMessageGroup()
Starts a group of messages that will be processed together.
-
-
-
Method Detail
-
delete
public void delete(java.lang.String... ids) throws AttivioException
Description copied from interface:DocumentOutputClient
Delete a series of documents from AIE by document id.If batching is enabled, then these delete messages will be batched along with any fed documents. If these deletes are meant to apply to uncommitted documents previously fed with this ContentFeeder, then those documents must be committed to the index before this delete is called. When ordered commits is enabled, this entails calling:
contentFeeder.commit(); contentFeeder.waitForCompletion(); contentFeeder.delete("id1",...);
When ordered commits is disabled, it entails calling:contentFeeder.waitForCompletion(); contentFeeder.commit(); contentFeeder.waitForCompletion(); contentFeeder.delete("id1",...);
- Specified by:
delete
in interfaceDocumentOutputClient
- Parameters:
ids
- The document IDs of the documents to delete.- Throws:
AttivioException
- if sending of deletes fails.
-
delete
public void delete(java.util.Collection<java.lang.String> ids) throws AttivioException
Description copied from interface:DocumentOutputClient
SeeDocumentOutputClient.delete(String...)
for documentation.- Specified by:
delete
in interfaceDocumentOutputClient
- Throws:
AttivioException
-
deleteByQuery
public void deleteByQuery(java.lang.String queryWorkflows, Query query) throws AttivioException
Description copied from interface:DocumentOutputClient
Delete all documents that match theQuery
.If documents are currently batched up, then those documents will be sent along with this delete.
Use
DocumentOutputClient.bulkUpdate(BulkUpdate)
to feed more complicated delete queries. If these deletes are meant to apply to uncommitted documents previously fed with this ContentFeeder, then those documents must be committed to the index before this delete is called. When ordered commits is enabled, this entails calling:contentFeeder.commit(); contentFeeder.waitForCompletion(); contentFeeder.delete("id1",...);
When ordered commits is disabled, it entails calling:contentFeeder.waitForCompletion(); contentFeeder.commit(); contentFeeder.waitForCompletion(); contentFeeder.delete(...);
- Specified by:
deleteByQuery
in interfaceDocumentOutputClient
- Parameters:
queryWorkflows
- the query workflow or null if none neededquery
- query to delete by- Throws:
AttivioException
-
bulkUpdate
public void bulkUpdate(BulkUpdate message)
Description copied from interface:DocumentOutputClient
Sendmessage
to AIE.- Specified by:
bulkUpdate
in interfaceDocumentOutputClient
-
feed
public void feed(IngestDocument... docs) throws AttivioException
Description copied from interface:DocumentOutputClient
Senddocs
to AIE.- Specified by:
feed
in interfaceDocumentOutputClient
- Parameters:
docs
- the documents to send.- Throws:
AttivioException
-
feed
public void feed(java.lang.Iterable<IngestDocument> docs) throws AttivioException
Description copied from interface:DocumentOutputClient
Senddocs
to AIE.- Specified by:
feed
in interfaceDocumentOutputClient
- Parameters:
docs
- the documents to send.- Throws:
AttivioException
-
getDocumentsSent
public long getDocumentsSent()
-
isMessageGroupInProgress
public boolean isMessageGroupInProgress()
- Specified by:
isMessageGroupInProgress
in interfaceDocumentOutputClient
- Returns:
true
if a message group has been started and not yet ended.
-
startMessageGroup
public void startMessageGroup() throws AttivioException
Description copied from interface:DocumentOutputClient
Starts a group of messages that will be processed together. All documents and deletes in the group will be processed together and in the order created. NOTE: failure to end a started message group will cause the last message of the group in progress to not be sent.- Specified by:
startMessageGroup
in interfaceDocumentOutputClient
- Throws:
AttivioException
-
endMessageGroup
public void endMessageGroup() throws AttivioException
Description copied from interface:DocumentOutputClient
Ends the current message group (if any). The next feed or delete will not be part of any group unlessDocumentOutputClient.startMessageGroup()
is called again.- Specified by:
endMessageGroup
in interfaceDocumentOutputClient
- Throws:
AttivioException
-
feed
public void feed(IngestDocument doc, AttivioAcl acl) throws AttivioException
Description copied from interface:SecurityFeeder
Sendsdoc
to the document receiver with the given ACL.- Specified by:
feed
in interfaceSecurityFeeder
- Parameters:
doc
- the documentacl
- the ACL- Throws:
AttivioException
-
feed
public void feed(AttivioPrincipal principal) throws AttivioException
Description copied from interface:SecurityFeeder
Ingests an AttivioPrincipal. Any existing data for the principal and its associations will be deleted.- Specified by:
feed
in interfaceSecurityFeeder
- Parameters:
principal
- the principal- Throws:
AttivioException
-
deletePrincipal
public void deletePrincipal(AttivioPrincipalKey key) throws AttivioException
Description copied from interface:SecurityFeeder
Deletes a principal from the index.- Specified by:
deletePrincipal
in interfaceSecurityFeeder
- Parameters:
key
- unique ID of the principal- Throws:
AttivioException
-
containsDocumentWithId
public boolean containsDocumentWithId(java.lang.String docId)
-
getDocumentWithId
public IngestDocument getDocumentWithId(java.lang.String docId)
-
getDocumentList
public java.util.List<IngestDocument> getDocumentList()
-
getBulkList
public java.util.List<BulkUpdate> getBulkList()
-
clear
public void clear()
-
-