Containerization feature of SO
[so.git] / adapters / mso-openstack-adapters / src / test / java / org / onap / so / 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.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 VduBlueprintTest {
31
32     private VduBlueprint vduBlueprint;
33
34     private Map<String, byte[]> templateFiles;
35     private Map<String, byte[]> attachedFiles;
36
37     @Before
38     public void setUp() {
39         vduBlueprint = new VduBlueprint();
40     }
41
42     @Test
43     public void testGetVduModelId() {
44         vduBlueprint.setVduModelId("vduModelId");
45         Assert.assertNotNull(vduBlueprint.getVduModelId());
46         Assert.assertEquals("vduModelId", vduBlueprint.getVduModelId());
47     }
48
49     @Test
50     public void testGetMainTemplateName() {
51         vduBlueprint.setMainTemplateName("MainTemplateName");
52         Assert.assertNotNull(vduBlueprint.getMainTemplateName());
53         Assert.assertEquals("MainTemplateName", vduBlueprint.getMainTemplateName());
54     }
55
56     @Test
57     public void testGetTemplateFiles() {
58         byte[] templateFileData = "some template file data".getBytes();
59         templateFiles = new HashMap<>();
60         templateFiles.put("templateKey1", templateFileData);
61         vduBlueprint.setTemplateFiles(templateFiles);
62         Assert.assertNotNull(vduBlueprint.getTemplateFiles());
63         Assert.assertTrue(vduBlueprint.getTemplateFiles().containsKey("templateKey1"));
64         Assert.assertTrue(vduBlueprint.getTemplateFiles().containsValue(templateFileData));
65     }
66
67     @Test
68     public void testGetAttachedFiles() {
69         byte[] attachedFileData = "some file data".getBytes();
70         attachedFiles = new HashMap<>();
71         attachedFiles.put("attachedKey1", attachedFileData);
72         vduBlueprint.setAttachedFiles(attachedFiles);
73         Assert.assertNotNull(vduBlueprint.getAttachedFiles());
74         Assert.assertTrue(vduBlueprint.getAttachedFiles().containsKey("attachedKey1"));
75         Assert.assertTrue(vduBlueprint.getAttachedFiles().containsValue(attachedFileData));
76     }
77 }