use of org.neo4j.driver.summary.ServerInfo in project spring-boot by spring-projects.
the class Neo4jHealthDetailsHandler method addHealthDetails.
/**
* Add health details for the specified {@link ResultSummary} and {@code edition}.
* @param builder the {@link Builder} to use
* @param healthDetails the health details of the server
*/
void addHealthDetails(Builder builder, Neo4jHealthDetails healthDetails) {
ResultSummary summary = healthDetails.getSummary();
ServerInfo serverInfo = summary.server();
builder.up().withDetail("server", healthDetails.getVersion() + "@" + serverInfo.address()).withDetail("edition", healthDetails.getEdition());
DatabaseInfo databaseInfo = summary.database();
if (StringUtils.hasText(databaseInfo.name())) {
builder.withDetail("database", databaseInfo.name());
}
}
use of org.neo4j.driver.summary.ServerInfo in project spring-boot by spring-projects.
the class ResultSummaryMock method createResultSummary.
static ResultSummary createResultSummary(String serverAddress, String databaseName) {
ServerInfo serverInfo = mock(ServerInfo.class);
given(serverInfo.address()).willReturn(serverAddress);
DatabaseInfo databaseInfo = mock(DatabaseInfo.class);
given(databaseInfo.name()).willReturn(databaseName);
ResultSummary resultSummary = mock(ResultSummary.class);
given(resultSummary.server()).willReturn(serverInfo);
given(resultSummary.database()).willReturn(databaseInfo);
return resultSummary;
}
use of org.neo4j.driver.summary.ServerInfo in project neo4j by neo4j.
the class BoltStateHandlerTest method stubResultSummaryInAnOpenSession.
private Driver stubResultSummaryInAnOpenSession(Result resultMock, Session sessionMock, String protocolVersion, String databaseName) {
Driver driverMock = mock(Driver.class);
ResultSummary resultSummary = mock(ResultSummary.class);
ServerInfo serverInfo = mock(ServerInfo.class);
DatabaseInfo databaseInfo = mock(DatabaseInfo.class);
when(resultSummary.server()).thenReturn(serverInfo);
when(serverInfo.protocolVersion()).thenReturn(protocolVersion);
when(resultMock.consume()).thenReturn(resultSummary);
when(resultSummary.database()).thenReturn(databaseInfo);
when(databaseInfo.name()).thenReturn(databaseName);
when(sessionMock.isOpen()).thenReturn(true);
when(sessionMock.run("CALL db.ping()")).thenReturn(resultMock);
when(sessionMock.run(anyString(), any(Value.class))).thenReturn(resultMock);
when(driverMock.session(any())).thenReturn(sessionMock);
return driverMock;
}
Aggregations