Containerization feature of SO
[so.git] / adapters / mso-openstack-adapters / src / test / java / org / onap / so / vdu / utils / VduInfoTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2018 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.vdu.utils;
22
23 import java.util.HashMap;
24 import java.util.Map;
25
26 import org.junit.Assert;
27 import org.junit.Before;
28 import org.junit.Test;
29
30 public class VduInfoTest {
31
32     private VduInfo vduInfo;
33     private VduStatus status = VduStatus.NOTFOUND;
34     private Map<String, Object> outputs;
35     private Map<String, Object> inputs;
36
37     @Before
38     public void setUp() {
39         vduInfo = new VduInfo();
40     }
41
42     @Test
43     public void testGetVnfInstanceId() {
44         String vnfInstanceId = "vnfInstanceId";
45         vduInfo.setVnfInstanceId(vnfInstanceId);
46         Assert.assertNotNull(vduInfo.getVnfInstanceId());
47         Assert.assertEquals("vnfInstanceId", vduInfo.getVnfInstanceId());
48     }
49
50     @Test
51     public void testGetVnfInstanceName() {
52         String vnfInstanceName = "vnfInstanceName";
53         vduInfo.setVnfInstanceName(vnfInstanceName);
54         Assert.assertNotNull(vduInfo.getVnfInstanceName());
55         Assert.assertEquals("vnfInstanceName", vduInfo.getVnfInstanceName());
56     }
57
58     @Test
59     public void testGetStatus() {
60         vduInfo.setStatus(status);
61         Assert.assertNotNull(vduInfo.getStatus());
62         Assert.assertEquals(status, vduInfo.getStatus());
63     }
64
65     @Test
66     public void testGetOutputs() {
67         Object obj = new Object();
68         String str = "some text";
69         outputs = new HashMap<>();
70         outputs.put(str, obj);
71         vduInfo.setOutputs(outputs);
72         Assert.assertNotNull(vduInfo.getOutputs());
73         Assert.assertTrue(vduInfo.getOutputs().containsKey(str));
74         Assert.assertTrue(vduInfo.getOutputs().containsValue(obj));
75     }
76
77     @Test
78     public void testGetInputs() {
79         Object obj = new Object();
80         String str = "some text";
81         inputs = new HashMap<>();
82         inputs.put(str, obj);
83         vduInfo.setInputs(inputs);
84         Assert.assertNotNull(vduInfo.getInputs());
85         Assert.assertTrue(vduInfo.getInputs().containsKey(str));
86         Assert.assertTrue(vduInfo.getInputs().containsValue(obj));
87     }
88
89 }