public final class MockQueryExecutionInfo extends Object implements QueryExecutionInfo
QueryExecutionInfo
for testing.Modifier and Type | Class and Description |
---|---|
static class |
MockQueryExecutionInfo.Builder |
Modifier and Type | Method and Description |
---|---|
static MockQueryExecutionInfo.Builder |
builder()
Provides a builder for
MockQueryExecutionInfo . |
static MockQueryExecutionInfo |
empty()
Provide an empty
MockMethodExecutionInfo . |
int |
getBatchSize()
Get the size of the batch query.
|
int |
getBindingsSize()
Get the number of the binding.
|
ConnectionInfo |
getConnectionInfo()
Get the associated
ConnectionInfo . |
Object |
getCurrentMappedResult()
Mapped query result available for each-query-result-callback(
ProxyExecutionListener.eachQueryResult(QueryExecutionInfo) ). |
int |
getCurrentResultCount()
Represent Nth
Result . |
Duration |
getExecuteDuration()
Get the time that took queries to execute.
|
Method |
getMethod()
Get the invoked query execution
Method . |
Object[] |
getMethodArgs()
Get the arguments of the invocation.
|
ProxyEventType |
getProxyEventType()
Get the proxy event type for query execution.
|
List<QueryInfo> |
getQueries()
Get the list of
QueryInfo . |
long |
getThreadId()
Get the currently executed thread ID.
|
String |
getThreadName()
Get the currently executed thread name.
|
Throwable |
getThrowable()
Get the thrown exception.
|
ExecutionType |
getType()
Get the type of query execution.
|
ValueStore |
getValueStore()
Retrieve
ValueStore which is associated to the scope of before/after method execution. |
boolean |
isSuccess()
Indicate whether the query execution was successful or not.
|
public static MockQueryExecutionInfo.Builder builder()
MockQueryExecutionInfo
.public static MockQueryExecutionInfo empty()
MockMethodExecutionInfo
.MockMethodExecutionInfo
.public Method getMethod()
QueryExecutionInfo
Method
.getMethod
in interface QueryExecutionInfo
public Object[] getMethodArgs()
QueryExecutionInfo
null
when method is invoked with no argument.getMethodArgs
in interface QueryExecutionInfo
null
if the invoked method did not take any argumentspublic Throwable getThrowable()
QueryExecutionInfo
ProxyExecutionListener.beforeQuery(QueryExecutionInfo)
callback or query execution
did't throw any error, this returns null
.getThrowable
in interface QueryExecutionInfo
public ConnectionInfo getConnectionInfo()
QueryExecutionInfo
ConnectionInfo
.getConnectionInfo
in interface QueryExecutionInfo
public boolean isSuccess()
QueryExecutionInfo
Publisher
returned from Statement.execute()
either received completion
or at least one element is emitted regardless of it has received cancellation.isSuccess
in interface QueryExecutionInfo
public int getBatchSize()
QueryExecutionInfo
Batch.add(String)
.getBatchSize
in interface QueryExecutionInfo
public List<QueryInfo> getQueries()
QueryExecutionInfo
QueryInfo
.getQueries
in interface QueryExecutionInfo
null
.public ExecutionType getType()
QueryExecutionInfo
getType
in interface QueryExecutionInfo
public int getBindingsSize()
QueryExecutionInfo
Statement.add()
.getBindingsSize
in interface QueryExecutionInfo
public Duration getExecuteDuration()
QueryExecutionInfo
Duration is only populated in appropriate phase.
(e.g.: ProxyExecutionListener.afterQuery(QueryExecutionInfo)
)
getExecuteDuration
in interface QueryExecutionInfo
public String getThreadName()
QueryExecutionInfo
getThreadName
in interface QueryExecutionInfo
public long getThreadId()
QueryExecutionInfo
getThreadId
in interface QueryExecutionInfo
public ProxyEventType getProxyEventType()
QueryExecutionInfo
getProxyEventType
in interface QueryExecutionInfo
ProxyEventType.BEFORE_QUERY
, ProxyEventType.AFTER_QUERY
,
or ProxyEventType.EACH_QUERY_RESULT
public int getCurrentResultCount()
QueryExecutionInfo
Result
.
On each query result callback(ProxyExecutionListener.eachQueryResult(QueryExecutionInfo)
),
this value indicates Nth Result
starting 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 of Result
returned by this query execution.getCurrentResultCount
in interface QueryExecutionInfo
public Object getCurrentMappedResult()
QueryExecutionInfo
ProxyExecutionListener.eachQueryResult(QueryExecutionInfo)
).
For before and after query execution(ProxyExecutionListener.beforeQuery(QueryExecutionInfo)
and ProxyExecutionListener.afterQuery(QueryExecutionInfo)
), this returns null
.getCurrentMappedResult
in interface QueryExecutionInfo
public ValueStore getValueStore()
QueryExecutionInfo
ValueStore
which is associated to the scope of before/after method execution.
Mainly used for passing values between ProxyExecutionListener.beforeQuery(QueryExecutionInfo)
and
ProxyExecutionListener.afterQuery(QueryExecutionInfo)
.getValueStore
in interface QueryExecutionInfo
Copyright © 2024. All rights reserved.