2  * ============LICENSE_START=======================================================
 
   3  *  Copyright (C) 2020 Nokia
 
   4  * ================================================================================
 
   5  * Licensed under the Apache License, Version 2.0 (the "License");
 
   6  * you may not use this file except in compliance with the License.
 
   7  * You may obtain a copy of the License at
 
   9  *      http://www.apache.org/licenses/LICENSE-2.0
 
  11  * Unless required by applicable law or agreed to in writing, software
 
  12  * distributed under the License is distributed on an "AS IS" BASIS,
 
  13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
  14  * See the License for the specific language governing permissions and
 
  15  * limitations under the License.
 
  17  * SPDX-License-Identifier: Apache-2.0
 
  18  * ============LICENSE_END=========================================================
 
  21 package org.onap.so.bpmn.infrastructure.service.level.impl;
 
  23 import static org.assertj.core.api.Assertions.assertThat;
 
  24 import org.camunda.bpm.engine.delegate.DelegateExecution;
 
  25 import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
 
  26 import org.junit.Test;
 
  28 public class ServiceLevelUpgradeTest {
 
  31     public void ServiceLevelUpgradeWithPnf() throws Exception {
 
  33         ServiceLevelUpgrade testedObject = new ServiceLevelUpgrade();
 
  34         DelegateExecution execution = prepareExecution();
 
  35         execution.setVariable(ServiceLevelConstants.RESOURCE_TYPE, "pnf");
 
  37         testedObject.execute(execution);
 
  39         assertThat(execution.getVariable(ServiceLevelConstants.SOFTWARE_WORKFLOW_TO_INVOKE))
 
  40                 .isEqualTo("GenericPnfSoftwareUpgrade");
 
  41         assertThat(execution.getVariable(ServiceLevelConstants.CONTROLLER_STATUS)).isEqualTo("");
 
  45     public void ServiceLevelUpgradeWithVnf() throws Exception {
 
  47         ServiceLevelUpgrade testedObject = new ServiceLevelUpgrade();
 
  48         DelegateExecution execution = prepareExecution();
 
  49         execution.setVariable(ServiceLevelConstants.RESOURCE_TYPE, "vnf");
 
  51         testedObject.execute(execution);
 
  53         assertThat(execution.getVariable(ServiceLevelConstants.SOFTWARE_WORKFLOW_TO_INVOKE));
 
  54         assertThat(execution.getVariable(ServiceLevelConstants.CONTROLLER_STATUS)).isEqualTo("");
 
  57     private DelegateExecution prepareExecution() {
 
  58         DelegateExecution execution = new DelegateExecutionFake();
 
  59         execution.setVariable(ServiceLevelConstants.SERVICE_INSTANCE_ID, "serviceTest");
 
  60         execution.setVariable(ServiceLevelConstants.BPMN_REQUEST, "bpmnRequestTest");
 
  61         execution.setVariable(ServiceLevelConstants.PNF_NAME, "pnfNameTest");