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 mockSearchClientthat returns a preset response regardless of search request. Documents can be preset by editing thedocumentsfield or callingadd(com.attivio.sdk.search.SearchDocument...). If more complicated responses are required theresponsefield 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 SearchDocumentListdocumentsThe preset documents to returnQueryResponseresponsePresetQueryResponseto 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 voidadd(SearchDocument... docs)Add documents to be returned on a search callSchemagetDefaultSchema()Gets the schema named 'default' which is the most commonly one used throughout the system.SearchDocumentgetDocumentById(java.lang.String documentId)Gets a document by a specific document IdSearchDocumentListgetDocuments()QueryResponsegetResponse()SchemagetSchema(java.lang.String schemaName)Get a named schema in the system or null if it does not exist.voidreset()Clear the documents and/or response returned on a search callQueryResponsesearch(QueryRequest query)Sends the query to the Attivio search and returns the result.StreamingQueryResponsesearch(StreamingQueryRequest req)Sends the streaming query request to the Attivio search and returns the result.QueryResponsesearch(java.lang.String query)Searches using a query string only.voidsetClientWorkflow(java.lang.String workflow)Sets the default client workflow to use for this search client.voidsetDocuments(SearchDocumentList documents)voidsetResponse(QueryResponse response)
-
-
-
Field Detail
-
documents
public SearchDocumentList documents
The preset documents to return
-
response
public QueryResponse response
PresetQueryResponseto return on any search request. This takes precendence over thedocumentsfield 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:SearchClientSends the query to the Attivio search and returns the result.- Specified by:
searchin interfaceSearchClient- Parameters:
query- the query to send- Returns:
- query response
-
getDocumentById
public SearchDocument getDocumentById(java.lang.String documentId)
Description copied from interface:SearchClientGets a document by a specific document Id- Specified by:
getDocumentByIdin 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:SearchClientSearches using a query string only. The query is assumed to be in the simple Attivio query language.- Specified by:
searchin interfaceSearchClient- Parameters:
query- the query to use- Returns:
- the query response
-
getDefaultSchema
public Schema getDefaultSchema()
Description copied from interface:SearchClientGets the schema named 'default' which is the most commonly one used throughout the system.- Specified by:
getDefaultSchemain interfaceSearchClient
-
getSchema
public Schema getSchema(java.lang.String schemaName)
Description copied from interface:SearchClientGet a named schema in the system or null if it does not exist.- Specified by:
getSchemain interfaceSearchClient
-
setClientWorkflow
public void setClientWorkflow(java.lang.String workflow)
Description copied from interface:SearchClientSets the default client workflow to use for this search client.- Specified by:
setClientWorkflowin interfaceSearchClient- Parameters:
workflow- the workflow name to use
-
search
public StreamingQueryResponse search(StreamingQueryRequest req)
Description copied from interface:SearchClientSends the streaming query request to the Attivio search and returns the result.- Specified by:
searchin interfaceSearchClient- Parameters:
req- the streaming query request to send- Returns:
- streaming query response
-
-