2 * ============LICENSE_START=======================================================
\r
4 * ================================================================================
\r
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * ================================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
18 * ============LICENSE_END=========================================================
\r
21 package org.openecomp.mso.adapters.vnf.test;
\r
23 import java.util.HashMap;
\r
24 import java.util.Map;
\r
26 import org.junit.Test;
\r
27 import org.openecomp.mso.adapters.vnf.MsoVnfAdapterAsyncImpl;
\r
28 import org.openecomp.mso.entity.MsoRequest;
\r
29 import org.openecomp.mso.openstack.beans.HeatStatus;
\r
30 import org.openecomp.mso.openstack.beans.StackInfo;
\r
31 import org.openecomp.mso.openstack.beans.VnfRollback;
\r
32 import org.openecomp.mso.openstack.exceptions.MsoException;
\r
33 import org.openecomp.mso.openstack.utils.MsoHeatUtils;
\r
36 import mockit.MockUp;
\r
38 public class MsoVnfAdapterAsyncImplTest {
\r
41 public void healthCheckVNFTest() {
\r
42 MsoVnfAdapterAsyncImpl instance = new MsoVnfAdapterAsyncImpl();
\r
43 instance.healthCheckA();
\r
47 public void createVNFTest() {
\r
48 new MockUp<MsoHeatUtils>() {
\r
50 public StackInfo queryStack(String cloudSiteId, String tenantId, String stackName) throws MsoException {
\r
51 StackInfo info = new StackInfo();
\r
52 info.setStatus(HeatStatus.CREATED);
\r
57 MsoVnfAdapterAsyncImpl instance = new MsoVnfAdapterAsyncImpl();
\r
58 MsoRequest msoRequest = new MsoRequest();
\r
59 msoRequest.setRequestId("12345");
\r
60 msoRequest.setServiceInstanceId("12345");
\r
63 instance.createVnfA("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
\r
64 "volumeGroupHeatStackId|1", new HashMap<String, String>(), Boolean.FALSE, Boolean.TRUE, "messageId",
\r
65 null, "http://org.openecomp.mso/notify/adapterNotify/updateVnfNotificationRequest");
\r
66 } catch (Exception e) {
\r
72 public void updateVnfTest() {
\r
73 MsoVnfAdapterAsyncImpl instance = new MsoVnfAdapterAsyncImpl();
\r
74 MsoRequest msoRequest = new MsoRequest();
\r
75 msoRequest.setRequestId("12345");
\r
76 msoRequest.setServiceInstanceId("12345");
\r
78 Map<String, String> map = new HashMap<>();
\r
79 map.put("key1", "value1");
\r
81 instance.updateVnfA("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
\r
82 "volumeGroupHeatStackId|1", map, "messageId", msoRequest,
\r
83 "http://org.openecomp.mso/notify/adapterNotify/updateVnfNotificationRequest");
\r
84 } catch (Exception e) {
\r
90 public void queryVnfTest() {
\r
91 MsoVnfAdapterAsyncImpl instance = new MsoVnfAdapterAsyncImpl();
\r
92 MsoRequest msoRequest = new MsoRequest();
\r
93 msoRequest.setRequestId("12345");
\r
94 msoRequest.setServiceInstanceId("12345");
\r
96 instance.queryVnfA("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", "messageId", msoRequest,
\r
97 "http://org.openecomp.mso/notify/adapterNotify/updateVnfNotificationRequest");
\r
98 } catch (Exception e) {
\r
104 public void deleteVnfTest() {
\r
105 MsoVnfAdapterAsyncImpl instance = new MsoVnfAdapterAsyncImpl();
\r
106 MsoRequest msoRequest = new MsoRequest();
\r
107 msoRequest.setRequestId("12345");
\r
108 msoRequest.setServiceInstanceId("12345");
\r
110 instance.deleteVnfA("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", "messageId", msoRequest,
\r
111 "http://org.openecomp.mso/notify/adapterNotify/updateVnfNotificationRequest");
\r
112 } catch (Exception e) {
\r
118 public void rollbackVnfTest() {
\r
119 MsoVnfAdapterAsyncImpl instance = new MsoVnfAdapterAsyncImpl();
\r
120 VnfRollback vnfRollBack = new VnfRollback();
\r
121 vnfRollBack.setCloudSiteId("mdt1");
\r
122 vnfRollBack.setTenantId("88a6ca3ee0394ade9403f075db23167e");
\r
123 vnfRollBack.setVnfId("ff5256d1-5a33-55df-13ab-12abad84e7ff");
\r
125 instance.rollbackVnfA(vnfRollBack, "messageId",
\r
126 "http://org.openecomp.mso/notify/adapterNotify/updateVnfNotificationRequest");
\r
127 } catch (Exception e) {
\r