From 280f8015d06af1f41a3ef12e8300801c7a5e0d54 Mon Sep 17 00:00:00 2001 From: AviZi Date: Fri, 9 Jun 2017 02:39:56 +0300 Subject: [SDC-29] Amdocs OnBoard 1707 initial commit. Change-Id: Ie4d12a3f574008b792899b368a0902a8b46b5370 Signed-off-by: AviZi --- .../validation-rest/pom.xml | 12 +- .../validation-rest/pom.xml.versionsBackup | 21 +++ .../validation-rest-services/pom.xml | 39 +++--- .../pom.xml.versionsBackup | 152 +++++++++++++++++++++ .../sdcrests/validation/rest/Validation.java | 1 - .../validation/rest/ValidationForSwaggerUsage.java | 49 +++++++ ...ionFileResponseToValidationFileResponseDto.java | 6 + .../validation/rest/services/ValidationImpl.java | 27 +++- .../validation-rest/validation-rest-types/pom.xml | 10 +- .../validation-rest-types/pom.xml.versionsBackup | 30 ++++ .../types/ValidationFileResponseDto.java | 7 +- 11 files changed, 317 insertions(+), 37 deletions(-) create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/pom.xml.versionsBackup create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/pom.xml.versionsBackup create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/ValidationForSwaggerUsage.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-types/pom.xml.versionsBackup (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest') diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/pom.xml index 512a150472..8d1eb94035 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/pom.xml +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/pom.xml @@ -3,6 +3,10 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 + org.openecomp.sdc.onboarding + validation-rest + validation-rest + pom org.openecomp.sdc @@ -10,14 +14,8 @@ 1.1.0-SNAPSHOT - org.openecomp.sdc.onboarding - validation-rest - validation-rest - pom - - /validation-rest-services /validation-rest-types - \ No newline at end of file + diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/pom.xml.versionsBackup new file mode 100644 index 0000000000..8bacd99f69 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/pom.xml.versionsBackup @@ -0,0 +1,21 @@ + + + 4.0.0 + org.openecomp.sdc.onboarding + validation-rest + validation-rest + 1.0-SNAPSHOT + pom + + + org.openecomp.sdc + openecomp-sdc-rest-webapp + 1.0-SNAPSHOT + + + /validation-rest-services + /validation-rest-types + + \ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/pom.xml index ba61a0cd0a..6c217ca718 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/pom.xml +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/pom.xml @@ -4,15 +4,13 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 + validation-rest-services org.openecomp.sdc.onboarding validation-rest 1.1.0-SNAPSHOT - validation-rest-services - - org.springframework @@ -46,26 +44,19 @@ cxf-rt-frontend-jaxrs ${cxf.version} - org.apache.httpcomponents httpclient ${http.client.version} - - javax.ws.rs - javax.ws.rs-api - ${ws.rs.version} - - - + @@ -82,7 +73,7 @@ com.sun.jersey jersey-core - 1.19.1 + ${jersey.core.version} javax.ws.rs @@ -93,7 +84,7 @@ io.swagger swagger-annotations - 1.5.3 + ${swagger.version} org.openecomp.sdc.onboarding @@ -103,24 +94,29 @@ com.fasterxml.jackson.core jackson-annotations - 2.7.4 + ${jackson.annotations.version} com.fasterxml.jackson.dataformat jackson-dataformat-xml - 2.7.4 + ${jackson.dataformat.version} org.codehaus.woodstox woodstox-core-asl - 4.4.1 + ${woodstox.version} - org.openecomp.sdc openecomp-sdc-vendor-software-product-manager ${project.version} + + com.sun.jersey.contribs + jersey-multipart + ${jersey.multipart.version} + provided + @@ -138,7 +134,12 @@ true + + - \ No newline at end of file + diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/pom.xml.versionsBackup new file mode 100644 index 0000000000..ffc417313a --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/pom.xml.versionsBackup @@ -0,0 +1,152 @@ + + + 4.0.0 + + validation-rest-services + + org.openecomp.sdc.onboarding + validation-rest + 1.0-SNAPSHOT + + + + + org.springframework + spring-core + ${spring.framework.version} + + + org.springframework + spring-context + ${spring.framework.version} + + + org.springframework + spring-context-support + ${spring.framework.version} + + + org.springframework + spring-web + ${spring.framework.version} + + + org.springframework + spring-beans + ${spring.framework.version} + + + + + org.apache.cxf + cxf-rt-frontend-jaxrs + ${cxf.version} + + + org.apache.httpcomponents + httpclient + ${http.client.version} + + + + javax.ws.rs + javax.ws.rs-api + ${ws.rs.version} + + + + + + + + javax.inject + javax.inject + ${javax.inject.version} + provided + + + javax.ws.rs + javax.ws.rs-api + ${ws.rs.version} + + + com.sun.jersey + jersey-core + 1.19.1 + + + javax.ws.rs + jsr311-api + + + + + io.swagger + swagger-annotations + 1.5.3 + + + org.openecomp.sdc.onboarding + validation-rest-types + ${project.version} + + + com.fasterxml.jackson.core + jackson-annotations + 2.7.4 + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + 2.7.4 + + + org.codehaus.woodstox + woodstox-core-asl + 4.4.1 + + + + org.openecomp.sdc + openecomp-sdc-vendor-software-product-manager + ${project.version} + + + com.sun.jersey.contribs + jersey-multipart + 1.18.1 + provided + + + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + test/core/unittest/offline/** + + true + + + + + + + + \ No newline at end of file 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 5a1955c0dd..c0c759e123 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 @@ -46,7 +46,6 @@ public interface Validation { @POST @Path("{type}/validate") @Consumes(MediaType.MULTIPART_FORM_DATA) - @ApiOperation(value = "Validate a package") 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 new file mode 100644 index 0000000000..0a737f32e8 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/ValidationForSwaggerUsage.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.openecomp.sdcrests.validation.rest; + +import com.sun.jersey.multipart.FormDataParam; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.cxf.jaxrs.ext.multipart.Multipart; +import org.springframework.validation.annotation.Validated; + +import javax.ws.rs.*; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import java.io.InputStream; + + +@Path("/v1.0/validation") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +@Api(value = "Validation") +@Validated +public interface ValidationForSwaggerUsage { + + + @POST + @Path("{type}/validate") + @Consumes(MediaType.MULTIPART_FORM_DATA) + @ApiOperation(value = "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 bd8639b682..a5e5205ba0 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 @@ -25,10 +25,16 @@ import org.openecomp.sdc.validation.types.ValidationFileResponse; import org.openecomp.sdcrests.mapping.MappingBase; import org.openecomp.sdcrests.validation.types.ValidationFileResponseDto; +/** + * Created by TALIO on 4/27/2016. + */ public class MapValidationFileResponseToValidationFileResponseDto extends MappingBase { @Override public void doMapping(ValidationFileResponse source, ValidationFileResponseDto target) { + //target.setErrors(source.getErrors()); + //target.setFileNames(source.getFileNames()); + //target.setStatus(source.getStatus()); 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 88a173de84..b0467b6ef0 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 @@ -20,11 +20,22 @@ package org.openecomp.sdcrests.validation.rest.services; + +import org.openecomp.sdc.common.utils.CommonUtil; +import org.openecomp.sdc.datatypes.error.ErrorLevel; +import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; +import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage; +import org.openecomp.sdc.logging.types.LoggerConstants; +import org.openecomp.sdc.logging.types.LoggerErrorCode; +import org.openecomp.sdc.logging.types.LoggerErrorDescription; +import org.openecomp.sdc.logging.types.LoggerServiceName; +import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.validation.UploadValidationManager; import org.openecomp.sdc.validation.types.ValidationFileResponse; import org.openecomp.sdcrests.validation.rest.Validation; import org.openecomp.sdcrests.validation.rest.mapping.MapValidationFileResponseToValidationFileResponseDto; import org.openecomp.sdcrests.validation.types.ValidationFileResponseDto; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Service; @@ -34,28 +45,38 @@ import java.io.InputStream; import javax.inject.Named; import javax.ws.rs.core.Response; - @Named @Service("validation") @Scope(value = "prototype") public class ValidationImpl implements Validation { + private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); @Autowired private UploadValidationManager uploadValidationManager; @Override public Response validateFile(String type, InputStream fileToValidate) { + + mdcDataDebugMessage.debugEntryMessage(null, null); + + MDC.put(LoggerConstants.SERVICE_NAME, + LoggerServiceName.Validate.toString()); ValidationFileResponse validationFileResponse = null; try { validationFileResponse = uploadValidationManager.validateFile(type, fileToValidate); - } catch (IOException e0) { - throw new RuntimeException(e0); + } catch (IOException exception) { + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API, + LoggerTragetServiceName.VALIDATE_FILE, ErrorLevel.ERROR.name(), + LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.VALIDATE_FILE); + throw new RuntimeException(exception); } ValidationFileResponseDto validationFileResponseDto = new MapValidationFileResponseToValidationFileResponseDto() .applyMapping(validationFileResponse, ValidationFileResponseDto.class); + mdcDataDebugMessage.debugExitMessage(null, null); + return Response.ok(validationFileResponseDto).build(); } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-types/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-types/pom.xml index b4f34969d3..61a4ed3544 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-types/pom.xml +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-types/pom.xml @@ -4,6 +4,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 + validation-rest-types + validation-rest-types + org.openecomp.sdc.onboarding validation-rest @@ -11,11 +14,6 @@ ../ - validation-rest-types - validation-rest-types - - - org.openecomp.sdc @@ -29,4 +27,4 @@ - \ No newline at end of file + diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-types/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-types/pom.xml.versionsBackup new file mode 100644 index 0000000000..5cc8ee7c51 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-types/pom.xml.versionsBackup @@ -0,0 +1,30 @@ + + + 4.0.0 + + validation-rest-types + validation-rest-types + + + org.openecomp.sdc.onboarding + validation-rest + 1.0-SNAPSHOT + ../ + + + + + org.openecomp.sdc + openecomp-sdc-common-rest + 1.0-SNAPSHOT + + + org.openecomp.sdc + openecomp-sdc-validation-manager + 1.0-SNAPSHOT + + + + \ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-types/src/main/java/org/openecomp/sdcrests/validation/types/ValidationFileResponseDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-types/src/main/java/org/openecomp/sdcrests/validation/types/ValidationFileResponseDto.java index 75e59973e3..1ec6568a73 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-types/src/main/java/org/openecomp/sdcrests/validation/types/ValidationFileResponseDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-types/src/main/java/org/openecomp/sdcrests/validation/types/ValidationFileResponseDto.java @@ -22,8 +22,13 @@ package org.openecomp.sdcrests.validation.types; import org.openecomp.sdc.heat.datatypes.structure.ValidationStructureList; +/** + * Created by TALIO on 4/27/2016. + */ public class ValidationFileResponseDto { - + //private List fileNames; + //private Map> errors; + //private ValidationFileStatus status; private ValidationStructureList validationData; public ValidationStructureList getValidationData() { -- cgit 1.2.3-korg