Class MockQueryExecutionInfo
java.lang.Object
io.r2dbc.proxy.test.MockQueryExecutionInfo
- All Implemented Interfaces:
QueryExecutionInfo
Mock implementation of
QueryExecutionInfo for testing.- Author:
- Tadaya Tsuyukubo
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Provides a builder forMockQueryExecutionInfo.static MockQueryExecutionInfoempty()Provide an emptyMockMethodExecutionInfo.intGet the size of the batch query.intGet the number of the binding.Get the associatedConnectionInfo.Mapped query result available for each-query-result-callback(ProxyExecutionListener.eachQueryResult(QueryExecutionInfo)).intRepresent NthResult.Get the time that took queries to execute.Get the invoked query executionMethod.Object[]Get the arguments of the invocation.Get the proxy event type for query execution.Get the list ofQueryInfo.longGet the currently executed thread ID.Get the currently executed thread name.Get the thrown exception.getType()Get the type of query execution.RetrieveValueStorewhich is associated to the scope of before/after method execution.booleanIndicate whether the query execution was successful or not.
-
Method Details
-
builder
Provides a builder forMockQueryExecutionInfo.- Returns:
- builder
-
empty
Provide an emptyMockMethodExecutionInfo.- Returns:
- a
MockMethodExecutionInfo.
-
getMethod
Description copied from interface:QueryExecutionInfoGet the invoked query executionMethod.- Specified by:
getMethodin interfaceQueryExecutionInfo- Returns:
- invoked method
-
getMethodArgs
Description copied from interface:QueryExecutionInfoGet the arguments of the invocation. This can benullwhen method is invoked with no argument.- Specified by:
getMethodArgsin interfaceQueryExecutionInfo- Returns:
- argument lists or
nullif the invoked method did not take any arguments
-
getThrowable
Description copied from interface:QueryExecutionInfoGet the thrown exception. ForProxyExecutionListener.beforeQuery(QueryExecutionInfo)callback or query execution did't throw any error, this returnsnull.- Specified by:
getThrowablein interfaceQueryExecutionInfo- Returns:
- thrown exception
-
getConnectionInfo
Description copied from interface:QueryExecutionInfoGet the associatedConnectionInfo.- Specified by:
getConnectionInfoin interfaceQueryExecutionInfo- Returns:
- connection info
-
isSuccess
public boolean isSuccess()Description copied from interface:QueryExecutionInfoIndicate whether the query execution was successful or not. Contains valid value only after the query execution. Query execution is considered successful when thePublisherreturned fromStatement.execute()either received completion or at least one element is emitted regardless of it has received cancellation.- Specified by:
isSuccessin interfaceQueryExecutionInfo- Returns:
- true when query has successfully executed
-
getBatchSize
public int getBatchSize()Description copied from interface:QueryExecutionInfoGet the size of the batch query. i.e. Number of the calls ofBatch.add(String).- Specified by:
getBatchSizein interfaceQueryExecutionInfo- Returns:
- batch size
-
getQueries
Description copied from interface:QueryExecutionInfoGet the list ofQueryInfo.- Specified by:
getQueriesin interfaceQueryExecutionInfo- Returns:
- list of queries. This will NOT return
null.
-
getType
Description copied from interface:QueryExecutionInfoGet the type of query execution.- Specified by:
getTypein interfaceQueryExecutionInfo- Returns:
- type of query execution
-
getBindingsSize
public int getBindingsSize()Description copied from interface:QueryExecutionInfoGet the number of the binding. i.e. Number of the calls ofStatement.add().- Specified by:
getBindingsSizein interfaceQueryExecutionInfo- Returns:
- size of the binding
-
getExecuteDuration
Description copied from interface:QueryExecutionInfoGet the time that took queries to execute.Duration is only populated in appropriate phase. (e.g.:
ProxyExecutionListener.afterQuery(QueryExecutionInfo))- Specified by:
getExecuteDurationin interfaceQueryExecutionInfo- Returns:
- query execution duration
-
getThreadName
Description copied from interface:QueryExecutionInfoGet the currently executed thread name.- Specified by:
getThreadNamein interfaceQueryExecutionInfo- Returns:
- thread name
-
getThreadId
public long getThreadId()Description copied from interface:QueryExecutionInfoGet the currently executed thread ID.- Specified by:
getThreadIdin interfaceQueryExecutionInfo- Returns:
- thread ID
-
getProxyEventType
Description copied from interface:QueryExecutionInfoGet the proxy event type for query execution.- Specified by:
getProxyEventTypein interfaceQueryExecutionInfo- Returns:
- proxy event type; one of
ProxyEventType.BEFORE_QUERY,ProxyEventType.AFTER_QUERY, orProxyEventType.EACH_QUERY_RESULT
-
getCurrentResultCount
public int getCurrentResultCount()Description copied from interface:QueryExecutionInfoRepresent NthResult. On each query result callback(ProxyExecutionListener.eachQueryResult(QueryExecutionInfo)), this value indicates NthResultstarting from 1. (1st query result, 2nd query result, 3rd, 4th,...). This returns 0 for before query execution(ProxyExecutionListener.beforeQuery(QueryExecutionInfo)). For after query execution(ProxyExecutionListener.afterQuery(QueryExecutionInfo)), this returns total number ofResultreturned by this query execution.- Specified by:
getCurrentResultCountin interfaceQueryExecutionInfo- Returns:
- Nth number of query result
-
getCurrentMappedResult
Description copied from interface:QueryExecutionInfoMapped query result available for each-query-result-callback(ProxyExecutionListener.eachQueryResult(QueryExecutionInfo)). For before and after query execution(ProxyExecutionListener.beforeQuery(QueryExecutionInfo)andProxyExecutionListener.afterQuery(QueryExecutionInfo)), this returnsnull.- Specified by:
getCurrentMappedResultin interfaceQueryExecutionInfo- Returns:
- currently mapped result
-
getValueStore
Description copied from interface:QueryExecutionInfoRetrieveValueStorewhich is associated to the scope of before/after method execution. Mainly used for passing values betweenProxyExecutionListener.beforeQuery(QueryExecutionInfo)andProxyExecutionListener.afterQuery(QueryExecutionInfo).- Specified by:
getValueStorein interfaceQueryExecutionInfo- Returns:
- value store
-