diff options
author | r.bogacki <r.bogacki@samsung.com> | 2019-04-03 14:00:21 +0200 |
---|---|---|
committer | r.bogacki <r.bogacki@samsung.com> | 2019-04-05 07:37:33 +0200 |
commit | 608a077f8ea3b18dddbfeb4d8b486661e05561c7 (patch) | |
tree | e95628c8f3030f6d03b3d92d1ed030b9db9d27d2 /mso-api-handlers/mso-api-handler-infra/src/main | |
parent | f81920304c7b62637d32473e672a1e51275ce54b (diff) |
Fixed Sonar blocker issues
Fixed blockers according to Sonar analysis.
Added tests for fixed issues.
Change-Id: I8e259147082d722961048454fae9484cc0d8b0a8
Issue-ID: SO-1734
Signed-off-by: Robert Bogacki <r.bogacki@samsung.com>
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/main')
-rw-r--r-- | mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CustomWorkflowValidation.java | 52 |
1 files changed, 20 insertions, 32 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CustomWorkflowValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CustomWorkflowValidation.java index 695213bf20..0602f09796 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CustomWorkflowValidation.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CustomWorkflowValidation.java @@ -4,6 +4,7 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * Modifications Copyright (c) 2019 Samsung * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,44 +22,31 @@ package org.onap.so.apihandlerinfra.validation; -import java.util.List; -import java.util.Map; - import org.onap.so.exceptions.ValidationException; import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.RequestParameters; import com.google.common.base.Strings; -public class CustomWorkflowValidation implements ValidationRule{ - +public class CustomWorkflowValidation implements ValidationRule { + @Override - public ValidationInformation validate(ValidationInformation info) throws ValidationException{ - RequestParameters requestParameters = info.getSir().getRequestDetails().getRequestParameters(); - CloudConfiguration cloudConfiguration = info.getSir().getRequestDetails ().getCloudConfiguration(); - String workflowUuid = info.getInstanceIdMap().get("workflowUuid"); - + public ValidationInformation validate(ValidationInformation info) throws ValidationException { + RequestParameters requestParameters = info.getSir().getRequestDetails().getRequestParameters(); + CloudConfiguration cloudConfiguration = info.getSir().getRequestDetails().getCloudConfiguration(); + if (cloudConfiguration == null) { - throw new ValidationException ("cloudConfiguration"); - }else if (Strings.isNullOrEmpty((cloudConfiguration.getCloudOwner ()))) { - throw new ValidationException ("cloudOwner"); - }else if (Strings.isNullOrEmpty((cloudConfiguration.getLcpCloudRegionId ()))) { - throw new ValidationException ("lcpCloudRegionId"); - }else if (Strings.isNullOrEmpty((cloudConfiguration.getTenantId ()))) { - throw new ValidationException ("tenantId"); - } - if(requestParameters == null){ - throw new ValidationException("requestParameters"); - } - - List<Map<String, Object>> userParams = requestParameters.getUserParams(); - if (!validateCustomUserParams(userParams, workflowUuid)) { - throw new ValidationException("userParams"); - } - return info; - } - - private boolean validateCustomUserParams(List<Map<String, Object>> userParams, String workflowUuid) { - return true; + throw new ValidationException("cloudConfiguration"); + } else if (Strings.isNullOrEmpty((cloudConfiguration.getCloudOwner()))) { + throw new ValidationException("cloudOwner"); + } else if (Strings.isNullOrEmpty((cloudConfiguration.getLcpCloudRegionId()))) { + throw new ValidationException("lcpCloudRegionId"); + } else if (Strings.isNullOrEmpty((cloudConfiguration.getTenantId()))) { + throw new ValidationException("tenantId"); + } + if (requestParameters == null) { + throw new ValidationException("requestParameters"); + } + return info; } -}
\ No newline at end of file +} |