Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion access-control-parent/access-control-drools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>uk.gov.moj.cpp.access-control</groupId>
<artifactId>access-control-parent</artifactId>
<version>17.104.4-SNAPSHOT</version>
<version>17.104.4-M3-SNAPSHOT</version>
</parent>

<artifactId>access-control-drools</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>uk.gov.moj.cpp.access-control</groupId>
<artifactId>access-control-providers</artifactId>
<version>17.104.4-SNAPSHOT</version>
<version>17.104.4-M3-SNAPSHOT</version>
</parent>

<artifactId>access-control-assignment-providers</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>uk.gov.moj.cpp.access-control</groupId>
<artifactId>access-control-providers</artifactId>
<version>17.104.4-SNAPSHOT</version>
<version>17.104.4-M3-SNAPSHOT</version>
</parent>

<artifactId>access-control-common-providers</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>uk.gov.moj.cpp.access-control</groupId>
<artifactId>access-control-providers</artifactId>
<version>17.104.4-SNAPSHOT</version>
<version>17.104.4-M3-SNAPSHOT</version>
</parent>

<artifactId>access-control-hearing-providers</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>uk.gov.moj.cpp.access-control</groupId>
<artifactId>access-control-providers</artifactId>
<version>17.104.4-SNAPSHOT</version>
<version>17.104.4-M3-SNAPSHOT</version>
</parent>

<artifactId>access-control-progression-providers</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>uk.gov.moj.cpp.access-control</groupId>
<artifactId>access-control-providers</artifactId>
<version>17.104.4-SNAPSHOT</version>
<version>17.104.4-M3-SNAPSHOT</version>
</parent>

<artifactId>access-control-refdata-providers</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>uk.gov.moj.cpp.access-control</groupId>
<artifactId>access-control-providers</artifactId>
<version>17.104.4-SNAPSHOT</version>
<version>17.104.4-M3-SNAPSHOT</version>
</parent>

<artifactId>access-control-sjp-providers</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion access-control-parent/access-control-providers/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>uk.gov.moj.cpp.access-control</groupId>
<artifactId>access-control-parent</artifactId>
<version>17.104.4-SNAPSHOT</version>
<version>17.104.4-M3-SNAPSHOT</version>
</parent>

<artifactId>access-control-providers</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion access-control-parent/access-control-test-utils/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>uk.gov.moj.cpp.access-control</groupId>
<artifactId>access-control-parent</artifactId>
<version>17.104.4-SNAPSHOT</version>
<version>17.104.4-M3-SNAPSHOT</version>
</parent>

<artifactId>access-control-test-utils</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion access-control-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>uk.gov.moj.platform.libraries</groupId>
<artifactId>platform-libraries-parent-pom</artifactId>
<version>17.104.4-SNAPSHOT</version>
<version>17.104.4-M3-SNAPSHOT</version>
</parent>

<groupId>uk.gov.moj.cpp.access-control</groupId>
Expand Down
2 changes: 1 addition & 1 deletion activiti-parent/activiti-embedded-rest-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>activiti-parent</artifactId>
<groupId>uk.gov.moj.cpp.activiti</groupId>
<version>17.104.4-SNAPSHOT</version>
<version>17.104.4-M3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion activiti-parent/activiti-embedded-rest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>activiti-parent</artifactId>
<groupId>uk.gov.moj.cpp.activiti</groupId>
<version>17.104.4-SNAPSHOT</version>
<version>17.104.4-M3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion activiti-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>uk.gov.moj.platform.libraries</groupId>
<artifactId>platform-libraries-parent-pom</artifactId>
<version>17.104.4-SNAPSHOT</version>
<version>17.104.4-M3-SNAPSHOT</version>
</parent>

<groupId>uk.gov.moj.cpp.activiti</groupId>
Expand Down
2 changes: 1 addition & 1 deletion audit-library-parent/audit-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>audit-library-parent</artifactId>
<groupId>uk.gov.moj.cpp.audit</groupId>
<version>17.104.4-SNAPSHOT</version>
<version>17.104.4-M3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion audit-library-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>uk.gov.moj.platform.libraries</groupId>
<artifactId>platform-libraries-parent-pom</artifactId>
<version>17.104.4-SNAPSHOT</version>
<version>17.104.4-M3-SNAPSHOT</version>
</parent>

<groupId>uk.gov.moj.cpp.audit</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>uk.gov.moj.cpp.common.library.utils</groupId>
<artifactId>cpp-platform-library-utils</artifactId>
<version>17.104.4-SNAPSHOT</version>
<version>17.104.4-M3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>uk.gov.moj.cpp.common.library.utils</groupId>
<artifactId>cpp-platform-data-utils</artifactId>
<version>17.104.4-SNAPSHOT</version>
<version>17.104.4-M3-SNAPSHOT</version>
</parent>

<artifactId>cpp-platform-data-utils-persistence</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>uk.gov.moj.cpp.common.library.utils</groupId>
<artifactId>cpp-platform-data-utils</artifactId>
<version>17.104.4-SNAPSHOT</version>
<version>17.104.4-M3-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>uk.gov.moj.cpp.common.library.utils</groupId>
<artifactId>cpp-platform-data-utils</artifactId>
<version>17.104.4-SNAPSHOT</version>
<version>17.104.4-M3-SNAPSHOT</version>
</parent>

<artifactId>cpp-platform-data-utils-service</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>uk.gov.moj.cpp.common.library.utils</groupId>
<artifactId>cpp-platform-data-utils</artifactId>
<version>17.104.4-SNAPSHOT</version>
<version>17.104.4-M3-SNAPSHOT</version>
</parent>

