7299e0602ebd7f60b75a0f8f7e29e7d8df47d8ff
[so.git] / bpmn / mso-infrastructure-bpmn / src / test / java / org / onap / so / bpmn / common / GenerateVfModuleNameIT.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
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.bpmn.common;
22
23 import static org.junit.Assert.assertNotNull;
24 import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfById;
25
26 import java.util.HashMap;
27 import java.util.Map;
28
29 import org.camunda.bpm.engine.RuntimeService;
30 import org.camunda.bpm.engine.test.Deployment;
31 import org.junit.Ignore;
32 import org.junit.Test;
33 import org.onap.so.BaseIntegrationTest;
34
35 /**
36  * Unit test for GenerateVfModuleName.bpmn.
37  */
38
39 public class GenerateVfModuleNameIT extends BaseIntegrationTest {
40         private static final String EOL = "\n";
41         
42         @Test   
43         public void  TestGenerateVfModuleNameSuvvess() {
44                 // 
45                 String request =
46                         "<vnf-request xmlns=\"http://ecomp.att.com/mso/infra/vnf-request/v1\">" + EOL +
47                         "  <request-info>" + EOL +
48                         "    <action>CREATE_VF_MODULE</action>" + EOL +
49                         "    <source>PORTAL</source>" + EOL +
50                         "  </request-info>" + EOL +
51                         "  <vnf-inputs>" + EOL +
52                         "    <vnf-name>STMTN5MMSC22</vnf-name>" + EOL +
53                         "    <vf-module-name>STMTN5MMSC22-MMSC::module-0-0</vf-module-name>" + EOL +
54                         "    <vf-module-model-name>MMSC::module-0</vf-module-model-name>" + EOL +
55                         "    <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
56                         "    <persona-model-version>1.0</persona-model-version>" + EOL +
57                         "    <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
58                         "    <aic-node-clli>MDTWNJ21</aic-node-clli>" + EOL +
59                         "    <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
60                         "  </vnf-inputs>" + EOL +
61                         "  <vnf-params xmlns:tns=\"http://ecomp.att.com/mso/infra/vnf-request/v1\"/>" + EOL +
62                         "</vnf-request>" + EOL;
63
64                 MockGetGenericVnfById(wireMockServer, ".*", "GenericFlows/getGenericVnfByNameResponse.xml");
65                 RuntimeService runtimeService = processEngine.getRuntimeService();                              
66                 Map<String, Object> variables = new HashMap<String, Object>();          
67                 variables.put("isDebugLogEnabled","true");              
68                 variables.put("vnfName", "STMTN5MMSC20");
69                 variables.put("vfModuleLabel", "ModuleLabel1");
70                 variables.put("personaModelId", "extrovert");
71                 variables.put("vnfId", "12345678-f41f-4822-9323-b75962763d74");
72                 
73                 runtimeService.startProcessInstanceByKey("GenerateVfModuleName", variables);
74                 String response = BPMNUtil.getVariable(processEngine, "GenerateVfModuleName", "vfModuleName");
75                 
76                 assertNotNull(response);
77         }
78 }