Config Assign
[so.git] / bpmn / MSOCommonBPMN / src / test / java / org / onap / so / client / cds / AbstractCDSProcessingBBUtilsTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2019 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.client.cds;
22
23 import static org.junit.Assert.assertTrue;
24 import static org.mockito.Mockito.mock;
25 import static org.mockito.Mockito.when;
26
27 import java.util.UUID;
28
29 import org.camunda.bpm.engine.delegate.DelegateExecution;
30 import org.junit.Test;
31 import org.junit.runner.RunWith;
32 import org.junit.runners.JUnit4;
33 import org.mockito.InjectMocks;
34 import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
35
36 @RunWith(JUnit4.class)
37 public class AbstractCDSProcessingBBUtilsTest {
38     @InjectMocks
39     private AbstractCDSProcessingBBUtils abstractCDSProcessingBBUtils = new AbstractCDSProcessingBBUtils();
40     @InjectMocks
41     AbstractCDSPropertiesBean abstractCDSPropertiesBean = new AbstractCDSPropertiesBean();
42
43     @Test
44     public void preProcessRequestTest() throws Exception {
45         String requestObject = "{\"config-assign-request\":{\"resolution-key\":\"resolutionKey\", \"config-assign-properties\":{\"service-instance-id\":\"serviceInstanceId\", \"vnf-id\":\"vnfId\", \"vnf-name\":\"vnfName\", \"service-model-uuid\":\"serviceModelUuid\", \"vnf-customization-uuid\":\"vnfCustomizationUuid\",\"Instance1\":\"Instance1Value\",\"Instance2\":\"Instance2Value\",\"Param3\":\"Param3Value\"}}}";
46         String blueprintName = "blueprintName";
47         String blueprintVersion = "blueprintVersion";
48         String actionName = "actionName";
49         String mode = "mode";
50         String requestId = "123456";
51         String originatorId = "originatorId";
52         String subRequestId = UUID.randomUUID().toString();
53
54         abstractCDSPropertiesBean.setActionName(actionName);
55         abstractCDSPropertiesBean.setBlueprintName(blueprintName);
56         abstractCDSPropertiesBean.setBlueprintVersion(blueprintVersion);
57         abstractCDSPropertiesBean.setMode(mode);
58         abstractCDSPropertiesBean.setOriginatorId(originatorId);
59         abstractCDSPropertiesBean.setRequestId(requestId);
60         abstractCDSPropertiesBean.setRequestObject(requestObject);
61         abstractCDSPropertiesBean.setSubRequestId(subRequestId);
62
63         DelegateExecution execution = mock(DelegateExecution.class);
64         when(execution.getVariable("executionObject")).thenReturn(abstractCDSPropertiesBean);
65
66         abstractCDSProcessingBBUtils.constructExecutionServiceInputObject(execution);
67         assertTrue(true);
68     }
69
70 }