Initial commit of RIC Dashboard webapp
[portal/ric-dashboard.git] / xapp-mgr-client / XappManagerClientDemo.java
1 /*-
2  * ========================LICENSE_START=================================
3  * ORAN-OSC
4  * %%
5  * Copyright (C) 2019 AT&T Intellectual Property and Nokia
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 package org.oranosc.ric.portal.dashboard.xmc.demo;
21
22 import org.oranosc.ric.portal.dashboard.api.DefaultApi;
23 import org.oranosc.ric.portal.dashboard.model.AllXapps;
24 import org.oranosc.ric.portal.dashboard.invoker.ApiClient;
25 import org.oranosc.ric.portal.dashboard.model.Xapp;
26 import org.springframework.web.client.RestClientException;
27
28 public class XappManagerClientDemo {
29
30         public static void main(String[] args) {
31                 ApiClient apiClient = new ApiClient();
32                 apiClient.setBasePath("http://localhost:30099/");
33                 DefaultApi apiInstance = new DefaultApi(apiClient);
34                 try {
35                         apiInstance.getHealth();
36                         System.out.println("Healthcheck answered " + apiClient.getStatusCode().toString());
37                 } catch (RestClientException e) {
38                         System.err.println("Failed on DefaultApi#getHealth: " + e.toString());
39                 }
40                 try {
41                         AllXapps allXapps = apiInstance.getAllXapps();
42                         System.out.println("getAllXapps answered " + apiClient.getStatusCode().toString());
43                         System.out.println("xApp count: " + allXapps.size());
44                         for (Xapp x : allXapps)
45                                 System.out.println("xApp: " + x.toString());
46                 } catch (RestClientException e) {
47                         System.err.println("Failed on DefaultApi#getAllXapps: " + e.toString());
48                 }
49         }
50
51 }