aboutsummaryrefslogtreecommitdiffstats
path: root/example-spring-boot/src/main/java/org/onap/boot/example/demo/ExampleClient.java
blob: 720264be3b49c13041a62e2a3f6b39091f0e2974 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package org.onap.boot.example.demo;

import java.io.IOException;

import org.onap.boot.example.demo.model.Employee;
import org.onap.msb.sdk.httpclient.RestServiceCreater;
import org.onap.msb.sdk.httpclient.msb.MSBServiceClient;

import retrofit2.Response;


public class ExampleClient {

  /**
   * @param args
   * @throws IOException
   */
  public static void main(String[] args) throws IOException {
    //For real use case, MSB IP and Port should come from configuration file instead of hard code here
    String MSB_IP="192.168.0.110";
    int MSB_Port=10081;

    MSBServiceClient msbClient = new MSBServiceClient(MSB_IP, MSB_Port);

    RestServiceCreater restServiceCreater =
        new RestServiceCreater(msbClient);

    EmployeeServiceClient implProxy =
        restServiceCreater.createService(EmployeeServiceClient.class);

    Employee employee = implProxy.queryEmployee().execute().body();
    System.out.println("Employee:" + employee);
  }

}