use of com.datastax.oss.driver.api.core.metadata.NodeState in project spring-boot by spring-projects.
the class CassandraDriverReactiveHealthIndicatorTests method mockCqlSessionWithNodeState.
private CqlSession mockCqlSessionWithNodeState(NodeState... nodeStates) {
CqlSession session = mock(CqlSession.class);
Metadata metadata = mock(Metadata.class);
List<Node> nodes = new ArrayList<>();
for (NodeState nodeState : nodeStates) {
Node node = mock(Node.class);
given(node.getState()).willReturn(nodeState);
nodes.add(node);
}
given(session.getMetadata()).willReturn(metadata);
given(metadata.getNodes()).willReturn(createNodesWithRandomUUID(nodes));
return session;
}
use of com.datastax.oss.driver.api.core.metadata.NodeState in project spring-boot by spring-projects.
the class CassandraDriverHealthIndicatorTests method mockCqlSessionWithNodeState.
private CqlSession mockCqlSessionWithNodeState(NodeState... nodeStates) {
CqlSession session = mock(CqlSession.class);
Metadata metadata = mock(Metadata.class);
List<Node> nodes = new ArrayList<>();
for (NodeState nodeState : nodeStates) {
Node node = mock(Node.class);
given(node.getState()).willReturn(nodeState);
nodes.add(node);
}
given(session.getMetadata()).willReturn(metadata);
given(metadata.getNodes()).willReturn(createNodesWithRandomUUID(nodes));
return session;
}
Aggregations