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