aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java/org/onap/vid/controller/AsyncInstantiationController.java
diff options
context:
space:
mode:
authorMichal Kabaj <michal.kabaj@nokia.com>2019-03-23 00:10:14 +0100
committerMichal Kabaj <michal.kabaj@nokia.com>2019-03-23 00:10:14 +0100
commit59b3997941ecf730beaa979c17ff6c9d303c87d5 (patch)
tree190379b7335d56ff180ddc159e3087f659801410 /vid-app-common/src/main/java/org/onap/vid/controller/AsyncInstantiationController.java
parent926100a4e3d59d0dbee1f79570fca98d177d323b (diff)
ControllerUtils tests and improvements
- added junits - Injecting SystemPropertiesWrapper via constructor - switched extractUserId is now instance method instead of static Change-Id: Ic706b780c64248e44207a1dee723981a4ca7ed74 Issue-ID: VID-449 Signed-off-by: Michal Kabaj <michal.kabaj@nokia.com>
Diffstat (limited to 'vid-app-common/src/main/java/org/onap/vid/controller/AsyncInstantiationController.java')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/AsyncInstantiationController.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/AsyncInstantiationController.java b/vid-app-common/src/main/java/org/onap/vid/controller/AsyncInstantiationController.java
index a204d3a9a..081e3c640 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controller/AsyncInstantiationController.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controller/AsyncInstantiationController.java
@@ -31,6 +31,7 @@ import org.onap.vid.model.serviceInstantiation.ServiceInstantiation;
import org.onap.vid.mso.MsoResponseWrapper2;
import org.onap.vid.services.AsyncInstantiationBusinessLogic;
import org.onap.vid.services.AuditService;
+import org.onap.vid.utils.SystemPropertiesWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -48,6 +49,7 @@ public class AsyncInstantiationController extends VidRestrictedBaseController {
public static final String ASYNC_INSTANTIATION = "asyncInstantiation";
protected final AsyncInstantiationBusinessLogic asyncInstantiationBL;
+ private final SystemPropertiesWrapper systemPropertiesWrapper;
protected ObjectMapper objectMapper = new ObjectMapper();
@@ -55,8 +57,9 @@ public class AsyncInstantiationController extends VidRestrictedBaseController {
protected AuditService auditService;
@Autowired
- public AsyncInstantiationController(AsyncInstantiationBusinessLogic asyncInstantiationBL) {
+ public AsyncInstantiationController(AsyncInstantiationBusinessLogic asyncInstantiationBL, SystemPropertiesWrapper systemPropertiesWrapper) {
this.asyncInstantiationBL = asyncInstantiationBL;
+ this.systemPropertiesWrapper = systemPropertiesWrapper;
}
@ExceptionHandler(OperationNotAllowedException.class)
@@ -84,7 +87,7 @@ public class AsyncInstantiationController extends VidRestrictedBaseController {
catch (Exception e) {
LOGGER.error(EELFLoggerDelegate.errorLogger, "failed to log incoming ServiceInstantiation request ", e);
}
- String userId = ControllersUtils.extractUserId(httpServletRequest);
+ String userId = new ControllersUtils(systemPropertiesWrapper).extractUserId(httpServletRequest);
List<UUID> uuids = asyncInstantiationBL.pushBulkJob(request, userId);
return new MsoResponseWrapper2(200, uuids);