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.vid.controller;
23 import static org.mockito.Mockito.mock;
25 import javax.servlet.http.HttpServletRequest;
26 import org.junit.Test;
27 import org.onap.vid.mso.MsoBusinessLogicImpl;
28 import org.onap.vid.mso.MsoInterface;
29 import org.onap.vid.mso.RestMsoImplementation;
30 import org.onap.vid.mso.rest.RequestDetails;
31 import org.onap.vid.mso.rest.RequestDetailsWrapper;
32 import org.onap.vid.services.CloudOwnerServiceImpl;
33 import org.springframework.http.ResponseEntity;
35 public class MsoControllerNewTest {
37 private MsoController createTestSubject() {
39 return new MsoController(new MsoBusinessLogicImpl(mock(MsoInterface.class), null), mock(RestMsoImplementation.class),
40 new CloudOwnerServiceImpl(null, null));
41 } catch (Exception e) {
47 public void testCreateSvcInstance() throws Exception {
48 MsoController testSubject;
49 HttpServletRequest request = null;
50 RequestDetails mso_request = null;
51 ResponseEntity<String> result;
55 testSubject = createTestSubject();
56 result = testSubject.createSvcInstance(request, mso_request);
57 } catch (Exception e) {
62 public void testCreateVnf() throws Exception {
63 MsoController testSubject;
64 String serviceInstanceId = "";
65 HttpServletRequest request = null;
66 RequestDetails mso_request = null;
67 ResponseEntity<String> result;
71 testSubject = createTestSubject();
72 result = testSubject.createVnf(serviceInstanceId, request, mso_request);
73 } catch (Exception e) {
78 public void testCreateNwInstance() throws Exception {
79 MsoController testSubject;
80 String serviceInstanceId = "";
81 HttpServletRequest request = null;
82 RequestDetails mso_request = null;
83 ResponseEntity<String> result;
87 testSubject = createTestSubject();
88 result = testSubject.createNwInstance(serviceInstanceId, request, mso_request);
89 } catch (Exception e) {
94 public void testCreateVolumeGroupInstance() throws Exception {
95 MsoController testSubject;
96 String serviceInstanceId = "";
97 String vnfInstanceId = "";
98 HttpServletRequest request = null;
99 RequestDetails mso_request = null;
100 ResponseEntity<String> result;
104 testSubject = createTestSubject();
105 result = testSubject.createVolumeGroupInstance(serviceInstanceId, vnfInstanceId, request, mso_request);
106 } catch (Exception e) {
111 public void testCreateVfModuleInstance() throws Exception {
112 MsoController testSubject;
113 String serviceInstanceId = "";
114 String vnfInstanceId = "";
115 HttpServletRequest request = null;
116 RequestDetails mso_request = null;
117 ResponseEntity<String> result;
121 testSubject = createTestSubject();
122 result = testSubject.createVfModuleInstance(serviceInstanceId, vnfInstanceId, request, mso_request);
123 } catch (Exception e) {
128 public void testCreateConfigurationInstance() throws Exception {
129 MsoController testSubject;
130 String serviceInstanceId = "";
131 HttpServletRequest request = null;
132 RequestDetailsWrapper mso_request = null;
133 ResponseEntity<String> result;
137 testSubject = createTestSubject();
138 result = testSubject.createConfigurationInstance(serviceInstanceId, request, mso_request);
139 } catch (Exception e) {
144 public void testDeleteSvcInstance() throws Exception {
145 MsoController testSubject;
146 String serviceInstanceId = "";
147 HttpServletRequest request = null;
148 RequestDetails mso_request = null;
153 testSubject = createTestSubject();
154 result = testSubject.deleteSvcInstance(serviceInstanceId, request, mso_request, "");
155 } catch (Exception e) {
160 public void testDeleteVnf() throws Exception {
161 MsoController testSubject;
162 String serviceInstanceId = "";
163 String vnfInstanceId = "";
164 HttpServletRequest request = null;
165 RequestDetails mso_request = null;
166 ResponseEntity<String> result;
170 testSubject = createTestSubject();
171 result = testSubject.deleteVnf(serviceInstanceId, vnfInstanceId, request, mso_request);
172 } catch (Exception e) {
177 public void testDeleteConfiguration() throws Exception {
178 MsoController testSubject;
179 String serviceInstanceId = "";
180 String configurationId = "";
181 RequestDetailsWrapper mso_request = null;
182 ResponseEntity<String> result;
186 testSubject = createTestSubject();
187 result = testSubject.deleteConfiguration(serviceInstanceId, configurationId, mso_request);
188 } catch (Exception e) {
193 public void testActivateConfiguration() throws Exception {
194 MsoController testSubject;
195 String serviceInstanceId = "";
196 String configurationId = "";
197 RequestDetails mso_request = null;
198 ResponseEntity<String> result;
202 testSubject = createTestSubject();
203 result = testSubject.activateConfiguration(serviceInstanceId, configurationId, mso_request);
204 } catch (Exception e) {
209 public void testDeactivateConfiguration() throws Exception {
210 MsoController testSubject;
211 String serviceInstanceId = "";
212 String configurationId = "";
213 RequestDetails mso_request = null;
214 ResponseEntity<String> result;
218 testSubject = createTestSubject();
219 result = testSubject.deactivateConfiguration(serviceInstanceId, configurationId, mso_request);
220 } catch (Exception e) {
225 public void testDisablePortOnConfiguration() throws Exception {
226 MsoController testSubject;
227 String serviceInstanceId = "";
228 String configurationId = "";
229 RequestDetails mso_request = null;
230 ResponseEntity<String> result;
234 testSubject = createTestSubject();
235 result = testSubject.disablePortOnConfiguration(serviceInstanceId, configurationId, mso_request);
236 } catch (Exception e) {
241 public void testEnablePortOnConfiguration() throws Exception {
242 MsoController testSubject;
243 String serviceInstanceId = "";
244 String configurationId = "";
245 RequestDetails mso_request = null;
246 ResponseEntity<String> result;
250 testSubject = createTestSubject();
251 result = testSubject.enablePortOnConfiguration(serviceInstanceId, configurationId, mso_request);
252 } catch (Exception e) {
257 public void testDeleteVfModule() throws Exception {
258 MsoController testSubject;
259 String serviceInstanceId = "";
260 String vnfInstanceId = "";
261 String vfModuleId = "";
262 HttpServletRequest request = null;
263 RequestDetails mso_request = null;
264 ResponseEntity<String> result;
268 testSubject = createTestSubject();
269 result = testSubject.deleteVfModule(serviceInstanceId, vnfInstanceId, vfModuleId, request, mso_request);
270 } catch (Exception e) {
275 public void testDeleteVolumeGroupInstance() throws Exception {
276 MsoController testSubject;
277 String serviceInstanceId = "";
278 String vnfInstanceId = "";
279 String volumeGroupId = "";
280 HttpServletRequest request = null;
281 RequestDetails mso_request = null;
282 ResponseEntity<String> result;
286 testSubject = createTestSubject();
287 result = testSubject.deleteVolumeGroupInstance(serviceInstanceId, vnfInstanceId, volumeGroupId, request,
289 } catch (Exception e) {
294 public void testDeleteNwInstance() throws Exception {
295 MsoController testSubject;
296 String serviceInstanceId = "";
297 String networkInstanceId = "";
298 HttpServletRequest request = null;
299 RequestDetails mso_request = null;
300 ResponseEntity<String> result;
304 testSubject = createTestSubject();
305 result = testSubject.deleteNwInstance(serviceInstanceId, networkInstanceId, request, mso_request);
306 } catch (Exception e) {
311 public void testGetOrchestrationRequest() throws Exception {
312 MsoController testSubject;
313 String requestId = "";
314 HttpServletRequest request = null;
315 ResponseEntity<String> result;
319 testSubject = createTestSubject();
320 result = testSubject.getOrchestrationRequest(requestId, request);
321 } catch (Exception e) {
326 public void testGetOrchestrationRequests() throws Exception {
327 MsoController testSubject;
328 String filterString = "";
329 HttpServletRequest request = null;
330 ResponseEntity<String> result;
334 testSubject = createTestSubject();
335 result = testSubject.getOrchestrationRequests(filterString, request);
336 } catch (Exception e) {
341 public void testActivateServiceInstance() throws Exception {
342 MsoController testSubject;
343 String serviceInstanceId = "";
344 RequestDetails requestDetails = null;
345 ResponseEntity<String> result;
349 testSubject = createTestSubject();
350 result = testSubject.activateServiceInstance(serviceInstanceId, requestDetails);
351 } catch (Exception e) {
356 public void testDeactivateServiceInstance() throws Exception {
357 MsoController testSubject;
358 String serviceInstanceId = "";
359 RequestDetails requestDetails = null;
360 ResponseEntity<String> result;
364 testSubject = createTestSubject();
365 result = testSubject.deactivateServiceInstance(serviceInstanceId, requestDetails);
366 } catch (Exception e) {
371 public void testManualTaskComplete() throws Exception {
372 MsoController testSubject;
374 RequestDetails requestDetails = null;
375 ResponseEntity<String> result;
379 testSubject = createTestSubject();
380 result = testSubject.manualTaskComplete(taskId, requestDetails);
381 } catch (Exception e) {
386 public void testRemoveRelationshipFromServiceInstance() throws Exception {
387 MsoController testSubject;
388 String serviceInstanceId = "";
389 RequestDetails requestDetails = null;
390 ResponseEntity<String> result;
394 testSubject = createTestSubject();
395 result = testSubject.removeRelationshipFromServiceInstance(serviceInstanceId, requestDetails);
396 } catch (Exception e) {
401 public void testAddRelationshipToServiceInstance() throws Exception {
402 MsoController testSubject;
403 String serviceInstanceId = "";
404 RequestDetails requestDetails = null;
405 ResponseEntity<String> result;
409 testSubject = createTestSubject();
410 result = testSubject.addRelationshipToServiceInstance(serviceInstanceId, requestDetails);
411 } catch (Exception e) {