From a17096bb5555c4fff43cdb3094c9b8b96bb3fd61 Mon Sep 17 00:00:00 2001 From: Joanna Jeremicz Date: Tue, 20 Nov 2018 08:52:31 +0100 Subject: ChangeManagementController tests Change-Id: I936a9c65c167e5076d775f4139cc76340d0fc55d Issue-ID: VID-353 Signed-off-by: Joanna Jeremicz --- .../controllers/ChangeManagementController.java | 60 +++++++++++++++++----- 1 file changed, 48 insertions(+), 12 deletions(-) (limited to 'vid-app-common/src/main') diff --git a/vid-app-common/src/main/java/org/onap/vid/controllers/ChangeManagementController.java b/vid-app-common/src/main/java/org/onap/vid/controllers/ChangeManagementController.java index 59fe61fd0..88875b510 100644 --- a/vid-app-common/src/main/java/org/onap/vid/controllers/ChangeManagementController.java +++ b/vid-app-common/src/main/java/org/onap/vid/controllers/ChangeManagementController.java @@ -1,12 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * VID + * ================================================================================ + * Copyright © 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Modifications Copyright 2018 Nokia + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.onap.vid.controllers; +import static org.onap.vid.utils.Logging.getMethodName; +import static org.springframework.http.HttpStatus.BAD_REQUEST; +import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR; +import static org.springframework.http.HttpStatus.OK; + import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.Collection; +import java.util.Collections; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.WebApplicationException; import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.commons.lang3.tuple.Pair; import org.json.simple.JSONArray; import org.onap.portalsdk.core.controller.UnRestrictedBaseController; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.onap.vid.changeManagement.*; +import org.onap.vid.changeManagement.ChangeManagementRequest; +import org.onap.vid.changeManagement.GetVnfWorkflowRelationRequest; +import org.onap.vid.changeManagement.GetWorkflowsResponse; +import org.onap.vid.changeManagement.VnfWorkflowRelationAllResponse; +import org.onap.vid.changeManagement.VnfWorkflowRelationRequest; +import org.onap.vid.changeManagement.VnfWorkflowRelationResponse; import org.onap.vid.exceptions.NotFoundException; import org.onap.vid.model.ExceptionResponse; import org.onap.vid.model.MsoExceptionResponse; @@ -18,17 +54,18 @@ import org.onap.vid.services.WorkflowService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.WebApplicationException; -import java.util.Collection; -import java.util.Collections; - -import static org.onap.vid.utils.Logging.getMethodName; -import static org.springframework.http.HttpStatus.*; - /** * Controller to handle ChangeManagement feature requests. */ @@ -68,8 +105,7 @@ public class ChangeManagementController extends UnRestrictedBaseController { } @RequestMapping(value = "/workflow/{vnfName}", method = RequestMethod.POST) - public ResponseEntity changeManagement(@PathVariable("vnfName") String vnfName, - HttpServletRequest request, + public ResponseEntity changeManagement(HttpServletRequest request, @PathVariable("vnfName") String vnfName, @RequestBody ChangeManagementRequest changeManagmentRequest) throws Exception { return this.changeManagementService.doChangeManagement(changeManagmentRequest, vnfName); -- cgit 1.2.3-korg