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/pom.xml39
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/pom.xml.versionsBackup152
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/Validation.java1
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/ValidationForSwaggerUsage.java49
-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.java6
-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.java27
6 files changed, 251 insertions, 23 deletions
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">
<modelVersion>4.0.0</modelVersion>
+ <artifactId>validation-rest-services</artifactId>
<parent>
<groupId>org.openecomp.sdc.onboarding</groupId>
<artifactId>validation-rest</artifactId>
<version>1.1.0-SNAPSHOT</version>
</parent>
- <artifactId>validation-rest-services</artifactId>
-
-
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
@@ -46,26 +44,19 @@
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>${cxf.version}</version>
</dependency>
-
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${http.client.version}</version>
</dependency>
- <dependency>
- <groupId>javax.ws.rs</groupId>
- <artifactId>javax.ws.rs-api</artifactId>
- <version>${ws.rs.version}</version>
- </dependency>
-
<!-- Other Stuff-->
- <dependency>
+ <!--dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>${cglib.nodep.version}</version>
<scope>runtime</scope>
- </dependency>
+ </dependency-->
<!-- Java Stuff -->
<dependency>
@@ -82,7 +73,7 @@
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
- <version>1.19.1</version>
+ <version>${jersey.core.version}</version>
<exclusions>
<exclusion>
<groupId>javax.ws.rs</groupId>
@@ -93,7 +84,7 @@
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
- <version>1.5.3</version>
+ <version>${swagger.version}</version>
</dependency>
<dependency>
<groupId>org.openecomp.sdc.onboarding</groupId>
@@ -103,24 +94,29 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
- <version>2.7.4</version>
+ <version>${jackson.annotations.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
- <version>2.7.4</version>
+ <version>${jackson.dataformat.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>woodstox-core-asl</artifactId>
- <version>4.4.1</version>
+ <version>${woodstox.version}</version>
</dependency>
-
<dependency>
<groupId>org.openecomp.sdc</groupId>
<artifactId>openecomp-sdc-vendor-software-product-manager</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>com.sun.jersey.contribs</groupId>
+ <artifactId>jersey-multipart</artifactId>
+ <version>${jersey.multipart.version}</version>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
@@ -138,7 +134,12 @@
<skipTests>true</skipTests>
</configuration>
</plugin>
+ <!-- Error codes generator plugin -->
+ <!--plugin>
+ <groupId>org.openecomp.nfv.tools</groupId>
+ <artifactId>error-codes-maven-plugin</artifactId>
+ </plugin-->
</plugins>
</build>
-</project> \ No newline at end of file
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ 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">
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>validation-rest-services</artifactId>
+ <parent>
+ <groupId>org.openecomp.sdc.onboarding</groupId>
+ <artifactId>validation-rest</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>${spring.framework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>${spring.framework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context-support</artifactId>
+ <version>${spring.framework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ <version>${spring.framework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ <version>${spring.framework.version}</version>
+ </dependency>
+
+ <!-- CXF -->
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+ <version>${cxf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ <version>${http.client.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>javax.ws.rs-api</artifactId>
+ <version>${ws.rs.version}</version>
+ </dependency>
+
+ <!-- Other Stuff-->
+ <!--dependency>
+ <groupId>cglib</groupId>
+ <artifactId>cglib-nodep</artifactId>
+ <version>${cglib.nodep.version}</version>
+ <scope>runtime</scope>
+ </dependency-->
+
+ <!-- Java Stuff -->
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ <version>${javax.inject.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>javax.ws.rs-api</artifactId>
+ <version>${ws.rs.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.jersey</groupId>
+ <artifactId>jersey-core</artifactId>
+ <version>1.19.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>jsr311-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-annotations</artifactId>
+ <version>1.5.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc.onboarding</groupId>
+ <artifactId>validation-rest-types</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ <version>2.7.4</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.dataformat</groupId>
+ <artifactId>jackson-dataformat-xml</artifactId>
+ <version>2.7.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>woodstox-core-asl</artifactId>
+ <version>4.4.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-vendor-software-product-manager</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.jersey.contribs</groupId>
+ <artifactId>jersey-multipart</artifactId>
+ <version>1.18.1</version>
+ <scope>provided</scope>
+ </dependency>
+
+
+ </dependencies>
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <includes>
+ <include>test/core/unittest/offline/**</include>
+ </includes>
+ <skipTests>true</skipTests>
+ </configuration>
+ </plugin>
+ <!-- Error codes generator plugin -->
+ <!--plugin>
+ <groupId>org.openecomp.nfv.tools</groupId>
+ <artifactId>error-codes-maven-plugin</artifactId>
+ </plugin-->
+ </plugins>
+ </build>
+
+</project> \ 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<ValidationFileResponse, ValidationFileResponseDto> {
@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();
}