1 /*******************************************************************************
2 * Copyright 2017 ZTE, Inc. 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.discovery.util;
16 import java.util.HashSet;
19 import org.apache.commons.lang3.StringUtils;
20 import org.onap.msb.sdk.discovery.entity.Node;
21 import org.onap.msb.sdk.discovery.entity.NodeInfo;
25 * @Description: TODO(msb功能工具方法类)
26 * @author tanghua10186366
30 public class MsbUtil {
34 * @Title getConsulServiceName
35 * @Description TODO(通过服务名和命名空间组装conusl存储名,用于服务变化监听)
40 public static String getConsulServiceName(String serviceName, String namespace) {
41 if (StringUtils.isEmpty(namespace)) {
44 return serviceName + "-" + namespace;
48 public static Set<NodeInfo> getLbNodes(Node lbNode) {
49 Set<NodeInfo> nodes = new HashSet<NodeInfo>();
50 NodeInfo nodeInfo = new NodeInfo();
51 nodeInfo.setIp(lbNode.getIp());
52 nodeInfo.setPort(lbNode.getPort());