2  * ============LICENSE_START=======================================================
 
   4  * ================================================================================
 
   5  * Copyright (C) 2017-2019 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.adapters.tasks.inventory;
 
  23 import static org.mockito.Mockito.doReturn;
 
  25 import java.io.IOException;
 
  26 import org.camunda.bpm.client.task.ExternalTask;
 
  27 import org.junit.Before;
 
  28 import org.mockito.InjectMocks;
 
  29 import org.mockito.Mock;
 
  30 import org.mockito.MockitoAnnotations;
 
  31 import org.onap.so.audit.beans.AuditInventory;
 
  32 import org.onap.aaiclient.client.aai.AAIResourcesClient;
 
  33 import org.onap.so.objects.audit.AAIObjectAuditList;
 
  34 import com.fasterxml.jackson.databind.ObjectMapper;
 
  36 public class CreateAAIInventoryTest extends CreateAAIInventory {
 
  39     private CreateAAIInventory createAAIInventory = new CreateAAIInventory();
 
  42     private ExternalTask mockExternalTask;
 
  45     private AAIResourcesClient mockClient;
 
  47     private ObjectMapper objectMapper = new ObjectMapper();
 
  49     private AuditInventory auditInventory = new AuditInventory();
 
  51     AAIObjectAuditList auditListSuccess;
 
  53     AAIObjectAuditList auditListFailure;
 
  55     AAIObjectAuditList missingSubInterfaces;
 
  58     public void setup() throws IOException {
 
  59         auditInventory.setCloudOwner("cloudOwner");
 
  60         auditInventory.setCloudRegion("cloudRegion");
 
  61         auditInventory.setTenantId("tenantId");
 
  62         auditInventory.setHeatStackName("stackName");
 
  63         MockitoAnnotations.initMocks(this);
 
  64         auditListSuccess = objectMapper.readValue(new File("src/test/resources/ExpectedVServerFound.json"),
 
  65                 AAIObjectAuditList.class);
 
  66         auditListFailure = objectMapper.readValue(new File("src/test/resources/Vserver2_Found_VServer1_Not_Found.json"),
 
  67                 AAIObjectAuditList.class);
 
  68         missingSubInterfaces = objectMapper.readValue(new File("src/test/resources/AuditResultsMissSub.json"),
 
  69                 AAIObjectAuditList.class);
 
  70         doReturn(auditInventory).when(mockExternalTask).getVariable("auditInventory");