d4f1660986909ade9d902776d1f5a6ba09ab99d4
[so.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 - 2018 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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.onap.so.bpmn.infrastructure.sdnc.mapper;
22
23 import java.net.URI;
24 import java.net.URISyntaxException;
25 import java.util.HashMap;
26 import java.util.List;
27 import java.util.Map;
28 import org.junit.Assert;
29 import org.junit.Test;
30 import org.junit.runner.RunWith;
31 import org.mockito.InjectMocks;
32 import org.mockito.Spy;
33 import org.mockito.junit.MockitoJUnitRunner;
34 import org.onap.sdnc.northbound.client.model.GenericResourceApiGcTopologyOperationInformation;
35 import org.onap.so.bpmn.common.data.TestDataSetup;
36 import org.onap.so.bpmn.infrastructure.sdnc.mapper.GCTopologyOperationRequestMapper;
37 import org.onap.so.bpmn.infrastructure.sdnc.mapper.GeneralTopologyObjectMapper;
38 import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
39 import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
40 import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
41 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
42 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy;
43 import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet;
44 import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBondingLink;
45 import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
46 import org.onap.so.client.sdnc.beans.SDNCSvcAction;
47
48 @RunWith(MockitoJUnitRunner.Silent.class)
49 public class GCTopologyOperationRequestMapperTest extends TestDataSetup {
50
51
52     @Spy
53     private GeneralTopologyObjectMapper generalTopologyObjectMapper;
54
55     @InjectMocks
56     private GCTopologyOperationRequestMapper genObjMapper = new GCTopologyOperationRequestMapper();
57
58     @Test
59     public void deactivateOrUnassignVnrReqMapperTest() throws URISyntaxException {
60         RequestContext requestContext = new RequestContext();
61         requestContext.setMsoRequestId("MsoRequestId");
62         ServiceInstance serviceInstance = new ServiceInstance();
63         serviceInstance.setServiceInstanceId("ServiceInstanceId");
64         Configuration Configuration = new Configuration();
65         Configuration.setConfigurationId("ConfigurationId");
66         Configuration.setConfigurationType("VLAN-NETWORK-RECEPTOR");
67         GenericResourceApiGcTopologyOperationInformation genericInfo =
68                 genObjMapper.deactivateOrUnassignVnrReqMapper(SDNCSvcAction.UNASSIGN, serviceInstance, requestContext,
69                         Configuration, "uuid", new URI("http://localhost"));
70
71         Assert.assertNotNull(genericInfo);
72         Assert.assertNotNull(genericInfo.getRequestInformation());
73         Assert.assertNotNull(genericInfo.getSdncRequestHeader());
74         Assert.assertNotNull(genericInfo.getClass());
75         Assert.assertNotNull(genericInfo.getServiceInformation());
76         Assert.assertEquals("ConfigurationId", genericInfo.getConfigurationInformation().getConfigurationId());
77         Assert.assertEquals("VLAN-NETWORK-RECEPTOR", genericInfo.getConfigurationInformation().getConfigurationType());
78         Assert.assertEquals("uuid", genericInfo.getSdncRequestHeader().getSvcRequestId());
79         Assert.assertEquals("http://localhost", genericInfo.getSdncRequestHeader().getSvcNotificationUrl());
80         Assert.assertEquals("MsoRequestId", genericInfo.getRequestInformation().getRequestId());
81     }
82
83 }