From ccf08b8ea35134b738549010da3d19f6deeed80d Mon Sep 17 00:00:00 2001 From: Hengye Date: Thu, 5 Dec 2019 15:01:58 +0800 Subject: change HealthCheckReport URL from self to hostName Issue-ID: POLICY-1689 Consolidate Policy Health Check into PAP Change-Id: I00e17610d3e4788008649791c684c0af415863ee Signed-off-by: Hengye --- .../policy/distribution/main/rest/TestDistributionRestServer.java | 8 +++++--- .../distribution/main/rest/TestHttpsDistributionRestServer.java | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'main/src/test/java') 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(); -- cgit 1.2.3-korg