summaryrefslogtreecommitdiffstats
path: root/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services')
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/Validation.java27
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/ValidationForSwaggerUsage.java27
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/mapping/MapValidationFileResponseToValidationFileResponseDto.java14
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/services/ValidationImpl.java49
4 files changed, 51 insertions, 66 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/Validation.java b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/Validation.java
index ec8c8eb945..e354abf85a 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/Validation.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/Validation.java
@@ -13,33 +13,30 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdcrests.validation.rest;
-import io.swagger.v3.oas.annotations.info.Info;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.tags.Tags;
-import org.apache.cxf.jaxrs.ext.multipart.Multipart;
-import org.springframework.validation.annotation.Validated;
-
-import javax.ws.rs.*;
+import java.io.InputStream;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import java.io.InputStream;
-
+import org.apache.cxf.jaxrs.ext.multipart.Multipart;
+import org.springframework.validation.annotation.Validated;
@Path("/v1.0/validation")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Tags({@Tag(name = "SDCE-1 APIs"), @Tag(name = "Validation")})
@Validated
-
public interface Validation {
-
- @POST
- @Path("{type}/validate")
- @Consumes(MediaType.MULTIPART_FORM_DATA)
- Response validateFile(@PathParam("type") String type,
- @Multipart("validate") InputStream fileToValidate);
+ @POST
+ @Path("{type}/validate")
+ @Consumes(MediaType.MULTIPART_FORM_DATA)
+ Response validateFile(@PathParam("type") String type, @Multipart("validate") InputStream fileToValidate);
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/ValidationForSwaggerUsage.java b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/ValidationForSwaggerUsage.java
index e184b9e2a4..ac4f0ad64d 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/ValidationForSwaggerUsage.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/ValidationForSwaggerUsage.java
@@ -13,35 +13,32 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdcrests.validation.rest;
import com.sun.jersey.multipart.FormDataParam;
import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.info.Info;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.tags.Tags;
-import org.springframework.validation.annotation.Validated;
-
-import javax.ws.rs.*;
+import java.io.InputStream;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import java.io.InputStream;
-
+import org.springframework.validation.annotation.Validated;
@Path("/v1.0/validation")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Tags({@Tag(name = "SDCE-1 APIs"), @Tag(name = "Validation")})
@Validated
-
public interface ValidationForSwaggerUsage {
-
- @POST
- @Path("{type}/validate")
- @Consumes(MediaType.MULTIPART_FORM_DATA)
- @Operation(description = "Validate a package")
- Response validateFile(@PathParam("type") String type,
- @FormDataParam("validate") InputStream fileToValidate);
+ @POST
+ @Path("{type}/validate")
+ @Consumes(MediaType.MULTIPART_FORM_DATA)
+ @Operation(description = "Validate a package")
+ Response validateFile(@PathParam("type") String type, @FormDataParam("validate") InputStream fileToValidate);
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/mapping/MapValidationFileResponseToValidationFileResponseDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/mapping/MapValidationFileResponseToValidationFileResponseDto.java
index 9f8ae80e18..99e375d07e 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/mapping/MapValidationFileResponseToValidationFileResponseDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/mapping/MapValidationFileResponseToValidationFileResponseDto.java
@@ -13,10 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdcrests.validation.rest.mapping;
-
import org.openecomp.sdc.validation.types.ValidationFileResponse;
import org.openecomp.sdcrests.mapping.MappingBase;
import org.openecomp.sdcrests.validation.types.ValidationFileResponseDto;
@@ -24,10 +22,10 @@ import org.openecomp.sdcrests.validation.types.ValidationFileResponseDto;
/**
* Created by TALIO on 4/27/2016.
*/
-public class MapValidationFileResponseToValidationFileResponseDto
- extends MappingBase<ValidationFileResponse, ValidationFileResponseDto> {
- @Override
- public void doMapping(ValidationFileResponse source, ValidationFileResponseDto target) {
- target.setValidationData(source.getValidationData());
- }
+public class MapValidationFileResponseToValidationFileResponseDto extends MappingBase<ValidationFileResponse, ValidationFileResponseDto> {
+
+ @Override
+ public void doMapping(ValidationFileResponse source, ValidationFileResponseDto target) {
+ target.setValidationData(source.getValidationData());
+ }
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/services/ValidationImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/services/ValidationImpl.java
index 1ece6f75f8..da604b7cb1 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/services/ValidationImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/services/ValidationImpl.java
@@ -7,9 +7,9 @@
* 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.
@@ -19,10 +19,12 @@
* Modifications copyright (c) 2019 Nokia
* ================================================================================
*/
-
package org.openecomp.sdcrests.validation.rest.services;
-
+import java.io.IOException;
+import java.io.InputStream;
+import javax.inject.Named;
+import javax.ws.rs.core.Response;
import org.openecomp.sdc.validation.UploadValidationManager;
import org.openecomp.sdc.validation.types.ValidationFileResponse;
import org.openecomp.sdcrests.validation.rest.Validation;
@@ -32,37 +34,28 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
-import javax.inject.Named;
-import javax.ws.rs.core.Response;
-import java.io.IOException;
-import java.io.InputStream;
-
@Named
@Service("validation")
@Scope(value = "prototype")
public class ValidationImpl implements Validation {
- private final UploadValidationManager uploadValidationManager;
-
- @Autowired
- public ValidationImpl(UploadValidationManager uploadValidationManager) {
- this.uploadValidationManager = uploadValidationManager;
- }
+ private final UploadValidationManager uploadValidationManager;
- @Override
- public Response validateFile(String type, InputStream fileToValidate) {
- ValidationFileResponse validationFileResponse;
- try {
- validationFileResponse = uploadValidationManager.validateFile(type, fileToValidate);
- } catch (IOException exception) {
- throw new RuntimeException(exception);
+ @Autowired
+ public ValidationImpl(UploadValidationManager uploadValidationManager) {
+ this.uploadValidationManager = uploadValidationManager;
}
- ValidationFileResponseDto validationFileResponseDto =
- new MapValidationFileResponseToValidationFileResponseDto()
+ @Override
+ public Response validateFile(String type, InputStream fileToValidate) {
+ ValidationFileResponse validationFileResponse;
+ try {
+ validationFileResponse = uploadValidationManager.validateFile(type, fileToValidate);
+ } catch (IOException exception) {
+ throw new RuntimeException(exception);
+ }
+ ValidationFileResponseDto validationFileResponseDto = new MapValidationFileResponseToValidationFileResponseDto()
.applyMapping(validationFileResponse, ValidationFileResponseDto.class);
- return Response.ok(validationFileResponseDto).build();
- }
-
-
+ return Response.ok(validationFileResponseDto).build();
+ }
}