2 * ============LICENSE_START=======================================================
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
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.bpmn.infrastructure.scripts
23 import org.camunda.bpm.engine.ProcessEngineServices
24 import org.camunda.bpm.engine.RepositoryService
25 import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
26 import org.camunda.bpm.engine.repository.ProcessDefinition
27 import org.camunda.bpm.engine.delegate.DelegateExecution
28 import org.junit.Before
31 import org.mockito.MockitoAnnotations
32 import org.onap.so.bpmn.common.scripts.MsoUtils
33 import org.onap.so.bpmn.core.WorkflowException
34 import org.onap.so.bpmn.core.json.JsonUtils
35 import org.onap.so.bpmn.common.scripts.VidUtils
37 import static org.junit.Assert.*;
38 import static org.mockito.Mockito.*
40 import com.github.tomakehurst.wiremock.junit.WireMockRule
42 class DeleteGenericAlaCarteServiceInstanceTest {
45 public WireMockRule wireMockRule = new WireMockRule(8090);
47 String Prefix="DELSI_"
48 def utils = new MsoUtils()
49 JsonUtils jsonUtil = new JsonUtils()
50 VidUtils vidUtils = new VidUtils()
52 String jsonIncomingRequest =
56 "modelType": "service",
57 "modelInvariantId": "1de901ed-17af-4b03-bc1f-41659cfa27cb",
58 "modelVersionId": "ace39141-09ec-4068-b06d-ac6b23bdc6e0",
59 "modelName": "demoVLB",
62 "cloudConfiguration" : {
63 "lcpCloudRegionId": "RegionOne",
67 "globalSubscriberId": "Demonstration",
68 "subscriberName": "Demonstration"
71 "instanceName": "sample-instance-2",
72 "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
75 "suppressRollback": "false"
77 "requestParameters": {
78 "subscriptionServiceType": "vLB"
86 MockitoAnnotations.initMocks(this)
90 public void initializeVariables(DelegateExecution mockExecution) {
92 verify(mockExecution).setVariable(Prefix + "Success", false)
94 verify(mockExecution).setVariable(Prefix + "CompleteMsoProcessRequest", "")
95 verify(mockExecution).setVariable(Prefix + "FalloutHandlerRequest", "")
96 verify(mockExecution).setVariable(Prefix + "isSilentSuccess", false)
102 public void preProcessRequest() {
104 println "************ preProcessRequest() ************* "
105 ExecutionEntity mockExecution = mock(ExecutionEntity.class)
106 // Initialize prerequisite variables
107 when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
108 when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest)
111 // preProcessRequest(DelegateExecution execution)
112 DeleteGenericALaCarteServiceInstance deleteGenericALaCarteServiceInstance = new DeleteGenericALaCarteServiceInstance()
113 deleteGenericALaCarteServiceInstance.preProcessRequest(mockExecution)
115 verify(mockExecution).getVariable("isDebugLogEnabled")
116 verify(mockExecution).setVariable("prefix", Prefix)
118 initializeVariables(mockExecution)
119 //verify(mockExecution).setVariable(Prefix + "Success", false)