2 * Copyright 2017 ZTE Corporation.
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
14 package org.onap.msb.sdk.httpclient;
16 import java.util.HashSet;
19 import org.junit.Assert;
20 import org.junit.Test;
21 import org.onap.msb.sdk.discovery.entity.MicroServiceFullInfo;
22 import org.onap.msb.sdk.discovery.entity.NodeInfo;
24 public class ServiceHttpEndPointObjectTest {
27 public void testBean() {
28 NodeInfo nodeInfo = new NodeInfo();
29 nodeInfo.setIp("127.0.0.1");
30 nodeInfo.setPort("80");
31 MicroServiceFullInfo cloneFullInfo = new MicroServiceFullInfo();
32 cloneFullInfo.setUrl("/aai/v8");
33 cloneFullInfo.setServiceName("aai");
34 cloneFullInfo.setVersion("v8");
35 cloneFullInfo.setVisualRange("1");
37 Set<NodeInfo> nodes=new HashSet<NodeInfo>();
39 cloneFullInfo.setNodes(nodes);
41 ServiceHttpEndPointObject endPointOjb = new ServiceHttpEndPointObject("aai", "v8", nodeInfo, cloneFullInfo);
42 Assert.assertEquals(endPointOjb.getIp(), "127.0.0.1");
43 Assert.assertEquals(endPointOjb.getPort(), "80");
44 Assert.assertEquals(endPointOjb.getServiceName(), "aai");
45 Assert.assertEquals(endPointOjb.getServiceVersion(), "v8");
47 System.out.println(endPointOjb.hashCode());
48 ServiceHttpEndPointObject endPointOjb2 = new ServiceHttpEndPointObject("aai", "v8", nodeInfo, cloneFullInfo);
49 Assert.assertTrue(endPointOjb2.equals(endPointOjb));
51 endPointOjb.setProtocl("HTTP");
52 endPointOjb.setNameSpace("ns");
53 System.out.println(endPointOjb.toString());
54 Assert.assertEquals("HTTP", endPointOjb.getProtocl());
55 Assert.assertEquals("ns", endPointOjb.getNameSpace());