summaryrefslogtreecommitdiffstats
path: root/main/src/test
diff options
context:
space:
mode:
authorHengye <yehui.wang@est.tech>2019-11-27 13:43:42 +0800
committerHengye <yehui.wang@est.tech>2019-12-11 11:30:28 +0800
commitb53f17e933de95d6a397313ad04f1c67b18a27da (patch)
tree63aaf842c16e200cb0b1bb0e3ad500e61489e9b9 /main/src/test
parentd97629ff8ec522d30d1f552201496182c72559ab (diff)
consolidate Policy Health Check into PAP
Issue-ID: POLICY-1689 Change-Id: I3b84094e217c8cda115efdbf3444e92f08013a7c Signed-off-by: Hengye <yehui.wang@est.tech>
Diffstat (limited to 'main/src/test')
-rw-r--r--main/src/test/java/org/onap/policy/pap/main/rest/CommonPapRestServer.java2
-rw-r--r--main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyComponentsHealthCheckControllerV1.java38
-rw-r--r--main/src/test/resources/e2e/PapConfigParameters.json20
-rw-r--r--main/src/test/resources/parameters/MinimumParameters.json20
-rw-r--r--main/src/test/resources/parameters/PapConfigParameters.json20
-rw-r--r--main/src/test/resources/parameters/PapConfigParametersStd.json20
6 files changed, 115 insertions, 5 deletions
diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/CommonPapRestServer.java b/main/src/test/java/org/onap/policy/pap/main/rest/CommonPapRestServer.java
index 8660d005..3823365b 100644
--- a/main/src/test/java/org/onap/policy/pap/main/rest/CommonPapRestServer.java
+++ b/main/src/test/java/org/onap/policy/pap/main/rest/CommonPapRestServer.java
@@ -72,7 +72,7 @@ public class CommonPapRestServer {
public static final String NOT_ALIVE = "not alive";
public static final String ALIVE = "alive";
- public static final String SELF = "self";
+ public static final String SELF = NetworkUtil.getHostname();
public static final String NAME = "Policy PAP";
public static final String ENDPOINT_PREFIX = "policy/pap/v1/";
diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyComponentsHealthCheckControllerV1.java b/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyComponentsHealthCheckControllerV1.java
new file mode 100644
index 00000000..f73178b7
--- /dev/null
+++ b/main/src/test/java/org/onap/policy/pap/main/rest/TestPolicyComponentsHealthCheckControllerV1.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.pap.main.rest;
+
+import org.junit.Test;
+
+/**
+ * Class to perform unit test of {@link PolicyComponentsHealthCheckControllerV1}.
+ *
+ * @author Yehui Wang (yehui.wang@est.tech)
+ */
+public class TestPolicyComponentsHealthCheckControllerV1 extends CommonPapRestServer {
+
+ private static final String ENDPOINT = "components/healthcheck";
+
+ @Test
+ public void testSwagger() throws Exception {
+ super.testSwagger(ENDPOINT);
+ }
+}
diff --git a/main/src/test/resources/e2e/PapConfigParameters.json b/main/src/test/resources/e2e/PapConfigParameters.json
index 17507bdb..610ded8c 100644
--- a/main/src/test/resources/e2e/PapConfigParameters.json
+++ b/main/src/test/resources/e2e/PapConfigParameters.json
@@ -42,5 +42,23 @@
"servers" : [ "message-router" ],
"topicCommInfrastructure" : "noop"
}]
- }
+ },
+ "healthCheckRestClientParameters":[{
+ "clientName": "api",
+ "hostname": "policy-api",
+ "port": 6969,
+ "userName": "healthcheck",
+ "password": "zb!XztG34",
+ "useHttps": true,
+ "basePath": "policy/api/v1/healthcheck"
+ },
+ {
+ "clientName": "distribution",
+ "hostname": "policy-distribution",
+ "port": 6969,
+ "userName": "healthcheck",
+ "password": "zb!XztG34",
+ "useHttps": true,
+ "basePath": "healthcheck"
+ }]
}
diff --git a/main/src/test/resources/parameters/MinimumParameters.json b/main/src/test/resources/parameters/MinimumParameters.json
index 6b21b4dc..69492e9b 100644
--- a/main/src/test/resources/parameters/MinimumParameters.json
+++ b/main/src/test/resources/parameters/MinimumParameters.json
@@ -37,5 +37,23 @@
"servers" : [ "message-router" ],
"topicCommInfrastructure" : "dmaap"
}]
- }
+ },
+ "healthCheckRestClientParameters":[{
+ "clientName": "api",
+ "hostname": "policy-api",
+ "port": 6969,
+ "userName": "healthcheck",
+ "password": "zb!XztG34",
+ "useHttps": true,
+ "basePath": "policy/api/v1/healthcheck"
+ },
+ {
+ "clientName": "distribution",
+ "hostname": "policy-distribution",
+ "port": 6969,
+ "userName": "healthcheck",
+ "password": "zb!XztG34",
+ "useHttps": true,
+ "basePath": "healthcheck"
+ }]
}
diff --git a/main/src/test/resources/parameters/PapConfigParameters.json b/main/src/test/resources/parameters/PapConfigParameters.json
index 11315029..111a6352 100644
--- a/main/src/test/resources/parameters/PapConfigParameters.json
+++ b/main/src/test/resources/parameters/PapConfigParameters.json
@@ -42,5 +42,23 @@
"servers" : [ "message-router" ],
"topicCommInfrastructure" : "noop"
}]
- }
+ },
+ "healthCheckRestClientParameters":[{
+ "clientName": "api",
+ "hostname": "policy-api",
+ "port": 6969,
+ "userName": "healthcheck",
+ "password": "zb!XztG34",
+ "useHttps": true,
+ "basePath": "policy/api/v1/healthcheck"
+ },
+ {
+ "clientName": "distribution",
+ "hostname": "policy-distribution",
+ "port": 6969,
+ "userName": "healthcheck",
+ "password": "zb!XztG34",
+ "useHttps": true,
+ "basePath": "healthcheck"
+ }]
}
diff --git a/main/src/test/resources/parameters/PapConfigParametersStd.json b/main/src/test/resources/parameters/PapConfigParametersStd.json
index 828c1a44..47925dff 100644
--- a/main/src/test/resources/parameters/PapConfigParametersStd.json
+++ b/main/src/test/resources/parameters/PapConfigParametersStd.json
@@ -42,5 +42,23 @@
"servers" : [ "message-router" ],
"topicCommInfrastructure" : "noop"
}]
- }
+ },
+ "healthCheckRestClientParameters":[{
+ "clientName": "api",
+ "hostname": "policy-api",
+ "port": 6969,
+ "userName": "healthcheck",
+ "password": "zb!XztG34",
+ "useHttps": true,
+ "basePath": "policy/api/v1/healthcheck"
+ },
+ {
+ "clientName": "distribution",
+ "hostname": "policy-distribution",
+ "port": 6969,
+ "userName": "healthcheck",
+ "password": "zb!XztG34",
+ "useHttps": true,
+ "basePath": "healthcheck"
+ }]
}