Package com.attivio.client
Class MockSearchClient
- java.lang.Object
-
- com.attivio.client.MockSearchClient
-
- All Implemented Interfaces:
SearchClient
public class MockSearchClient extends java.lang.Object implements SearchClient
A mockSearchClient
that returns a preset response regardless of search request. Documents can be preset by editing thedocuments
field or callingadd(com.attivio.sdk.search.SearchDocument...)
. If more complicated responses are required theresponse
field should be preset. Setting this field invalidates any set documents (documents can be set directly in theresponse
)
-
-
Field Summary
Fields Modifier and Type Field Description SearchDocumentList
documents
The preset documents to returnQueryResponse
response
PresetQueryResponse
to return on any search request.-
Fields inherited from interface com.attivio.sdk.client.SearchClient
DEFAULT_SEARCH_WORKFLOW, ENDPOINT
-
-
Constructor Summary
Constructors Constructor Description MockSearchClient()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(SearchDocument... docs)
Add documents to be returned on a search callSchema
getDefaultSchema()
Gets the schema named 'default' which is the most commonly one used throughout the system.SearchDocument
getDocumentById(java.lang.String documentId)
Gets a document by a specific document IdSearchDocumentList
getDocuments()
QueryResponse
getResponse()
Schema
getSchema(java.lang.String schemaName)
Get a named schema in the system or null if it does not exist.void
reset()
Clear the documents and/or response returned on a search callQueryResponse
search(QueryRequest query)
Sends the query to the Attivio search and returns the result.StreamingQueryResponse
search(StreamingQueryRequest req)
Sends the streaming query request to the Attivio search and returns the result.QueryResponse
search(java.lang.String query)
Searches using a query string only.void
setClientWorkflow(java.lang.String workflow)
Sets the default client workflow to use for this search client.void
setDocuments(SearchDocumentList documents)
void
setResponse(QueryResponse response)
-
-
-
Field Detail
-
documents
public SearchDocumentList documents
The preset documents to return
-
response
public QueryResponse response
PresetQueryResponse
to return on any search request. This takes precendence over thedocuments
field when set
-
-
Method Detail
-
reset
public void reset()
Clear the documents and/or response returned on a search call
-
add
public void add(SearchDocument... docs)
Add documents to be returned on a search call- Parameters:
docs
-
-
getDocuments
public SearchDocumentList getDocuments()
-
setDocuments
public void setDocuments(SearchDocumentList documents)
-
getResponse
public QueryResponse getResponse()
-
setResponse
public void setResponse(QueryResponse response)
-
search
public QueryResponse search(QueryRequest query)
Description copied from interface:SearchClient
Sends the query to the Attivio search and returns the result.- Specified by:
search
in interfaceSearchClient
- Parameters:
query
- the query to send- Returns:
- query response
-
getDocumentById
public SearchDocument getDocumentById(java.lang.String documentId)
Description copied from interface:SearchClient
Gets a document by a specific document Id- Specified by:
getDocumentById
in interfaceSearchClient
- Parameters:
documentId
- ID of the document that will be returned- Returns:
- document that was requested or null if does not exist.
-
search
public QueryResponse search(java.lang.String query)
Description copied from interface:SearchClient
Searches using a query string only. The query is assumed to be in the simple Attivio query language.- Specified by:
search
in interfaceSearchClient
- Parameters:
query
- the query to use- Returns:
- the query response
-
getDefaultSchema
public Schema getDefaultSchema()
Description copied from interface:SearchClient
Gets the schema named 'default' which is the most commonly one used throughout the system.- Specified by:
getDefaultSchema
in interfaceSearchClient
-
getSchema
public Schema getSchema(java.lang.String schemaName)
Description copied from interface:SearchClient
Get a named schema in the system or null if it does not exist.- Specified by:
getSchema
in interfaceSearchClient
-
setClientWorkflow
public void setClientWorkflow(java.lang.String workflow)
Description copied from interface:SearchClient
Sets the default client workflow to use for this search client.- Specified by:
setClientWorkflow
in interfaceSearchClient
- Parameters:
workflow
- the workflow name to use
-
search
public StreamingQueryResponse search(StreamingQueryRequest req)
Description copied from interface:SearchClient
Sends the streaming query request to the Attivio search and returns the result.- Specified by:
search
in interfaceSearchClient
- Parameters:
req
- the streaming query request to send- Returns:
- streaming query response
-
-