|
|
@ -1,5 +1,5 @@
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Copyright 2012-2019 the original author or authors.
|
|
|
|
* Copyright 2012-2020 the original author or authors.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
@ -61,17 +61,21 @@ class Neo4jHealthIndicatorTests {
|
|
|
|
void neo4jUp() {
|
|
|
|
void neo4jUp() {
|
|
|
|
Result result = mock(Result.class);
|
|
|
|
Result result = mock(Result.class);
|
|
|
|
given(this.session.query(Neo4jHealthIndicator.CYPHER, Collections.emptyMap())).willReturn(result);
|
|
|
|
given(this.session.query(Neo4jHealthIndicator.CYPHER, Collections.emptyMap())).willReturn(result);
|
|
|
|
int nodeCount = 500;
|
|
|
|
|
|
|
|
Map<String, Object> expectedCypherDetails = new HashMap<>();
|
|
|
|
Map<String, Object> expectedCypherDetails = new HashMap<>();
|
|
|
|
expectedCypherDetails.put("nodes", nodeCount);
|
|
|
|
String edition = "community";
|
|
|
|
|
|
|
|
String version = "4.0.0";
|
|
|
|
|
|
|
|
expectedCypherDetails.put("edition", edition);
|
|
|
|
|
|
|
|
expectedCypherDetails.put("version", version);
|
|
|
|
List<Map<String, Object>> queryResults = new ArrayList<>();
|
|
|
|
List<Map<String, Object>> queryResults = new ArrayList<>();
|
|
|
|
queryResults.add(expectedCypherDetails);
|
|
|
|
queryResults.add(expectedCypherDetails);
|
|
|
|
given(result.queryResults()).willReturn(queryResults);
|
|
|
|
given(result.queryResults()).willReturn(queryResults);
|
|
|
|
Health health = this.neo4jHealthIndicator.health();
|
|
|
|
Health health = this.neo4jHealthIndicator.health();
|
|
|
|
assertThat(health.getStatus()).isEqualTo(Status.UP);
|
|
|
|
assertThat(health.getStatus()).isEqualTo(Status.UP);
|
|
|
|
Map<String, Object> details = health.getDetails();
|
|
|
|
Map<String, Object> details = health.getDetails();
|
|
|
|
int nodeCountFromDetails = (int) details.get("nodes");
|
|
|
|
String editionFromDetails = details.get("edition").toString();
|
|
|
|
assertThat(nodeCountFromDetails).isEqualTo(nodeCount);
|
|
|
|
String versionFromDetails = details.get("version").toString();
|
|
|
|
|
|
|
|
assertThat(editionFromDetails).isEqualTo(edition);
|
|
|
|
|
|
|
|
assertThat(versionFromDetails).isEqualTo(version);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|