Add integration test for sliboot docker
[ccsdk/apps.git] / ms / sliboot / src / test / java / org / onap / ccsdk / apps / ms / sliboot / SlibootIT.java
1 package org.onap.ccsdk.apps.ms.sliboot;
2
3 import static org.junit.jupiter.api.Assertions.assertEquals;
4
5 import java.io.IOException;
6
7 import org.apache.http.client.ClientProtocolException;
8 import org.apache.http.client.methods.CloseableHttpResponse;
9 import org.apache.http.client.methods.HttpPost;
10 import org.apache.http.impl.client.CloseableHttpClient;
11 import org.apache.http.impl.client.HttpClients;
12 import org.junit.Test;
13
14 public class SlibootIT {
15     @Test
16     public void healthcheckTest() throws ClientProtocolException, IOException {
17         String slibootPort = System.getenv("SLIBOOT_PORT");
18         if ((slibootPort == null) || (slibootPort.length() == 0)) {
19             slibootPort = "8080";
20         }
21
22         String testUrl = "http://localhost:" + slibootPort + "/restconf/operations/SLI-API:healthcheck/";
23
24         CloseableHttpClient client = HttpClients.createDefault();
25         HttpPost postCmd = new HttpPost(testUrl);
26         postCmd.addHeader("Content-Type", "application/json");
27         
28         CloseableHttpResponse resp = client.execute(postCmd);
29         assertEquals(200, resp.getStatusLine().getStatusCode());
30     }
31 }