2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.mso.client.grm;
23 import static org.junit.Assert.assertEquals;
24 import java.util.ArrayList;
25 import java.util.List;
26 import org.junit.Test;
27 import org.openecomp.mso.client.grm.beans.OperationalInfo;
28 import org.openecomp.mso.client.grm.beans.Property;
29 import org.openecomp.mso.client.grm.beans.ServiceEndPoint;
30 import org.openecomp.mso.client.grm.beans.ServiceEndPointRequest;
31 import org.openecomp.mso.client.grm.beans.Version;
33 import com.fasterxml.jackson.databind.ObjectMapper;
35 public class ServiceEndPointRequestTest {
37 private ObjectMapper mapper = new ObjectMapper();
40 public void testMarshall() throws Exception {
43 "{\"serviceEndPoint\":{\"name\":\"TEST.ECOMP_PSL.Inventory\",\"version\":{\"major\":1,\"minor\":0,\"patch\":\"0\"}," +
44 "\"hostAddress\":\"127.0.0.1\",\"listenPort\":\"8080\",\"latitude\":\"37.7022\",\"longitude\":\"121.9358\"," +
45 "\"contextPath\":\"/\",\"routeOffer\":\"TEST\",\"operationalInfo\":{\"createdBy\":\"edge\",\"updatedBy\":\"edge\"}," +
46 "\"properties\":[{\"name\":\"Environment\",\"value\":\"TEST\"},{\"name\":\"cpfrun_cluster_name\"," +
47 "\"value\":\"testcase_cluster_no_cluster\"}]},\"env\":\"DEV\"}";
49 Version ver = new Version();
54 ServiceEndPoint sep = new ServiceEndPoint();
55 sep.setName("TEST.ECOMP_PSL.Inventory");
57 sep.setHostAddress("127.0.0.1");
58 sep.setListenPort("8080");
59 sep.setLatitude("37.7022");
60 sep.setLongitude("121.9358");
61 sep.setContextPath("/");
62 sep.setRouteOffer("TEST");
64 OperationalInfo operInfo = new OperationalInfo();
65 operInfo.setCreatedBy("edge");
66 operInfo.setUpdatedBy("edge");
68 sep.setOperationalInfo(operInfo);
70 Property prop1 = new Property();
71 prop1.setName("Environment");
72 prop1.setValue("TEST");
74 Property prop2 = new Property();
75 prop2.setName("cpfrun_cluster_name");
76 prop2.setValue("testcase_cluster_no_cluster");
78 List<Property> props = new ArrayList<Property>();
82 sep.setProperties(props);
84 ServiceEndPointRequest request = new ServiceEndPointRequest();
85 request.setEnv("DEV");
86 request.setServiceEndPoint(sep);
88 assertEquals(expected, mapper.writeValueAsString(request));