f429afbdcd63a40f2c2cd2981c18370c5c152f67
[policy/pap.git] / main / src / test / java / org / onap / policy / pap / main / rest / e2e / HealthCheckTest.java
1 /*
2  * ============LICENSE_START=======================================================
3  * ONAP PAP
4  * ================================================================================
5  * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.policy.pap.main.rest.e2e;
22
23 import static org.junit.Assert.assertEquals;
24
25 import java.net.HttpURLConnection;
26 import javax.ws.rs.client.Invocation;
27 import org.junit.Test;
28 import org.onap.policy.common.endpoints.report.HealthCheckReport;
29
30 public class HealthCheckTest extends End2EndBase {
31     private static final String HEALTHCHECK_ENDPOINT = "healthcheck";
32
33     @Test
34     public void testHealthCheckSuccess() throws Exception {
35         final Invocation.Builder invocationBuilder = sendRequest(HEALTHCHECK_ENDPOINT);
36         final HealthCheckReport report = invocationBuilder.get(HealthCheckReport.class);
37
38         assertEquals(NAME, report.getName());
39         assertEquals(SELF, report.getUrl());
40         assertEquals(true, report.isHealthy());
41         assertEquals(HttpURLConnection.HTTP_OK, report.getCode());
42         assertEquals(ALIVE, report.getMessage());
43     }
44 }