<artifactId>cpp-platform-data-utils-test-utils</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>uk.gov.moj.cpp.common.library.utils</groupId>
<artifactId>cpp-platform-library-utils</artifactId>
<version>17.104.4-SNAPSHOT</version>
<version>17.104.4-M3-SNAPSHOT</version>
</parent>

<artifactId>cpp-platform-data-utils</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>cpp-platform-library-utils</artifactId>
<groupId>uk.gov.moj.cpp.common.library.utils</groupId>
<version>17.104.4-SNAPSHOT</version>
<version>17.104.4-M3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion cpp-platform-library-utils/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>uk.gov.moj.platform.libraries</groupId>
<artifactId>platform-libraries-parent-pom</artifactId>
<version>17.104.4-SNAPSHOT</version>
<version>17.104.4-M3-SNAPSHOT</version>
</parent>

<groupId>uk.gov.moj.cpp.common.library.utils</groupId>
Expand Down
2 changes: 1 addition & 1 deletion feature-control/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>platform-libraries-parent-pom</artifactId>
<groupId>uk.gov.moj.platform.libraries</groupId>
<version>17.104.4-SNAPSHOT</version>
<version>17.104.4-M3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion healthchecks-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>uk.gov.moj.platform.libraries</groupId>
<artifactId>platform-libraries-parent-pom</artifactId>
<version>17.104.4-SNAPSHOT</version>
<version>17.104.4-M3-SNAPSHOT</version>
</parent>

<groupId>uk.gov.moj.cpp.healthchecks</groupId>
Expand Down
6 changes: 3 additions & 3 deletions healthchecks-parent/unifiedsearch-healthchecks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>uk.gov.moj.cpp.healthchecks</groupId>
<artifactId>healthchecks-parent</artifactId>
<version>17.104.4-SNAPSHOT</version>
<version>17.104.4-M3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand All @@ -30,8 +30,8 @@
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<groupId>co.elastic.clients</groupId>
<artifactId>elasticsearch-java</artifactId>
</dependency>

<!-- Test Dependencies -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,17 @@

import java.io.IOException;

import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import co.elastic.clients.elasticsearch.ElasticsearchClient;
import co.elastic.clients.elasticsearch.cluster.HealthResponse;

/**
* Wrapper class for the unmockable parts of getting a health response from elastic search
*/
public class ElasticSearchHealthQuerier {

public ClusterHealthResponse getClusterHealth(
final RestHighLevelClient restHighLevelClient,
final RequestOptions requestOptions) throws IOException {
public HealthResponse getClusterHealth(
final ElasticsearchClient client) throws IOException {

return restHighLevelClient
.cluster()
.health(new ClusterHealthRequest(), requestOptions);
return client.cluster().health();
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package uk.gov.justice.services.unifiedsearch.healthchecks;

import static co.elastic.clients.elasticsearch._types.HealthStatus.Green;
import static java.lang.String.format;
import static org.elasticsearch.client.RequestOptions.DEFAULT;
import static org.elasticsearch.cluster.health.ClusterHealthStatus.GREEN;
import static uk.gov.justice.services.healthcheck.api.HealthcheckResult.failure;
import static uk.gov.justice.services.healthcheck.api.HealthcheckResult.success;
import static uk.gov.justice.services.unifiedsearch.client.utils.UnifiedSearchSecurityConstants.MONITOR_USER;
Expand All @@ -15,15 +14,16 @@
import javax.inject.Inject;
import javax.inject.Named;

import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.cluster.health.ClusterHealthStatus;
import co.elastic.clients.elasticsearch.ElasticsearchClient;
import co.elastic.clients.elasticsearch._types.HealthStatus;
import co.elastic.clients.elasticsearch.cluster.HealthResponse;


public class ElasticSearchHealthcheck implements Healthcheck {

@Inject
@Named(MONITOR_USER)
private RestHighLevelClient restHighLevelClient;
private ElasticsearchClient restHighLevelClient;

@Inject
private ElasticSearchHealthQuerier elasticSearchHealthQuerier;
Expand All @@ -35,24 +35,23 @@ public String getHealthcheckName() {

@Override
public String healthcheckDescription() {
return "Verifies Elastic Search Health Status is '" + GREEN + "'";
return "Verifies Elastic Search Health Status is '" + Green + "'";
}

@Override
public HealthcheckResult runHealthcheck() {

try {
final ClusterHealthResponse clusterHealthResponse = elasticSearchHealthQuerier.getClusterHealth(
restHighLevelClient,
DEFAULT);
final HealthResponse clusterHealthResponse = elasticSearchHealthQuerier.getClusterHealth(
restHighLevelClient);

final ClusterHealthStatus healthStatus = clusterHealthResponse.getStatus();
final HealthStatus healthStatus = clusterHealthResponse.status();

if (healthStatus == GREEN) {
if (healthStatus == Green) {
return success();
}

return failure(format("Elastic Search healthcheck failed. CLuster Health Status should be '%s' but was '%s'", GREEN, healthStatus));
return failure(format("Elastic Search healthcheck failed. CLuster Health Status should be '%s' but was '%s'", Green, healthStatus));

} catch (final IOException e) {
throw new ElasticSearchHealtcheckQueryException(format("IOException thrown when calling Elastic Search. Exception message: '%s'", e.getMessage()), e);
Expand Down
Loading
Loading