2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 TechMahindra
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.onap.so.client.cds.beans;
23 import static org.junit.Assert.assertEquals;
24 import static org.junit.Assert.assertNotNull;
25 import java.util.HashMap;
27 import org.junit.Test;
29 public class ConfigAssignPropertiesForPnfTest {
30 ConfigAssignPropertiesForPnf configAssignPropertiesForPnf = new ConfigAssignPropertiesForPnf();
31 private Map<String, Object> userParam = new HashMap<String, Object>();
32 private String serviceInstanceId;
34 private String pnfName;
35 private String serviceModelUuid;
36 private String pnfCustomizationUuid;
39 public final void testConfigDeployPropertiesForPnfTest() {
40 userParam.put("Instance1", "instance1value");
41 userParam.put("Instance2", "instance2value");
42 configAssignPropertiesForPnf.setPnfCustomizationUuid("pnf-customization-uuid");
43 configAssignPropertiesForPnf.setPnfId("pnf-id");
44 configAssignPropertiesForPnf.setPnfName("pnf-name");
45 configAssignPropertiesForPnf.setServiceInstanceId("service-instance-id");
46 configAssignPropertiesForPnf.setServiceModelUuid("service-model-uuid");
47 configAssignPropertiesForPnf.setUserParam("Instance1", "instance1value");
48 configAssignPropertiesForPnf.setUserParam("Instance2", "instance2value");
50 assertNotNull(configAssignPropertiesForPnf.getPnfCustomizationUuid());
51 assertNotNull(configAssignPropertiesForPnf.getPnfId());
52 assertNotNull(configAssignPropertiesForPnf.getPnfName());
53 assertNotNull(configAssignPropertiesForPnf.getServiceInstanceId());
54 assertNotNull(configAssignPropertiesForPnf.getServiceModelUuid());
55 assertNotNull(configAssignPropertiesForPnf.getUserParam());
57 assertEquals("service-instance-id", configAssignPropertiesForPnf.getServiceInstanceId());
58 assertEquals("service-model-uuid", configAssignPropertiesForPnf.getServiceModelUuid());
59 assertEquals("pnf-customization-uuid", configAssignPropertiesForPnf.getPnfCustomizationUuid());
60 assertEquals("pnf-id", configAssignPropertiesForPnf.getPnfId());
61 assertEquals("pnf-name", configAssignPropertiesForPnf.getPnfName());
62 assertEquals(userParam, configAssignPropertiesForPnf.getUserParam());
66 public void testtoString() {
67 final StringBuilder sb = new StringBuilder("{");
68 sb.append("\"service-instance-id\":").append("\"").append(serviceInstanceId).append("\"");
69 sb.append(", \"pnf-id\":").append("\"").append(pnfId).append("\"");
70 sb.append(", \"pnf-name\":").append("\"").append(pnfName).append("\"");
71 sb.append(", \"service-model-uuid\":").append("\"").append(serviceModelUuid).append("\"");
72 sb.append(", \"pnf-customization-uuid\":").append("\"").append(pnfCustomizationUuid).append("\"");
73 for (Map.Entry<String, Object> entry : userParam.entrySet()) {
76 sb.append(entry.getKey());
80 sb.append(entry.getValue());
84 String Expexted = sb.toString();
85 assertEquals(Expexted, configAssignPropertiesForPnf.toString());