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.client.orchestration;
23 import static org.junit.Assert.assertNotNull;
24 import static org.mockito.ArgumentMatchers.any;
25 import static org.mockito.ArgumentMatchers.isA;
26 import static org.mockito.Mockito.doReturn;
27 import static org.mockito.Mockito.times;
28 import static org.mockito.Mockito.verify;
31 import java.net.URISyntaxException;
33 import org.junit.Before;
34 import org.junit.Test;
35 import org.junit.runner.RunWith;
36 import org.mockito.InjectMocks;
37 import org.mockito.Mock;
38 import org.mockito.Mockito;
39 import org.mockito.Spy;
40 import org.mockito.junit.MockitoJUnitRunner;
41 import org.onap.so.bpmn.common.data.TestDataSetup;
42 import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
43 import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
44 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
45 import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBondingLink;
46 import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
47 import org.onap.so.client.exception.BadResponseException;
48 import org.onap.so.client.exception.MapperException;
49 import org.onap.so.client.sdnc.SDNCClient;
50 import org.onap.so.client.sdnc.endpoint.SDNCTopology;
51 import org.onap.so.client.sdnc.mapper.GCTopologyOperationRequestMapper;
53 import org.onap.sdnc.northbound.client.model.GenericResourceApiGcTopologyOperationInformation;
55 @RunWith(MockitoJUnitRunner.Silent.class)
56 public class SDNCConfigurationResourcesTest extends TestDataSetup{
59 private SDNCConfigurationResources sdncConfigurationResources = new SDNCConfigurationResources();
62 GCTopologyOperationRequestMapper MOCK_gcTopologyMapper ;
65 protected SDNCClient MOCK_sdncClient;
67 private RequestContext requestContext;
68 private ServiceInstance serviceInstance;
69 private VpnBondingLink vpnBondingLink;
70 private GenericVnf vnf;
71 private Customer customer;
75 customer = buildCustomer();
76 requestContext = buildRequestContext();
77 serviceInstance = buildServiceInstance();
78 vpnBondingLink = buildVpnBondingLink();
79 vnf = vpnBondingLink.getInfrastructureServiceProxy().getServiceInstance().getVnfs().get(0);
83 public void activateVnrConfigurationTest() throws BadResponseException, MapperException, URISyntaxException {
84 GenericResourceApiGcTopologyOperationInformation response = sdncConfigurationResources.activateVnrConfiguration(serviceInstance,requestContext,customer,vpnBondingLink.getVnrConfiguration(),vnf,"uuid",new URI("http://localhost"));
85 assertNotNull(response);
89 public void assignVnrConfigurationTest() throws BadResponseException, MapperException, URISyntaxException {
90 GenericResourceApiGcTopologyOperationInformation response = sdncConfigurationResources.assignVnrConfiguration(serviceInstance,requestContext,customer,vpnBondingLink.getVnrConfiguration(),vnf,"uuid",new URI("http://localhost"));
91 assertNotNull(response);
95 public void unAssignVnrConfigurationTest() throws BadResponseException, MapperException , URISyntaxException{
96 GenericResourceApiGcTopologyOperationInformation response = sdncConfigurationResources.unAssignVnrConfiguration(serviceInstance,requestContext,vpnBondingLink.getVnrConfiguration(),"uuid",new URI("http://localhost"));
97 assertNotNull(response);
101 public void deactivateVnrConfigurationTest() throws BadResponseException, MapperException , URISyntaxException{
102 GenericResourceApiGcTopologyOperationInformation response = sdncConfigurationResources.deactivateVnrConfiguration(serviceInstance,requestContext,vpnBondingLink.getVnrConfiguration(),"uuid",new URI("http://localhost"));
103 assertNotNull(response);