2 * Copyright 2023 ZTE Corporation.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.onap.holmes.common.msb.entity;
19 import org.junit.Test;
21 import java.util.HashSet;
24 import static org.junit.Assert.assertEquals;
26 public class MicroServiceInfoTest {
28 public void testToString() {
29 MicroServiceInfo microServiceInfo = getMicroServiceInfo();
31 String expectedOutput = "MicroService List:\r\n" +
32 "serviceName:service-name\r\n" +
34 "url:http://example.com\r\n" +
36 "visualRange:local\r\n" +
37 "enable_ssl:true\r\n" +
43 assertEquals(expectedOutput, microServiceInfo.toString());
46 private static MicroServiceInfo getMicroServiceInfo() {
47 MicroServiceInfo microServiceInfo = new MicroServiceInfo();
48 microServiceInfo.setServiceName("service-name");
49 microServiceInfo.setVersion("1.0");
50 microServiceInfo.setUrl("http://example.com");
51 microServiceInfo.setProtocol("http");
52 microServiceInfo.setVisualRange("local");
53 microServiceInfo.setEnable_ssl(true);
55 Set<Node> nodes = new HashSet<>();
56 Node node = new Node();
57 node.setIp("127.0.0.1");
61 microServiceInfo.setNodes(nodes);
62 return microServiceInfo;