aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers
diff options
context:
space:
mode:
Diffstat (limited to 'mso-api-handlers')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CustomWorkflowValidation.java52
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java2
3 files changed, 22 insertions, 34 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java
index b58a3cdddc..dba393dcd6 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java
@@ -85,6 +85,6 @@ public class WorkflowSpecificationsHandler {
throw validateException;
}
- return builder.buildResponse(HttpStatus.SC_ACCEPTED, "", jsonResponse, apiVersion);
+ return builder.buildResponse(HttpStatus.SC_OK, "", jsonResponse, apiVersion);
}
}
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
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java
index 1a2eca6300..760532e6fe 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java
@@ -71,7 +71,7 @@ public class WorkflowSpecificationsHandlerTest extends BaseTest{
WorkflowSpecifications expectedResponse = mapper.readValue(new String(Files.readAllBytes(Paths.get("src/test/resources/__files/WorkflowSpecifications.json"))), WorkflowSpecifications.class);
- assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
WorkflowSpecifications realResponse = mapper.readValue(response.getBody(), WorkflowSpecifications.class);
assertThat(realResponse, sameBeanAs(expectedResponse));
assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0));