public class QueryCounter extends Object
BoundNodes.
One tricky thing about validating query counts in context of testing is in cases where you don't require waiting for a node to respond. In this case it's possible that a user would check count criteria before the node has even processed the message. This class offers the capability to wait a specified amount of time when asserting query arrival counts on nodes.
| Modifier and Type | Class and Description |
|---|---|
static class |
QueryCounter.NotificationMode |
static class |
QueryCounter.QueryCounterBuilder |
| Modifier and Type | Method and Description |
|---|---|
void |
assertNodeCounts(int... counts)
Asserts that the total number of requests received matcher filter criteria matches the expected
count for each node within the configured time period.
|
void |
assertTotalCount(int expected)
Asserts that the total number of requests received matching filter criteria matches the
expected count within the configured time period.
|
static QueryCounter.QueryCounterBuilder |
builder(com.datastax.oss.simulacron.server.BoundTopic<?,?> topic)
Creates a builder that tracks counts for the given
BoundTopic (cluster, dc, node). |
void |
clearCounts()
Clears all counters.
|
public static QueryCounter.QueryCounterBuilder builder(com.datastax.oss.simulacron.server.BoundTopic<?,?> topic)
BoundTopic (cluster, dc, node).public void clearCounts()
public void assertTotalCount(int expected)
public void assertNodeCounts(int... counts)
counts - The expected node counts, with the value at each index matching the expected
count for that node id (i.e. index 0 = node id 0 expected count).Copyright © 2017–2023. All rights reserved.