AT&T 1712 and 1802 release code
[so.git] / bpmn / MSOInfrastructureBPMN / src / test / java / org / openecomp / mso / bpmn / infrastructure / DoCreateServiceInstanceV3Test.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.infrastructure;
22
23 import java.io.IOException;
24 import java.util.HashMap;
25 import java.util.Map;
26 import java.util.UUID;
27
28 import org.camunda.bpm.engine.test.Deployment;
29 import org.junit.Assert;
30 import org.junit.Ignore;
31 import org.junit.Test;
32 import org.openecomp.mso.bpmn.common.WorkflowTest;
33 import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition;
34 import org.openecomp.mso.bpmn.core.json.JsonDecomposingException;
35
36 /**
37  * Unit test cases for DoCreateServiceInstanceV3.bpmn
38  */
39 public class DoCreateServiceInstanceV3Test extends WorkflowTest {
40
41         public DoCreateServiceInstanceV3Test() throws IOException {
42
43         }
44
45         @Test
46         @Deployment(resources = { "subprocess/DoCreateServiceInstanceV3.bpmn",
47                                                           "subprocess/DoCreateServiceInstanceV3Rollback.bpmn"
48                                                         })
49         @Ignore // 1802 merge
50         public void sunnyDay() throws Exception {
51                 logStart();
52                 String businessKey = UUID.randomUUID().toString();
53                 Map<String, Object> variables = new HashMap<String, Object>();
54                 setupVariables(variables);
55                 invokeSubProcess("DoCreateServiceInstanceV3", businessKey, variables);
56                 waitForProcessEnd(businessKey, 10000);
57                 Assert.assertTrue(isProcessEnded(businessKey));
58                 logEnd();
59         }
60
61         // Success Scenario
62         private void setupVariables(Map<String, Object> variables) throws JsonDecomposingException {
63                 variables.put("abc", "thevalueisabc");
64                 variables.put("mso-request-id", "213");
65                 ServiceDecomposition serviceDecomp = new ServiceDecomposition("{\"serviceResources\":{}}", "123");
66                 serviceDecomp.setServiceType("PORT-MIRRO");
67                 serviceDecomp.setSdncVersion("1610");
68                 variables.put("serviceDecomposition", serviceDecomp);
69         }
70 }