summaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorHengye <yehui.wang@est.tech>2019-12-05 15:01:58 +0800
committerHengye <yehui.wang@est.tech>2019-12-05 16:09:12 +0800
commitccf08b8ea35134b738549010da3d19f6deeed80d (patch)
tree8ea5ba9506e50fa07b09ba1b570bb270c574a454 /main
parente8b7873d43a6f0e01f8bb0385dff3deac3929d3c (diff)
change HealthCheckReport URL from self to hostName
Issue-ID: POLICY-1689 Consolidate Policy Health Check into PAP Change-Id: I00e17610d3e4788008649791c684c0af415863ee Signed-off-by: Hengye <yehui.wang@est.tech>
Diffstat (limited to 'main')
-rw-r--r--main/src/main/java/org/onap/policy/distribution/main/rest/HealthCheckProvider.java4
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/rest/TestDistributionRestServer.java8
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/rest/TestHttpsDistributionRestServer.java6
3 files changed, 11 insertions, 7 deletions
diff --git a/main/src/main/java/org/onap/policy/distribution/main/rest/HealthCheckProvider.java b/main/src/main/java/org/onap/policy/distribution/main/rest/HealthCheckProvider.java
index a22d0857..2fe46b22 100644
--- a/main/src/main/java/org/onap/policy/distribution/main/rest/HealthCheckProvider.java
+++ b/main/src/main/java/org/onap/policy/distribution/main/rest/HealthCheckProvider.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,6 +22,7 @@
package org.onap.policy.distribution.main.rest;
import org.onap.policy.common.endpoints.report.HealthCheckReport;
+import org.onap.policy.common.utils.network.NetworkUtil;
import org.onap.policy.distribution.main.startstop.DistributionActivator;
/**
@@ -32,7 +34,7 @@ public class HealthCheckProvider {
private static final String NOT_ALIVE = "not alive";
private static final String ALIVE = "alive";
- private static final String URL = "self";
+ private static final String URL = NetworkUtil.getHostname();
private static final String NAME = "Policy SSD";
/**
diff --git a/main/src/test/java/org/onap/policy/distribution/main/rest/TestDistributionRestServer.java b/main/src/test/java/org/onap/policy/distribution/main/rest/TestDistributionRestServer.java
index 3644864e..008a1104 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/rest/TestDistributionRestServer.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/rest/TestDistributionRestServer.java
@@ -3,6 +3,7 @@
* Copyright (C) 2018 Ericsson. All rights reserved.
* Copyright (C) 2019 Nordix Foundation.
* Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -57,12 +58,12 @@ public class TestDistributionRestServer {
private static final Logger LOGGER = LoggerFactory.getLogger(TestDistributionRestServer.class);
private static final String NOT_ALIVE = "not alive";
private static final String ALIVE = "alive";
- private static final String SELF = "self";
+ private static final String SELF = NetworkUtil.getHostname();
private static final String NAME = "Policy SSD";
@Test
public void testHealthCheckSuccess() {
- final String reportString = "Report [name=Policy SSD, url=self, healthy=true, code=200, message=alive]";
+ final String reportString = "Report [name=Policy SSD, url=" + SELF + ", healthy=true, code=200, message=alive]";
try {
final Main main = startDistributionService();
final HealthCheckReport report = performHealthCheck();
@@ -76,7 +77,8 @@ public class TestDistributionRestServer {
@Test
public void testHealthCheckFailure() {
- final String reportString = "Report [name=Policy SSD, url=self, healthy=false, code=500, message=not alive]";
+ final String reportString =
+ "Report [name=Policy SSD, url=" + SELF + ", healthy=false, code=500, message=not alive]";
final RestServerParameters restServerParams = new CommonTestData().getRestServerParameters(false);
restServerParams.setName(CommonTestData.DISTRIBUTION_GROUP_NAME);
final RestServer restServer = new RestServer(restServerParams, null, DistributionRestController.class);
diff --git a/main/src/test/java/org/onap/policy/distribution/main/rest/TestHttpsDistributionRestServer.java b/main/src/test/java/org/onap/policy/distribution/main/rest/TestHttpsDistributionRestServer.java
index f3046c29..7a9835cb 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/rest/TestHttpsDistributionRestServer.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/rest/TestHttpsDistributionRestServer.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Intel. All rights reserved.
- * Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -55,13 +55,13 @@ public class TestHttpsDistributionRestServer {
private static final Logger LOGGER = LoggerFactory.getLogger(TestHttpsDistributionRestServer.class);
private static final String ALIVE = "alive";
- private static final String SELF = "self";
+ private static final String SELF = NetworkUtil.getHostname();
private static final String NAME = "Policy SSD";
private static String KEYSTORE = System.getProperty("user.dir") + "/src/test/resources/ssl/policy-keystore";
@Test
public void testHttpsHealthCheckSuccess() {
- final String reportString = "Report [name=Policy SSD, url=self, healthy=true, code=200, message=alive]";
+ final String reportString = "Report [name=Policy SSD, url=" + SELF + ", healthy=true, code=200, message=alive]";
try {
final Main main = startDistributionService();
final HealthCheckReport report = performHealthCheck();