License agreement changes
[so.git] / bpmn / MSOCommonBPMN / src / test / java / org / onap / so / client / cds / beans / ConfigAssignPropertiesForPnfTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
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
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
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=========================================================
19  */
20
21 package org.onap.so.client.cds.beans;
22
23 import static org.junit.Assert.assertEquals;
24 import static org.junit.Assert.assertNotNull;
25 import java.util.HashMap;
26 import java.util.Map;
27 import org.junit.Test;
28
29 public class ConfigAssignPropertiesForPnfTest {
30     ConfigAssignPropertiesForPnf configAssignPropertiesForPnf = new ConfigAssignPropertiesForPnf();
31     private Map<String, Object> userParam = new HashMap<String, Object>();
32     private String serviceInstanceId;
33     private String pnfId;
34     private String pnfName;
35     private String serviceModelUuid;
36     private String pnfCustomizationUuid;
37
38     @Test
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");
49
50         assertNotNull(configAssignPropertiesForPnf.getPnfCustomizationUuid());
51         assertNotNull(configAssignPropertiesForPnf.getPnfId());
52         assertNotNull(configAssignPropertiesForPnf.getPnfName());
53         assertNotNull(configAssignPropertiesForPnf.getServiceInstanceId());
54         assertNotNull(configAssignPropertiesForPnf.getServiceModelUuid());
55         assertNotNull(configAssignPropertiesForPnf.getUserParam());
56
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());
63     }
64
65     @Test
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()) {
74             sb.append(",");
75             sb.append("\"");
76             sb.append(entry.getKey());
77             sb.append("\"");
78             sb.append(":");
79             sb.append("\"");
80             sb.append(entry.getValue());
81             sb.append("\"");
82         }
83         sb.append('}');
84         String Expexted = sb.toString();
85         assertEquals(Expexted, configAssignPropertiesForPnf.toString());
86
87     }
88 }