Merge "Unit test coverage"
[so.git] / adapters / mso-vnf-adapter / src / test / java / org / openecomp / mso / vdu / utils / VduBlueprintTest.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.openecomp.mso.vdu.utils;
22
23 import static org.junit.Assert.*;
24
25 import java.util.HashMap;
26 import java.util.Map;
27
28 import org.junit.Before;
29 import org.junit.Test;
30 import org.openecomp.mso.vdu.utils.VduBlueprint;
31
32 import org.junit.Assert;
33
34 public class VduBlueprintTest {
35
36     private VduBlueprint vduBlueprint;
37
38     private Map<String, byte[]> templateFiles;
39     private Map<String, byte[]> attachedFiles;
40
41     @Before
42     public void setUp() {
43         vduBlueprint = new VduBlueprint();
44     }
45
46     @Test
47     public void testGetVduModelId() {
48         vduBlueprint.setVduModelId("vduModelId");
49         Assert.assertNotNull(vduBlueprint.getVduModelId());
50         Assert.assertEquals(vduBlueprint.getVduModelId(), "vduModelId");
51     }
52
53     @Test
54     public void testGetMainTemplateName() {
55         vduBlueprint.setMainTemplateName("MainTemplateName");
56         Assert.assertNotNull(vduBlueprint.getMainTemplateName());
57         Assert.assertEquals(vduBlueprint.getMainTemplateName(), "MainTemplateName");
58     }
59
60     @Test
61     public void testGetTemplateFiles() {
62         byte[] templateFileData = "some template file data".getBytes();
63         templateFiles = new HashMap<String, byte[]>();
64         templateFiles.put("templateKey1", templateFileData);
65         vduBlueprint.setTemplateFiles(templateFiles);
66         Assert.assertNotNull(vduBlueprint.getTemplateFiles());
67         Assert.assertTrue(vduBlueprint.getTemplateFiles().containsKey("templateKey1"));
68         Assert.assertTrue(vduBlueprint.getTemplateFiles().containsValue(templateFileData));
69     }
70
71     @Test
72     public void testGetAttachedFiles() {
73         byte[] attachedFileData = "some file data".getBytes();
74         attachedFiles = new HashMap<String, byte[]>();
75         attachedFiles.put("attachedKey1", attachedFileData);
76         vduBlueprint.setAttachedFiles(attachedFiles);
77         Assert.assertNotNull(vduBlueprint.getAttachedFiles());
78         Assert.assertTrue(vduBlueprint.getAttachedFiles().containsKey("attachedKey1"));
79         Assert.assertTrue(vduBlueprint.getAttachedFiles().containsValue(attachedFileData));
80     }
81 }