/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2020 Nordix Foundation.
- * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
-import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import javax.ws.rs.core.Response;
import org.onap.policy.common.endpoints.http.client.HttpClient;
import org.onap.policy.common.endpoints.http.client.HttpClientConfigException;
import org.onap.policy.common.endpoints.http.client.HttpClientFactory;
-import org.onap.policy.common.endpoints.parameters.RestServerParameters;
import org.onap.policy.common.endpoints.report.HealthCheckReport;
import org.onap.policy.common.parameters.ParameterService;
import org.onap.policy.common.utils.services.Registry;
// Check PAP itself
HealthCheckReport papReport = new HealthCheckProvider().performHealthCheck();
- RestServerParameters restServerParameters = papParameterGroup.getRestServerParameters();
+ var restServerParameters = papParameterGroup.getRestServerParameters();
papReport.setUrl(
(restServerParameters.isHttps() ? "https://" : "http://") + papReport.getUrl() + ":" + restServerParameters
.getPort() + POLICY_PAP_HEALTHCHECK_URI);
}
private boolean verifyNumberOfPdps(List<PdpGroup> groups) {
- boolean flag = true;
+ var flag = true;
for (final PdpGroup group : groups) {
for (final PdpSubGroup subGroup : group.getPdpSubgroups()) {
if (subGroup.getCurrentInstanceCount() < subGroup.getDesiredInstanceCount()) {
}
private HealthCheckReport createUnHealthCheckReport(String name, String url, int code, String message) {
- HealthCheckReport report = new HealthCheckReport();
+ var report = new HealthCheckReport();
report.setName(name);
report.setUrl(url);
report.setHealthy(false);
}
private HealthCheckReport replaceIpWithHostname(HealthCheckReport report, String baseUrl) {
- Matcher matcher = IP_REPLACEMENT_PATTERN.matcher(baseUrl);
- String ip = "";
+ var matcher = IP_REPLACEMENT_PATTERN.matcher(baseUrl);
if (matcher.find()) {
- ip = matcher.group(1);
+ var ip = matcher.group(1);
report.setUrl(baseUrl.replace(ip, report.getUrl()));
}
return report;