1 /*******************************************************************************
2 * Copyright 2017 Infosys Limited and others.
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5 * in compliance with the License. You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software distributed under the License
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11 * or implied. See the License for the specific language governing permissions and limitations under
13 ******************************************************************************/
14 package org.onap.msb.sdk.example.springboot.common;
16 import java.net.InetAddress;
17 import java.util.HashSet;
20 import org.onap.msb.sdk.discovery.entity.MicroServiceInfo;
21 import org.onap.msb.sdk.discovery.entity.Node;
22 import org.onap.msb.sdk.httpclient.msb.MSBServiceClient;
24 public class MsbHelper {
26 private MSBServiceClient msbClient;
28 public MsbHelper(MSBServiceClient msbClient) {
30 this.msbClient = msbClient;
33 public void registerMsb() throws Exception {
36 MicroServiceInfo msinfo = new MicroServiceInfo();
38 msinfo.setServiceName("employee");
39 msinfo.setVersion("v1");
40 msinfo.setUrl("/api/v1");
41 msinfo.setProtocol("REST");
42 msinfo.setVisualRange("0|1");
44 Set<Node> nodes = new HashSet<>();
45 Node node1 = new Node();
46 node1.setIp(InetAddress.getLocalHost().getHostAddress());
47 node1.setPort("8080");
49 msinfo.setNodes(nodes);
50 msbClient.registerMicroServiceInfo(msinfo, false);