2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.so.client.cds;
23 import static org.junit.Assert.assertTrue;
24 import static org.mockito.Mockito.mock;
25 import static org.mockito.Mockito.when;
27 import java.util.UUID;
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;
36 @RunWith(JUnit4.class)
37 public class AbstractCDSProcessingBBUtilsTest {
39 private AbstractCDSProcessingBBUtils abstractCDSProcessingBBUtils = new AbstractCDSProcessingBBUtils();
41 AbstractCDSPropertiesBean abstractCDSPropertiesBean = new AbstractCDSPropertiesBean();
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";
50 String requestId = "123456";
51 String originatorId = "originatorId";
52 String subRequestId = UUID.randomUUID().toString();
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);
63 DelegateExecution execution = mock(DelegateExecution.class);
64 when(execution.getVariable("executionObject")).thenReturn(abstractCDSPropertiesBean);
66 abstractCDSProcessingBBUtils.constructExecutionServiceInputObject(execution);