Add VNF-Macro-Create and VNF-Macro-Delete
[so.git] / bpmn / so-bpmn-tasks / src / test / java / org / onap / so / bpmn / infrastructure / workflow / tasks / ExecuteBuildingBlockBuilderTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Modifications Copyright (c) 2019 Samsung
8  * ================================================================================
9  * Modifications Copyright (c) 2021 Nokia
10  * ================================================================================
11  * Modifications Copyright (c) 2020 Tech Mahindra
12  * ================================================================================
13  * Licensed under the Apache License, Version 2.0 (the "License");
14  * you may not use this file except in compliance with the License.
15  * You may obtain a copy of the License at
16  *
17  *      http://www.apache.org/licenses/LICENSE-2.0
18  *
19  * Unless required by applicable law or agreed to in writing, software
20  * distributed under the License is distributed on an "AS IS" BASIS,
21  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22  * See the License for the specific language governing permissions and
23  * limitations under the License.
24  * ============LICENSE_END=========================================================
25  */
26
27 package org.onap.so.bpmn.infrastructure.workflow.tasks;
28
29 import org.junit.Test;
30 import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys;
31 import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
32 import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
33 import java.util.ArrayList;
34 import java.util.List;
35 import static org.junit.Assert.assertEquals;
36 import static org.junit.Assert.assertNotNull;
37 import static org.junit.Assert.fail;
38
39 public class ExecuteBuildingBlockBuilderTest {
40
41     final private ExecuteBuildingBlockBuilder executeBBBuilder = new ExecuteBuildingBlockBuilder();
42
43     @Test
44     public void verifyLackOfNullPointerExceptionForNullResource() {
45         ExecuteBuildingBlock result = null;
46         try {
47             result = executeBBBuilder.buildExecuteBuildingBlock(new OrchestrationFlow(), null, null, null, null, null,
48                     false, null, null, null, false, null, null, true, null);
49         } catch (NullPointerException e) {
50             fail("NullPointerException should not be thrown when 'resource' is null");
51         }
52         assertNotNull(result);
53     }
54
55     @Test
56     public void getConfigurationResourceKeysTest() {
57         String vnfcName = "vnfc";
58         String vfModuleCustomizationId = "1a2b3c4e5d";
59         String cvnfModuleCustomizationId = "2b1a3c";
60         String vnfCustomizationId = "zz12aa";
61
62         Resource resource = new Resource(WorkflowType.SERVICE, "123", true);
63
64         resource.setCvnfModuleCustomizationId(vfModuleCustomizationId);
65         resource.setCvnfModuleCustomizationId(cvnfModuleCustomizationId);
66         resource.setVnfCustomizationId(vnfCustomizationId);
67
68         ConfigurationResourceKeys confResourceKeys = executeBBBuilder.getConfigurationResourceKeys(resource, vnfcName);
69
70         assertNotNull(confResourceKeys);
71         assertEquals(vnfcName, confResourceKeys.getVnfcName());
72         assertEquals(cvnfModuleCustomizationId, confResourceKeys.getCvnfcCustomizationUUID());
73         assertEquals(vnfCustomizationId, confResourceKeys.getVnfResourceCustomizationUUID());
74
75     }
76 }