diff options
author | Avi Ziv <AVIZI@amdocs.com> | 2017-07-26 17:37:57 +0300 |
---|---|---|
committer | Avi Ziv <avi.ziv@amdocs.com> | 2017-07-26 18:27:22 +0300 |
commit | 61070c9c6b665fdea79b3ccdfeafc3a6b50d262e (patch) | |
tree | dfe9c169cfac91d6c72ac9ff23375f2aafac6405 /openecomp-be | |
parent | b824a997e19f6ee9627cb1b1e124c756bd8183fc (diff) |
[SDC] Full OnBoard health-check and NFoD support
Change-Id: I606f8a52c7e6d2bd5558f824957d890e552c5423
Signed-off-by: Avi Ziv <avi.ziv@amdocs.com>
Diffstat (limited to 'openecomp-be')
162 files changed, 1942 insertions, 5719 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/pom.xml.versionsBackup deleted file mode 100644 index 47b9bdde7b..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/pom.xml.versionsBackup +++ /dev/null @@ -1,143 +0,0 @@ -<?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>action-library-rest-services</artifactId> - <parent> - <groupId>org.openecomp.sdc.onboarding</groupId> - <artifactId>action-library-rest</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - - - <properties> - <errorcode.dir>${project.build.directory}/generated-sources/error-codes</errorcode.dir> - </properties> - - <dependencies> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>action-library-rest-types</artifactId> - <version>${project.version}</version> - </dependency> - - <!-- Spring --> - <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>org.apache.httpcomponents</groupId> - <artifactId>httpcore</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>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-action-manager</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-action-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-logging-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - <version>1.7.21</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/action-library-rest/action-library-rest-types/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-types/pom.xml.versionsBackup deleted file mode 100644 index 4749ce7f8c..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-types/pom.xml.versionsBackup +++ /dev/null @@ -1,36 +0,0 @@ -<?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>action-library-rest-types</artifactId> - <name>action-library-rest-types</name> - - <parent> - <groupId>org.openecomp.sdc.onboarding</groupId> - <artifactId>action-library-rest</artifactId> - <version>1.0-SNAPSHOT</version> - <relativePath>../</relativePath> - </parent> - - <dependencies> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-common-rest</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-action-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <!--<dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-vendor-license-manager</artifactId> - <version>${project.version}</version> - </dependency>--> - </dependencies> - - -</project>
\ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/pom.xml.versionsBackup deleted file mode 100644 index de6c4c6760..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/pom.xml.versionsBackup +++ /dev/null @@ -1,22 +0,0 @@ -<?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> - <groupId>org.openecomp.sdc.onboarding</groupId> - <artifactId>action-library-rest</artifactId> - <name>action-library-rest</name> - <version>1.0-SNAPSHOT</version> - <packaging>pom</packaging> - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-rest-webapp</artifactId> - <version>1.0-SNAPSHOT</version> - <relativePath>../</relativePath> - </parent> - <modules> - <module>/action-library-rest-services</module> - <module>/action-library-rest-types</module> - </modules> -</project>
\ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/pom.xml.versionsBackup deleted file mode 100644 index 9c3472a970..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/pom.xml.versionsBackup +++ /dev/null @@ -1,63 +0,0 @@ -<?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> - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>application-config-rest</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - - <artifactId>application-config-rest-services</artifactId> - <version>1.0-SNAPSHOT</version> - <!--packaging>pom</packaging--> - - <dependencies> - - <dependency> - <groupId>io.swagger</groupId> - <artifactId>swagger-annotations</artifactId> - <version>1.5.3</version> - </dependency> - <dependency> - <groupId>javax.ws.rs</groupId> - <artifactId>javax.ws.rs-api</artifactId> - <version>${ws.rs.version}</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-context</artifactId> - <version>${spring.framework.version}</version> - </dependency> - <dependency> - <groupId>javax.inject</groupId> - <artifactId>javax.inject</artifactId> - <version>1</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-application-config-manager</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>application-config-rest-types</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-common-rest</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <!-- CXF --> - <dependency> - <groupId>org.apache.cxf</groupId> - <artifactId>cxf-rt-frontend-jaxrs</artifactId> - <version>${cxf.version}</version> - </dependency> - </dependencies> - - -</project>
\ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-types/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-types/pom.xml.versionsBackup deleted file mode 100644 index a9c8bbaee5..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-types/pom.xml.versionsBackup +++ /dev/null @@ -1,18 +0,0 @@ -<?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> - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>application-config-rest</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - - <groupId>org.openecomp.sdc</groupId> - <artifactId>application-config-rest-types</artifactId> - <version>1.0-SNAPSHOT</version> - - -</project>
\ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/pom.xml.versionsBackup deleted file mode 100644 index fd2e251fea..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/pom.xml.versionsBackup +++ /dev/null @@ -1,24 +0,0 @@ -<?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> - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-rest-webapp</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - - <groupId>org.openecomp.sdc</groupId> - <artifactId>application-config-rest</artifactId> - <version>1.0-SNAPSHOT</version> - <packaging>pom</packaging> - - - <modules> - <module>application-config-rest-services</module> - <module>application-config-rest-types</module> - </modules> - -</project>
\ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/pom.xml.versionsBackup deleted file mode 100644 index 983518fd29..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/pom.xml.versionsBackup +++ /dev/null @@ -1,226 +0,0 @@ -<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> - - <groupId>org.openecomp.sdc.onboarding</groupId> - <artifactId>onboarding-be</artifactId> - <name>onboarding-rest-war</name> - <version>1.0-SNAPSHOT</version> - <packaging>war</packaging> - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-rest-webapp</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - - <dependencies> - <dependency> - <groupId>org.openecomp.sdc.onboarding</groupId> - <artifactId>vendor-license-rest-services</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc.onboarding</groupId> - <artifactId>vendor-software-products-rest-services</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc.onboarding</groupId> - <artifactId>validation-rest-services</artifactId> - <version>${project.version}</version> - </dependency> - <!--dependency> - <groupId>org.openecomp.sdc.onboarding</groupId> - <artifactId>application-config-rest-services</artifactId> - <version>${project.version}</version> - </dependency--> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>application-config-rest-services</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc.onboarding</groupId> - <artifactId>action-library-rest-services</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> - <version>${javax.servlet.version}</version> - </dependency> - <!-- JSON --> - <dependency> - <groupId>org.codehaus.jackson</groupId> - <artifactId>jackson-jaxrs</artifactId> - <version>${org.codehaus.jackson.version}</version> - </dependency> - <dependency> - <groupId>org.codehaus.jackson</groupId> - <artifactId>jackson-core-asl</artifactId> - <version>${org.codehaus.jackson.version}</version> - </dependency> - <dependency> - <groupId>javax.inject</groupId> - <artifactId>javax.inject</artifactId> - <version>1</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-vendor-software-product-manager</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.eclipse.jetty</groupId> - <artifactId>jetty-servlets</artifactId> - <version>9.0.6.v20130930</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-application-config-manager</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.codehaus.groovy</groupId> - <artifactId>groovy</artifactId> - <version>${groovy.version}</version> - </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <version>${logback.version}</version> - </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-core</artifactId> - <version>${logback.version}</version> - </dependency> - <dependency> - <groupId>org.codehaus.janino</groupId> - <artifactId>janino</artifactId> - <scope>compile</scope> - </dependency> - <!--dependency> - <groupId>org.codehaus.janino</groupId> - <artifactId>commons-compiler</artifactId> - <version>3.0.6</version> - <scope>compile</scope> - </dependency--> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-core</artifactId> - <version>4.1.3.RELEASE</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-web</artifactId> - <version>4.1.3.RELEASE</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-aop</artifactId> - <version>4.1.3.RELEASE</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-webmvc</artifactId> - <version>4.1.3.RELEASE</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>aspectjweaver</artifactId> - <version>1.8.9</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>aspectjrt</artifactId> - <version>1.8.9</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>aspectjtools</artifactId> - <version>1.8.9</version> - </dependency> - - </dependencies> - - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - </plugin> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <includes> - <include>test/core/unittest/offline/**</include> - </includes> - <skipTests>true</skipTests> - <systemProperties> - <property> - <name>buildNumber</name> - <value>${buildNumber}</value> - </property> - </systemProperties> - </configuration> - </plugin> - <plugin> - <artifactId>maven-war-plugin</artifactId> - <version>2.1.1</version> - <configuration> - <attachClasses>true</attachClasses> - <webResources> - <resource> - <!-- this is relative to the pom.xml directory --> - <directory>${basedir}/target/generated/swagger-ui</directory> - </resource> - </webResources> - </configuration> - </plugin> - <plugin> - <groupId>com.github.kongchen</groupId> - <artifactId>swagger-maven-plugin</artifactId> - <version>3.1.0</version> - <configuration> - <apiSources> - <apiSource> - <springmvc>false</springmvc> - <locations>org.openecomp.sdcrests</locations> - <schemes>http</schemes> - <basePath>/onboarding-api</basePath> - <info> - <title>Rest API</title> - <version>v1.0, build #${buildNumber}</version> - <description>Rest API Documentation</description> - <termsOfService> - http://www.github.com/kongchen/swagger-maven-plugin - </termsOfService> - </info> - <templatePath>${basedir}/templates/strapdown.html.hbs</templatePath> - <outputPath>${basedir}/target/generated/api.html</outputPath> - <swaggerDirectory>${basedir}/target/generated/swagger-ui - </swaggerDirectory> - </apiSource> - </apiSources> - </configuration> - <executions> - <execution> - <phase>compile</phase> - <goals> - <goal>generate</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - - <!--finalName>onboarding-api</finalName--> - </build> - -</project>
\ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/pom.xml.versionsBackup deleted file mode 100644 index aaf3383c42..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/openecomp-sdc-common-rest/pom.xml.versionsBackup +++ /dev/null @@ -1,44 +0,0 @@ -<?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>openecomp-sdc-common-rest</artifactId> - <name>openecomp-sdc-common-rest</name> - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-rest-webapp</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - - <dependencies> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-utilities-lib</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-common-lib</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-validator</artifactId> - <version>${hibernate.validator.version}</version> - </dependency> - <dependency> - <groupId>javax.ws.rs</groupId> - <artifactId>javax.ws.rs-api</artifactId> - <version>${ws.rs.version}</version> - </dependency> - <!-- Swagger --> - <dependency> - <groupId>io.swagger</groupId> - <artifactId>swagger-core</artifactId> - <version>${swagger.version}</version> - <scope>compile</scope> - </dependency> - </dependencies> - -</project>
\ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/pom.xml.versionsBackup deleted file mode 100644 index cd9b491c08..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/pom.xml.versionsBackup +++ /dev/null @@ -1,28 +0,0 @@ -<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>openecomp-sdc-rest-webapp</artifactId> - <name>openecomp-sdc-rest-webapp</name> - <version>1.0-SNAPSHOT</version> - <packaging>pom</packaging> - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-api</artifactId> - <version>1.0-SNAPSHOT</version> - <relativePath>../</relativePath> - </parent> - - <modules> - <module>/openecomp-sdc-common-rest</module> - <module>/vendor-license-rest</module> - <module>/onboarding-rest-war</module> - <module>/vendor-software-products-rest</module> - <module>/sequence-rest</module> - <module>/validation-rest</module> - <module>/action-library-rest</module> - <module>/application-config-rest</module> - </modules> - -</project>
\ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/sequence-rest/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/sequence-rest/pom.xml.versionsBackup deleted file mode 100644 index 313a50ca9d..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/sequence-rest/pom.xml.versionsBackup +++ /dev/null @@ -1,15 +0,0 @@ -<?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"> - <parent> - <artifactId>openecomp-sdc-rest-webapp</artifactId> - <groupId>org.openecomp.sdc</groupId> - <version>1.0-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - - <artifactId>sequence-rest</artifactId> - - -</project>
\ 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 deleted file mode 100644 index 8bacd99f69..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/pom.xml.versionsBackup +++ /dev/null @@ -1,21 +0,0 @@ -<?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> - <groupId>org.openecomp.sdc.onboarding</groupId> - <artifactId>validation-rest</artifactId> - <name>validation-rest</name> - <version>1.0-SNAPSHOT</version> - <packaging>pom</packaging> - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-rest-webapp</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - <modules> - <module>/validation-rest-services</module> - <module>/validation-rest-types</module> - </modules> -</project>
\ 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 deleted file mode 100644 index ffc417313a..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/pom.xml.versionsBackup +++ /dev/null @@ -1,152 +0,0 @@ -<?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-types/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-types/pom.xml.versionsBackup deleted file mode 100644 index 5cc8ee7c51..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-types/pom.xml.versionsBackup +++ /dev/null @@ -1,30 +0,0 @@ -<?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-types</artifactId> - <name>validation-rest-types</name> - - <parent> - <groupId>org.openecomp.sdc.onboarding</groupId> - <artifactId>validation-rest</artifactId> - <version>1.0-SNAPSHOT</version> - <relativePath>../</relativePath> - </parent> - - <dependencies> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-common-rest</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-validation-manager</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - </dependencies> - -</project>
\ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/pom.xml.versionsBackup deleted file mode 100644 index ae9c3063bc..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/pom.xml.versionsBackup +++ /dev/null @@ -1,23 +0,0 @@ -<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> - - <groupId>org.openecomp.sdc.onboarding</groupId> - <artifactId>vendor-license-rest</artifactId> - <name>vendor-license-rest</name> - <version>1.0-SNAPSHOT</version> - <packaging>pom</packaging> - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-rest-webapp</artifactId> - <version>1.0-SNAPSHOT</version> - <relativePath>../</relativePath> - </parent> - - <modules> - <module>/vendor-license-rest-services</module> - <module>/vendor-license-rest-types</module> - </modules> - -</project>
\ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/pom.xml.versionsBackup deleted file mode 100644 index 187135e1f4..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/pom.xml.versionsBackup +++ /dev/null @@ -1,135 +0,0 @@ -<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>vendor-license-rest-services</artifactId> - <name>vendor-license-rest-services</name> - - <parent> - <groupId>org.openecomp.sdc.onboarding</groupId> - <artifactId>vendor-license-rest</artifactId> - <version>1.0-SNAPSHOT</version> - <relativePath>../</relativePath> - </parent> - - - <properties> - <errorcode.dir>${project.build.directory}/generated-sources/error-codes</errorcode.dir> - </properties> - - <dependencies> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>vendor-license-rest-types</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-vendor-license-api</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-vendor-license-manager</artifactId> - <version>${project.version}</version> - </dependency> - - - <!-- Spring --> - <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>org.apache.httpcomponents</groupId> - <artifactId>httpcore</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>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-vendor-software-product-manager</artifactId> - <version>1.0-SNAPSHOT</version> - </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/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDto.java index d35c06c30d..21293ab607 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDto.java @@ -22,7 +22,6 @@ package org.openecomp.sdcrests.vendorlicense.rest.mapping; import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; import org.openecomp.sdcrests.mapping.MappingBase; -import org.openecomp.sdcrests.vendorlicense.types.ChoiceOrOtherDto; import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolEntityDto; import org.openecomp.sdcrests.vendorlicense.types.MultiChoiceOrOtherDto; @@ -39,14 +38,9 @@ public class MapEntitlementPoolEntityToEntitlementPoolEntityDto MapChoiceOrOtherToChoiceOrOtherDto choiceOrOtherMapper = new MapChoiceOrOtherToChoiceOrOtherDto(); - target.setEntitlementMetric( - choiceOrOtherMapper.applyMapping(source.getEntitlementMetric(), ChoiceOrOtherDto.class)); - target.setAggregationFunction( - choiceOrOtherMapper.applyMapping(source.getAggregationFunction(), ChoiceOrOtherDto.class)); target.setOperationalScope(new MapMultiChoiceOrOtherToMultiChoiceOrOtherDto() .applyMapping(source.getOperationalScope(), MultiChoiceOrOtherDto.class)); - target.setTime(choiceOrOtherMapper.applyMapping(source.getTime(), ChoiceOrOtherDto.class)); - target.setManufacturerReferenceNumber(source.getManufacturerReferenceNumber()); + target.setReferencingFeatureGroups(source.getReferencingFeatureGroups()); target.setStartDate(source.getStartDate()); diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntity.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntity.java index 5442e1af61..9b215d69aa 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntity.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntity.java @@ -20,7 +20,6 @@ package org.openecomp.sdcrests.vendorlicense.rest.mapping; -import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther; import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther; import org.openecomp.sdcrests.mapping.MappingBase; @@ -35,17 +34,11 @@ public class MapEntitlementPoolRequestDtoToEntitlementPoolEntity target.setThresholdValue(source.getThresholdValue()); target.setThresholdUnit(source.getThresholdUnits()); target.setIncrements(source.getIncrements()); - MapChoiceOrOtherDtoToChoiceOrOther choiceOrOtherMapper = new MapChoiceOrOtherDtoToChoiceOrOther(); - target.setEntitlementMetric( - choiceOrOtherMapper.applyMapping(source.getEntitlementMetric(), ChoiceOrOther.class)); - target.setAggregationFunction( - choiceOrOtherMapper.applyMapping(source.getAggregationFunction(), ChoiceOrOther.class)); target.setOperationalScope(new MapMultiChoiceOrOtherDtoToMultiChoiceOrOther() .applyMapping(source.getOperationalScope(), MultiChoiceOrOther.class)); - target.setTime(choiceOrOtherMapper.applyMapping(source.getTime(), ChoiceOrOther.class)); - target.setManufacturerReferenceNumber(source.getManufacturerReferenceNumber()); + target.setStartDate(source.getStartDate()); target.setExpiryDate(source.getExpiryDate()); } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto.java index 38384711b1..66618e8fa7 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto.java @@ -36,5 +36,10 @@ public class MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto target.setOperationalScope(new MapMultiChoiceOrOtherToMultiChoiceOrOtherDto() .applyMapping(source.getOperationalScope(), MultiChoiceOrOtherDto.class)); target.setReferencingFeatureGroups(source.getReferencingFeatureGroups()); + target.setStartDate(source.getStartDate()); + target.setExpiryDate(source.getExpiryDate()); + target.setThresholdUnits(source.getThresholdUnits()); + target.setThresholdValue(source.getThresholdValue()); + target.setIncrements(source.getIncrements()); } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity.java index aee27c8521..4682a46216 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity.java @@ -34,5 +34,10 @@ public class MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity target.setType(source.getType()); target.setOperationalScope(new MapMultiChoiceOrOtherDtoToMultiChoiceOrOther() .applyMapping(source.getOperationalScope(), MultiChoiceOrOther.class)); + target.setStartDate(source.getStartDate()); + target.setExpiryDate(source.getExpiryDate()); + target.setThresholdUnits(source.getThresholdUnits()); + target.setThresholdValue(source.getThresholdValue()); + target.setIncrements(source.getIncrements()); } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/FeatureGroupsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/FeatureGroupsImpl.java index e41942d455..99ac3cdb70 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/FeatureGroupsImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/FeatureGroupsImpl.java @@ -80,6 +80,7 @@ public class FeatureGroupsImpl implements FeatureGroups { fgDto.setLicenseKeyGroupsIds(fg.getLicenseKeyGroupIds()); fgDto.setEntitlementPoolsIds(fg.getEntitlementPoolIds()); fgDto.setReferencingLicenseAgreements(fg.getReferencingLicenseAgreements()); + fgDto.setManufacturerReferenceNumber(fg.getManufacturerReferenceNumber()); outputMapper.doMapping(fg, fgDto); results.add(fgDto); } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/pom.xml.versionsBackup deleted file mode 100644 index d24c315f39..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/pom.xml.versionsBackup +++ /dev/null @@ -1,29 +0,0 @@ -<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>vendor-license-rest-types</artifactId> - <name>vendor-license-rest-types</name> - <version>1.0-SNAPSHOT</version> - - <parent> - <groupId>org.openecomp.sdc.onboarding</groupId> - <artifactId>vendor-license-rest</artifactId> - <version>1.0-SNAPSHOT</version> - <relativePath>../</relativePath> - </parent> - - <dependencies> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-common-rest</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-vendor-license-manager</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> - -</project>
\ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java index b49a138a09..79cf750f74 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java @@ -33,7 +33,7 @@ import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; @ApiModel(value = "EntitlementPoolRequest") -//@JsonIgnoreProperties(value = {"manufacturerReferenceNumber"}) +@JsonIgnoreProperties({"manufacturerReferenceNumber", "time", "aggregationFunction", "entitlementMetric"}) public class EntitlementPoolRequestDto { @NotNull @@ -46,23 +46,11 @@ public class EntitlementPoolRequestDto { private Integer thresholdValue; private ThresholdUnit thresholdUnits; - @NotNull - @Valid - private ChoiceOrOtherDto<EntitlementMetric> entitlementMetric; @Size(max = 120) private String increments; - @NotNull - @Valid - private ChoiceOrOtherDto<AggregationFunction> aggregationFunction; @Valid private MultiChoiceOrOtherDto<OperationalScope> operationalScope; - @NotNull - @Valid - private ChoiceOrOtherDto<EntitlementTime> time; - @NotNull - @Size(max = 100) - private String manufacturerReferenceNumber; private String startDate; private String expiryDate; @@ -99,14 +87,6 @@ public class EntitlementPoolRequestDto { this.thresholdUnits = thresholdUnits; } - public ChoiceOrOtherDto<EntitlementMetric> getEntitlementMetric() { - return entitlementMetric; - } - - public void setEntitlementMetric(ChoiceOrOtherDto<EntitlementMetric> entitlementMetric) { - this.entitlementMetric = entitlementMetric; - } - public String getIncrements() { return increments; } @@ -115,14 +95,6 @@ public class EntitlementPoolRequestDto { this.increments = increments; } - public ChoiceOrOtherDto<AggregationFunction> getAggregationFunction() { - return aggregationFunction; - } - - public void setAggregationFunction(ChoiceOrOtherDto<AggregationFunction> aggregationFunction) { - this.aggregationFunction = aggregationFunction; - } - public MultiChoiceOrOtherDto<OperationalScope> getOperationalScope() { return operationalScope; } @@ -131,22 +103,6 @@ public class EntitlementPoolRequestDto { this.operationalScope = operationalScope; } - public ChoiceOrOtherDto<EntitlementTime> getTime() { - return time; - } - - public void setTime(ChoiceOrOtherDto<EntitlementTime> time) { - this.time = time; - } - - public String getManufacturerReferenceNumber() { - return manufacturerReferenceNumber; - } - - public void setManufacturerReferenceNumber(String manufacturerReferenceNumber) { - this.manufacturerReferenceNumber = manufacturerReferenceNumber; - } - public String getStartDate() { return startDate; } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupDescriptorDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupDescriptorDto.java index f2d0d651ef..56b3c25635 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupDescriptorDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupDescriptorDto.java @@ -35,7 +35,7 @@ public class FeatureGroupDescriptorDto { @NotNull private String partNumber; - //@NotBlank(message = "is mandatory and should not be empty") + @NotBlank(message = "is mandatory and should not be empty") @Size(max = 100) private String manufacturerReferenceNumber; diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseKeyGroupRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseKeyGroupRequestDto.java index a9072f5e94..fb56f85326 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseKeyGroupRequestDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseKeyGroupRequestDto.java @@ -22,6 +22,7 @@ package org.openecomp.sdcrests.vendorlicense.types; import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyType; import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope; +import org.openecomp.sdc.vendorlicense.dao.types.ThresholdUnit; import javax.validation.Valid; import javax.validation.constraints.NotNull; @@ -39,6 +40,16 @@ public class LicenseKeyGroupRequestDto { @Valid private MultiChoiceOrOtherDto<OperationalScope> operationalScope; + private String startDate; + private String expiryDate; + + private Integer thresholdValue; + + private ThresholdUnit thresholdUnits; + + @Size(max = 120) + private String increments; + public String getName() { return name; } @@ -70,4 +81,44 @@ public class LicenseKeyGroupRequestDto { public void setOperationalScope(MultiChoiceOrOtherDto<OperationalScope> operationalScope) { this.operationalScope = operationalScope; } + + public String getStartDate() { + return startDate; + } + + public void setStartDate(String startDate) { + this.startDate = startDate; + } + + public String getExpiryDate() { + return expiryDate; + } + + public void setExpiryDate(String expiryDate) { + this.expiryDate = expiryDate; + } + + public Integer getThresholdValue() { + return thresholdValue; + } + + public void setThresholdValue(Integer thresholdValue) { + this.thresholdValue = thresholdValue; + } + + public ThresholdUnit getThresholdUnits() { + return thresholdUnits; + } + + public void setThresholdUnits(ThresholdUnit thresholdUnits) { + this.thresholdUnits = thresholdUnits; + } + + public String getIncrements() { + return increments; + } + + public void setIncrements(String increments) { + this.increments = increments; + } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/pom.xml.versionsBackup deleted file mode 100644 index 074c8d9e10..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/pom.xml.versionsBackup +++ /dev/null @@ -1,21 +0,0 @@ -<?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> - <groupId>org.openecomp.sdc.onboarding</groupId> - <artifactId>vendor-software-products-rest</artifactId> - <name>vendor-software-products-rest</name> - <version>1.0-SNAPSHOT</version> - <packaging>pom</packaging> - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-rest-webapp</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - <modules> - <module>/vendor-software-products-rest-services</module> - <module>/vendor-software-products-rest-types</module> - </modules> -</project>
\ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/pom.xml.versionsBackup deleted file mode 100644 index ba2814613e..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/pom.xml.versionsBackup +++ /dev/null @@ -1,153 +0,0 @@ -<?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>vendor-software-products-rest-services</artifactId> - <parent> - <groupId>org.openecomp.sdc.onboarding</groupId> - <artifactId>vendor-software-products-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>vendor-software-products-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/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImpl.java index d5eb961285..0793e9473e 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImpl.java @@ -3,6 +3,8 @@ package org.openecomp.sdcrests.vsp.rest.services; import org.apache.commons.beanutils.BeanUtils; import org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder; import org.openecomp.sdc.common.errors.Messages; +import org.openecomp.sdc.datatypes.error.ErrorLevel; +import org.openecomp.sdc.datatypes.error.ErrorMessage; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.logging.context.MdcUtil; @@ -30,6 +32,9 @@ import javax.ws.rs.core.Response; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.InvocationTargetException; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; import java.util.Optional; @Named @@ -82,9 +87,12 @@ public class OrchestrationTemplateCandidateImpl implements OrchestrationTemplate OrchestrationTemplateActionResponseDto responseDto = new OrchestrationTemplateActionResponseDto(); BeanUtils.copyProperties(responseDto, response); + return Response.ok(responseDto).build(); } + + @Override public Response updateFilesDataStructure( String vspId, String versionId, FileDataStructureDto fileDataStructureDto, String user) diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java index 6dcb63dfdd..9c642eb862 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java @@ -25,6 +25,7 @@ import org.openecomp.sdc.activityLog.ActivityLogManagerFactory; import org.openecomp.sdc.common.errors.CoreException; import org.openecomp.sdc.common.errors.ErrorCode; import org.openecomp.sdc.datatypes.error.ErrorLevel; +import org.openecomp.sdc.datatypes.error.ErrorMessage; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.logging.context.MdcUtil; @@ -75,6 +76,8 @@ import java.io.IOException; import java.util.Collection; import java.util.List; +import static org.openecomp.sdc.logging.messages.AuditMessages.SUBMIT_VSP_ERROR; + @Named @Service("vendorSoftwareProducts") @@ -206,8 +209,8 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts { switch (request.getAction()) { case Checkout: MDC.put(LoggerConstants.SERVICE_NAME, LoggerServiceName.Checkout_VSP.toString()); - logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.CHECK_OUT_VSP + vspId); vendorSoftwareProductManager.checkout(vspId, user); + logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.CHECK_OUT_VSP + vspId); break; case Undo_Checkout: MDC.put(LoggerConstants.SERVICE_NAME, LoggerServiceName.Undo_Checkout_VSP.toString()); @@ -215,18 +218,28 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts { break; case Checkin: MDC.put(LoggerConstants.SERVICE_NAME, LoggerServiceName.Checkin_VSP.toString()); - logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.CHECK_IN_VSP + vspId); vendorSoftwareProductManager.checkin(vspId, user); + logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.CHECK_IN_VSP + vspId); break; case Submit: MDC.put(LoggerConstants.SERVICE_NAME, LoggerServiceName.Submit_VSP.toString()); - logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.SUBMIT_VSP + vspId); ValidationResponse validationResponse = vendorSoftwareProductManager.submit(vspId, user); if (!validationResponse.isValid()) { + logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.SUBMIT_VSP_FAIL + vspId); + if (validationResponse.getVspErrors() != null) { + validationResponse.getVspErrors().forEach(errorCode -> logger.audit(AuditMessages + .AUDIT_MSG + String.format(SUBMIT_VSP_ERROR, errorCode.message(), vspId))); + } + if (validationResponse.getUploadDataErrors() != null) { + validationResponse.getUploadDataErrors().values().forEach(errorMessages + -> printAuditForErrors(errorMessages, vspId, SUBMIT_VSP_ERROR)); + } + return Response.status(Response.Status.EXPECTATION_FAILED).entity( new MapValidationResponseToDto() .applyMapping(validationResponse, ValidationResponseDto.class)).build(); } + logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.SUBMIT_VSP + vspId); break; case Create_Package: MDC.put(LoggerConstants.SERVICE_NAME, LoggerServiceName.Create_Package.toString()); @@ -371,4 +384,14 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts { return Response.ok(results).build(); } + + private void printAuditForErrors(List<ErrorMessage> errorList, String vspId, String auditType) { + + errorList.forEach(errorMessage -> { + if (errorMessage.getLevel().equals(ErrorLevel.ERROR)) { + logger.audit(AuditMessages.AUDIT_MSG + String.format(auditType, errorMessage.getMessage(), + vspId)); + } + }); + } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/pom.xml.versionsBackup b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/pom.xml.versionsBackup deleted file mode 100644 index 7fb5fd711e..0000000000 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/pom.xml.versionsBackup +++ /dev/null @@ -1,30 +0,0 @@ -<?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>vendor-software-products-rest-types</artifactId> - <name>vendor-software-products-rest-types</name> - - <parent> - <groupId>org.openecomp.sdc.onboarding</groupId> - <artifactId>vendor-software-products-rest</artifactId> - <version>1.0-SNAPSHOT</version> - <relativePath>../</relativePath> - </parent> - - <dependencies> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-common-rest</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-vendor-software-product-manager</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - </dependencies> - -</project>
\ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/ComputeDetailsDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/ComputeDetailsDto.java index 4b7889b16d..92ad0fdb0c 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/ComputeDetailsDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/ComputeDetailsDto.java @@ -8,7 +8,6 @@ import javax.validation.constraints.Size; public class ComputeDetailsDto implements CompositionDataEntityDto { @NotBlank(message = "is mandatory and should not be empty") @Size(min = 0, max = 30, message = "length should not exceed 30 characters.") - @Pattern(regexp = "^[a-zA-Z 0-9._-]*$", message = "must match \"^[a-zA-Z 0-9._-]*$\"") private String name; @Size(min = 0, max = 300, message = "length should not exceed 300 characters.") private String description; diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/DeploymentFlavorRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/DeploymentFlavorRequestDto.java index 54ce63b252..baf6707ddf 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/DeploymentFlavorRequestDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/DeploymentFlavorRequestDto.java @@ -10,7 +10,6 @@ import javax.validation.constraints.Size; public class DeploymentFlavorRequestDto { @NotBlank(message = "is mandatory and should not be empty") - @Pattern(regexp = "^[a-zA-Z 0-9._-]*$", message = "must match \"^[a-zA-Z 0-9._-]*$\"") @Size(min = 0, max = 30,message = "length should not exceed 30 characters.") private String model; @Size(min = 0, max = 300,message = "length should not exceed 300 characters.") diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/ImageRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/ImageRequestDto.java index 6164522dda..4386245342 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/ImageRequestDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/ImageRequestDto.java @@ -8,7 +8,6 @@ import javax.validation.constraints.Pattern; public class ImageRequestDto implements CompositionDataEntityDto { @NotBlank(message = "is mandatory and should not be empty") - @Pattern(regexp = "^[a-zA-Z 0-9._-]*$", message = "must match \"^[a-zA-Z 0-9._-]*$\"") private String fileName; private String description; /*private String version; diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/NicRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/NicRequestDto.java index fba85b64ed..fdf953c80c 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/NicRequestDto.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/NicRequestDto.java @@ -29,7 +29,6 @@ import javax.validation.constraints.Pattern; public class NicRequestDto { @NotBlank(message = "is mandatory and should not be empty") - @Pattern(regexp = "^[a-zA-Z 0-9._-]*$", message = "must match \"^[a-zA-Z 0-9._-]*$\"") private String name; private String description; private String networkId; diff --git a/openecomp-be/api/pom.xml.versionsBackup b/openecomp-be/api/pom.xml.versionsBackup deleted file mode 100644 index 4c41573002..0000000000 --- a/openecomp-be/api/pom.xml.versionsBackup +++ /dev/null @@ -1,21 +0,0 @@ -<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>openecomp-sdc-api</artifactId> - <name>openecomp-sdc-api</name> - <version>1.0-SNAPSHOT</version> - <packaging>pom</packaging> - <url>http://maven.apache.org</url> - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - - <modules> - <module>/openecomp-sdc-rest-webapp</module> - </modules> - -</project>
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-action-manager/pom.xml.versionsBackup b/openecomp-be/backend/openecomp-sdc-action-manager/pom.xml.versionsBackup deleted file mode 100644 index 21cfd19b02..0000000000 --- a/openecomp-be/backend/openecomp-sdc-action-manager/pom.xml.versionsBackup +++ /dev/null @@ -1,76 +0,0 @@ -<?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>openecomp-sdc-action-manager</artifactId> - <version>1.0-SNAPSHOT</version> - <dependencies> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-utilities-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-validation-core</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-nosqldb-core</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <version>6.9.10</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>RELEASE</version> - <scope>test</scope> - </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-action-core</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-versioning-core</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-logging-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-logging-core</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - </dependencies> - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>backend</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - - -</project>
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-application-config-manager/pom.xml.versionsBackup b/openecomp-be/backend/openecomp-sdc-application-config-manager/pom.xml.versionsBackup deleted file mode 100644 index a9cc7a32f6..0000000000 --- a/openecomp-be/backend/openecomp-sdc-application-config-manager/pom.xml.versionsBackup +++ /dev/null @@ -1,36 +0,0 @@ -<?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> - - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-application-config-manager</artifactId> - <version>1.0-SNAPSHOT</version> - <dependencies> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-config-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <version>6.9.10</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-logging-core</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - </dependencies> - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>backend</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - - -</project>
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/pom.xml b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/pom.xml index ea105b1f90..359d940e52 100644 --- a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/pom.xml +++ b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/pom.xml @@ -80,4 +80,4 @@ </plugin> </plugins> </build> -</project> +</project>
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-validation-manager/pom.xml.versionsBackup b/openecomp-be/backend/openecomp-sdc-validation-manager/pom.xml.versionsBackup deleted file mode 100644 index 4d678ad77d..0000000000 --- a/openecomp-be/backend/openecomp-sdc-validation-manager/pom.xml.versionsBackup +++ /dev/null @@ -1,78 +0,0 @@ -<?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>openecomp-sdc-validation-manager</artifactId> - <version>1.0-SNAPSHOT</version> - <dependencies> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-utilities-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-heat-lib</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <version>6.9.10</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>RELEASE</version> - <scope>test</scope> - </dependency> - - <!--dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-translator-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency--> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-translator-core</artifactId> - <version>1.0-SNAPSHOT</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-license-core</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-validation-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-common-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - </dependencies> - - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>backend</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - - -</project>
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/pom.xml.versionsBackup b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/pom.xml.versionsBackup deleted file mode 100644 index 85b34a187e..0000000000 --- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/pom.xml.versionsBackup +++ /dev/null @@ -1,77 +0,0 @@ -<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> - - <name>openecomp-sdc-vendor-license-manager</name> - <artifactId>openecomp-sdc-vendor-license-manager</artifactId> - - <parent> - <artifactId>backend</artifactId> - <groupId>org.openecomp.sdc</groupId> - <version>1.0-SNAPSHOT</version> - </parent> - - <dependencies> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-vendor-license-core</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <scope>test</scope> - <version>1.10.19</version> - </dependency> - <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <scope>test</scope> - <version>6.8.5</version> - <exclusions> - <exclusion> - <artifactId>snakeyaml</artifactId> - <groupId>org.yaml</groupId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - <version>4.11</version> - </dependency> - <dependency> - <groupId>javax.el</groupId> - <artifactId>javax.el-api</artifactId> - <version>${javax.el-api.version}</version> - </dependency> - <dependency> - <groupId>org.glassfish.web</groupId> - <artifactId>javax.el</artifactId> - <version>2.2.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>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.dataformat</groupId> - <artifactId>jackson-dataformat-xml</artifactId> - <version>2.7.4</version> - </dependency> - <!-- https://mvnrepository.com/artifact/commons-io/commons-io --> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <version>${commons.io.version}</version> - </dependency> - - </dependencies> -</project>
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java index 622ff02501..b570170985 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java @@ -365,9 +365,7 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { String user) { mdcDataDebugMessage.debugEntryMessage("VLM id", vlmId); mdcDataDebugMessage.debugExitMessage("VLM id", vlmId); - return featureGroupDao.list(new FeatureGroupEntity(vlmId, VersioningUtil - .resolveVersion(version, getVersionInfo(vlmId, VersionableEntityAction.Read, user), user), - null)); + return vendorLicenseFacade.listFeatureGroups(vlmId, version, user); } @Override @@ -487,15 +485,6 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { .debugEntryMessage("VLM id", entitlementPool.getVendorLicenseModelId()); mdcDataDebugMessage .debugExitMessage("VLM id", entitlementPool.getVendorLicenseModelId()); - validateCreateDate(entitlementPool); - return vendorLicenseFacade.createEntitlementPool(entitlementPool, user); - } - - private void validateCreateDate(EntitlementPoolEntity entitlementPool){ - mdcDataDebugMessage.debugEntryMessage("Start date and end date", entitlementPool.getStartDate - ()+" "+entitlementPool.getExpiryDate()); - - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy'T'HH:mm:ss'Z'"); entitlementPool.setStartDate(entitlementPool.getStartDate() != null ? (entitlementPool .getStartDate().trim().length() != 0 ? entitlementPool.getStartDate()+"T00:00:00Z" @@ -504,40 +493,49 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { .getExpiryDate().trim().length() != 0 ? entitlementPool.getExpiryDate()+"T23:59:59Z" : null) : null); - if(entitlementPool.getStartDate() != null && entitlementPool.getExpiryDate() != null) { - if (LocalDate.parse(entitlementPool.getStartDate(), formatter).atStartOfDay().isBefore - (LocalDate.now().atStartOfDay()) || - LocalDate.parse(entitlementPool.getExpiryDate(), formatter).atStartOfDay() - .isEqual(LocalDate.now().atStartOfDay()) || - LocalDate.parse(entitlementPool.getExpiryDate(), formatter) - .isBefore(LocalDate.parse(entitlementPool.getStartDate(), formatter))) { + validateCreateDate(entitlementPool.getStartDate(), entitlementPool.getExpiryDate(), + entitlementPool.getVendorLicenseModelId()); + return vendorLicenseFacade.createEntitlementPool(entitlementPool, user); + } + + private void validateCreateDate(String startDate, String expiryDate, String vendorLicenseModelId){ + mdcDataDebugMessage.debugEntryMessage("Start date and end date", startDate + +" "+expiryDate); + + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy'T'HH:mm:ss'Z'"); + + if(startDate != null && expiryDate != null) { + if (LocalDate.parse(startDate, formatter).atStartOfDay().isBefore + (LocalDate.now().atStartOfDay()) || LocalDate.parse(expiryDate, formatter).atStartOfDay() + .isEqual(LocalDate.parse(startDate, formatter).atStartOfDay()) || LocalDate + .parse(expiryDate, formatter).isBefore(LocalDate.parse(startDate, formatter))) { MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, LoggerTragetServiceName.VALIDATE_DATE_RANGE,ErrorLevel.ERROR.name(), LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VALUE); throw new CoreException( - new InvalidDateErrorBuilder(entitlementPool.getVendorLicenseModelId()) + new InvalidDateErrorBuilder(vendorLicenseModelId) .build()); } } - if(entitlementPool.getStartDate() != null && entitlementPool.getExpiryDate() == null) { - if (LocalDate.parse(entitlementPool.getStartDate(), formatter).atStartOfDay().isBefore + if(startDate != null && expiryDate == null) { + if (LocalDate.parse(startDate, formatter).atStartOfDay().isBefore (LocalDate.now().atStartOfDay())) { MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, LoggerTragetServiceName.VALIDATE_DATE_RANGE,ErrorLevel.ERROR.name(), LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VALUE); throw new CoreException( - new InvalidDateErrorBuilder(entitlementPool.getVendorLicenseModelId()) + new InvalidDateErrorBuilder(vendorLicenseModelId) .build()); } } - if(entitlementPool.getStartDate() == null && entitlementPool.getExpiryDate() != null) { + if(startDate == null && expiryDate != null) { MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, LoggerTragetServiceName.VALIDATE_DATE_RANGE,ErrorLevel.ERROR.name(), LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VALUE); throw new CoreException( - new InvalidDateErrorBuilder(entitlementPool.getVendorLicenseModelId()) + new InvalidDateErrorBuilder(vendorLicenseModelId) .build()); } @@ -545,39 +543,31 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { mdcDataDebugMessage.debugExitMessage(null,null); } - private void validateUpdateDate(EntitlementPoolEntity entitlementPool){ - mdcDataDebugMessage.debugEntryMessage("Start date and end date", entitlementPool.getStartDate - ()+" "+entitlementPool.getExpiryDate()); + private void validateUpdateDate(String startDate, String expiryDate, String vendorLicenseModelId){ + mdcDataDebugMessage.debugEntryMessage("Start date and end date", startDate + +" "+ expiryDate); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy'T'HH:mm:ss'Z'"); - entitlementPool.setStartDate(entitlementPool.getStartDate() != null ? (entitlementPool - .getStartDate().trim().length() != 0 ? entitlementPool.getStartDate()+"T00:00:00Z" - : null) : null); - entitlementPool.setExpiryDate(entitlementPool.getExpiryDate() != null ? (entitlementPool - .getExpiryDate().trim().length() != 0 ? entitlementPool.getExpiryDate()+"T23:59:59Z" - : null) : null); - - if(entitlementPool.getStartDate() != null && entitlementPool.getExpiryDate() != null) { - if (LocalDate.parse(entitlementPool.getExpiryDate(), formatter).atStartOfDay() - .isEqual(LocalDate.parse(entitlementPool.getStartDate(), formatter).atStartOfDay()) || - LocalDate.parse(entitlementPool.getExpiryDate(), formatter) - .isBefore(LocalDate.parse(entitlementPool.getStartDate(), formatter))) { + if(startDate != null && expiryDate != null) { + if (LocalDate.parse(expiryDate, formatter).atStartOfDay() + .isEqual(LocalDate.parse(startDate, formatter).atStartOfDay()) || + LocalDate.parse(expiryDate, formatter).isBefore(LocalDate.parse(startDate, formatter))) { MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, LoggerTragetServiceName.VALIDATE_DATE_RANGE,ErrorLevel.ERROR.name(), LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VALUE); throw new CoreException( - new InvalidDateErrorBuilder(entitlementPool.getVendorLicenseModelId()) + new InvalidDateErrorBuilder(vendorLicenseModelId) .build()); } } - if(entitlementPool.getStartDate() == null && entitlementPool.getExpiryDate() != null) { + if(startDate == null && expiryDate != null) { MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, LoggerTragetServiceName.VALIDATE_DATE_RANGE,ErrorLevel.ERROR.name(), LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.INVALID_VALUE); throw new CoreException( - new InvalidDateErrorBuilder(entitlementPool.getVendorLicenseModelId()) + new InvalidDateErrorBuilder(vendorLicenseModelId) .build()); } @@ -590,7 +580,15 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { mdcDataDebugMessage.debugEntryMessage("VLM id, EP id", entitlementPool .getVendorLicenseModelId(), entitlementPool.getId()); - validateUpdateDate(entitlementPool); + entitlementPool.setStartDate(entitlementPool.getStartDate() != null ? (entitlementPool + .getStartDate().trim().length() != 0 ? entitlementPool.getStartDate()+"T00:00:00Z" + : null) : null); + entitlementPool.setExpiryDate(entitlementPool.getExpiryDate() != null ? (entitlementPool + .getExpiryDate().trim().length() != 0 ? entitlementPool.getExpiryDate()+"T23:59:59Z" + : null) : null); + + validateUpdateDate(entitlementPool.getStartDate(), entitlementPool.getExpiryDate(), + entitlementPool.getVendorLicenseModelId()); Version version = VersioningUtil.resolveVersion(entitlementPool.getVersion(), getVersionInfo(entitlementPool.getVendorLicenseModelId(), VersionableEntityAction.Write, user), user); @@ -692,6 +690,16 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { mdcDataDebugMessage.debugExitMessage("VLM id", licenseKeyGroup .getVendorLicenseModelId()); + + licenseKeyGroup.setStartDate(licenseKeyGroup.getStartDate() != null ? (licenseKeyGroup + .getStartDate().trim().length() != 0 ? licenseKeyGroup.getStartDate()+"T00:00:00Z" + : null) : null); + licenseKeyGroup.setExpiryDate(licenseKeyGroup.getExpiryDate() != null ? (licenseKeyGroup + .getExpiryDate().trim().length() != 0 ? licenseKeyGroup.getExpiryDate()+"T23:59:59Z" + : null) : null); + + validateCreateDate(licenseKeyGroup.getStartDate(), licenseKeyGroup.getExpiryDate(), + licenseKeyGroup.getVendorLicenseModelId()); return vendorLicenseFacade.createLicenseKeyGroup(licenseKeyGroup, user); } @@ -700,6 +708,16 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { mdcDataDebugMessage.debugEntryMessage("VLM id, LKG id", licenseKeyGroup .getVendorLicenseModelId(), licenseKeyGroup.getId()); + licenseKeyGroup.setStartDate(licenseKeyGroup.getStartDate() != null ? (licenseKeyGroup + .getStartDate().trim().length() != 0 ? licenseKeyGroup.getStartDate()+"T00:00:00Z" + : null) : null); + licenseKeyGroup.setExpiryDate(licenseKeyGroup.getExpiryDate() != null ? (licenseKeyGroup + .getExpiryDate().trim().length() != 0 ? licenseKeyGroup.getExpiryDate()+"T23:59:59Z" + : null) : null); + + validateUpdateDate(licenseKeyGroup.getStartDate(), licenseKeyGroup.getExpiryDate(), + licenseKeyGroup.getVendorLicenseModelId()); + Version version = VersioningUtil.resolveVersion(licenseKeyGroup.getVersion(), getVersionInfo(licenseKeyGroup.getVendorLicenseModelId(), VersionableEntityAction.Write, user), user); diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/EntitlementPoolTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/EntitlementPoolTest.java index 9b079de3fa..620c6fbf91 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/EntitlementPoolTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/EntitlementPoolTest.java @@ -89,15 +89,9 @@ public class EntitlementPoolTest { entitlementPool.setDescription(desc); entitlementPool.setThresholdValue(threshold); entitlementPool.setThresholdUnit(thresholdUnit); - entitlementPool - .setEntitlementMetric(new ChoiceOrOther<>(entitlementMetricChoice, entitlementMetricOther)); entitlementPool.setIncrements(increments); - entitlementPool.setAggregationFunction( - new ChoiceOrOther<>(aggregationFunctionChoice, aggregationFunctionOther)); entitlementPool.setOperationalScope( new MultiChoiceOrOther<>(operationalScopeChoices, operationalScopeOther)); - entitlementPool.setTime(new ChoiceOrOther<>(timeChoice, timeOther)); - entitlementPool.setManufacturerReferenceNumber(sku); return entitlementPool; } diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LicenseKeyGroupTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LicenseKeyGroupTest.java index 782d93a885..04f7c794bc 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LicenseKeyGroupTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LicenseKeyGroupTest.java @@ -29,6 +29,7 @@ import org.openecomp.sdc.common.errors.CoreException; import org.openecomp.sdc.vendorlicense.dao.LicenseKeyGroupDao; import org.openecomp.sdc.vendorlicense.dao.LimitDao; import org.openecomp.sdc.vendorlicense.dao.types.*; +import org.openecomp.sdc.vendorlicense.errors.VendorLicenseErrorCodes; import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade; import org.openecomp.sdc.vendorlicense.impl.VendorLicenseManagerImpl; import org.openecomp.sdc.versioning.dao.types.Version; @@ -41,6 +42,10 @@ import org.testng.annotations.Test; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.ArrayList; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.Collection; +import java.util.Collections; import java.util.HashSet; import java.util.Set; @@ -54,6 +59,8 @@ public class LicenseKeyGroupTest { private final String USER = "lkgTestUser"; private final String LKG_NAME = "LKG name"; private final String LT_NAME = "LT name"; + private final String LKG1_NAME = "LKG1 name"; + private final String USER1 = "user1"; @Mock private VendorLicenseFacade vendorLicenseFacade; @@ -186,8 +193,193 @@ public class LicenseKeyGroupTest { } } + @Test + public void createTest() { + Set<OperationalScope> opScopeChoices; + opScopeChoices = new HashSet<>(); + opScopeChoices.add(OperationalScope.Core); + opScopeChoices.add(OperationalScope.CPU); + opScopeChoices.add(OperationalScope.Network_Wide); + LicenseKeyGroupEntity lkg = + createLicenseKeyGroup("vlm1Id", null, LKG1_NAME, "LKG1 dec",LicenseKeyType.Unique, + new MultiChoiceOrOther<>(opScopeChoices, null)); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); + lkg.setStartDate(LocalDate.now().format(formatter)); + lkg.setExpiryDate(LocalDate.now().plusDays(1L).format(formatter)); + + vendorLicenseManagerImpl.createLicenseKeyGroup(lkg, USER1); + } + + @Test + public void createWithInvalidStartExpiryDateTest() { + try { + + Set<OperationalScope> opScopeChoices; + opScopeChoices = new HashSet<>(); + opScopeChoices.add(OperationalScope.Core); + opScopeChoices.add(OperationalScope.CPU); + opScopeChoices.add(OperationalScope.Network_Wide); + LicenseKeyGroupEntity lkg = + createLicenseKeyGroup("vlm1Id", null, LKG1_NAME, "LKG1 dec",LicenseKeyType.Unique, + new MultiChoiceOrOther<>(opScopeChoices, null)); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); + lkg.setStartDate(LocalDate.now().format(formatter)); + lkg.setExpiryDate(LocalDate.now().minusDays(2L).format(formatter)); + vendorLicenseManagerImpl.createLicenseKeyGroup(lkg, USER1); + Assert.fail(); + } catch (CoreException exception) { + Assert.assertEquals(exception.code().id(), VendorLicenseErrorCodes.DATE_RANGE_INVALID); + } + } + + @Test + public void createWithoutStartDateTest() { + try { + + Set<OperationalScope> opScopeChoices; + opScopeChoices = new HashSet<>(); + opScopeChoices.add(OperationalScope.Core); + opScopeChoices.add(OperationalScope.CPU); + opScopeChoices.add(OperationalScope.Network_Wide); + LicenseKeyGroupEntity lkg = + createLicenseKeyGroup("vlm1Id", null, LKG1_NAME, "LKG1 dec",LicenseKeyType.Unique, + new MultiChoiceOrOther<>(opScopeChoices, null)); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); + lkg.setExpiryDate(LocalDate.now().plusDays(2L).format(formatter)); + vendorLicenseManagerImpl.createLicenseKeyGroup(lkg, USER1).getId(); + Assert.fail(); + } catch (CoreException exception) { + Assert.assertEquals(exception.code().id(), VendorLicenseErrorCodes.DATE_RANGE_INVALID); + } + } + + @Test + public void createWithSameStartExpiryDateTest() { + try { + + Set<OperationalScope> opScopeChoices; + opScopeChoices = new HashSet<>(); + opScopeChoices.add(OperationalScope.Core); + opScopeChoices.add(OperationalScope.CPU); + opScopeChoices.add(OperationalScope.Network_Wide); + LicenseKeyGroupEntity lkg = + createLicenseKeyGroup("vlm1Id", null, LKG1_NAME, "LKG1 dec",LicenseKeyType.Unique, + new MultiChoiceOrOther<>(opScopeChoices, null)); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); + lkg.setStartDate(LocalDate.now().plusDays(2L).format(formatter)); + lkg.setExpiryDate(LocalDate.now().plusDays(2L).format(formatter)); + vendorLicenseManagerImpl.createLicenseKeyGroup(lkg, USER1).getId(); + Assert.fail(); + } catch (CoreException exception) { + Assert.assertEquals(exception.code().id(), VendorLicenseErrorCodes.DATE_RANGE_INVALID); + } + } + + @Test + public void createUpdate() { + Set<OperationalScope> opScopeChoices; + opScopeChoices = new HashSet<>(); + opScopeChoices.add(OperationalScope.Core); + opScopeChoices.add(OperationalScope.CPU); + opScopeChoices.add(OperationalScope.Network_Wide); + LicenseKeyGroupEntity lkg = + createLicenseKeyGroup("vlm1Id", null, LKG1_NAME, "LKG1 dec",LicenseKeyType.Unique, + new MultiChoiceOrOther<>(opScopeChoices, null)); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); + lkg.setStartDate(LocalDate.now().minusDays(3L).format(formatter)); + lkg.setExpiryDate(LocalDate.now().minusDays(2L).format(formatter)); + VersionInfo info = new VersionInfo(); + Version version = new Version(); + info.getViewableVersions().add(version); + info.setActiveVersion(version); + doReturn(info).when(vendorLicenseFacade).getVersionInfo(anyObject(),anyObject(),anyObject()); + + vendorLicenseManagerImpl.updateLicenseKeyGroup(lkg, USER1); + } + + @Test + public void updateWithInvalidStartExpiryDateTest() { + try { + + Set<OperationalScope> opScopeChoices; + opScopeChoices = new HashSet<>(); + opScopeChoices.add(OperationalScope.Core); + opScopeChoices.add(OperationalScope.CPU); + opScopeChoices.add(OperationalScope.Network_Wide); + LicenseKeyGroupEntity lkg = + createLicenseKeyGroup("vlm1Id", null, LKG1_NAME, "LKG1 dec",LicenseKeyType.Unique, + new MultiChoiceOrOther<>(opScopeChoices, null)); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); + lkg.setStartDate(LocalDate.now().format(formatter)); + lkg.setExpiryDate(LocalDate.now().minusDays(2L).format(formatter)); + vendorLicenseManagerImpl.updateLicenseKeyGroup(lkg, USER1); + Assert.fail(); + } catch (CoreException exception) { + Assert.assertEquals(exception.code().id(), VendorLicenseErrorCodes.DATE_RANGE_INVALID); + } + } + + @Test + public void updateWithoutStartDateTest() { + try { + + Set<OperationalScope> opScopeChoices; + opScopeChoices = new HashSet<>(); + opScopeChoices.add(OperationalScope.Core); + opScopeChoices.add(OperationalScope.CPU); + opScopeChoices.add(OperationalScope.Network_Wide); + LicenseKeyGroupEntity lkg = + createLicenseKeyGroup("vlm1Id", null, LKG1_NAME, "LKG1 dec",LicenseKeyType.Unique, + new MultiChoiceOrOther<>(opScopeChoices, null)); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); + lkg.setExpiryDate(LocalDate.now().plusDays(2L).format(formatter)); + vendorLicenseManagerImpl.updateLicenseKeyGroup(lkg, USER1); + Assert.fail(); + } catch (CoreException exception) { + Assert.assertEquals(exception.code().id(), VendorLicenseErrorCodes.DATE_RANGE_INVALID); + } + } + + @Test + public void updateWithSameStartExpiryDateTest() { + try { + + Set<OperationalScope> opScopeChoices; + opScopeChoices = new HashSet<>(); + opScopeChoices.add(OperationalScope.Core); + opScopeChoices.add(OperationalScope.CPU); + opScopeChoices.add(OperationalScope.Network_Wide); + LicenseKeyGroupEntity lkg = + createLicenseKeyGroup("vlm1Id", null, LKG1_NAME, "LKG1 dec",LicenseKeyType.Unique, + new MultiChoiceOrOther<>(opScopeChoices, null)); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); + lkg.setStartDate(LocalDate.now().format(formatter)); + lkg.setExpiryDate(LocalDate.now().format(formatter)); + vendorLicenseManagerImpl.updateLicenseKeyGroup(lkg, USER1); + Assert.fail(); + } catch (CoreException exception) { + Assert.assertEquals(exception.code().id(), VendorLicenseErrorCodes.DATE_RANGE_INVALID); + } + } + + + public static LicenseKeyGroupEntity createLicenseKeyGroup(String vlmId, Version version, + String name, String desc, + LicenseKeyType type, + MultiChoiceOrOther<OperationalScope> operationalScope) { + LicenseKeyGroupEntity licenseKeyGroup = new LicenseKeyGroupEntity(); + licenseKeyGroup.setVendorLicenseModelId(vlmId); + licenseKeyGroup.setVersion(version); + licenseKeyGroup.setName(name); + licenseKeyGroup.setDescription(desc); + licenseKeyGroup.setType(type); + licenseKeyGroup.setOperationalScope(operationalScope); + return licenseKeyGroup; + } + /*public static final String LKG1_NAME = "LKG1 name"; private static final Version VERSION01 = new Version(0, 1); + public static final String LKG1_NAME = "LKG1 name"; private static final String USER1 = "user1"; public static String vlm1Id; public static String vlm2Id; @@ -211,7 +403,12 @@ public class LicenseKeyGroupTest { return licenseKeyGroup; } - @BeforeClass + @BeforeMethod + public void setUp() throws Exception { + MockitoAnnotations.initMocks(this); + } + + /*@BeforeClass private void init() { licenseKeyGroupDao = LicenseKeyGroupDaoFactory.getInstance().createInterface(); noSqlDb = NoSqlDbFactory.getInstance().createInterface(); diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/VendorLicenseFacadeImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/VendorLicenseFacadeImplTest.java index 58db488d86..40bbc77faa 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/VendorLicenseFacadeImplTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/VendorLicenseFacadeImplTest.java @@ -1,18 +1,27 @@ package org.openecomp.sdc.vendorlicense; +import org.junit.Assert; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.mockito.Spy; import org.openecomp.sdc.vendorlicense.dao.*; +import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity; import org.openecomp.sdc.vendorlicense.facade.impl.VendorLicenseFacadeImpl; +import org.openecomp.sdc.vendorlicense.impl.VendorLicenseManagerImpl; import org.openecomp.sdc.versioning.VersioningManager; import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.sdc.versioning.types.VersionInfo; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.Collection; import java.util.HashSet; +import java.util.List; import java.util.Set; import static org.mockito.Matchers.anyObject; @@ -21,12 +30,16 @@ import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; /** - * Created by diveshm on 7/3/2017. + * This test just verifies Feature Group Get and List APIs. */ public class VendorLicenseFacadeImplTest { //JUnit Test Cases using Mockito private static final Version VERSION01 = new Version(0, 1); - private final String FG1_NAME = "FG1 name"; + public static final String EP1 = "ep1"; + public static final String MRN = "mrn"; + public static final String VLM_ID = "VLM_ID"; + public static final String USER = "USER1"; + @Mock private VendorLicenseModelDao vendorLicenseModelDao; @@ -50,78 +63,101 @@ public class VendorLicenseFacadeImplTest { @Spy private VendorLicenseFacadeImpl vendorLicenseFacadeImpl; - public FeatureGroupEntity createFeatureGroup(String vlmId, Version version, String id, String name, String desc, - String partNumber, String manufacturerReferenceNumber, Set<String> - licenseKeyGroupIds, Set<String> entitlementPoolIds, Set<String> - referencingLicenseAgreements){ - FeatureGroupEntity featureGroup = new FeatureGroupEntity(vlmId, version, id); - featureGroup.setVendorLicenseModelId(vlmId); - featureGroup.setVersion(version); - featureGroup.setId(id); - featureGroup.setName(name); - featureGroup.setDescription(desc); - featureGroup.setPartNumber(partNumber); - //featureGroup.setManufacturerReferenceNumber(manufacturerReferenceNumber); - featureGroup.setLicenseKeyGroupIds(licenseKeyGroupIds); - featureGroup.setEntitlementPoolIds(entitlementPoolIds); - featureGroup.setReferencingLicenseAgreements(referencingLicenseAgreements); - - return featureGroup; - } - @BeforeMethod public void setUp() throws Exception{ MockitoAnnotations.initMocks(this); } @Test - public void testCreate(){ - Set<String> licenseKeyGroupIds; - licenseKeyGroupIds = new HashSet<>(); - licenseKeyGroupIds.add("lkg1"); + public void testGetFeatureGroupWhenMRNNull () { + resetFieldModifiers(); + + FeatureGroupEntity featureGroup = createFeatureGroup(); + + VersionInfo info = new VersionInfo(); + info.getViewableVersions().add(VERSION01); + info.setActiveVersion(VERSION01); Set<String> entitlementPoolIds; entitlementPoolIds = new HashSet<>(); - entitlementPoolIds.add("ep1"); - - Set<String> referencingLicenseAgreements; - referencingLicenseAgreements = new HashSet<>(); - referencingLicenseAgreements.add("la1"); + entitlementPoolIds.add(EP1); - FeatureGroupEntity featureGroupEntity = createFeatureGroup("vlmId", VERSION01, "fgId", FG1_NAME, "fg1 desc", - "partNumber", "MRN", licenseKeyGroupIds, entitlementPoolIds, - referencingLicenseAgreements); + EntitlementPoolEntity ep = createEP(); - doReturn(featureGroupEntity).when(featureGroupDao).get(anyObject()); + featureGroup.setEntitlementPoolIds(entitlementPoolIds); - /*if(featureGroupEntity.getManufacturerReferenceNumber() != null) - featureGroupDao.create(featureGroupEntity); - verify(featureGroupDao).create(anyObject());*/ + doReturn(info).when(vendorLicenseFacadeImpl).getVersionInfo(anyObject(),anyObject(),anyObject()); + doReturn(featureGroup).when(featureGroupDao).get(featureGroup); + doReturn(ep).when(entitlementPoolDao).get(anyObject()); + doReturn(MRN).when(entitlementPoolDao).getManufacturerReferenceNumber(anyObject()); + FeatureGroupEntity retrieved = vendorLicenseFacadeImpl.getFeatureGroup(featureGroup, USER); + Assert.assertEquals(MRN, retrieved.getManufacturerReferenceNumber()); } @Test - public void testCreateWithoutManufacturerReferenceNumber(){ - Set<String> licenseKeyGroupIds; - licenseKeyGroupIds = new HashSet<>(); - licenseKeyGroupIds.add("lkg1"); + public void testListFeatureGroups () { + resetFieldModifiers(); - Set<String> entitlementPoolIds; - entitlementPoolIds = new HashSet<>(); - entitlementPoolIds.add("ep1"); + FeatureGroupEntity featureGroup = createFeatureGroup(); - Set<String> referencingLicenseAgreements; - referencingLicenseAgreements = new HashSet<>(); - referencingLicenseAgreements.add("la1"); + Collection<FeatureGroupEntity> featureGroups = new ArrayList<FeatureGroupEntity>(); + featureGroups.add(featureGroup); - FeatureGroupEntity featureGroupEntity = createFeatureGroup("vlmId", VERSION01, "fgId", FG1_NAME, "fg1 desc", - "partNumber", null, licenseKeyGroupIds, entitlementPoolIds, - referencingLicenseAgreements); - doReturn(featureGroupEntity).when(featureGroupDao).get(anyObject()); + VersionInfo info = new VersionInfo(); + info.getViewableVersions().add(VERSION01); + info.setActiveVersion(VERSION01); - /*if(featureGroupEntity.getManufacturerReferenceNumber() != null) - featureGroupDao.create(featureGroupEntity); + EntitlementPoolEntity ep = createEP(); - verify(featureGroupDao, never()).create(anyObject());*/ + doReturn(info).when(vendorLicenseFacadeImpl).getVersionInfo(anyObject(),anyObject(),anyObject()); + doReturn(featureGroup).when(featureGroupDao).get(featureGroup); + doReturn(ep).when(entitlementPoolDao).get(anyObject()); + doReturn(MRN).when(entitlementPoolDao).getManufacturerReferenceNumber(anyObject()); + Collection<FeatureGroupEntity> retrieved = vendorLicenseFacadeImpl.listFeatureGroups(VLM_ID, + VERSION01, USER); + retrieved.stream().forEach(fg -> Assert.assertEquals(MRN,fg.getManufacturerReferenceNumber())); + } + + private void resetFieldModifiers() { + try { + Field fgField = VendorLicenseFacadeImpl.class.getDeclaredField("featureGroupDao"); + fgField.setAccessible(true); + Field modifiersField = Field.class.getDeclaredField("modifiers"); + modifiersField.setAccessible(true); + modifiersField.setInt(fgField, fgField.getModifiers() & ~Modifier.FINAL); + fgField.set(null, featureGroupDao); + + Field epField = VendorLicenseFacadeImpl.class.getDeclaredField("entitlementPoolDao"); + epField.setAccessible(true); + modifiersField = Field.class.getDeclaredField("modifiers"); + modifiersField.setAccessible(true); + modifiersField.setInt(epField, epField.getModifiers() & ~Modifier.FINAL); + epField.set(null, entitlementPoolDao); + } catch(NoSuchFieldException | IllegalAccessException e) + { + org.testng.Assert.fail(); + } + } + + private FeatureGroupEntity createFeatureGroup() { + FeatureGroupEntity featureGroup = new FeatureGroupEntity(VLM_ID, VERSION01, USER); + featureGroup.setManufacturerReferenceNumber(null); + VersionInfo info = new VersionInfo(); + info.getViewableVersions().add(VERSION01); + info.setActiveVersion(VERSION01); + + Set<String> entitlementPoolIds; + entitlementPoolIds = new HashSet<>(); + entitlementPoolIds.add(EP1); + + featureGroup.setEntitlementPoolIds(entitlementPoolIds); + return featureGroup; + } + private EntitlementPoolEntity createEP() { + EntitlementPoolEntity ep = new EntitlementPoolEntity(VLM_ID,VERSION01, EP1); + ep.setManufacturerReferenceNumber(MRN); + return ep; } + } diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/VSPPackage.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/VSPPackage.zip Binary files differdeleted file mode 100644 index ca55484a3c..0000000000 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/VSPPackage.zip +++ /dev/null diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml.versionsBackup b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml.versionsBackup deleted file mode 100644 index 839a192ec5..0000000000 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml.versionsBackup +++ /dev/null @@ -1,159 +0,0 @@ -<?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>openecomp-sdc-vendor-software-product-manager</artifactId> - <version>1.0-SNAPSHOT</version> - <dependencies> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-utilities-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-nosqldb-core</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-vendor-software-product-core</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-heat-lib</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-tosca-lib</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <version>6.9.10</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>RELEASE</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <version>1.10.19</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-translator-core</artifactId> - <version>1.0-SNAPSHOT</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-license-core</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-enrichment-core</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-validation-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-validation-impl</artifactId> - <version>1.0-SNAPSHOT</version> - <scope>runtime</scope> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-enrichment-impl</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <version>${commons.io.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-model-impl</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-validation-manager</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-logging-core</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-logging-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-healing-core</artifactId> - <version>1.0-SNAPSHOT</version> - <scope>runtime</scope> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-healing-impl</artifactId> - <version>1.0-SNAPSHOT</version> - <scope>runtime</scope> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-healing-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>2.19.1</version> - <configuration> - <useSystemClassLoader>false</useSystemClassLoader> - <redirectTestOutputToFile>true</redirectTestOutputToFile> - </configuration> - </plugin> - </plugins> - </build> - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>backend</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - - -</project>
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComputeErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComputeErrorBuilder.java new file mode 100644 index 0000000000..1c728bdfbb --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ComputeErrorBuilder.java @@ -0,0 +1,25 @@ +package org.openecomp.sdc.vendorsoftwareproduct.errors; + +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; + +/** + * The Compute error builder. + */ +public class ComputeErrorBuilder { + private static final String COMPUTE_NAME_FORMAT_MSG = "Field does not conform to predefined criteria" + + ": name : must match %s"; + + /** + * Gets image name format error builder. + * + * @return the image name format error builder + */ + public static ErrorCode getComputeNameFormatErrorBuilder(String pattern) { + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(VendorSoftwareProductErrorCodes.COMPUTE_NAME_FORMAT_NOT_ALLOWED); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(COMPUTE_NAME_FORMAT_MSG, pattern)); + return builder.build(); + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DeploymentFlavorErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DeploymentFlavorErrorBuilder.java index 63d716504b..97476a2dfd 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DeploymentFlavorErrorBuilder.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/DeploymentFlavorErrorBuilder.java @@ -17,6 +17,8 @@ public class DeploymentFlavorErrorBuilder { "Invalid Request,Same Vfc cannot be associated more than once."; private static final String DUPLICATE_DEPLOYMENT_FLAVOR_MODEL_NOT_ALLOWED_MSG = "Invalid request, Deployment Flavor with model %s already exists for Vsp with Id %s."; + private static final String DEPLOYMENT_FLAVOUR_NAME_FORMAT_MSG = "Field does not conform to predefined criteria" + + ": name : must match %s"; private static final String INVALID_COMPUTE_FLAVOR_ID_MSG = "Invalid request, Compute Flavor with Id %s does not exist for VFC with Id %s."; private static final String INVALID_COMPONENT_COMPUTE_ASSOCIATION_ERROR_MSG="VSP cannot be " + @@ -92,4 +94,12 @@ public class DeploymentFlavorErrorBuilder { builder.withMessage(String.format(FEATUREGROUP_REQUIRED_IN_DEPLOYMENT_FLAVOR_MSG)); return builder.build(); } + + public static ErrorCode getDeploymentFlavorNameFormatErrorBuilder(String pattern){ + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(VendorSoftwareProductErrorCodes.DEPLOYMENT_FLAVOR_NAME_FORMAT_NOT_ALLOWED); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(DEPLOYMENT_FLAVOUR_NAME_FORMAT_MSG, pattern)); + return builder.build(); + } } diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ImageErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ImageErrorBuilder.java index 95bff60479..24883b5c13 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ImageErrorBuilder.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/ImageErrorBuilder.java @@ -1,13 +1,10 @@ package org.openecomp.sdc.vendorsoftwareproduct.errors; -import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.DUPLICATE_IMAGE_NAME_NOT_ALLOWED; - -import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.UPDATE_IMAGE_NOT_ALLOWED; -import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.VFC_IMAGE_INVALID_FORMAT; - import org.openecomp.sdc.common.errors.ErrorCategory; import org.openecomp.sdc.common.errors.ErrorCode; +import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.*; + /** * The Image error builder. */ @@ -15,7 +12,8 @@ public class ImageErrorBuilder { private static final String VFC_IMAGE_DUPLICATE_NAME_MSG = "Invalid request, Image with name %s" + " already exists for component with ID %s."; - + private static final String VFC_IMAGE_NAME_FORMAT_MSG = "Field does not conform to predefined criteria" + + ": name : must match %s"; private static final String IMAGE_INVALID_FORMAT_MSG = "The format value doesn't meet the " + "expected attribute value."; @@ -28,11 +26,24 @@ public class ImageErrorBuilder { * * @return the duplicate image name error builder */ - public static ErrorCode getDuplicateImageNameErrorBuilder(String imageName, String componenetId) { + public static ErrorCode getDuplicateImageNameErrorBuilder(String imageName, String componentId) { ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); builder.withId(DUPLICATE_IMAGE_NAME_NOT_ALLOWED); builder.withCategory(ErrorCategory.APPLICATION); - builder.withMessage(String.format(VFC_IMAGE_DUPLICATE_NAME_MSG, imageName, componenetId )); + builder.withMessage(String.format(VFC_IMAGE_DUPLICATE_NAME_MSG, imageName, componentId )); + return builder.build(); + } + + /** + * Gets image name format error builder. + * + * @return the image name format error builder + */ + public static ErrorCode getImageNameFormatErrorBuilder(String pattern) { + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(IMAGE_NAME_FORMAT_NOT_ALLOWED); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(VFC_IMAGE_NAME_FORMAT_MSG, pattern)); return builder.build(); } diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicErrorBuilder.java new file mode 100644 index 0000000000..fc8ecf26a4 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/NicErrorBuilder.java @@ -0,0 +1,27 @@ +package org.openecomp.sdc.vendorsoftwareproduct.errors; + +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; + +import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.NIC_NAME_FORMAT_NOT_ALLOWED; + +/** + * The NIC error builder. + */ +public class NicErrorBuilder { + private static final String NIC_NAME_FORMAT_MSG = "Field does not conform to predefined criteria" + + ": name : must match %s"; + + /** + * Gets image name format error builder. + * + * @return the image name format error builder + */ + public static ErrorCode getNicNameFormatErrorBuilder(String imageName, String pattern) { + ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + builder.withId(NIC_NAME_FORMAT_NOT_ALLOWED); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(NIC_NAME_FORMAT_MSG, pattern)); + return builder.build(); + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImpl.java index a2d1d708c1..cd102ebb1d 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImpl.java @@ -12,15 +12,15 @@ import org.openecomp.sdc.logging.types.LoggerConstants; import org.openecomp.sdc.logging.types.LoggerErrorCode; import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.vendorsoftwareproduct.ComputeManager; +import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants; import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDao; -import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComputeEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.DeploymentFlavorEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; +import org.openecomp.sdc.vendorsoftwareproduct.errors.ComputeErrorBuilder; import org.openecomp.sdc.vendorsoftwareproduct.errors.DuplicateComputeInComponentErrorBuilder; import org.openecomp.sdc.vendorsoftwareproduct.errors.NotSupportedHeatOnboardMethodErrorBuilder; import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes; @@ -34,14 +34,11 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEnti import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComputeData; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.DeploymentFlavor; -import org.openecomp.sdc.vendorsoftwareproduct.types.questionnaire.component.compute.Compute; import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.ComputeCompositionSchemaInput; import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateContext; import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateInput; -import org.openecomp.sdc.vendorsoftwareproduct.utils.VendorSoftwareProductUtils; import org.openecomp.sdc.versioning.VersioningUtil; import org.openecomp.sdc.versioning.dao.types.Version; -import org.openecomp.sdc.versioning.types.VersionableEntityAction; import java.util.ArrayList; import java.util.Collection; @@ -92,9 +89,13 @@ public class ComputeManagerImpl implements ComputeManager { onboardingMethodUpdateErrorCode.message()); throw new CoreException(onboardingMethodUpdateErrorCode); } else { + //validateComponentId(compute.getVspId(),compute.getVersion(),compute.getComponentId()); - validateCompute(compute); - createdCompute = createCompute(compute); + Collection<ComputeEntity> vfcComputeList = listCompute(compute.getVspId(),compute.getVersion + (),compute.getComponentId()); + + validateVfcCompute(compute, vfcComputeList, LoggerTragetServiceName.CREATE_COMPUTE); + createdCompute = createCompute(compute); } mdcDataDebugMessage @@ -108,7 +109,7 @@ public class ComputeManagerImpl implements ComputeManager { return compositionEntityDataManager.createCompute(compute); } - private void validateCompute(ComputeEntity compute) { + /*private void validateCompute(ComputeEntity compute) { Collection<ComputeEntity> vfcComputeList = listCompute(compute.getVspId(),compute.getVersion (),compute.getComponentId()); @@ -123,7 +124,7 @@ public class ComputeManagerImpl implements ComputeManager { throw new CoreException(duplicateComputeInComponentErrorBuilder); } - } + }*/ private void validateComputeUpdate(ComputeEntity compute) { Collection<ComputeEntity> vfcComputeList = listCompute(compute.getVspId(),compute.getVersion @@ -347,7 +348,7 @@ public class ComputeManagerImpl implements ComputeManager { retrieved.setQuestionnaireData(null); vfcComputeList.remove(retrieved); if(vspInfoDao.isManual(compute.getVspId(), compute.getVersion())) - validateVfcCompute(compute, vfcComputeList); + validateVfcCompute(compute, vfcComputeList, LoggerTragetServiceName.UPDATE_COMPUTE); //Set format to default value in order to handle FTL validation when compute format is null /*if(compute.getComputeCompositionData().getFormat() == null) @@ -384,22 +385,32 @@ public class ComputeManagerImpl implements ComputeManager { } } - private void validateVfcCompute(ComputeEntity compute, Collection<ComputeEntity> vfcComputeList) { - if (isComputeNameDuplicate(vfcComputeList,compute.getComputeCompositionData().getName(), compute.getId())) { - ErrorCode errorCode = DuplicateComputeInComponentErrorBuilder.getDuplicateComputeNameErrorBuilder(compute + private void validateVfcCompute(ComputeEntity compute, Collection<ComputeEntity> vfcComputeList, String event) { + if(!compute.getComputeCompositionData().getName().matches(VendorSoftwareProductConstants.NAME_PATTERN)) + { + ErrorCode errorCode = ComputeErrorBuilder.getComputeNameFormatErrorBuilder( + VendorSoftwareProductConstants.NAME_PATTERN); + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, + event, ErrorLevel.ERROR.name(), + errorCode.id(),errorCode.message()); + throw new CoreException(errorCode); + } + + if (isComputeNameDuplicate(vfcComputeList,compute.getComputeCompositionData().getName(), compute.getId())) { + ErrorCode errorCode = DuplicateComputeInComponentErrorBuilder.getDuplicateComputeNameErrorBuilder(compute .getComputeCompositionData().getName(), compute.getComponentId()); - MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - LoggerTragetServiceName.CREATE_COMPONENT, ErrorLevel.ERROR.name(), + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, + event, ErrorLevel.ERROR.name(), errorCode.id(),errorCode.message()); - throw new CoreException(errorCode); - } + throw new CoreException(errorCode); + } } private boolean isComputeNameDuplicate(Collection<ComputeEntity> computes, String name, String computeId) { for (ComputeEntity compute : computes) { - if (compute.getComputeCompositionData().getName().equals(name) && !compute.getId().equals(computeId)) { + if (compute.getComputeCompositionData().getName().equalsIgnoreCase(name) && !compute.getId().equals(computeId)) { return true; } } diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImpl.java index 7069d778a7..2e964458d5 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImpl.java @@ -10,6 +10,7 @@ import org.openecomp.sdc.logging.types.LoggerConstants; import org.openecomp.sdc.logging.types.LoggerErrorCode; import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.vendorsoftwareproduct.DeploymentFlavorManager; +import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants; import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDao; @@ -23,17 +24,14 @@ import org.openecomp.sdc.vendorsoftwareproduct.errors.NotSupportedHeatOnboardMet import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager; import org.openecomp.sdc.vendorsoftwareproduct.services.schemagenerator.SchemaGenerator; import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse; -import org.openecomp.sdc.vendorsoftwareproduct.types.VersionedVendorSoftwareProductInfo; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentComputeAssociation; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.DeploymentFlavor; import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.DeploymentFlavorCompositionSchemaInput; import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateContext; -import org.openecomp.sdc.vendorsoftwareproduct.utils.VendorSoftwareProductUtils; import org.openecomp.sdc.versioning.VersioningUtil; import org.openecomp.sdc.versioning.dao.types.Version; -import org.openecomp.sdc.versioning.types.VersionableEntityAction; import java.util.ArrayList; import java.util.Collection; @@ -112,6 +110,18 @@ public class DeploymentFlavorManagerImpl implements DeploymentFlavorManager { private void validateDeploymentFlavor(DeploymentFlavorEntity deploymentFlavorEntity, String user, Version activeVersion) { + + if(!deploymentFlavorEntity.getDeploymentFlavorCompositionData().getModel().matches(VendorSoftwareProductConstants.NAME_PATTERN)) + { + ErrorCode errorCode = DeploymentFlavorErrorBuilder.getDeploymentFlavorNameFormatErrorBuilder( + VendorSoftwareProductConstants.NAME_PATTERN); + + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, + LoggerTragetServiceName.UPDATE_NIC, ErrorLevel.ERROR.name(), + errorCode.id(),errorCode.message()); + + throw new CoreException(errorCode); + } //Validation for unique model. Collection<DeploymentFlavorEntity> listDeploymentFlavors = listDeploymentFlavors(deploymentFlavorEntity.getVspId(), @@ -357,6 +367,17 @@ public class DeploymentFlavorManagerImpl implements DeploymentFlavorManager { updateDeploymentFlavorErrorBuilder.message()); throw new CoreException(updateDeploymentFlavorErrorBuilder); } + else { + if(!deploymentFlavorEntity.getDeploymentFlavorCompositionData().getModel().matches(VendorSoftwareProductConstants.NAME_PATTERN)) + { + ErrorCode errorCode = DeploymentFlavorErrorBuilder.getDeploymentFlavorNameFormatErrorBuilder( + VendorSoftwareProductConstants.NAME_PATTERN); + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, + LoggerTragetServiceName.UPDATE_DEPLOYMENT_FLAVOR, ErrorLevel.ERROR.name(), + errorCode.id(),errorCode.message()); + throw new CoreException(errorCode); + } + } //deploymentFlavorEntity.setVersion(activeVersion); DeploymentFlavorEntity retrieved = getDeploymentFlavor(deploymentFlavorEntity.getVspId(), deploymentFlavorEntity.getVersion(), diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImpl.java index e180138119..6a8f9e0c45 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImpl.java @@ -12,9 +12,7 @@ import org.openecomp.sdc.logging.types.LoggerConstants; import org.openecomp.sdc.logging.types.LoggerErrorCode; import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.vendorsoftwareproduct.ImageManager; -import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao; -import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao; -import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDao; +import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants; import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; @@ -34,10 +32,8 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.questionnaire.component.ima import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.ImageCompositionSchemaInput; import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateContext; import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateInput; -import org.openecomp.sdc.vendorsoftwareproduct.utils.VendorSoftwareProductUtils; import org.openecomp.sdc.versioning.VersioningUtil; import org.openecomp.sdc.versioning.dao.types.Version; -import org.openecomp.sdc.versioning.types.VersionableEntityAction; import java.util.Collection; @@ -66,7 +62,8 @@ public class ImageManagerImpl implements ImageManager { VersionableEntityAction.Write, user).getActiveVersion(); imageEntity.setVersion(activeVersion);*/ - if (!vspInfoDao.isManual(imageEntity.getVspId(), imageEntity.getVersion())) { + boolean isManual = vspInfoDao.isManual(imageEntity.getVspId(), imageEntity.getVersion()); + if (!isManual) { ErrorCode errorCode = NotSupportedHeatOnboardMethodErrorBuilder .getAddImageNotSupportedHeatOnboardMethodErrorBuilder(); @@ -80,7 +77,7 @@ public class ImageManagerImpl implements ImageManager { Collection<ImageEntity> vfcImageList = listImages(imageEntity.getVspId() , imageEntity.getVersion(), imageEntity.getComponentId()); - validateVfcImage(imageEntity, vfcImageList); + validateVfcImage(isManual, imageEntity, vfcImageList, LoggerTragetServiceName.CREATE_IMAGE); compositionEntityDataManager.createImage(imageEntity); return imageEntity; } @@ -219,11 +216,11 @@ public class ImageManagerImpl implements ImageManager { /*Version activeVersion = getVersionInfo(image.getVspId(), VersionableEntityAction.Write, user).getActiveVersion(); image.setVersion(activeVersion);*/ - + boolean isManual = vspInfoDao.isManual(image.getVspId(), image.getVersion()); ImageEntity retrieved = getImageEntity(image.getVspId(), image.getVersion(), image.getComponentId(), image.getId()); - if(!vspInfoDao.isManual(image.getVspId(), image.getVersion())) { + if(!isManual) { final Image imageCompositionData = image.getImageCompositionData(); final String fileName = imageCompositionData.getFileName(); //final String format = imageCompositionData.getFormat(); @@ -239,7 +236,7 @@ public class ImageManagerImpl implements ImageManager { //Set to null so that retrieved object is equal to one in list and gets removed. retrieved.setQuestionnaireData(null); vfcImageList.remove(retrieved); - validateVfcImage(image, vfcImageList); + validateVfcImage(isManual, image, vfcImageList, LoggerTragetServiceName.UPDATE_IMAGE); //Set format to default value in order to handle FTL validation when image format is null /*if(image.getImageCompositionData().getFormat() == null) @@ -325,13 +322,25 @@ public class ImageManagerImpl implements ImageManager { return false; } - private void validateVfcImage(ImageEntity image, Collection<ImageEntity> vfcImageList) { + private void validateVfcImage(boolean isManual, ImageEntity image, Collection<ImageEntity> vfcImageList, String event) { + if(isManual && !image.getImageCompositionData().getFileName().matches(VendorSoftwareProductConstants.NAME_PATTERN)) + { + ErrorCode errorCode = ImageErrorBuilder.getImageNameFormatErrorBuilder( + VendorSoftwareProductConstants.NAME_PATTERN); + + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, + event, ErrorLevel.ERROR.name(), + errorCode.id(),errorCode.message()); + + throw new CoreException(errorCode); + } + if (isImageNameDuplicate(vfcImageList,image.getImageCompositionData().getFileName())) { ErrorCode errorCode = ImageErrorBuilder.getDuplicateImageNameErrorBuilder(image .getImageCompositionData().getFileName(), image.getComponentId()); MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - LoggerTragetServiceName.CREATE_COMPONENT, ErrorLevel.ERROR.name(), + event, ErrorLevel.ERROR.name(), errorCode.id(),errorCode.message()); throw new CoreException(errorCode); @@ -354,6 +363,4 @@ public class ImageManagerImpl implements ImageManager { .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.image, schemaInput); } - - } diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImpl.java index ef33812ddc..06e54528b7 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImpl.java @@ -2,7 +2,6 @@ package org.openecomp.sdc.vendorsoftwareproduct.impl; import org.apache.commons.collections4.MapUtils; import org.openecomp.sdc.datatypes.error.ErrorLevel; -import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.generator.core.services.ManualVspToscaGenerationService; import org.openecomp.sdc.generator.datatypes.tosca.DeploymentFlavorModel; import org.openecomp.sdc.generator.datatypes.tosca.MultiFlavorVfcImage; @@ -14,8 +13,8 @@ import org.openecomp.sdc.logging.types.LoggerErrorCode; import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; import org.openecomp.sdc.vendorsoftwareproduct.ManualVspToscaManager; +import org.openecomp.sdc.vendorsoftwareproduct.services.ManualVspDataCollectionService; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic; -import org.openecomp.sdc.vendorsoftwareproduct.utils.ManualVspDataCollectionService; import org.openecomp.sdc.versioning.dao.types.Version; import java.util.List; @@ -25,12 +24,12 @@ import java.util.Optional; public class ManualVspToscaManagerImpl implements ManualVspToscaManager { private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); + private ManualVspDataCollectionService + manualVspDataCollectionService = new ManualVspDataCollectionService(); @Override public VspModelInfo gatherVspInformation(String vspId, Version version, String user) { mdcDataDebugMessage.debugEntryMessage(null, null); - ManualVspDataCollectionService - manualVspDataCollectionService = new ManualVspDataCollectionService(); VspModelInfo vspModelInfo = new VspModelInfo(); //Get Release Vendor Name Optional<String> releaseVendor; @@ -40,7 +39,8 @@ public class ManualVspToscaManagerImpl implements ManualVspToscaManager { releaseVendor = Optional.empty(); MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API, LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), "Release Vendor not found"); + LoggerErrorCode.DATA_ERROR.getErrorCode(), "Release Vendor not found : " + + ex.getMessage()); } releaseVendor.ifPresent(vspModelInfo::setReleaseVendor); @@ -51,7 +51,8 @@ public class ManualVspToscaManagerImpl implements ManualVspToscaManager { } catch (Exception ex) { MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API, LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to collect allowed flavors"); + LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to collect allowed flavors : " + + ex.getMessage()); allowedFlavors = null; } if (MapUtils.isNotEmpty(allowedFlavors)) { @@ -66,7 +67,8 @@ public class ManualVspToscaManagerImpl implements ManualVspToscaManager { } catch (Exception ex) { MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API, LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to collect vsp component images"); + LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to collect vsp component images : " + + ex.getMessage()); vspComponentImages = null; } if (MapUtils.isNotEmpty(vspComponentImages)) { @@ -80,7 +82,8 @@ public class ManualVspToscaManagerImpl implements ManualVspToscaManager { } catch (Exception ex) { MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API, LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to collect vsp components"); + LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to collect vsp components : " + + ex.getMessage()); vspComponents = null; } if (MapUtils.isNotEmpty(vspComponents)) { @@ -94,7 +97,8 @@ public class ManualVspToscaManagerImpl implements ManualVspToscaManager { } catch (Exception ex) { MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API, LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to collect vsp component nics"); + LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to collect vsp component nics : " + + ex.getMessage()); vspComponentNics = null; } if (MapUtils.isNotEmpty(vspComponentNics)) { diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImpl.java index b196b3f54c..0304353113 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImpl.java @@ -31,18 +31,13 @@ import org.openecomp.sdc.logging.types.LoggerErrorCode; import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.vendorsoftwareproduct.NetworkManager; import org.openecomp.sdc.vendorsoftwareproduct.NicManager; +import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants; import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; -import org.openecomp.sdc.vendorsoftwareproduct.errors.CompositionEditNotAllowedErrorBuilder; -import org.openecomp.sdc.vendorsoftwareproduct.errors.DeleteNicErrorBuilder; -import org.openecomp.sdc.vendorsoftwareproduct.errors.DuplicateNicInComponentErrorBuilder; -import org.openecomp.sdc.vendorsoftwareproduct.errors.NicInternalNetworkErrorBuilder; -import org.openecomp.sdc.vendorsoftwareproduct.errors.NicNetworkIdNotAllowedExternalNetworkErrorBuilder; -import org.openecomp.sdc.vendorsoftwareproduct.errors.NotSupportedHeatOnboardMethodErrorBuilder; +import org.openecomp.sdc.vendorsoftwareproduct.errors.*; import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager; import org.openecomp.sdc.vendorsoftwareproduct.services.schemagenerator.SchemaGenerator; import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse; @@ -55,7 +50,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic; import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.NicCompositionSchemaInput; import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateContext; import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateInput; -import org.openecomp.sdc.vendorsoftwareproduct.utils.VendorSoftwareProductUtils; import org.openecomp.sdc.versioning.VersioningUtil; import org.openecomp.sdc.versioning.dao.types.Version; @@ -145,6 +139,19 @@ public class NicManagerImpl implements NicManager { String networkId = nic.getNicCompositionData().getNetworkId(); NetworkType networkType = nic.getNicCompositionData().getNetworkType(); String networkDescription = nic.getNicCompositionData().getNetworkDescription(); + + if(!nic.getNicCompositionData().getName().matches(VendorSoftwareProductConstants.NAME_PATTERN)) + { + ErrorCode errorCode = NicErrorBuilder.getNicNameFormatErrorBuilder(nic + .getNicCompositionData().getName(), VendorSoftwareProductConstants.NAME_PATTERN); + + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, + LoggerTragetServiceName.CREATE_NIC, ErrorLevel.ERROR.name(), + errorCode.id(),errorCode.message()); + + throw new CoreException(errorCode); + } + listNics.forEach(nicEntity -> { Nic nicdata = nicEntity.getNicCompositionData(); if (nic.getNicCompositionData().getName().equalsIgnoreCase(nicdata.getName())) { @@ -265,6 +272,18 @@ public class NicManagerImpl implements NicManager { schemaInput.setManual(vspInfoDao.isManual(nic.getVspId(), nic.getVersion())); schemaInput.setNic(retrieved.getNicCompositionData()); + if(schemaInput.isManual() && !nic.getNicCompositionData().getName().matches(VendorSoftwareProductConstants.NAME_PATTERN)) + { + ErrorCode errorCode = NicErrorBuilder.getNicNameFormatErrorBuilder(nic + .getNicCompositionData().getName(), VendorSoftwareProductConstants.NAME_PATTERN); + + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, + LoggerTragetServiceName.UPDATE_NIC, ErrorLevel.ERROR.name(), + errorCode.id(),errorCode.message()); + + throw new CoreException(errorCode); + } + CompositionEntityValidationData validationData = compositionEntityDataManager .validateEntity(nic, SchemaTemplateContext.composition, schemaInput); if (CollectionUtils.isEmpty(validationData.getErrors())) { diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java index 959cf15789..07e84803aa 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java @@ -29,6 +29,7 @@ import org.openecomp.core.util.UniqueValueUtil; import org.openecomp.core.utilities.file.FileContentHandler; import org.openecomp.core.utilities.file.FileUtils; import org.openecomp.core.utilities.json.JsonUtil; +import org.openecomp.core.validation.util.MessageContainerUtil; import org.openecomp.sdc.activityLog.ActivityLogManager; import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity; import org.openecomp.sdc.common.errors.CoreException; @@ -47,6 +48,7 @@ import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.logging.api.annotations.Metrics; import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; +import org.openecomp.sdc.logging.messages.AuditMessages; import org.openecomp.sdc.logging.types.LoggerServiceName; import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; @@ -90,6 +92,7 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import static org.openecomp.sdc.logging.messages.AuditMessages.HEAT_VALIDATION_ERROR; import static org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants.GENERAL_COMPONENT_ID; import static org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants.UniqueValues.PROCESS_NAME; @@ -225,6 +228,7 @@ public class OrchestrationTemplateCandidateManagerImpl throw new CoreException(new OrchestrationTemplateNotFoundErrorBuilder(vspId).build()); } + logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.HEAT_VALIDATION_STARTED + vspId); OrchestrationTemplateActionResponse response = new OrchestrationTemplateActionResponse(); UploadFileResponse uploadFileResponse = new UploadFileResponse(); OrchestrationTemplateCandidateData candidateDataEntity = candidate.get(); @@ -233,6 +237,8 @@ public class OrchestrationTemplateCandidateManagerImpl if (!fileContent.isPresent()) { response.addStructureErrors(uploadFileResponse.getErrors()); mdcDataDebugMessage.debugExitMessage("VSP id", vspId); + response.getErrors().values().forEach(errorList -> printAuditForErrors(errorList,vspId, + HEAT_VALIDATION_ERROR)); return response; } @@ -246,6 +252,8 @@ public class OrchestrationTemplateCandidateManagerImpl Messages.FOUND_UNASSIGNED_FILES.getErrorMessage(), ErrorLevel.ERROR); mdcDataDebugMessage.debugExitMessage("VSP id", vspId); + response.getErrors().values().forEach(errorList -> printAuditForErrors(errorList,vspId, + HEAT_VALIDATION_ERROR)); return response; } @@ -258,6 +266,8 @@ public class OrchestrationTemplateCandidateManagerImpl Optional<ByteArrayInputStream> zipByteArrayInputStream = candidateService .fetchZipFileByteArrayInputStream(vspId, candidateDataEntity, manifest, uploadErrors); if (!zipByteArrayInputStream.isPresent()) { + response.getErrors().values().forEach(errorList -> printAuditForErrors(errorList,vspId, + HEAT_VALIDATION_ERROR)); return response; } @@ -275,8 +285,18 @@ public class OrchestrationTemplateCandidateManagerImpl deleteUploadDataAndContent(vspId, version); saveHotData(vspId, version, zipByteArrayInputStream.get(), fileContentMap, tree); + response.getErrors().values().forEach(errorList -> printAuditForErrors(errorList,vspId, + HEAT_VALIDATION_ERROR)); + if ( MapUtils.isEmpty(MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, response.getErrors + ()))) { + logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.HEAT_VALIDATION_COMPLETED + vspId); + } + + logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.HEAT_TRANSLATION_STARTED + vspId); + TranslatorOutput translatorOutput = HeatToToscaUtil.loadAndTranslateTemplateData(fileContentMap); + ToscaServiceModel toscaServiceModel = translatorOutput.getToscaServiceModel(); if (toscaServiceModel != null) { serviceModelDao.storeServiceModel(vspId, version, toscaServiceModel); @@ -287,7 +307,10 @@ public class OrchestrationTemplateCandidateManagerImpl .getNonUnifiedToscaServiceModel())); retainComponentQuestionnaireData(vspId, version, componentsQuestionnaire, componentNicsQuestionnaire, componentMibList, processes, processArtifact); + + logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.HEAT_TRANSLATION_COMPLETED + vspId); } + uploadFileResponse.addStructureErrors(uploadErrors); ActivityLogEntity activityLogEntity = @@ -299,7 +322,6 @@ public class OrchestrationTemplateCandidateManagerImpl return response; } - @Override public Optional<FilesDataStructure> getFilesDataStructure( String vspId, Version version, String user) { @@ -462,7 +484,7 @@ public class OrchestrationTemplateCandidateManagerImpl componentArtifactDao.listArtifacts(new ComponentMonitoringUploadEntity(vspId, activeVersion, componentEntity.getId(), null)); - if(CollectionUtils.isNotEmpty(componentMib)){ + if (CollectionUtils.isNotEmpty(componentMib)) { componentMibList.put(componentName,componentMib); } @@ -614,4 +636,14 @@ public class OrchestrationTemplateCandidateManagerImpl return vspDetails; } -} + private void printAuditForErrors(List<ErrorMessage> errorList, String vspId, String auditType) { + + errorList.forEach(errorMessage -> { + if (errorMessage.getLevel().equals(ErrorLevel.ERROR)) { + logger.audit(AuditMessages.AUDIT_MSG + String.format(auditType, errorMessage.getMessage(), + vspId)); + } + }); + } + + } diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java index 0b48c334c6..89246376e4 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java @@ -48,6 +48,7 @@ import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage; +import org.openecomp.sdc.logging.messages.AuditMessages; import org.openecomp.sdc.logging.types.LoggerConstants; import org.openecomp.sdc.logging.types.LoggerErrorCode; import org.openecomp.sdc.logging.types.LoggerServiceName; @@ -594,6 +595,14 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa enrichmentManager.setModel(serviceModel); Map<String, List<ErrorMessage>> enrichErrors = enrichmentManager.enrich(); + if (MapUtils.isEmpty(MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, enrichErrors))) { + logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.ENRICHMENT_COMPLETED + + vendorSoftwareProductId); + } else { + enrichErrors.values().forEach(errorList -> + auditIfContainsErrors(errorList,vendorSoftwareProductId,AuditMessages.ENRICHMENT_ERROR)); + } + enrichedServiceModelDao .storeServiceModel(vendorSoftwareProductId, version, enrichmentManager.getModel()); @@ -993,6 +1002,8 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa packageInfoDao.create(packageInfo); + logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.CREATE_PACKAGE + vspId); + mdcDataDebugMessage.debugExitMessage("VSP id", vspId); return packageInfo; } @@ -1178,4 +1189,14 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa String user) { return vendorSoftwareProductDao.listComputesByVsp(vspId, version); } + + private void auditIfContainsErrors(List<ErrorMessage> errorList, String vspId,String auditType) { + + errorList.forEach(errorMessage -> { + if (errorMessage.getLevel().equals(ErrorLevel.ERROR)) { + logger.audit(AuditMessages.AUDIT_MSG + String.format(auditType, errorMessage.getMessage(), + vspId)); + } + }); + } } diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImplTest.java index c8f473c8c7..103762c56d 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImplTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImplTest.java @@ -140,11 +140,12 @@ public class ComputeManagerImplTest { } @Test - public void testCreateManualImageWithDuplicateName() { + public void testCreateManualComputeWithDuplicateName() { ComputeEntity expected = createCompute(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID); doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); ComputeEntity expectedDiffName = createCompute(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID); + expectedDiffName.setId(COMPUTE1_ID + "Name"); ComputeData computeData = expectedDiffName.getComputeCompositionData(); computeData.setName(COMPUTE1_ID + "Name"); expectedDiffName.setComputeCompositionData(computeData); @@ -162,6 +163,28 @@ public class ComputeManagerImplTest { } } + @Test + public void testCreateManualComputeWithIncorrectNameFormat() { + ComputeEntity expected = createCompute(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID); + doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); + + ComputeEntity expectedDiffName = createCompute(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID); + ComputeData computeData = expectedDiffName.getComputeCompositionData(); + computeData.setName(COMPUTE1_ID + "Name/*"); + expectedDiffName.setComputeCompositionData(computeData); + List<ComputeEntity> vfcImageList = new ArrayList<ComputeEntity>(); + vfcImageList.add(expectedDiffName); + doReturn(vfcImageList).when(computeDao).list(anyObject()); + + try { + computeManager.createCompute(expectedDiffName, USER); + Assert.fail(); + } + catch (CoreException ex) { + Assert.assertEquals(VendorSoftwareProductErrorCodes.COMPUTE_NAME_FORMAT_NOT_ALLOWED, + ex.code().id()); + } + } @Test public void testUpdateNonExistingComputeId_negative() { @@ -192,6 +215,33 @@ public class ComputeManagerImplTest { } @Test + public void testUpdateComputeWithIncorrectNameFormat() { + doReturn(createCompute(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID)) + .when(computeDao).get(anyObject()); + + doReturn(new CompositionEntityValidationData(CompositionEntityType.compute, COMPUTE1_ID)) + .when(compositionEntityDataManagerMock) + .validateEntity(anyObject(), anyObject(), anyObject()); + + doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); + + ComputeEntity computeEntity = new ComputeEntity(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID); + ComputeData computeData = new ComputeData(); + computeData.setName(COMPUTE1_ID + "name/*"); + computeData.setDescription(COMPUTE1_ID + "desc updated"); + computeEntity.setComputeCompositionData(computeData); + + try { + computeManager.updateCompute(computeEntity, USER); + Assert.fail(); + } + catch (CoreException ex) { + Assert.assertEquals(VendorSoftwareProductErrorCodes.COMPUTE_NAME_FORMAT_NOT_ALLOWED, + ex.code().id()); + } + } + + @Test public void testIllegalComputeUpdate() { doReturn(createCompute(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID)) .when(computeDao).get(anyObject()); @@ -207,7 +257,7 @@ public class ComputeManagerImplTest { ComputeEntity computeEntity = new ComputeEntity(VSP_ID, VERSION, COMPONENT_ID, COMPUTE1_ID); ComputeData computeData = new ComputeData(); - computeData.setName(COMPUTE1_ID + " name updated"); + computeData.setName(COMPUTE1_ID + "_name_updated"); computeData.setDescription(COMPUTE1_ID + " desc updated"); computeEntity.setComputeCompositionData(computeData); diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeplomentFlavorManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeplomentFlavorManagerImplTest.java index e082b25435..598b97b34e 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeplomentFlavorManagerImplTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeplomentFlavorManagerImplTest.java @@ -22,8 +22,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes; import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager; import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse; -import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse; -import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Component; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentComputeAssociation; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData; @@ -99,7 +97,7 @@ public class DeplomentFlavorManagerImplTest { DeploymentFlavorEntity expectedDiffName = createDeploymentFlavor(VSP_ID, VERSION, DF1_ID); DeploymentFlavor deploymentFlavor = expectedDiffName.getDeploymentFlavorCompositionData(); - deploymentFlavor.setModel(DF1_ID + " Name"); + deploymentFlavor.setModel(DF1_ID + "Name"); expectedDiffName.setDeploymentFlavorCompositionData(deploymentFlavor); List<DeploymentFlavorEntity> list = new ArrayList<DeploymentFlavorEntity>(); list.add(expectedDiffName); @@ -116,6 +114,28 @@ public class DeplomentFlavorManagerImplTest { } @Test + public void testCreateManualDepFlavorWithIncorrectNameFormat() { + DeploymentFlavorEntity expected = createDeploymentFlavor(VSP_ID, VERSION, DF1_ID); + doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); + + DeploymentFlavorEntity expectedDiffName = createDeploymentFlavor(VSP_ID, VERSION, DF1_ID); + DeploymentFlavor deploymentFlavor = expectedDiffName.getDeploymentFlavorCompositionData(); + deploymentFlavor.setModel(DF1_ID + "Name/*"); + expectedDiffName.setDeploymentFlavorCompositionData(deploymentFlavor); + List<DeploymentFlavorEntity> list = new ArrayList<DeploymentFlavorEntity>(); + list.add(expectedDiffName); + doReturn(list).when(deploymentFlavorDaoMock).list(anyObject()); + + try { + deploymentFlavorManager.createDeploymentFlavor(expectedDiffName, USER); + Assert.fail(); + } + catch (CoreException ex) { + Assert.assertEquals(VendorSoftwareProductErrorCodes.DEPLOYMENT_FLAVOR_NAME_FORMAT_NOT_ALLOWED, + ex.code().id()); + } + } + @Test public void testCreateManualDepFlavorWithFGNotInVSP() { DeploymentFlavorEntity expected = createDeploymentFlavor(VSP_ID, VERSION, DF1_ID); final DeploymentFlavor deploymentFlavor = @@ -253,7 +273,7 @@ public class DeplomentFlavorManagerImplTest { Assert.assertEquals(deploymentFlavorEntities.size(), 2); for (DeploymentFlavorEntity deploymentFlavorEntity : deploymentFlavorEntities) { Assert.assertEquals(deploymentFlavorEntity.getDeploymentFlavorCompositionData().getModel() - , DF1_ID.equals(deploymentFlavorEntity.getId()) ? DF1_ID+" name" : DF2_ID+" name" ); + , DF1_ID.equals(deploymentFlavorEntity.getId()) ? DF1_ID+"name" : DF2_ID+"name" ); } } @@ -286,7 +306,7 @@ public class DeplomentFlavorManagerImplTest { DeploymentFlavorEntity deploymentFlavorEntity = new DeploymentFlavorEntity(VSP_ID, VERSION, DF1_ID); DeploymentFlavor deploymentFlavor = new DeploymentFlavor(); - deploymentFlavor.setModel(DF1_ID + " name"); + deploymentFlavor.setModel(DF1_ID + "_name"); deploymentFlavor.setDescription(DF1_ID + " desc updated"); deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor); @@ -296,6 +316,36 @@ public class DeplomentFlavorManagerImplTest { verify(deploymentFlavorDaoMock).update(deploymentFlavorEntity); } + @Test + public void testManualUpdateDepFlavorIncorrectNameFormat() { + doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); + + doReturn(createDeploymentFlavor(VSP_ID, VERSION, DF1_ID)) + .when(deploymentFlavorDaoMock).get(anyObject()); + + doReturn(new CompositionEntityValidationData(CompositionEntityType.image, DF1_ID)) + .when(compositionEntityDataManagerMock) + .validateEntity(anyObject(), anyObject(), anyObject()); + + VspDetails vspDetails = new VspDetails(VSP_ID, VERSION); + doReturn(vspDetails).when(vspInfoDao).get(anyObject()); + + DeploymentFlavorEntity deploymentFlavorEntity = new DeploymentFlavorEntity(VSP_ID, VERSION, DF1_ID); + DeploymentFlavor deploymentFlavor = new DeploymentFlavor(); + deploymentFlavor.setModel(DF1_ID + "_name/*"); + deploymentFlavor.setDescription(DF1_ID + " desc updated"); + deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor); + + try { + deploymentFlavorManager.updateDeploymentFlavor(deploymentFlavorEntity, USER); + Assert.fail(); + } + catch (CoreException ex) { + Assert.assertEquals(VendorSoftwareProductErrorCodes.DEPLOYMENT_FLAVOR_NAME_FORMAT_NOT_ALLOWED, + ex.code().id()); + } + } + @Test public void testGetNonExistingDepFlavorId_negative() { testGet_negative(VSP_ID, VERSION, "non existing image id", USER, @@ -378,7 +428,7 @@ public class DeplomentFlavorManagerImplTest { DeploymentFlavorEntity deploymentFlavorEntity = new DeploymentFlavorEntity(vspId, version, deploymentFlavorId); DeploymentFlavor deploymentFlavor = new DeploymentFlavor(); - deploymentFlavor.setModel(deploymentFlavorId + " name"); + deploymentFlavor.setModel(deploymentFlavorId + "name"); deploymentFlavor.setDescription(deploymentFlavorId + " desc"); deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor); @@ -388,8 +438,12 @@ public class DeplomentFlavorManagerImplTest { private void testUpdate_negative(String vspId, Version version, String deploymentFlavorId, String user, String expectedErrorCode) { try { + DeploymentFlavorEntity deploymentFlavorEntity = new DeploymentFlavorEntity(vspId, version, deploymentFlavorId); + DeploymentFlavor deploymentFlavor = new DeploymentFlavor(); + deploymentFlavor.setModel("Name"); + deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor); deploymentFlavorManager - .updateDeploymentFlavor(new DeploymentFlavorEntity(vspId, version, deploymentFlavorId), user); + .updateDeploymentFlavor(deploymentFlavorEntity, user); Assert.fail(); } catch (CoreException exception) { Assert.assertEquals(exception.code().id(), expectedErrorCode); diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImplTest.java index ec676e517b..c29cb42953 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImplTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImplTest.java @@ -84,7 +84,7 @@ public class ImageManagerImplTest { Assert.assertEquals(images.size(), 2); for (ImageEntity image : images) { Assert.assertEquals(image.getImageCompositionData().getFileName(), - IMAGE1_ID.equals(image.getId()) ? IMAGE1_ID+" name" : IMAGE2_ID+" name" ); + IMAGE1_ID.equals(image.getId()) ? IMAGE1_ID+"_name" : IMAGE2_ID+"_name" ); } } @@ -105,13 +105,35 @@ public class ImageManagerImplTest { } @Test + public void testCreateManualImageWithIncorrectNameFormat() { + ImageEntity expected = createImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID); + doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); + + ImageEntity expectedDiffName = createImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID); + Image image = expectedDiffName.getImageCompositionData(); + image.setFileName(IMAGE1_ID + " Name*/"); + expectedDiffName.setImageCompositionData(image); + List<ImageEntity> vfcImageList = new ArrayList<ImageEntity>(); + vfcImageList.add(expectedDiffName); + doReturn(vfcImageList).when(imageDao).list(anyObject()); + try { + imageManager.createImage(expectedDiffName, USER); + Assert.fail(); + } + catch (CoreException ex) { + Assert.assertEquals(VendorSoftwareProductErrorCodes.IMAGE_NAME_FORMAT_NOT_ALLOWED, + ex.code().id()); + } + } + + @Test public void testCreateManualImageWithDuplicateName() { ImageEntity expected = createImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID); doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); ImageEntity expectedDiffName = createImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID); Image image = expectedDiffName.getImageCompositionData(); - image.setFileName(IMAGE1_ID + " Name"); + image.setFileName(IMAGE1_ID + "_Name"); expectedDiffName.setImageCompositionData(image); List<ImageEntity> vfcImageList = new ArrayList<ImageEntity>(); vfcImageList.add(expectedDiffName); @@ -143,7 +165,7 @@ public class ImageManagerImplTest { ImageEntity imageEntity = new ImageEntity(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID); Image imageData = new Image(); - imageData.setFileName(IMAGE1_ID + " name"); + imageData.setFileName(IMAGE1_ID + "_name"); imageData.setDescription(IMAGE1_ID + " desc updated"); imageEntity.setImageCompositionData(imageData); @@ -154,6 +176,33 @@ public class ImageManagerImplTest { } @Test + public void testUpdateImageWithIncorrectNameFormat() { + doReturn(createImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID)) + .when(imageDao).get(anyObject()); + + doReturn(new CompositionEntityValidationData(CompositionEntityType.image, IMAGE1_ID)) + .when(compositionEntityDataManagerMock) + .validateEntity(anyObject(), anyObject(), anyObject()); + + doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); + + ImageEntity imageEntity = new ImageEntity(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID); + Image imageData = new Image(); + imageData.setFileName(IMAGE1_ID + "name/*"); + imageData.setDescription(IMAGE1_ID + " desc updated"); + imageEntity.setImageCompositionData(imageData); + + try { + imageManager.updateImage(imageEntity, USER); + Assert.fail(); + } + catch (CoreException ex) { + Assert.assertEquals(VendorSoftwareProductErrorCodes.IMAGE_NAME_FORMAT_NOT_ALLOWED, + ex.code().id()); + } + } + + @Test public void testIllegalImageUpdate() { doReturn(createImage(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID)) .when(imageDao).get(anyObject()); @@ -169,7 +218,7 @@ public class ImageManagerImplTest { ImageEntity imageEntity = new ImageEntity(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID); Image imageData = new Image(); - imageData.setFileName(IMAGE1_ID + " name updated"); + imageData.setFileName(IMAGE1_ID + "_name_updated"); imageData.setDescription(IMAGE1_ID + " desc updated"); imageEntity.setImageCompositionData(imageData); @@ -345,7 +394,7 @@ public class ImageManagerImplTest { static ImageEntity createImage(String vspId, Version version, String compId, String imageId) { ImageEntity imageEntity = new ImageEntity(vspId, version, compId, imageId); Image imageData = new Image(); - imageData.setFileName(imageId + " name"); + imageData.setFileName(imageId + "_name"); imageData.setDescription(imageId + " desc"); imageEntity.setImageCompositionData(imageData); return imageEntity; diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImplTest.java index 4bbbec166e..8ea853c5fa 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImplTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImplTest.java @@ -1,6 +1,9 @@ package org.openecomp.sdc.vendorsoftwareproduct.impl; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; import static org.openecomp.sdc.generator.util.GeneratorConstants.ALLOWED_FLAVORS_PROPERTY; +import static org.openecomp.sdc.generator.util.GeneratorConstants.IMAGES_PROPERTY; import static org.openecomp.sdc.generator.util.GeneratorConstants.PORT_NODE_TEMPLATE_ID_SUFFIX; import static org.openecomp.sdc.tosca.services.ToscaConstants.BINDING_REQUIREMENT_ID; import static org.openecomp.sdc.tosca.services.ToscaConstants.COUNT_PROPERTY_NAME; @@ -10,6 +13,10 @@ import static org.openecomp.sdc.translator.services.heattotosca.Constants.GLOBAL import org.junit.Assert; import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.mockito.Spy; import org.openecomp.sdc.generator.core.utils.GeneratorUtils; import org.openecomp.sdc.generator.datatypes.tosca.ComputeFlavor; import org.openecomp.sdc.generator.datatypes.tosca.DeploymentFlavorModel; @@ -36,43 +43,112 @@ import org.openecomp.sdc.tosca.services.ToscaUtil; import org.openecomp.sdc.tosca.services.impl.ToscaAnalyzerServiceImpl; import org.openecomp.sdc.vendorsoftwareproduct.ManualVspToscaManager; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic; +import org.openecomp.sdc.vendorsoftwareproduct.services.ManualVspDataCollectionService; +import org.openecomp.sdc.versioning.dao.types.Version; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Optional; public class ManualVspToscaManagerImplTest { + private static final String USER = "manualVspToscaTestUser"; + private static final String INVALID_VSP_ID = "Invalid_Vsp_Id"; + private static final String VSP_ID = "Vsp_Id_1"; + private static final String VSP_VERSION = "1.0"; + + private static final String RELEASE_VENDOR = "Vendor-1"; private static final String COMPONENT_ID = "Component_id"; private static final String COMPONENT_NAME = "Component_name"; private static final String SP_PART_NUMBER_1 = "Part_number_123"; private static final String FEATURE_GROUP_ID_1 = "Feature_Group_id_1"; private static final String MANUFACTURER_REF_1 = "Manufacturer_Ref_1"; - private static final String VENDOR_MODEL_1 = "VLM_1"; + private static final String VENDOR_MODEL_1 = "Deployment_Flavor_Model_1"; private static final int NUM_CPUS_1 = 1; - private static final String DISK_SIZE_1 = "2GB"; - private static final String MEM_SIZE_1 = "8GB"; + private static final String DISK_SIZE_1 = "2 GB"; + private static final String MEM_SIZE_1 = "8 GB"; private static final String SP_PART_NUMBER_2 = "Part_number_345"; private static final String FEATURE_GROUP_ID_2 = "Feature_Group_id_2"; private static final String MANUFACTURER_REF_2 = "Manufacturer_Ref_2"; - private static final String VENDOR_MODEL_2 = "VLM_2"; + private static final String VENDOR_MODEL_2 = "Deployment_Flavor_Model_2"; private static final int NUM_CPUS_2 = 4; - private static final String DISK_SIZE_2 = "3GB"; - private static final String MEM_SIZE_2 = "2GB"; + private static final String DISK_SIZE_2 = "3 GB"; + private static final String MEM_SIZE_2 = "2 GB"; private static final String IMAGE_VERSION_1 = "3.16.1"; private static final String IMAGE_HASH_1 = "65edfgye3256hjutve"; private static final String IMAGE_FILE_NAME_1 = "image-file-name1"; - private static final String IMAGE_FILE_FORMAT_1 = "qcow2"; private static final String IMAGE_VERSION_2 = "3.1.9"; private static final String IMAGE_HASH_2 = "84rtedfe3256hjutaw"; private static final String IMAGE_FILE_NAME_2 = "image-file-name1"; - private static final String IMAGE_FILE_FORMAT_2 = "iso"; private ManualVspToscaManager manualVspToscaManager = new ManualVspToscaManagerImpl(); + @Spy + @InjectMocks + private ManualVspToscaManagerImpl manualVspToscaManagerMock; + + @Mock + private ManualVspDataCollectionService manualVspDataCollectionServiceMock; + + @Test + public void testGatherVspInformationInvalidVsp() { + MockitoAnnotations.initMocks(this); + VspModelInfo expectedVspData = new VspModelInfo(); + doThrow(new RuntimeException()) + .when(manualVspDataCollectionServiceMock) + .getReleaseVendor(INVALID_VSP_ID, Version.valueOf(VSP_VERSION), USER); + doThrow(new RuntimeException()) + .when(manualVspDataCollectionServiceMock) + .getAllowedFlavors(INVALID_VSP_ID, Version.valueOf(VSP_VERSION), USER); + doThrow(new RuntimeException()) + .when(manualVspDataCollectionServiceMock) + .getVspComponentImages(INVALID_VSP_ID, Version.valueOf(VSP_VERSION), USER); + doThrow(new RuntimeException()) + .when(manualVspDataCollectionServiceMock) + .getVspComponents(INVALID_VSP_ID, Version.valueOf(VSP_VERSION), USER); + doThrow(new RuntimeException()) + .when(manualVspDataCollectionServiceMock) + .getVspComponentNics(INVALID_VSP_ID, Version.valueOf(VSP_VERSION), USER); + VspModelInfo vspModelInfo = manualVspToscaManagerMock.gatherVspInformation(INVALID_VSP_ID, + Version.valueOf(VSP_VERSION), USER); + Assert.assertEquals(expectedVspData, vspModelInfo); + } + + + @Test + public void testGatherVspInformationValidVsp() { + MockitoAnnotations.initMocks(this); + Map<String, DeploymentFlavorModel> deploymentFlavorData = getDeploymentFlavorData(); + Map<String, List<Nic>> componentNics = getComponentNics(); + Map<String, String> componentData = getComponentData(); + Map<String, List<MultiFlavorVfcImage>> vfcImageData = getVfcImageData(); + doReturn(Optional.of(RELEASE_VENDOR)).when(manualVspDataCollectionServiceMock) + .getReleaseVendor(VSP_ID, Version.valueOf(VSP_VERSION), USER); + doReturn(deploymentFlavorData).when(manualVspDataCollectionServiceMock) + .getAllowedFlavors(VSP_ID, Version.valueOf(VSP_VERSION), USER); + doReturn(vfcImageData).when(manualVspDataCollectionServiceMock) + .getVspComponentImages(VSP_ID, Version.valueOf(VSP_VERSION), USER); + doReturn(componentData).when(manualVspDataCollectionServiceMock) + .getVspComponents(VSP_ID, Version.valueOf(VSP_VERSION), USER); + doReturn(componentNics).when(manualVspDataCollectionServiceMock) + .getVspComponentNics(VSP_ID, Version.valueOf(VSP_VERSION), USER); + VspModelInfo vspModelInfo = manualVspToscaManagerMock.gatherVspInformation(VSP_ID, + Version.valueOf(VSP_VERSION), USER); + + VspModelInfo expectedVspData = new VspModelInfo(); + expectedVspData.setReleaseVendor(RELEASE_VENDOR); + expectedVspData.setComponents(getComponentData()); + expectedVspData.setMultiFlavorVfcImages(getVfcImageData()); + expectedVspData.setAllowedFlavors(getDeploymentFlavorData()); + expectedVspData.setNics(getComponentNics()); + + Assert.assertEquals(expectedVspData, vspModelInfo); + } + @Test public void testGenerateToscaInvalidVspId() { VspModelInfo emptyVspCollectedData = new VspModelInfo(); @@ -87,7 +163,7 @@ public class ManualVspToscaManagerImplTest { @Test public void testGenerateToscaNoComponent() { VspModelInfo vspCollectedData = new VspModelInfo(); - vspCollectedData.setReleaseVendor("Vendor-1"); + vspCollectedData.setReleaseVendor(RELEASE_VENDOR); vspCollectedData.setComponents(null); vspCollectedData.setMultiFlavorVfcImages(null); vspCollectedData.setAllowedFlavors(getDeploymentFlavorData()); @@ -111,7 +187,6 @@ public class ManualVspToscaManagerImplTest { manualVspToscaManager.generateToscaModel(vspCollectedData); Assert.assertNotNull(toscaServiceModel); Assert.assertNotNull(toscaServiceModel.getServiceTemplates()); - //Service model should contain only the packed global types Assert.assertEquals(22, toscaServiceModel.getServiceTemplates().size()); Map<String, ServiceTemplate> serviceTemplates = toscaServiceModel.getServiceTemplates(); String entryDefinitionServiceTemplate = toscaServiceModel.getEntryDefinitionServiceTemplate(); @@ -131,7 +206,6 @@ public class ManualVspToscaManagerImplTest { manualVspToscaManager.generateToscaModel(vspCollectedData); Assert.assertNotNull(toscaServiceModel); Assert.assertNotNull(toscaServiceModel.getServiceTemplates()); - //Service model should contain only the packed global types Assert.assertEquals(22, toscaServiceModel.getServiceTemplates().size()); Map<String, ServiceTemplate> serviceTemplates = toscaServiceModel.getServiceTemplates(); String entryDefinitionServiceTemplate = toscaServiceModel.getEntryDefinitionServiceTemplate(); @@ -139,8 +213,8 @@ public class ManualVspToscaManagerImplTest { Assert.assertNotNull(mainServiceTemplate); String componentName = vspCollectedData.getComponents().get(COMPONENT_ID); Assert.assertNull(mainServiceTemplate.getTopology_template().getNode_templates() - .get(componentName + GeneratorConstants.VFC_NODE_TEMPLATE_ID_SUFFIX) - .getProperties()); + .get(componentName + GeneratorConstants.VNF_NODE_TEMPLATE_ID_SUFFIX) + .getProperties().get(IMAGES_PROPERTY)); } @Test @@ -154,7 +228,6 @@ public class ManualVspToscaManagerImplTest { manualVspToscaManager.generateToscaModel(vspCollectedData); Assert.assertNotNull(toscaServiceModel); Assert.assertNotNull(toscaServiceModel.getServiceTemplates()); - //Service model should contain only the packed global types Assert.assertEquals(22, toscaServiceModel.getServiceTemplates().size()); Map<String, ServiceTemplate> serviceTemplates = toscaServiceModel.getServiceTemplates(); String componentName = vspCollectedData.getComponents().get(COMPONENT_ID); @@ -171,7 +244,7 @@ public class ManualVspToscaManagerImplTest { @Test public void testGenerateToscaNoManufacturerRefNumAndFeatureGroup() { VspModelInfo vspCollectedData = new VspModelInfo(); - vspCollectedData.setReleaseVendor("Vendor-1"); + vspCollectedData.setReleaseVendor(RELEASE_VENDOR); vspCollectedData.setComponents(getComponentData()); vspCollectedData.setMultiFlavorVfcImages(getVfcImageData()); Map<String, DeploymentFlavorModel> deploymentFlavorData = getDeploymentFlavorData(); @@ -184,7 +257,6 @@ public class ManualVspToscaManagerImplTest { manualVspToscaManager.generateToscaModel(vspCollectedData); Assert.assertNotNull(toscaServiceModel); Assert.assertNotNull(toscaServiceModel.getServiceTemplates()); - //Service model should contain only the packed global types Assert.assertEquals(22, toscaServiceModel.getServiceTemplates().size()); Map<String, ServiceTemplate> serviceTemplates = toscaServiceModel.getServiceTemplates(); String entryDefinitionServiceTemplate = toscaServiceModel.getEntryDefinitionServiceTemplate(); @@ -204,7 +276,7 @@ public class ManualVspToscaManagerImplTest { @Test public void testGenerateToscaNoDeploymentFlavor() { VspModelInfo vspCollectedData = new VspModelInfo(); - vspCollectedData.setReleaseVendor("Vendor-1"); + vspCollectedData.setReleaseVendor(RELEASE_VENDOR); vspCollectedData.setComponents(getComponentData()); vspCollectedData.setMultiFlavorVfcImages(getVfcImageData()); vspCollectedData.setAllowedFlavors(null); @@ -213,7 +285,6 @@ public class ManualVspToscaManagerImplTest { manualVspToscaManager.generateToscaModel(vspCollectedData); Assert.assertNotNull(toscaServiceModel); Assert.assertNotNull(toscaServiceModel.getServiceTemplates()); - //Service model should contain only the packed global types Assert.assertEquals(22, toscaServiceModel.getServiceTemplates().size()); Map<String, ServiceTemplate> serviceTemplates = toscaServiceModel.getServiceTemplates(); String entryDefinitionServiceTemplate = toscaServiceModel.getEntryDefinitionServiceTemplate(); @@ -228,7 +299,7 @@ public class ManualVspToscaManagerImplTest { @Test public void testGenerateToscaCompleteData() { VspModelInfo vspCollectedData = new VspModelInfo(); - vspCollectedData.setReleaseVendor("Vendor-1"); + vspCollectedData.setReleaseVendor(RELEASE_VENDOR); vspCollectedData.setComponents(getComponentData()); vspCollectedData.setMultiFlavorVfcImages(getVfcImageData()); vspCollectedData.setAllowedFlavors(getDeploymentFlavorData()); @@ -237,31 +308,23 @@ public class ManualVspToscaManagerImplTest { manualVspToscaManager.generateToscaModel(vspCollectedData); Assert.assertNotNull(toscaServiceModel); Assert.assertNotNull(toscaServiceModel.getServiceTemplates()); - //Service model should contain only the packed global types Assert.assertEquals(22, toscaServiceModel.getServiceTemplates().size()); Map<String, ServiceTemplate> serviceTemplates = toscaServiceModel.getServiceTemplates(); String entryDefinitionServiceTemplate = toscaServiceModel.getEntryDefinitionServiceTemplate(); ServiceTemplate mainServiceTemplate = serviceTemplates.get(entryDefinitionServiceTemplate); Assert.assertNotNull(mainServiceTemplate); String componentName = vspCollectedData.getComponents().get(COMPONENT_ID); - - Assert.assertNotNull(mainServiceTemplate.getTopology_template().getNode_templates() - .get(componentName + GeneratorConstants.VFC_NODE_TEMPLATE_ID_SUFFIX)); Assert.assertNotNull(mainServiceTemplate.getTopology_template().getNode_templates() .get(componentName + GeneratorConstants.VNF_NODE_TEMPLATE_ID_SUFFIX)); //Validate vnf configuration node template validateVnfConfigurationNodeTemplate(mainServiceTemplate, componentName); - //Validate vfc node template - validateVfcNodeTemplateinMainServiceTemplate(mainServiceTemplate, componentName); //Validate vnf node template validateVnfNodeTemplate(mainServiceTemplate, componentName); - //Validate substitution service template ServiceTemplate substitutionServiceTemplate = toscaServiceModel.getServiceTemplates() .get(componentName + GeneratorConstants.TOSCA_SERVICE_TEMPLATE_FILE_NAME_SUFFIX); List<Nic> nics = vspCollectedData.getNics().get(COMPONENT_ID); validateSubstitutionServiceTemplate(substitutionServiceTemplate, nics, componentName); - //Validate global substitution service template ServiceTemplate globalSubstitutionServiceTemplate = toscaServiceModel.getServiceTemplates() .get(ToscaUtil.getServiceTemplateFileName(GLOBAL_SUBSTITUTION_TYPES_TEMPLATE_NAME)); @@ -284,24 +347,18 @@ public class ManualVspToscaManagerImplTest { Assert.assertEquals(deploymentFlavorData, allowedFlavors); } - private void validateVfcNodeTemplateinMainServiceTemplate(ServiceTemplate mainServiceTemplate, - String componentName) { - NodeTemplate vfcNodeTemplate = - mainServiceTemplate.getTopology_template().getNode_templates() - .get(componentName + GeneratorConstants.VFC_NODE_TEMPLATE_ID_SUFFIX); - Assert.assertNotNull(vfcNodeTemplate); - Assert.assertEquals(ToscaNodeType.MULTIFLAVOR_VFC_NODE_TYPE, vfcNodeTemplate.getType()); + private void validateImagePropertyData(NodeTemplate vnfNodeTemplate, String componentName) { Map<String, MultiFlavorVfcImage> vfcImages = (Map<String, MultiFlavorVfcImage>) - vfcNodeTemplate.getProperties().get(GeneratorConstants.IMAGES_PROPERTY); + vnfNodeTemplate.getProperties().get(GeneratorConstants.IMAGES_PROPERTY); Assert.assertNotNull(vfcImages); Assert.assertEquals(2, vfcImages.size()); MultiFlavorVfcImage image1 = vfcImages.get(IMAGE_VERSION_1); MultiFlavorVfcImage expectedImage1 = getImageData(IMAGE_VERSION_1, IMAGE_HASH_1, - IMAGE_FILE_NAME_1, "md5", IMAGE_FILE_FORMAT_1); + IMAGE_FILE_NAME_1, "md5"); Assert.assertEquals(expectedImage1, image1); MultiFlavorVfcImage image2 = vfcImages.get(IMAGE_VERSION_2); MultiFlavorVfcImage expectedImage2 = getImageData(IMAGE_VERSION_2, IMAGE_HASH_2, - IMAGE_FILE_NAME_2, "md5", IMAGE_FILE_FORMAT_2); + IMAGE_FILE_NAME_2, "md5"); Assert.assertEquals(expectedImage2, image2); } @@ -311,12 +368,11 @@ public class ManualVspToscaManagerImplTest { mainServiceTemplate.getTopology_template().getNode_templates() .get(componentName + GeneratorConstants.VNF_NODE_TEMPLATE_ID_SUFFIX); Assert.assertNotNull(vnfNodeTemplate); - Assert.assertEquals(ToscaNodeType.MULTIDEPLOYMENTFLAVOR_NODE_TYPE + "." + componentName, - vnfNodeTemplate.getType()); + Assert.assertEquals(ToscaNodeType.MULTIDEPLOYMENTFLAVOR_NODE_TYPE, vnfNodeTemplate.getType()); Assert.assertNotNull(vnfNodeTemplate.getDirectives()); Assert.assertEquals(true, vnfNodeTemplate.getDirectives().contains(ToscaConstants .NODE_TEMPLATE_DIRECTIVE_SUBSTITUTABLE)); - + validateImagePropertyData(vnfNodeTemplate, componentName); Map<String, Object> serviceTemplateFilterProperty = (Map<String, Object>) vnfNodeTemplate .getProperties().get(SERVICE_TEMPLATE_FILTER_PROPERTY_NAME); Assert.assertNotNull(serviceTemplateFilterProperty); @@ -372,8 +428,8 @@ public class ManualVspToscaManagerImplTest { private void validateSubstitutionMappings(SubstitutionMapping substitutionMappings, List<Nic> nics, String componentName) { - Assert.assertEquals(ToscaNodeType.MULTIDEPLOYMENTFLAVOR_NODE_TYPE + "." + componentName, - substitutionMappings.getNode_type()); + Assert.assertEquals(ToscaNodeType.MULTIDEPLOYMENTFLAVOR_NODE_TYPE, substitutionMappings + .getNode_type()); Map<String, List<String>> capabilities = substitutionMappings.getCapabilities(); validateSubstitutionCapabilities(capabilities, componentName); Map<String, List<String>> requirements = substitutionMappings.getRequirements(); @@ -420,7 +476,7 @@ public class ManualVspToscaManagerImplTest { Map<String, NodeType> nodeTypes = globalSubstitutionServiceTemplate.getNode_types(); Assert.assertEquals(1, nodeTypes.size()); NodeType deploymentFlavorNodeType = - nodeTypes.get(ToscaNodeType.MULTIDEPLOYMENTFLAVOR_NODE_TYPE + "." + componentName); + nodeTypes.get(ToscaNodeType.MULTIDEPLOYMENTFLAVOR_NODE_TYPE); Assert.assertNotNull(deploymentFlavorNodeType); Map<String, PropertyDefinition> properties = deploymentFlavorNodeType.getProperties(); Assert.assertNotNull(properties); @@ -475,9 +531,9 @@ public class ManualVspToscaManagerImplTest { Map<String, List<MultiFlavorVfcImage>> imageData = new HashMap<>(); List<MultiFlavorVfcImage> images = new ArrayList<>(2); MultiFlavorVfcImage image1 = getImageData(IMAGE_VERSION_1, IMAGE_HASH_1, IMAGE_FILE_NAME_1, - "md5", IMAGE_FILE_FORMAT_1); + "md5"); MultiFlavorVfcImage image2 = getImageData(IMAGE_VERSION_2, IMAGE_HASH_2, IMAGE_FILE_NAME_2, - "md5", IMAGE_FILE_FORMAT_2); + "md5"); images.add(image1); images.add(image2); imageData.put(COMPONENT_ID, images); @@ -522,10 +578,10 @@ public class ManualVspToscaManagerImplTest { return computeFlavor; } - private VendorInfo getVendorInfo(String manufacturerRefNumber, String vlmId) { + private VendorInfo getVendorInfo(String manufacturerRefNumber, String deploymentFlavorModel) { VendorInfo vendorInfo = new VendorInfo(); vendorInfo.setManufacturer_reference_number(manufacturerRefNumber); - vendorInfo.setVendor_model(vlmId); + vendorInfo.setVendor_model(deploymentFlavorModel); return vendorInfo; } @@ -535,13 +591,13 @@ public class ManualVspToscaManagerImplTest { return licenseFlavor; } - private MultiFlavorVfcImage getImageData(String imageVersion, String fileHash, String fileName, - String fileHashType, String fileFormat) { + private MultiFlavorVfcImage getImageData(String imageVersion, String fileHash, + String fileName, String fileHashType) { MultiFlavorVfcImage image = new MultiFlavorVfcImage(); image.setSoftware_version(imageVersion); image.setFile_hash(fileHash); image.setFile_hash_type(fileHashType); - image.setFile_name(fileName+"-"+IMAGE_VERSION_2+"."+fileFormat); + image.setFile_name(fileName); return image; } diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImplTest.java index b2cfba7672..fe275e9d68 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImplTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImplTest.java @@ -110,6 +110,31 @@ public class NicManagerImplTest { } @Test + public void testCreateWithIncorrectNicNameFormat() { + NicEntity nicEntity = createNic(VSP_ID, VERSION, COMPONENT_ID, NIC1_ID, NETWORK1_ID); + Nic nic = nicEntity.getNicCompositionData(); + nic.setNetworkType(NetworkType.Internal); + nicEntity.setNicCompositionData(nic); + doReturn(true).when(vspInfoDao).isManual(anyObject(),anyObject()); + Collection<NicEntity> nicEntities = new ArrayList<>(); + + NicEntity nicEntityDiffName = createNic(VSP_ID, VERSION, COMPONENT_ID, NIC1_ID, NETWORK1_ID); + Nic newNameNic = nicEntityDiffName.getNicCompositionData(); + newNameNic.setName(NIC1_ID + "_Name/*"); + nicEntityDiffName.setNicCompositionData(newNameNic); + nicEntities.add(nicEntityDiffName); + doReturn(nicEntities).when(nicDao).list(anyObject()); + doReturn(nicEntity).when(compositionEntityDataManagerMock).createNic(anyObject()); + + try { + NicEntity created = nicManager.createNic(nicEntity,USER); + } catch (CoreException exception) { + Assert.assertEquals(VendorSoftwareProductErrorCodes.NIC_NAME_FORMAT_NOT_ALLOWED, + exception.code().id()); + } + } + + @Test public void testCreateWithDupNicName() { NicEntity nicEntity = createNic(VSP_ID, VERSION, COMPONENT_ID, NIC1_ID, NETWORK1_ID); Nic nic = nicEntity.getNicCompositionData(); @@ -120,7 +145,7 @@ public class NicManagerImplTest { NicEntity nicEntityDiffName = createNic(VSP_ID, VERSION, COMPONENT_ID, NIC1_ID, NETWORK1_ID); Nic newNameNic = nicEntityDiffName.getNicCompositionData(); - newNameNic.setName(NIC1_ID + " Name"); + newNameNic.setName(NIC1_ID + "_Name"); nicEntityDiffName.setNicCompositionData(newNameNic); nicEntities.add(nicEntityDiffName); doReturn(nicEntities).when(nicDao).list(anyObject()); @@ -282,7 +307,7 @@ public class NicManagerImplTest { NicEntity nicEntity = new NicEntity(VSP_ID, VERSION, COMPONENT_ID, NIC1_ID); Nic nicData = new Nic(); - nicData.setName(NIC1_ID + " name updated"); + nicData.setName(NIC1_ID + "_name_updated"); nicData.setDescription(NIC1_ID + " desc updated"); nicData.setNetworkId(NETWORK1_ID); nicEntity.setNicCompositionData(nicData); @@ -294,6 +319,36 @@ public class NicManagerImplTest { verify(nicDao, never()).update(nicEntity); } + @Test + public void testUpdateIncorrectNameFormat() { + doReturn(createNic(VSP_ID, VERSION, COMPONENT_ID, NIC1_ID, NETWORK1_ID)) + .when(nicDao).get(anyObject()); + + CompositionEntityValidationData toBeReturned = + new CompositionEntityValidationData(CompositionEntityType.nic, NIC1_ID); + toBeReturned.setErrors(Arrays.asList("error1", "error2")); + doReturn(toBeReturned) + .when(compositionEntityDataManagerMock) + .validateEntity(anyObject(), anyObject(), anyObject()); + doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject()); + + NicEntity nicEntity = new NicEntity(VSP_ID, VERSION, COMPONENT_ID, NIC1_ID); + Nic nicData = new Nic(); + nicData.setName(NIC1_ID + "_name_updated/*"); + nicData.setDescription(NIC1_ID + " desc updated"); + nicData.setNetworkId(NETWORK1_ID); + nicEntity.setNicCompositionData(nicData); + + try { + nicManager.updateNic(nicEntity, USER); + Assert.fail(); + } + catch (CoreException ex) { + Assert.assertEquals(VendorSoftwareProductErrorCodes.NIC_NAME_FORMAT_NOT_ALLOWED, + ex.code().id()); + } + } + @Test public void testGetNonExistingNicId_negative() { @@ -426,7 +481,7 @@ public class NicManagerImplTest { String networkId) { NicEntity nicEntity = new NicEntity(vspId, version, compId, nicId); Nic nicData = new Nic(); - nicData.setName(nicId + " name"); + nicData.setName(nicId + "_name"); nicData.setDescription(nicId + " desc"); nicData.setNetworkId(networkId); nicEntity.setNicCompositionData(nicData); diff --git a/openecomp-be/backend/pom.xml.versionsBackup b/openecomp-be/backend/pom.xml.versionsBackup deleted file mode 100644 index 15ac71b64d..0000000000 --- a/openecomp-be/backend/pom.xml.versionsBackup +++ /dev/null @@ -1,26 +0,0 @@ -<?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> - - <parent> - <artifactId>openecomp-sdc</artifactId> - <groupId>org.openecomp.sdc</groupId> - <version>1.0-SNAPSHOT</version> - </parent> - - <groupId>org.openecomp.sdc</groupId> - <artifactId>backend</artifactId> - <packaging>pom</packaging> - - <modules> - <module>openecomp-sdc-vendor-license-manager</module> - <module>openecomp-sdc-vendor-software-product-manager</module> - <module>openecomp-sdc-validation-manager</module> - <module>openecomp-sdc-action-manager</module> - <module>openecomp-sdc-application-config-manager</module> - </modules> - - -</project> diff --git a/openecomp-be/configuration/pom.xml.versionsBackup b/openecomp-be/configuration/pom.xml.versionsBackup deleted file mode 100644 index a627e11af3..0000000000 --- a/openecomp-be/configuration/pom.xml.versionsBackup +++ /dev/null @@ -1,17 +0,0 @@ -<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>openecomp-sdc-configuration</artifactId> - <name>openecomp-sdc-configuration</name> - <version>1.0-SNAPSHOT</version> - <packaging>pom</packaging> - - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-common-lib/pom.xml b/openecomp-be/lib/openecomp-common-lib/pom.xml index 0ebbf0632d..747ba4a28d 100644 --- a/openecomp-be/lib/openecomp-common-lib/pom.xml +++ b/openecomp-be/lib/openecomp-common-lib/pom.xml @@ -35,16 +35,6 @@ <version>${logback.version}</version> </dependency> <dependency> - <groupId>org.openecomp.sdc.core</groupId> - <artifactId>openecomp-utilities-lib</artifactId> - <version>1.1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <version>2.5</version> - </dependency> - <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>2.5</version> diff --git a/openecomp-be/lib/openecomp-common-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-common-lib/pom.xml.versionsBackup deleted file mode 100644 index e2333b5ae3..0000000000 --- a/openecomp-be/lib/openecomp-common-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,44 +0,0 @@ -<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> - - <groupId>org.openecomp.core</groupId> - <name>openecomp-common-lib</name> - <dependencies> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-utilities-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-datatypes-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>javax.ws.rs</groupId> - <artifactId>javax.ws.rs-api</artifactId> - <version>2.0-m10</version> - </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <version>${logback.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-utilities-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - </dependencies> - - <artifactId>openecomp-common-lib</artifactId> - - <parent> - <artifactId>openecomp-sdc-lib</artifactId> - <groupId>org.openecomp.sdc</groupId> - <version>1.0-SNAPSHOT</version> - </parent> - - -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/pom.xml.versionsBackup deleted file mode 100644 index 7d6cd8f980..0000000000 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,36 +0,0 @@ -<?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> - <dependencies> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-nosqldb-core</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <version>6.9.10</version> - <scope>test</scope> - </dependency> - <!--dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-vendor-software-product-api</artifactId> - <version>1.0-SNAPSHOT</version> - <scope>test</scope> - </dependency--> - </dependencies> - - <parent> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-core-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - - <artifactId>openecomp-config-lib</artifactId> - <version>1.0-SNAPSHOT</version> - - -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-api/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-api/pom.xml.versionsBackup deleted file mode 100644 index be88b2799a..0000000000 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-api/pom.xml.versionsBackup +++ /dev/null @@ -1,35 +0,0 @@ -<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> - - <name>openecomp-facade-api</name> - <artifactId>openecomp-facade-api</artifactId> - <groupId>org.openecomp.core</groupId> - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-lib</artifactId> - <version>1.0-SNAPSHOT</version> - <relativePath>../../..</relativePath> - </parent> - - <dependencies> - - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-utilities-lib</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-common-lib</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-utilities-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - </dependencies> - -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/pom.xml.versionsBackup deleted file mode 100644 index 72ce7fab94..0000000000 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/pom.xml.versionsBackup +++ /dev/null @@ -1,41 +0,0 @@ -<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>openecomp-facade-core</artifactId> - <name>openecomp-facade-core</name> - <groupId>org.openecomp.core</groupId> - <parent> - <artifactId>openecomp-sdc-lib</artifactId> - <groupId>org.openecomp.sdc</groupId> - <version>1.0-SNAPSHOT</version> - <relativePath>../../..</relativePath> - </parent> - - - <dependencies> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-utilities-lib</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-common-lib</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-facade-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-facade-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - </dependencies> - - - -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/pom.xml.versionsBackup deleted file mode 100644 index c4d0d1faf0..0000000000 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,34 +0,0 @@ -<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> - - <name>openecomp-facade-lib</name> - <artifactId>openecomp-facade-lib</artifactId> - - <packaging>pom</packaging> - <parent> - <artifactId>openecomp-core-lib</artifactId> - <groupId>org.openecomp.core</groupId> - <version>1.0-SNAPSHOT</version> - </parent> - - <modules> - <module>openecomp-facade-api</module> - <module>openecomp-facade-core</module> - </modules> - - <dependencies> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-facade-api</artifactId> - <version>${project.version}</version> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-facade-core</artifactId> - <version>${project.version}</version> - <scope>runtime</scope> - </dependency> - </dependencies> -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/pom.xml.versionsBackup deleted file mode 100644 index 288274d728..0000000000 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/pom.xml.versionsBackup +++ /dev/null @@ -1,45 +0,0 @@ -<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> - - <name>openecomp-nosqldb-api</name> - <artifactId>openecomp-nosqldb-api</artifactId> - <groupId>org.openecomp.core</groupId> - - <parent> - <artifactId>openecomp-sdc-lib</artifactId> - <groupId>org.openecomp.sdc</groupId> - <version>1.0-SNAPSHOT</version> - <relativePath>../../..</relativePath> - </parent> - - <dependencies> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-facade-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>com.datastax.cassandra</groupId> - <artifactId>cassandra-driver-core</artifactId> - <version>${datasatx.version}</version> - </dependency> - <dependency> - <groupId>com.datastax.cassandra</groupId> - <artifactId>cassandra-driver-mapping</artifactId> - <version>${datasatx.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-facade-core</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-logging-core</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - </dependencies> - - -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/pom.xml.versionsBackup deleted file mode 100644 index fa859a0db8..0000000000 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/pom.xml.versionsBackup +++ /dev/null @@ -1,46 +0,0 @@ -<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> - - <name>openecomp-nosqldb-core</name> - <artifactId>openecomp-nosqldb-core</artifactId> - <groupId>org.openecomp.core</groupId> - <parent> - <artifactId>openecomp-sdc-lib</artifactId> - <groupId>org.openecomp.sdc</groupId> - <version>1.0-SNAPSHOT</version> - <relativePath>../../..</relativePath> - </parent> - - <dependencies> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-nosqldb-api</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <scope>test</scope> - <version>1.10.19</version> - </dependency> - <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <scope>test</scope> - <version>6.8.5</version> - <exclusions> - <exclusion> - <artifactId>snakeyaml</artifactId> - <groupId>org.yaml</groupId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - <version>4.11</version> - </dependency> - </dependencies> -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/pom.xml.versionsBackup deleted file mode 100644 index 3a4bfd4ba0..0000000000 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,35 +0,0 @@ -<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> - - <name>openecomp-nosqldb-lib</name> - <artifactId>openecomp-nosqldb-lib</artifactId> - <groupId>org.openecomp.core</groupId> - <packaging>pom</packaging> - <parent> - <artifactId>openecomp-sdc-lib</artifactId> - <groupId>org.openecomp.sdc</groupId> - <version>1.0-SNAPSHOT</version> - <relativePath>../..</relativePath> - </parent> - - <modules> - <module>openecomp-nosqldb-api</module> - <module>openecomp-nosqldb-core</module> - </modules> - - <dependencies> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-nosqldb-api</artifactId> - <version>${project.version}</version> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-nosqldb-core</artifactId> - <version>${project.version}</version> - <scope>runtime</scope> - </dependency> - </dependencies> -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/pom.xml.versionsBackup deleted file mode 100644 index 1e448f5a61..0000000000 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,83 +0,0 @@ -<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> - - <name>openecomp-utilities-lib</name> - <artifactId>openecomp-utilities-lib</artifactId> - - - <parent> - <artifactId>openecomp-core-lib</artifactId> - <groupId>org.openecomp.core</groupId> - <version>1.0-SNAPSHOT</version> - </parent> - - - - <dependencies> - <dependency> - <groupId>org.yaml</groupId> - <artifactId>snakeyaml</artifactId> - <version>1.17</version> - </dependency> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-lang3</artifactId> - <version>3.4</version> - </dependency> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-collections4</artifactId> - <version>4.1</version> - </dependency> - <dependency> - <groupId>com.google.code.gson</groupId> - <artifactId>gson</artifactId> - <version>2.3.1</version> - </dependency> - <dependency> - <groupId>commons-codec</groupId> - <artifactId>commons-codec</artifactId> - <version>${commons.codec.version}</version> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - <version>4.11</version> - </dependency> - <dependency> - <groupId>org.codehaus.jackson</groupId> - <artifactId>jackson-mapper-asl</artifactId> - <version>1.9.13</version> - </dependency> - <dependency> - <groupId>org.everit.json</groupId> - <artifactId>org.everit.json.schema</artifactId> - <version>1.3.0</version> - </dependency> - <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <scope>test</scope> - <version>6.8.5</version> - <exclusions> - <exclusion> - <artifactId>snakeyaml</artifactId> - <groupId>org.yaml</groupId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-logging-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>com.google.code.gson</groupId> - <artifactId>gson</artifactId> - <version>2.3.1</version> - </dependency> - </dependencies> - -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-core-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-core-lib/pom.xml.versionsBackup deleted file mode 100644 index d02ce28af6..0000000000 --- a/openecomp-be/lib/openecomp-core-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,22 +0,0 @@ -<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> - - <groupId>org.openecomp.core</groupId> - <name>openecomp-core-lib</name> - <artifactId>openecomp-core-lib</artifactId> - - <packaging>pom</packaging> - <parent> - <artifactId>openecomp-sdc-lib</artifactId> - <groupId>org.openecomp.sdc</groupId> - <version>1.0-SNAPSHOT</version> - </parent> - - <modules> - <module>/openecomp-facade-lib</module> - <module>/openecomp-nosqldb-lib</module> - <module>/openecomp-utilities-lib</module> - <module>/openecomp-config-lib</module> - </modules> -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-api/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-api/pom.xml.versionsBackup deleted file mode 100644 index c9d100dd50..0000000000 --- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-api/pom.xml.versionsBackup +++ /dev/null @@ -1,35 +0,0 @@ -<?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> - <dependencies> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-facade-core</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-facade-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-validation-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - </dependencies> - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-healing-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-healing-api</artifactId> - <version>1.0-SNAPSHOT</version> - - -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/pom.xml.versionsBackup deleted file mode 100644 index c48c3259e1..0000000000 --- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/pom.xml.versionsBackup +++ /dev/null @@ -1,35 +0,0 @@ -<?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> - <dependencies> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-healing-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-validation-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-vendor-software-product-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - </dependencies> - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-healing-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-healing-core</artifactId> - <version>1.0-SNAPSHOT</version> - - -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/pom.xml.versionsBackup deleted file mode 100644 index c5f936366b..0000000000 --- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/pom.xml.versionsBackup +++ /dev/null @@ -1,36 +0,0 @@ -<?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> - <dependencies> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-healing-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-vendor-software-product-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-vendor-software-product-core</artifactId> - <version>1.0-SNAPSHOT</version> - <scope>runtime</scope> - </dependency> - </dependencies> - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-healing-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-healing-impl</artifactId> - <version>1.0-SNAPSHOT</version> - - -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ComponentQuestionnaireHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ComponentQuestionnaireHealer.java index c759d21f01..2e63a8d50a 100644 --- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ComponentQuestionnaireHealer.java +++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ComponentQuestionnaireHealer.java @@ -1,5 +1,6 @@ package org.openecomp.sdc.healing.healers; +import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import org.openecomp.sdc.common.utils.SdcCommon; @@ -7,9 +8,15 @@ import org.openecomp.sdc.healing.interfaces.Healer; import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDaoFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComputeEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ImageEntity; import org.openecomp.sdc.versioning.dao.types.Version; import java.util.Collection; @@ -17,13 +24,31 @@ import java.util.Map; public class ComponentQuestionnaireHealer implements Healer { - /*private static final VendorSoftwareProductDao vendorSoftwareProductDao = - VendorSoftwareProductDaoFactory.getInstance().createInterface();*/ private static final ComponentDao componentDao = ComponentDaoFactory.getInstance().createInterface(); + private static final ComputeDao computeDao = + ComputeDaoFactory.getInstance().createInterface(); + private static final ImageDao imageDao = + ImageDaoFactory.getInstance().createInterface(); + private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); + public static final String GENERAL = "general"; + public static final String IMAGE = "image"; + public static final String FORMAT = "format"; + public static final String CPU_OVER_SUBSCRIPTION_RATIO = "CpuOverSubscriptionRatio"; + public static final String MEMORY_RAM = "MemoryRAM"; + public static final String VM_SIZING = "vmSizing"; + public static final String COMPUTE = "compute"; + public static final String NUM_OF_VMS = "numOfVMs"; + public static final String DISK = "disk"; + public static final String IO_OP_PER_SEC = "IOOperationsPerSec"; + + public static final String COMPUTE_CPU_OVER_SUBSCRIPTION_RATIO = "cpuOverSubscriptionRatio"; + public static final String COMPUTE_MEMORY_RAM = "memoryRAM"; + public static final String COMPUTE_IO_OP_PER_SEC = "ioOperationsPerSec"; + public ComponentQuestionnaireHealer(){ } @@ -36,43 +61,133 @@ public class ComponentQuestionnaireHealer implements Healer { Collection<ComponentEntity> componentEntities = componentDao.list(new ComponentEntity(vspId, version, null)); componentEntities.forEach(componentEntity -> { - /*String questionnaire=vendorSoftwareProductDao.getComponent(vspId, version, componentEntity - .getId()).getQuestionnaireData();*/ String questionnaire = componentDao.getQuestionnaireData(vspId, version, componentEntity .getId()).getQuestionnaireData(); + if (questionnaire != null) { - JsonParser jsonParser = new JsonParser(); - JsonObject json = (JsonObject) jsonParser.parse(questionnaire); - if (json.getAsJsonObject("compute") != null && json.getAsJsonObject("compute") - .getAsJsonObject("vmSizing") != null) { - json.getAsJsonObject("compute").remove("vmSizing"); - } + JsonParser jsonParser = new JsonParser(); + JsonObject json = (JsonObject) jsonParser.parse(questionnaire); - if (json.getAsJsonObject("compute") != null && json.getAsJsonObject("compute") - .getAsJsonObject("numOfVMs") != null ) { - if (json.getAsJsonObject("compute").getAsJsonObject("numOfVMs"). - get("CpuOverSubscriptionRatio") != null ) { - json.getAsJsonObject("compute").getAsJsonObject("numOfVMs").remove - ("CpuOverSubscriptionRatio"); - } - if (json.getAsJsonObject("compute").getAsJsonObject("numOfVMs"). - get("MemoryRAM") != null ) { - json.getAsJsonObject("compute").getAsJsonObject("numOfVMs").remove("MemoryRAM"); - } - } + Collection<ComputeEntity> computeEntities = computeDao.list(new ComputeEntity(vspId, + version, componentEntity.getId(), null)); + computeEntities.stream().forEach( + computeEntity -> { + populateComputeQuestionnaire(json, computeEntity); + } + ); - if (json.getAsJsonObject("general") != null && json.getAsJsonObject("general") - .getAsJsonObject("image") != null && json.getAsJsonObject("general").getAsJsonObject - ("image").get("format") != null) { - json.getAsJsonObject("general").getAsJsonObject("image").remove("format"); - } - String questionnaireData = json.toString(); - /*vendorSoftwareProductDao.updateComponentQuestionnaire(vspId, version, componentEntity - .getId(),questionnaireData);*/ + Collection<ImageEntity> imageEntities = imageDao.list(new ImageEntity(vspId, + version, componentEntity.getId(), null)); + imageEntities.stream().forEach( + imageEntity -> { + populateImageQuestionnaire(json, imageEntity); + } + ); + + processDiskAttribute(json, "bootDiskSizePerVM"); + processDiskAttribute(json, "ephemeralDiskSizePerVM"); + + String questionnaireData = json.toString(); componentDao.updateQuestionnaireData(vspId, version, componentEntity.getId(), questionnaireData); } }); return componentEntities; } + + /** + * Move Disk Atributes from genral/image/ to genral/disk in component questionnaire itself + * @param json + * @param diskAttrName + * @param diskJsonObject + * @return + */ + private void processDiskAttribute(JsonObject json, String diskAttrName) { + boolean isBootDisksizePerVM = isDiskAttributePresent(json, diskAttrName); + if (isBootDisksizePerVM) { + JsonObject diskJsonObject = json.getAsJsonObject(GENERAL).getAsJsonObject(DISK); + if (diskJsonObject == null) { + diskJsonObject = new JsonObject(); + } + + diskJsonObject.addProperty(diskAttrName, json.getAsJsonObject(GENERAL).getAsJsonObject(IMAGE) + .get(diskAttrName).getAsNumber()); + + json.getAsJsonObject(GENERAL).add(DISK, diskJsonObject); + json.getAsJsonObject(GENERAL).getAsJsonObject(IMAGE).remove(diskAttrName); + } + } + + private boolean isDiskAttributePresent(JsonObject json, String diskAttrName) { + return json.getAsJsonObject(GENERAL) != null && + json.getAsJsonObject(GENERAL).getAsJsonObject(IMAGE) != null && + json.getAsJsonObject(GENERAL).getAsJsonObject (IMAGE).get(diskAttrName) + != null; + } + + /** + * Move the required attributes from component to Image Questionnaire + * @param json + * @param imageEntity + */ + private void populateImageQuestionnaire(JsonObject json, ImageEntity imageEntity) { + JsonObject general = getJsonObject(json, GENERAL); + boolean isImageFormat = general != null && json + .getAsJsonObject(GENERAL) + .getAsJsonObject(IMAGE) != null && json.getAsJsonObject(GENERAL).getAsJsonObject + (IMAGE).get(FORMAT) != null; + if (isImageFormat) { + JsonObject image = getJsonObject(general, IMAGE); + JsonElement jsonElement = image.get(FORMAT); + JsonObject jsonObject = new JsonObject(); + jsonObject.add(FORMAT, jsonElement); + imageDao.updateQuestionnaireData(imageEntity.getVspId(), imageEntity.getVersion(), imageEntity + .getComponentId(),imageEntity.getId(), jsonObject.toString()); + image.remove(FORMAT); + } + } + + /** + * Move the required attributes from component to Compute Questionnaire + * @param json + * @param computeEntity + */ + private void populateComputeQuestionnaire(JsonObject json, ComputeEntity computeEntity) { + JsonObject compute = getJsonObject(json, COMPUTE); + JsonObject vmSizing = getJsonObject(compute, VM_SIZING); + if (compute != null && vmSizing != null) { + JsonElement ioOperationsPerSec = vmSizing.get(IO_OP_PER_SEC); + if (ioOperationsPerSec != null) { + vmSizing.addProperty(COMPUTE_IO_OP_PER_SEC, ioOperationsPerSec.getAsNumber()); + vmSizing.remove(IO_OP_PER_SEC); + } + + JsonObject numberOfVms = getJsonObject(compute, NUM_OF_VMS); + if (numberOfVms != null ) { + JsonElement cpuRatio = numberOfVms.get(CPU_OVER_SUBSCRIPTION_RATIO); + if (cpuRatio != null ) { + vmSizing.addProperty(COMPUTE_CPU_OVER_SUBSCRIPTION_RATIO, cpuRatio.getAsString()); + numberOfVms.remove(CPU_OVER_SUBSCRIPTION_RATIO); + } + JsonElement memoryRam = numberOfVms.get(MEMORY_RAM); + if (memoryRam != null ) { + vmSizing.addProperty(COMPUTE_MEMORY_RAM, memoryRam.getAsString()); + numberOfVms.remove(MEMORY_RAM); + } + } + + JsonObject computeQuestionnaireJsonObject = new JsonObject(); + computeQuestionnaireJsonObject.add(VM_SIZING, vmSizing); + String computeQuestionnaire = computeQuestionnaireJsonObject != null ? + computeQuestionnaireJsonObject.toString() : null; + computeDao.updateQuestionnaireData(computeEntity.getVspId(), computeEntity.getVersion(), + computeEntity.getComponentId(), computeEntity.getId(), computeQuestionnaire); + compute.remove(VM_SIZING); + + } + } + + private JsonObject getJsonObject(JsonObject json, String name) { + return json.getAsJsonObject(name); + } } diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/CompositionDataHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/CompositionDataHealer.java index 6fdf14451f..bdb7bc3a93 100644 --- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/CompositionDataHealer.java +++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/CompositionDataHealer.java @@ -174,8 +174,8 @@ public class CompositionDataHealer implements Healer { Collection<ComputeEntity> computeEntities = computeDao.listByVsp(vspId, version); Collection<ImageEntity> imageEntities = imageDao.listByVsp(vspId, version); - Collection<DeploymentFlavorEntity> deploymentFlavorEntities = deloymentFlavorDao.list(new - DeploymentFlavorEntity(vspId, version, null)); + //Collection<DeploymentFlavorEntity> deploymentFlavorEntities = deloymentFlavorDao.list(new + //DeploymentFlavorEntity(vspId, version, null)); if (CollectionUtils.isEmpty(computeEntities) && CollectionUtils.isEmpty(imageEntities)) { for (Component component : compositionData.getComponents()) { @@ -195,9 +195,9 @@ public class CompositionDataHealer implements Healer { } - if (CollectionUtils.isEmpty(deploymentFlavorEntities)) { + /*if (CollectionUtils.isEmpty(deploymentFlavorEntities)) { compositionEntityDataManager.saveDeploymentFlavors(vspId,version,compositionData); - } + }*/ } private CompositionData healCompositionData(String vspId, Version version, diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VlmVersionHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VlmVersionHealer.java index 5eb15bf9ba..6a82d8fa49 100644 --- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VlmVersionHealer.java +++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VlmVersionHealer.java @@ -21,6 +21,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Optional; /** @@ -44,6 +45,11 @@ public class VlmVersionHealer implements Healer { VspDetails vspDetails = vspInfoDao.get(new VspDetails(vspId, version)); VersionedVendorLicenseModel vendorLicenseModel; + + if(!Objects.isNull(vspDetails.getVlmVersion())) { + return Optional.empty(); + } + try{ vendorLicenseModel = @@ -61,6 +67,7 @@ public class VlmVersionHealer implements Healer { new ArrayList<>( licenseAgreementDao.list(new LicenseAgreementEntity(vlmId, vlmVersion, null))); + vspDetails.setVlmVersion(vlmVersion); vspDetails.setLicenseAgreement(laList.get(0).getId()); vspDetails.setFeatureGroups(new ArrayList<>(laList.get(0).getFeatureGroupIds())); diff --git a/openecomp-be/lib/openecomp-healing-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-healing-lib/pom.xml.versionsBackup deleted file mode 100644 index 02ba7f140b..0000000000 --- a/openecomp-be/lib/openecomp-healing-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,23 +0,0 @@ -<?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> - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-healing-lib</artifactId> - <version>1.0-SNAPSHOT</version> - <packaging>pom</packaging> - - <modules> - <module>openecomp-sdc-healing-api</module> - <module>openecomp-sdc-healing-core</module> - <module>openecomp-sdc-healing-impl</module> - </modules> -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-heat-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-heat-lib/pom.xml.versionsBackup deleted file mode 100644 index f434a8e24c..0000000000 --- a/openecomp-be/lib/openecomp-heat-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,50 +0,0 @@ -<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> - - <groupId>org.openecomp.core</groupId> - <name>openecomp-heat-lib</name> - <dependencies> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-utilities-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-datatypes-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-common-lib</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <version>${logback.version}</version> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>RELEASE</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-validation-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - </dependencies> - - <artifactId>openecomp-heat-lib</artifactId> - - <parent> - <artifactId>openecomp-sdc-lib</artifactId> - <groupId>org.openecomp.sdc</groupId> - <version>1.0-SNAPSHOT</version> - </parent> - - -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/pom.xml.versionsBackup deleted file mode 100644 index a2786b2401..0000000000 --- a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/pom.xml.versionsBackup +++ /dev/null @@ -1,57 +0,0 @@ -<?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> - <dependencies> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>aspectjrt</artifactId> - <version>1.8.9</version> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - </dependency> - </dependencies> - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-logging-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - - - <artifactId>openecomp-sdc-logging-api</artifactId> - <name>openecomp-sdc-logging-api</name> - <version>1.0-SNAPSHOT</version> - - <!--dependencies> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-core</artifactId> - <version>4.1.3.RELEASE</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-context</artifactId> - <version>4.1.3.RELEASE</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-beans</artifactId> - <version>4.1.3.RELEASE</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-beans</artifactId> - <version>4.1.3.RELEASE</version> - </dependency> - </dependencies--> - - -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/messages/AuditMessages.java b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/messages/AuditMessages.java index f23a2c5352..de39cff30f 100644 --- a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/messages/AuditMessages.java +++ b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/messages/AuditMessages.java @@ -16,14 +16,24 @@ public class AuditMessages { public static final String CHECK_IN_VSP = "Check in VSP. VSP Id: "; public static final String CHECK_OUT_VSP = "Check out VSP. VSP Id: "; public static final String SUBMIT_VSP = "Submit VSP. VSP Id: "; + public static final String SUBMIT_VSP_FAIL = "Submit VSP failed!. VSP Id: "; + public static final String SUBMIT_VSP_ERROR = "Submit VSP error: %s. VSP Id: %s"; public static final String UPLOAD_HEAT = "Upload HEAT. VSP Id: "; public static final String UPLOAD_PROCESS_ARTIFACT = "Upload Process Artifact. VSP Id: "; - public static final String UPLOAD_MONITORING_FILE = "Upload Monitoring File of type %s " + - "" + ". VSP Id: %s, component id: %s"; -// public static final String UPLOAD_ARTIFACT_MIB_TRAP = "Upload Artifact SNMP TRAP. VSP Id: "; + public static final String UPLOAD_MONITORING_FILE = "Upload Monitoring File of type %s " + + ". VSP Id: %s, component id: %s"; public static final String IMPORT_SUCCESS = "VSP import to VF success. VSP Id: "; public static final String IMPORT_FAIL = "VSP import to VF fail. VSP Id: "; + public static final String HEAT_VALIDATION_STARTED = "HEAT validation started. VSP Id: "; + public static final String HEAT_VALIDATION_COMPLETED = "HEAT validation completed. VSP Id: "; + public static final String HEAT_VALIDATION_ERROR = "HEAT validation error: %s. VSP Id: %s"; + public static final String HEAT_TRANSLATION_STARTED = "HEAT translation started. VSP Id: "; + public static final String HEAT_TRANSLATION_COMPLETED = "HEAT translation completed. VSP Id: "; + public static final String ENRICHMENT_ERROR = "Enrichment error: %s. VSP Id: %s"; + public static final String ENRICHMENT_COMPLETED = "Enrichment completed. VSP Id: "; + public static final String CREATE_PACKAGE = "Created package. VSP Id: "; + } diff --git a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-core/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-core/pom.xml.versionsBackup deleted file mode 100644 index 374de71273..0000000000 --- a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-core/pom.xml.versionsBackup +++ /dev/null @@ -1,58 +0,0 @@ -<?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> - <dependencies> - <!--dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-common-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency--> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-logging-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-context</artifactId> - <version>4.1.3.RELEASE</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-webmvc</artifactId> - <version>4.1.3.RELEASE</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <version>${logback.version}</version> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> - <version>2.5</version> - </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <version>1.1.7</version> - </dependency> - - </dependencies> - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-logging-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-logging-core</artifactId> - <name>openecomp-sdc-logging-core</name> - <version>1.0-SNAPSHOT</version> - - -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-logging-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-logging-lib/pom.xml.versionsBackup deleted file mode 100644 index 77657139f0..0000000000 --- a/openecomp-be/lib/openecomp-logging-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,24 +0,0 @@ -<?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> - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - - <groupId>org.openecomp.sdc</groupId> - <name>openecomp-logging-lib</name> - <artifactId>openecomp-logging-lib</artifactId> - <packaging>pom</packaging> - - <modules> - <module>/openecomp-sdc-logging-api</module> - <module>/openecomp-sdc-logging-core</module> - </modules> - - -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-migration-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-migration-lib/pom.xml.versionsBackup deleted file mode 100644 index bca0cd32a3..0000000000 --- a/openecomp-be/lib/openecomp-migration-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,151 +0,0 @@ -<?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> - - <properties> - - <groovy.version>2.4.7</groovy.version> - <janino.version>2.7.7</janino.version> - - </properties> - - <dependencies> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-vendor-software-product-manager</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.codehaus.groovy</groupId> - <artifactId>groovy</artifactId> - <version>${groovy.version}</version> - </dependency> - - <dependency> - <groupId>org.openecomp.sdc.common</groupId> - <artifactId>openecomp-configuration-management-core</artifactId> - <version>1707.0.0-SNAPSHOT</version> - <scope>runtime</scope> - <exclusions> - <exclusion> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - </exclusion> - </exclusions> - </dependency> - - <dependency> - <groupId>org.codehaus.janino</groupId> - <artifactId>janino</artifactId> - <version>${janino.version}</version> - </dependency> - - <dependency> - <groupId>org.codehaus.janino</groupId> - <artifactId>commons-compiler</artifactId> - <version>3.0.6</version> - </dependency> - - </dependencies> - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - - - <artifactId>openecomp-migration-lib</artifactId> - <name>openecomp-migration-lib</name> - <version>1.0-SNAPSHOT</version> - - <build> - <plugins> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-dependency-plugin</artifactId> - <executions> - <execution> - <id>copy-dependencies</id> - <phase>install</phase> - <goals> - <goal>copy-dependencies</goal> - </goals> - <configuration> - <outputDirectory>${project.build.directory}/lib</outputDirectory> - <overWriteReleases>false</overWriteReleases> - <overWriteSnapshots>false</overWriteSnapshots> - <overWriteIfNewer>true</overWriteIfNewer> - <!--includeScope>runtime</includeScope--> - </configuration> - </execution> - </executions> - </plugin> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-jar-plugin</artifactId> - <executions> - <execution> - <phase>package</phase> - </execution> - </executions> - <configuration> - <archive> - <manifest> - <addClasspath>true</addClasspath> - <classpathPrefix>lib/</classpathPrefix> - <mainClass>org.openecomp.sdc.migration.ToscaNamespaceMigration</mainClass> - </manifest> - <manifestEntries> - <Class-Path>lib/</Class-Path> - </manifestEntries> - </archive> - </configuration> - </plugin> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-antrun-plugin</artifactId> - <executions> - <execution> - <id>ant-test</id> - <phase>package</phase> - <configuration> - <tasks> - <fixcrlf srcdir="../../tools/migration/" eol="unix" - includes="1702_to_1707.sh"/> - </tasks> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <artifactId>maven-assembly-plugin</artifactId> - <executions> - <execution> - <id>Generate assembly</id> - <phase>install</phase> - <goals> - <goal>single</goal> - </goals> - </execution> - </executions> - <configuration> - <descriptors> - <descriptor>${basedir}/src/main/assembly/migration-lib-assembly.xml</descriptor> - </descriptors> - <finalName>openecomp-migration-lib</finalName> - </configuration> - </plugin> - - </plugins> - </build> -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/pom.xml.versionsBackup deleted file mode 100644 index 5da20949fe..0000000000 --- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/pom.xml.versionsBackup +++ /dev/null @@ -1,47 +0,0 @@ -<?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> - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-action-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-action-api</artifactId> - <version>1.0-SNAPSHOT</version> - - - <dependencies> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-core-lib</artifactId> - <type>pom</type> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-facade-core</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-nosqldb-core</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-versioning-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-annotations</artifactId> - <version>2.7.4</version> - </dependency> - </dependencies> - -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/healthcheck/dao/ActionDao.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/healthcheck/dao/ActionDao.java index ee5e8830d4..86ae7510a6 100644 --- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/healthcheck/dao/ActionDao.java +++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/healthcheck/dao/ActionDao.java @@ -41,7 +41,7 @@ public interface ActionDao extends VersionableDao, BaseDao<ActionEntity> { public Action getActionsByActionUuId(String uniqueId) throws ActionException; - public List<OpenEcompComponent> getOpenEcompComponents() throws ActionException; + public List<OpenEcompComponent> getEcompComponents() throws ActionException; public List<Action> getActionsByActionInvariantUuId(String actionInvariantUuId) throws ActionException; diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/pom.xml.versionsBackup deleted file mode 100644 index 274bdb04c7..0000000000 --- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/pom.xml.versionsBackup +++ /dev/null @@ -1,30 +0,0 @@ -<?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> - - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-action-core</artifactId> - <version>1.0-SNAPSHOT</version> - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-action-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - - <dependencies> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-action-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-versioning-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - </dependencies> - -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-action-lib/pom.xml.versionsBackup deleted file mode 100644 index 447437fe33..0000000000 --- a/openecomp-be/lib/openecomp-sdc-action-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,23 +0,0 @@ -<?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> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-action-lib</artifactId> - <packaging>pom</packaging> - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - - - <modules> - <module>openecomp-sdc-action-api</module> - <module>openecomp-sdc-action-core</module> - </modules> - - -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-datatypes-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-datatypes-lib/pom.xml.versionsBackup deleted file mode 100644 index 9e29da0ee6..0000000000 --- a/openecomp-be/lib/openecomp-sdc-datatypes-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,39 +0,0 @@ -<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> - - <name>openecomp-sdc-datatypes-lib</name> - <dependencies> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-collections4</artifactId> - <version>4.1</version> - </dependency> - <dependency> - <groupId>org.codehaus.jackson</groupId> - <artifactId>jackson-mapper-asl</artifactId> - <version>1.9.13</version> - </dependency> - <dependency> - <groupId>io.swagger</groupId> - <artifactId>swagger-annotations</artifactId> - <version>1.5.3</version> - </dependency> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.5</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc.common</groupId> - <artifactId>openecomp-configuration-management-api</artifactId> - <version>1707.0.0-SNAPSHOT</version> - </dependency> - </dependencies> - <artifactId>openecomp-sdc-datatypes-lib</artifactId> - <parent> - <artifactId>openecomp-sdc-lib</artifactId> - <groupId>org.openecomp.sdc</groupId> - <version>1.0-SNAPSHOT</version> - </parent> -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/pom.xml.versionsBackup deleted file mode 100644 index 493e4256a3..0000000000 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/pom.xml.versionsBackup +++ /dev/null @@ -1,45 +0,0 @@ -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - 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> - - <name>openecomp-sdc-enrichment-api</name> - <artifactId>openecomp-sdc-enrichment-api</artifactId> - - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-lib</artifactId> - <version>1.0-SNAPSHOT</version> - <relativePath>../..</relativePath> - </parent> - - <dependencies> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-facade-core</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>io.swagger</groupId> - <artifactId>swagger-annotations</artifactId> - <version>1.5.3</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-datatypes-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <version>${logback.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-versioning-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - </dependencies> - -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/pom.xml.versionsBackup deleted file mode 100644 index d8f63f10e9..0000000000 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/pom.xml.versionsBackup +++ /dev/null @@ -1,94 +0,0 @@ -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - 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> - - <name>openecomp-sdc-enrichment-core</name> - <artifactId>openecomp-sdc-enrichment-core</artifactId> - - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-lib</artifactId> - <version>1.0-SNAPSHOT</version> - <relativePath>../..</relativePath> - </parent> - - <dependencies> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <version>${logback.version}</version> - - </dependency> - <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <scope>test</scope> - <version>6.8.5</version> - <exclusions> - <exclusion> - <artifactId>snakeyaml</artifactId> - <groupId>org.yaml</groupId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>RELEASE</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-utilities-lib</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-enrichment-api</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-enrichment-impl</artifactId> - <version>${project.version}</version> - <!--scope>runtime</scope--> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-datatypes-lib</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <scope>test</scope> - <version>1.10.19</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-model-impl</artifactId> - <version>1.0-SNAPSHOT</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-tosca-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>2.19.1</version> - <configuration> - <useSystemClassLoader>false</useSystemClassLoader> - <redirectTestOutputToFile>true</redirectTestOutputToFile> - </configuration> - </plugin> - </plugins> - </build> -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/pom.xml.versionsBackup deleted file mode 100644 index 65e84d88dc..0000000000 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/pom.xml.versionsBackup +++ /dev/null @@ -1,127 +0,0 @@ -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - 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> - - <name>openecomp-sdc-enrichment-impl</name> - <artifactId>openecomp-sdc-enrichment-impl</artifactId> - - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-lib</artifactId> - <version>1.0-SNAPSHOT</version> - <relativePath>../..</relativePath> - </parent> - - <dependencies> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <version>${logback.version}</version> - - </dependency> - - <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <scope>test</scope> - <version>6.8.5</version> - <exclusions> - <exclusion> - <artifactId>snakeyaml</artifactId> - <groupId>org.yaml</groupId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>RELEASE</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-utilities-lib</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-enrichment-api</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-model-core</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-common-lib</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-vendor-software-product-core</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <scope>test</scope> - <version>1.10.19</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-heat-lib</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-tosca-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-translator-core</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-config-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-vendor-software-product-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <scope>runtime</scope> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-vendor-software-product-core</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <scope>test</scope> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-model-impl</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - - </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>2.19.1</version> - <configuration> - <useSystemClassLoader>false</useSystemClassLoader> - <redirectTestOutputToFile>true</redirectTestOutputToFile> - </configuration> - </plugin> - </plugins> - </build> - -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-enrichment-lib/pom.xml.versionsBackup deleted file mode 100644 index b6e0173b77..0000000000 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,44 +0,0 @@ -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - 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> - - <name>openecomp-sdc-enrichment-lib</name> - <artifactId>openecomp-sdc-enrichment-lib</artifactId> - - <packaging>pom</packaging> - <parent> - <artifactId>openecomp-sdc-lib</artifactId> - <groupId>org.openecomp.sdc</groupId> - <version>1.0-SNAPSHOT</version> - </parent> - - <modules> - <module>openecomp-sdc-enrichment-api</module> - <module>openecomp-sdc-enrichment-core</module> - <module>openecomp-sdc-enrichment-impl</module> - </modules> - - <dependencies> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-enrichment-api</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-enrichment-core</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-vendor-software-product-core</artifactId> - <version>${project.version}</version> - </dependency> - <!--dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-validation-impl</artifactId> - <version>${project.version}</version> - </dependency--> - </dependencies> -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/pom.xml.versionsBackup deleted file mode 100644 index eba0f207e4..0000000000 --- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/pom.xml.versionsBackup +++ /dev/null @@ -1,51 +0,0 @@ -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - 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> - - <name>openecomp-sdc-model-api</name> - <artifactId>openecomp-sdc-model-api</artifactId> - - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-lib</artifactId> - <version>1.0-SNAPSHOT</version> - <relativePath>../..</relativePath> - </parent> - - <dependencies> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-facade-core</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-validation-api</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-versioning-core</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>io.swagger</groupId> - <artifactId>swagger-annotations</artifactId> - <version>1.5.3</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-heat-lib</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-tosca-lib</artifactId> - <version>${project.version}</version> - </dependency> - - </dependencies> - -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-core/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-core/pom.xml.versionsBackup deleted file mode 100644 index d62437122a..0000000000 --- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-core/pom.xml.versionsBackup +++ /dev/null @@ -1,56 +0,0 @@ -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - 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> - - <name>openecomp-sdc-model-core</name> - <artifactId>openecomp-sdc-model-core</artifactId> - - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-lib</artifactId> - <version>1.0-SNAPSHOT</version> - <relativePath>../..</relativePath> - </parent> - - <dependencies> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <version>${logback.version}</version> - - </dependency> - - - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-utilities-lib</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-model-api</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-versioning-core</artifactId> - <version>${project.version}</version> - </dependency> - - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-datatypes-lib</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <scope>test</scope> - <version>1.10.19</version> - </dependency> - - - </dependencies> -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/pom.xml.versionsBackup deleted file mode 100644 index b8db689bd5..0000000000 --- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/pom.xml.versionsBackup +++ /dev/null @@ -1,49 +0,0 @@ -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - 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> - - <name>openecomp-sdc-model-impl</name> - <artifactId>openecomp-sdc-model-impl</artifactId> - - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-lib</artifactId> - <version>1.0-SNAPSHOT</version> - <relativePath>../..</relativePath> - </parent> - - <dependencies> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <version>${logback.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-utilities-lib</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-model-core</artifactId> - <version>${project.version}</version> - </dependency> - - - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-datatypes-lib</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <scope>test</scope> - <version>1.10.19</version> - </dependency> - - - </dependencies> -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-model-lib/pom.xml.versionsBackup deleted file mode 100644 index d49cbd7069..0000000000 --- a/openecomp-be/lib/openecomp-sdc-model-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,44 +0,0 @@ -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - 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> - - <name>openecomp-sdc-model-lib</name> - <artifactId>openecomp-sdc-model-lib</artifactId> - - <packaging>pom</packaging> - <parent> - <artifactId>openecomp-sdc-lib</artifactId> - <groupId>org.openecomp.sdc</groupId> - <version>1.0-SNAPSHOT</version> - </parent> - - <modules> - <module>openecomp-sdc-model-api</module> - <module>openecomp-sdc-model-core</module> - <module>openecomp-sdc-model-impl</module> - </modules> - - <dependencies> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-model-api</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-model-core</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-model-impl</artifactId> - <version>${project.version}</version> - </dependency> - <!--dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-common-lib</artifactId> - <version>${project.version}</version> - </dependency--> - </dependencies> -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/pom.xml b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/pom.xml index 047fe7f843..51399fbb7d 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/pom.xml @@ -65,4 +65,4 @@ </dependency> </dependencies> -</project> +</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VspModelInfo.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VspModelInfo.java index 1fb1030dd3..025db1cafc 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VspModelInfo.java +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VspModelInfo.java @@ -55,4 +55,79 @@ public class VspModelInfo { public void setNics(Map<String, List<Nic>> nics) { this.nics = nics; } + + @Override + public int hashCode() { + int result = releaseVendor != null ? releaseVendor.hashCode() : 0; + result = 31 * result + (components != null ? components.hashCode() : 0); + result = 31 * result + (allowedFlavors != null ? allowedFlavors.hashCode() : 0); + result = 31 * result + (multiFlavorVfcImages != null ? multiFlavorVfcImages.hashCode() : 0); + result = 31 * result + (nics != null ? nics.hashCode() : 0); + return result; + } + + @Override + public String toString() { + return "VspModelInfo{" + + "releaseVendor='" + releaseVendor + '\'' + + ", components=" + components + + ", allowedFlavors=" + allowedFlavors + + ", multiFlavorVfcImages=" + multiFlavorVfcImages + + ", nics=" + nics + + '}'; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (getClass() != obj.getClass()) { + return false; + } + VspModelInfo other = (VspModelInfo) obj; + if (this.releaseVendor == null) { + if (other.releaseVendor != null) { + return false; + } + } else if (!releaseVendor.equals(other.releaseVendor)) { + return false; + } + if (this.components == null) { + if (other.components != null) { + return false; + } + } else if (!components.equals(other.components)) { + return false; + } + if (this.allowedFlavors == null) { + if (other.allowedFlavors != null) { + return false; + } + } else if (!allowedFlavors.equals(other.allowedFlavors)) { + return false; + } + if (this.multiFlavorVfcImages == null) { + if (other.multiFlavorVfcImages != null) { + return false; + } + } else if (!multiFlavorVfcImages.equals(other.multiFlavorVfcImages)) { + return false; + } + if (this.multiFlavorVfcImages == null) { + if (other.multiFlavorVfcImages != null) { + return false; + } + } else if (!multiFlavorVfcImages.equals(other.multiFlavorVfcImages)) { + return false; + } + if (this.nics == null) { + if (other.nics != null) { + return false; + } + } else if (!nics.equals(other.nics)) { + return false; + } + return true; + } } diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/util/GeneratorConstants.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/util/GeneratorConstants.java index b24a85d61c..5464627927 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/util/GeneratorConstants.java +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/util/GeneratorConstants.java @@ -5,9 +5,10 @@ public class GeneratorConstants { public static final String IMAGES_PROPERTY = "images"; public static final String RELEASE_VENDOR = "releaseVendor"; public static final String VNF_CONFIG_NODE_TEMPLATE_ID_SUFFIX = "_VNF_Configuration"; - public static final String VFC_NODE_TEMPLATE_ID_SUFFIX = "_VFC"; public static final String VNF_NODE_TEMPLATE_ID_SUFFIX = "_VNF"; - public static final String PORT_NODE_TEMPLATE_ID_SUFFIX = "_wan_port"; + public static final String PORT_TYPE_INTERNAL_NODE_TEMPLATE_SUFFIX = "_lan"; + public static final String PORT_TYPE_EXTERNAL_NODE_TEMPLATE_SUFFIX = "_wan"; + public static final String PORT_NODE_TEMPLATE_ID_SUFFIX = "_port"; public static final String TOSCA_SERVICE_TEMPLATE_FILE_NAME_SUFFIX = "ServiceTemplate.yaml"; diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/src/main/java/org/openecomp/sdc/generator/core/services/ManualVspToscaGenerationService.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/src/main/java/org/openecomp/sdc/generator/core/services/ManualVspToscaGenerationService.java index 6d488c0221..6ec7bfca9f 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/src/main/java/org/openecomp/sdc/generator/core/services/ManualVspToscaGenerationService.java +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/src/main/java/org/openecomp/sdc/generator/core/services/ManualVspToscaGenerationService.java @@ -9,9 +9,10 @@ import static org.openecomp.sdc.generator.util.GeneratorConstants.MEM_SIZE_PROP_ import static org.openecomp.sdc.generator.util.GeneratorConstants.NUM_CPUS; import static org.openecomp.sdc.generator.util.GeneratorConstants.NUM_CPUS_PROP_DESC_PREFIX; import static org.openecomp.sdc.generator.util.GeneratorConstants.PORT_NODE_TEMPLATE_ID_SUFFIX; +import static org.openecomp.sdc.generator.util.GeneratorConstants.PORT_TYPE_EXTERNAL_NODE_TEMPLATE_SUFFIX; +import static org.openecomp.sdc.generator.util.GeneratorConstants.PORT_TYPE_INTERNAL_NODE_TEMPLATE_SUFFIX; import static org.openecomp.sdc.generator.util.GeneratorConstants.RELEASE_VENDOR; import static org.openecomp.sdc.generator.util.GeneratorConstants.TOSCA_SERVICE_TEMPLATE_FILE_NAME_SUFFIX; -import static org.openecomp.sdc.generator.util.GeneratorConstants.VFC_NODE_TEMPLATE_ID_SUFFIX; import static org.openecomp.sdc.generator.util.GeneratorConstants.VNF_CONFIG_NODE_TEMPLATE_ID_SUFFIX; import static org.openecomp.sdc.generator.util.GeneratorConstants.VNF_NODE_TEMPLATE_ID_SUFFIX; @@ -36,6 +37,7 @@ import org.openecomp.sdc.tosca.services.ToscaUtil; import org.openecomp.sdc.tosca.services.impl.ToscaAnalyzerServiceImpl; import org.openecomp.sdc.translator.services.heattotosca.Constants; import org.openecomp.sdc.translator.services.heattotosca.globaltypes.GlobalTypesGenerator; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.NetworkType; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic; import java.util.ArrayList; @@ -118,8 +120,7 @@ public class ManualVspToscaGenerationService { // May be need to revisited for supporting multiple components String componentId = components.entrySet().iterator().next().getKey(); createVnfConfigurationNodeTemplate(mainServiceTemplate, vspModelInfo); - createComponentNodeTemplate(mainServiceTemplate, vspModelInfo, componentId); - createVnfNodeTemplate(mainServiceTemplate, vspModelInfo); + createVnfNodeTemplate(mainServiceTemplate, vspModelInfo, componentId); } return mainServiceTemplate; } @@ -141,42 +142,16 @@ public class ManualVspToscaGenerationService { } } - private void createComponentNodeTemplate(ServiceTemplate mainServiceTemplate, - VspModelInfo vspModelInfo, - String componentId) { - Optional<String> componentName = getComponentNameFromVspModel(vspModelInfo); - if (componentName.isPresent()) { - NodeTemplate vfcNodeTemplate = new NodeTemplate(); - vfcNodeTemplate.setType(ToscaNodeType.MULTIFLAVOR_VFC_NODE_TYPE); - Map<String, Object> properties = new LinkedHashMap<>(); - if (MapUtils.isNotEmpty(vspModelInfo.getMultiFlavorVfcImages())) { - List<MultiFlavorVfcImage> componentImages = - vspModelInfo.getMultiFlavorVfcImages().get(componentId); - Map<String, MultiFlavorVfcImage> vfcImages = new HashMap<>(); - for (MultiFlavorVfcImage image : componentImages) { - vfcImages.put(image.getSoftware_version(), image); - } - properties.put(IMAGES_PROPERTY, vfcImages); - vfcNodeTemplate.setProperties(properties); - } - String nodeTemplateId = componentName.get() + VFC_NODE_TEMPLATE_ID_SUFFIX; - DataModelUtil.addNodeTemplate(mainServiceTemplate, nodeTemplateId, - vfcNodeTemplate); - } - } - private void createVnfNodeTemplate(ServiceTemplate mainServiceTemplate, - VspModelInfo vspModelInfo) { + VspModelInfo vspModelInfo, String componentId) { Optional<String> componentName = getComponentNameFromVspModel(vspModelInfo); if (componentName.isPresent()) { NodeTemplate vnfNodeTemplate = new NodeTemplate(); - String vnfNodeTemplateType = - ToscaNodeType.MULTIDEPLOYMENTFLAVOR_NODE_TYPE + "." + componentName.get(); - vnfNodeTemplate.setType(vnfNodeTemplateType); + vnfNodeTemplate.setType(ToscaNodeType.MULTIDEPLOYMENTFLAVOR_NODE_TYPE); List<String> directiveList = new ArrayList<>(); directiveList.add(ToscaConstants.NODE_TEMPLATE_DIRECTIVE_SUBSTITUTABLE); vnfNodeTemplate.setDirectives(directiveList); - vnfNodeTemplate.setProperties(new LinkedHashMap<>()); + vnfNodeTemplate.setProperties(getVnfNodeTemplateProperties(vspModelInfo, componentId)); DataModelUtil .addSubstitutionFilteringProperty(getSubstitutionServiceTemplateFileName(componentName .get()), vnfNodeTemplate, 1); @@ -186,10 +161,28 @@ public class ManualVspToscaGenerationService { String nodeTemplateId = componentName.get() + VNF_NODE_TEMPLATE_ID_SUFFIX; DataModelUtil.addNodeTemplate(mainServiceTemplate, nodeTemplateId, vnfNodeTemplate); - abstractSubstitutionIdTypes.put(componentName.get(), vnfNodeTemplateType); + abstractSubstitutionIdTypes.put(componentName.get(), ToscaNodeType + .MULTIDEPLOYMENTFLAVOR_NODE_TYPE); } } + private Map<String, Object> getVnfNodeTemplateProperties(VspModelInfo vspModelInfo, + String componentId) { + Map<String, Object> properties = new LinkedHashMap<>(); + if (MapUtils.isNotEmpty(vspModelInfo.getMultiFlavorVfcImages())) { + List<MultiFlavorVfcImage> componentImages = + vspModelInfo.getMultiFlavorVfcImages().get(componentId); + if (Objects.nonNull(componentImages)) { + Map<String, MultiFlavorVfcImage> vfcImages = new HashMap<>(); + componentImages.stream() + .forEach(multiFlavorVfcImage -> + vfcImages.put(multiFlavorVfcImage.getSoftware_version(), multiFlavorVfcImage)); + properties.put(IMAGES_PROPERTY, vfcImages); + } + } + return properties; + } + private String getSubstitutionServiceTemplateFileName(String componentName) { return componentName + TOSCA_SERVICE_TEMPLATE_FILE_NAME_SUFFIX; } @@ -276,7 +269,7 @@ public class ManualVspToscaGenerationService { nicNodeTemplate.setType(ToscaNodeType.NETWORK_PORT); DataModelUtil.addBindingReqFromPortToCompute(componentNodeTemplateId, nicNodeTemplate); DataModelUtil.addNodeTemplate(substitutionServiceTemplate, - getNicNodeTemplateId(nic.getName()), nicNodeTemplate); + getNicNodeTemplateId(nic.getName(), nic.getNetworkType()), nicNodeTemplate); } } } @@ -288,9 +281,14 @@ public class ManualVspToscaGenerationService { return componentName; } - private String getNicNodeTemplateId(String nicName) { + private String getNicNodeTemplateId(String nicName, NetworkType nicNetworkType) { StringBuilder builder = new StringBuilder(); builder.append(nicName); + if (nicNetworkType == NetworkType.External) { + builder.append(PORT_TYPE_EXTERNAL_NODE_TEMPLATE_SUFFIX); + } else if (nicNetworkType == NetworkType.Internal) { + builder.append(PORT_TYPE_INTERNAL_NODE_TEMPLATE_SUFFIX); + } builder.append(PORT_NODE_TEMPLATE_ID_SUFFIX); return builder.toString(); } @@ -337,7 +335,6 @@ public class ManualVspToscaGenerationService { createGlobalSubstitutionNodeType(substitutionServiceTemplate, componentName); DataModelUtil.addNodeType(globalSubstitutionServiceTemplate, substitutionNodeTypeId, substitutionNodeType); - Map<String, Map<String, List<String>>> substitutionMapping = GeneratorUtils.getSubstitutionNodeTypeExposedConnectionPoints(substitutionNodeType, substitutionServiceTemplate, toscaServiceModel); @@ -379,7 +376,7 @@ public class ManualVspToscaGenerationService { String componentName) { NodeType substitutionNodeType = new ToscaAnalyzerServiceImpl() .createInitSubstitutionNodeType(substitutionServiceTemplate, - ToscaNodeType.VFC_ABSTRACT_SUBSTITUTE); + ToscaNodeType.MULTIFLAVOR_VFC_NODE_TYPE); substitutionNodeType.setProperties( getManualVspSubstitutionNodeTypeProperties(substitutionNodeType, componentName)); return substitutionNodeType; diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/src/main/java/org/openecomp/sdc/generator/core/utils/GeneratorUtils.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/src/main/java/org/openecomp/sdc/generator/core/utils/GeneratorUtils.java index c13997b47c..59b06ba7a8 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/src/main/java/org/openecomp/sdc/generator/core/utils/GeneratorUtils.java +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/src/main/java/org/openecomp/sdc/generator/core/utils/GeneratorUtils.java @@ -163,8 +163,8 @@ public class GeneratorUtils { } catch (Exception ex) { MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API, LoggerTragetServiceName.GENERATE_MANUAL_VSP_TOSCA, ErrorLevel.INFO.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), "Error occured in get node type exposed " - + "points"); + LoggerErrorCode.DATA_ERROR.getErrorCode(), + "Error occured in get node type exposed points : " + ex.getMessage()); return null; } return substitutionMapping; diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/att-sdc-translator-impl/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-translator-lib/att-sdc-translator-impl/pom.xml.versionsBackup deleted file mode 100644 index e44d37ff8f..0000000000 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/att-sdc-translator-impl/pom.xml.versionsBackup +++ /dev/null @@ -1,70 +0,0 @@ -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - 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> - - <name>att-sdc-translator-impl</name> - <artifactId>att-sdc-translator-impl</artifactId> - - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-lib</artifactId> - <version>1.0-SNAPSHOT</version> - <relativePath>../..</relativePath> - </parent> - - <dependencies> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <version>1.1.2</version> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>RELEASE</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-translator-api</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-heat-lib</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-tosca-lib</artifactId> - <version>${project.version}</version> - </dependency> - - - <!-- need to be changed to sdk --> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-translator-core</artifactId> - <version>${project.version}</version> - </dependency> - <!--dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-translator-core</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency--> - </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>2.19.1</version> - <configuration> - <useSystemClassLoader>false</useSystemClassLoader> - </configuration> - </plugin> - </plugins> - </build> -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api/pom.xml.versionsBackup deleted file mode 100644 index d46dd3f442..0000000000 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api/pom.xml.versionsBackup +++ /dev/null @@ -1,68 +0,0 @@ -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - 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> - - <name>openecomp-sdc-translator-api</name> - <artifactId>openecomp-sdc-translator-api</artifactId> - - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-lib</artifactId> - <version>1.0-SNAPSHOT</version> - <relativePath>../..</relativePath> - </parent> - - <dependencies> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-facade-core</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-validation-api</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-validation-core</artifactId> - <version>${project.version}</version> - <scope>runtime</scope> - </dependency> - <dependency> - <groupId>io.swagger</groupId> - <artifactId>swagger-annotations</artifactId> - <version>1.5.3</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-heat-lib</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-tosca-lib</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc.common</groupId> - <artifactId>openecomp-configuration-management-core</artifactId> - <version>1707.0.0-SNAPSHOT</version> - <scope>runtime</scope> - <exclusions> - <exclusion> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.openecomp.sdc.common</groupId> - <artifactId>openecomp-configuration-management-api</artifactId> - <version>1707.0.0-SNAPSHOT</version> - </dependency> - </dependencies> - -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/pom.xml.versionsBackup deleted file mode 100644 index aea451e1ca..0000000000 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/pom.xml.versionsBackup +++ /dev/null @@ -1,75 +0,0 @@ -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - 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> - - <name>openecomp-sdc-translator-core</name> - <artifactId>openecomp-sdc-translator-core</artifactId> - - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-lib</artifactId> - <version>1.0-SNAPSHOT</version> - <relativePath>../..</relativePath> - </parent> - - <dependencies> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <version>${logback.version}</version> - - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>RELEASE</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-utilities-lib</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-translator-api</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-datatypes-lib</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-validation-api</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>att-sdc-validation-impl</artifactId> - <version>1.0-SNAPSHOT</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-heat-lib</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>2.19.1</version> - <configuration> - <useSystemClassLoader>false</useSystemClassLoader> - <redirectTestOutputToFile>true</redirectTestOutputToFile> - </configuration> - </plugin> - </plugins> - </build> -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-impl/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-impl/pom.xml.versionsBackup deleted file mode 100644 index 95c45309da..0000000000 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-impl/pom.xml.versionsBackup +++ /dev/null @@ -1,68 +0,0 @@ -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - 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> - - <name>openecomp-sdc-translator-impl</name> - <artifactId>openecomp-sdc-translator-impl</artifactId> - - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-lib</artifactId> - <version>1.0-SNAPSHOT</version> - <relativePath>../..</relativePath> - </parent> - - <dependencies> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <version>1.1.2</version> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>RELEASE</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-translator-api</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-heat-lib</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-tosca-lib</artifactId> - <version>${project.version}</version> - </dependency> - - - <!-- need to be changed to sdk --> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-translator-core</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>2.19.1</version> - <configuration> - <useSystemClassLoader>false</useSystemClassLoader> - <systemPropertyVariables> - <config.location>${project.basedir}/configuration</config.location> - </systemPropertyVariables> - </configuration> - </plugin> - </plugins> - </build> -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-sdk/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-sdk/pom.xml.versionsBackup deleted file mode 100644 index 2cb266a815..0000000000 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-sdk/pom.xml.versionsBackup +++ /dev/null @@ -1,45 +0,0 @@ -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - 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> - - <name>openecomp-sdc-translator-sdk</name> - <artifactId>openecomp-sdc-translator-sdk</artifactId> - - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-lib</artifactId> - <version>1.0-SNAPSHOT</version> - <relativePath>../..</relativePath> - </parent> - - <dependencies> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <version>1.1.2</version> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>RELEASE</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-translator-api</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-heat-lib</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-tosca-lib</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-translator-lib/pom.xml.versionsBackup deleted file mode 100644 index 9d7224a2e1..0000000000 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,26 +0,0 @@ -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - 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> - - <name>openecomp-sdc-translator-lib</name> - <artifactId>openecomp-sdc-translator-lib</artifactId> - - <packaging>pom</packaging> - <parent> - <artifactId>openecomp-sdc-lib</artifactId> - <groupId>org.openecomp.sdc</groupId> - <version>1.0-SNAPSHOT</version> - </parent> - - <modules> - <module>openecomp-sdc-translator-api</module> - <module>openecomp-sdc-translator-sdk</module> - <module>openecomp-sdc-translator-core</module> - <module>openecomp-sdc-translator-impl</module> - <module>att-sdc-translator-impl</module> - </modules> - - <dependencies> - </dependencies> -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/pom.xml.versionsBackup deleted file mode 100644 index b53f4159fc..0000000000 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/att-sdc-validation-impl/pom.xml.versionsBackup +++ /dev/null @@ -1,92 +0,0 @@ -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - 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> - - <name>att-sdc-validation-impl</name> - <artifactId>att-sdc-validation-impl</artifactId> - - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-lib</artifactId> - <version>1.0-SNAPSHOT</version> - <relativePath>../..</relativePath> - </parent> - - <dependencies> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-facade-core</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-datatypes-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <version>${logback.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-logging-core</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-logging-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-validation-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-validation-core</artifactId> - <version>1.0-SNAPSHOT</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-validation-impl</artifactId> - <version>1.0-SNAPSHOT</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-heat-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <version>6.9.10</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-validation-sdk</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>2.19.1</version> - <configuration> - <useSystemClassLoader>false</useSystemClassLoader> - <redirectTestOutputToFile>true</redirectTestOutputToFile> - </configuration> - </plugin> - </plugins> - </build> - -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-api/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-api/pom.xml.versionsBackup deleted file mode 100644 index 5850819a7f..0000000000 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-api/pom.xml.versionsBackup +++ /dev/null @@ -1,49 +0,0 @@ -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - 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> - - <name>openecomp-sdc-validation-api</name> - <artifactId>openecomp-sdc-validation-api</artifactId> - - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-lib</artifactId> - <version>1.0-SNAPSHOT</version> - <relativePath>../..</relativePath> - </parent> - - <dependencies> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-facade-core</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>io.swagger</groupId> - <artifactId>swagger-annotations</artifactId> - <version>1.5.3</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-datatypes-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <version>${logback.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-logging-core</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-logging-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - </dependencies> -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/pom.xml.versionsBackup deleted file mode 100644 index 8731097f41..0000000000 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/pom.xml.versionsBackup +++ /dev/null @@ -1,110 +0,0 @@ -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - 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> - - <name>openecomp-sdc-validation-core</name> - <artifactId>openecomp-sdc-validation-core</artifactId> - - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-lib</artifactId> - <version>1.0-SNAPSHOT</version> - <relativePath>../..</relativePath> - </parent> - - <dependencies> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <version>${logback.version}</version> - - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-logging-core</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <scope>test</scope> - <version>6.8.5</version> - <exclusions> - <exclusion> - <artifactId>snakeyaml</artifactId> - <groupId>org.yaml</groupId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>RELEASE</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-utilities-lib</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-validation-api</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-validation-sdk</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-datatypes-lib</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <scope>test</scope> - <version>1.10.19</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc.common</groupId> - <artifactId>openecomp-configuration-management-core</artifactId> - <version>1707.0.0-SNAPSHOT</version> - <scope>runtime</scope> - <exclusions> - <exclusion> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-heat-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <version>6.9.10</version> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>2.19.1</version> - <configuration> - <useSystemClassLoader>false</useSystemClassLoader> - <redirectTestOutputToFile>true</redirectTestOutputToFile> - </configuration> - </plugin> - </plugins> - </build> -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/pom.xml.versionsBackup deleted file mode 100644 index e2927eb5b3..0000000000 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/pom.xml.versionsBackup +++ /dev/null @@ -1,103 +0,0 @@ -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - 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> - - <name>openecomp-sdc-validation-impl</name> - <artifactId>openecomp-sdc-validation-impl</artifactId> - - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-lib</artifactId> - <version>1.0-SNAPSHOT</version> - <relativePath>../..</relativePath> - </parent> - - <dependencies> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <version>${logback.version}</version> - - </dependency> - - <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <scope>test</scope> - <version>6.8.5</version> - <exclusions> - <exclusion> - <artifactId>snakeyaml</artifactId> - <groupId>org.yaml</groupId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-logging-core</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-logging-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>RELEASE</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-utilities-lib</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-validation-api</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-common-lib</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <scope>test</scope> - <version>1.10.19</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-heat-lib</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-logging-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <!--dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-validation-sdk</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency--> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <version>2.5</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-validation-core</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - </dependencies> - - -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidator.java index a0c25d44f8..6016ba0cb8 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidator.java @@ -230,9 +230,9 @@ public class NovaServerNamingConventionGuideLineValidator implements ResourceVal } if (network.contains("_net_id")) { return network.substring(0, network.indexOf("_net_id")); - } else if (network.contains("net_name")) { + } else if (network.contains("_net_name")) { return network.substring(0, network.indexOf("_net_name")); - } else if (network.contains("net_fqdn")) { + } else if (network.contains("_net_fqdn")) { return network.substring(0, network.indexOf("_net_fqdn")); } return null; diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/pom.xml.versionsBackup deleted file mode 100644 index d179ae0469..0000000000 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/pom.xml.versionsBackup +++ /dev/null @@ -1,42 +0,0 @@ -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - 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>openecomp-sdc-validation-sdk</artifactId> - <dependencies> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-logging-core</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <version>6.9.10</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-validation-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-heat-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <version>2.5</version> - </dependency> - </dependencies> - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-lib</artifactId> - <version>1.0-SNAPSHOT</version> - <relativePath>../..</relativePath> - </parent> - -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-validation-lib/pom.xml.versionsBackup deleted file mode 100644 index 3188265847..0000000000 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,24 +0,0 @@ -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - 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> - - <name>openecomp-sdc-validation-lib</name> - <artifactId>openecomp-sdc-validation-lib</artifactId> - - <packaging>pom</packaging> - <parent> - <artifactId>openecomp-sdc-lib</artifactId> - <groupId>org.openecomp.sdc</groupId> - <version>1.0-SNAPSHOT</version> - </parent> - - <modules> - <module>openecomp-sdc-validation-api</module> - <module>openecomp-sdc-validation-core</module> - <module>openecomp-sdc-validation-impl</module> - <module>openecomp-sdc-validation-sdk</module> - <module>att-sdc-validation-impl</module> - </modules> - -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/pom.xml.versionsBackup deleted file mode 100644 index fc22abcf38..0000000000 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/pom.xml.versionsBackup +++ /dev/null @@ -1,55 +0,0 @@ -<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> - - <name>openecomp-sdc-vendor-license-api</name> - <artifactId>openecomp-sdc-vendor-license-api</artifactId> - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-lib</artifactId> - <version>1.0-SNAPSHOT</version> - <relativePath>../..</relativePath> - </parent> - <dependencies> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-facade-core</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-versioning-core</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-nosqldb-core</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>javax.el</groupId> - <artifactId>javax.el-api</artifactId> - <version>${javax.el-api.version}</version> - </dependency> - <dependency> - <groupId>org.glassfish.web</groupId> - <artifactId>javax.el</artifactId> - <version>2.2.4</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> - </dependencies> -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolEntity.java index ce225931f5..dce2939ae5 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolEntity.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/EntitlementPoolEntity.java @@ -26,12 +26,10 @@ import com.datastax.driver.mapping.annotations.Enumerated; import com.datastax.driver.mapping.annotations.Frozen; import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; -import org.openecomp.sdc.vendorlicense.dao.types.xml.AggregationFunctionForXml; -import org.openecomp.sdc.vendorlicense.dao.types.xml.EntitlementMetricForXml; -import org.openecomp.sdc.vendorlicense.dao.types.xml.EntitlementTimeForXml; -import org.openecomp.sdc.vendorlicense.dao.types.xml.ThresholdForXml; -import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitForXml; +import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitXml; +import org.openecomp.sdc.vendorlicense.dao.types.xml.OperationalScopeForXml; +import org.openecomp.sdc.vendorlicense.dao.types.xml.ThresholdForXml; import org.openecomp.sdc.versioning.dao.types.Version; import org.openecomp.sdc.versioning.dao.types.VersionableEntity; @@ -65,25 +63,12 @@ public class EntitlementPoolEntity implements VersionableEntity { @Enumerated private ThresholdUnit thresholdUnit; - @Column(name = "entitlement_metric") - @Frozen - private ChoiceOrOther<EntitlementMetric> entitlementMetric; private String increments; - @Column(name = "aggregation_func") - @Frozen - private ChoiceOrOther<AggregationFunction> aggregationFunction; - @Column(name = "operational_scope") @Frozen private MultiChoiceOrOther<OperationalScope> operationalScope; - @Frozen - private ChoiceOrOther<EntitlementTime> time; - - @Column(name = "manufacturer_ref_num") - private String manufacturerReferenceNumber; - @Column(name = "ref_fg_ids") private Set<String> referencingFeatureGroups = new HashSet<>(); @@ -96,6 +81,9 @@ public class EntitlementPoolEntity implements VersionableEntity { private Collection<LimitEntity> limits; + //Defined and used only for License Artifcat XMLs + private String manufacturerReferenceNumber; + public EntitlementPoolEntity() { } @@ -200,15 +188,6 @@ public class EntitlementPoolEntity implements VersionableEntity { this.thresholdUnit = thresholdUnits; } - public ChoiceOrOther<EntitlementMetric> getEntitlementMetric() { - return entitlementMetric; - } - - public void setEntitlementMetric(ChoiceOrOther<EntitlementMetric> entitlementMetric) { - entitlementMetric.resolveEnum(EntitlementMetric.class); - this.entitlementMetric = entitlementMetric; - } - public String getIncrements() { return increments; } @@ -217,15 +196,6 @@ public class EntitlementPoolEntity implements VersionableEntity { this.increments = increments; } - public ChoiceOrOther<AggregationFunction> getAggregationFunction() { - return aggregationFunction; - } - - public void setAggregationFunction(ChoiceOrOther<AggregationFunction> aggregationFunction) { - aggregationFunction.resolveEnum(AggregationFunction.class); - this.aggregationFunction = aggregationFunction; - } - public MultiChoiceOrOther<OperationalScope> getOperationalScope() { return operationalScope; } @@ -237,23 +207,6 @@ public class EntitlementPoolEntity implements VersionableEntity { this.operationalScope = operationalScope; } - public ChoiceOrOther<EntitlementTime> getTime() { - return time; - } - - public void setTime(ChoiceOrOther<EntitlementTime> time) { - time.resolveEnum(EntitlementTime.class); - this.time = time; - } - - public String getManufacturerReferenceNumber() { - return manufacturerReferenceNumber; - } - - public void setManufacturerReferenceNumber(String manufacturerReferenceNumber) { - this.manufacturerReferenceNumber = manufacturerReferenceNumber; - } - /** * Gets threshold for artifact. * @@ -274,35 +227,6 @@ public class EntitlementPoolEntity implements VersionableEntity { return version.toString(); } - /** - * Gets entitlement metric for artifact. - * - * @return the entitlement metric for artifact - */ - public EntitlementMetricForXml getEntitlementMetricForArtifact() { - EntitlementMetricForXml metric = new EntitlementMetricForXml(); - if (entitlementMetric != null) { - metric.setValue(entitlementMetric.getResult()); - } else { - metric.setValue(null); - } - return metric; - } - - /** - * Gets time for artifact. - * - * @return the time for artifact - */ - public EntitlementTimeForXml getTimeForArtifact() { - EntitlementTimeForXml timeForXml = new EntitlementTimeForXml(); - if (time != null) { - timeForXml.setValue(time.getResult()); - } - - return timeForXml; - } - public String getStartDate() { return startDate; } @@ -334,7 +258,7 @@ public class EntitlementPoolEntity implements VersionableEntity { if(obj.getType().equals(LimitType.ServiceProvider)){ LimitXml xmlObj = new LimitXml(); xmlObj.setDescription(obj.getDescription()); - xmlObj.setMetric(obj.getMetric().toString()); + xmlObj.setMetric(obj.getMetric()!=null?obj.getMetric().name():null); xmlObj.setValues(obj.getValue()!=null?Integer.toString(obj.getValue()):null); xmlObj.setUnit(obj.getUnit()!=null?Integer.toString(obj.getUnit()):null); xmlObj.setAggregationFunction(obj.getAggregationFunction()!=null?obj.getAggregationFunction().name():null); @@ -357,7 +281,7 @@ public class EntitlementPoolEntity implements VersionableEntity { if(obj.getType().equals(LimitType.Vendor)){ LimitXml xmlObj = new LimitXml(); xmlObj.setDescription(obj.getDescription()); - xmlObj.setMetric(obj.getMetric().toString()); + xmlObj.setMetric(obj.getMetric()!=null?obj.getMetric().name():null); xmlObj.setValues(obj.getValue()!=null?Integer.toString(obj.getValue()):null); xmlObj.setUnit(obj.getUnit()!=null?Integer.toString(obj.getUnit()):null); xmlObj.setAggregationFunction(obj.getAggregationFunction()!=null?obj.getAggregationFunction().name():null); @@ -378,8 +302,7 @@ public class EntitlementPoolEntity implements VersionableEntity { public int hashCode() { return Objects .hash(vendorLicenseModelId, version, id, name, description, thresholdValue, thresholdUnit, - entitlementMetric, increments, aggregationFunction, operationalScope, time, - manufacturerReferenceNumber, referencingFeatureGroups, startDate, expiryDate); + increments, operationalScope, referencingFeatureGroups, startDate, expiryDate); } @Override @@ -397,12 +320,8 @@ public class EntitlementPoolEntity implements VersionableEntity { && Objects.equals(name, that.name) && Objects.equals(description, that.description) && Objects.equals(thresholdUnit, that.thresholdUnit) - && Objects.equals(entitlementMetric, that.entitlementMetric) && Objects.equals(increments, that.increments) - && Objects.equals(aggregationFunction, that.aggregationFunction) && Objects.equals(operationalScope, that.operationalScope) - && Objects.equals(time, that.time) - && Objects.equals(manufacturerReferenceNumber, that.manufacturerReferenceNumber) && Objects.equals(referencingFeatureGroups, that.referencingFeatureGroups) && Objects.equals(startDate, that.startDate) && Objects.equals(expiryDate, that.expiryDate); @@ -418,12 +337,8 @@ public class EntitlementPoolEntity implements VersionableEntity { + ", description='" + description + '\'' + ", thresholdValue=" + thresholdValue + ", thresholdUnit='" + thresholdUnit + '\'' - + ", entitlementMetric=" + entitlementMetric + ", increments='" + increments + '\'' - + ", aggregationFunction=" + aggregationFunction + ", operationalScope=" + operationalScope - + ", time=" + time - + ", manufacturerReferenceNumber='" + manufacturerReferenceNumber + '\'' + ", referencingFeatureGroups=" + referencingFeatureGroups + ", version_uuid=" + versionUuId + ", startDate=" + startDate @@ -432,30 +347,26 @@ public class EntitlementPoolEntity implements VersionableEntity { } /** - * Gets aggregation function for artifact. - * - * @return the aggregation function for artifact - */ - public AggregationFunctionForXml getAggregationFunctionForArtifact() { - AggregationFunctionForXml aggregationFunctionForXml = new AggregationFunctionForXml(); - if (entitlementMetric != null) { - aggregationFunctionForXml.setValue(aggregationFunction.getResult()); - } else { - aggregationFunctionForXml.setValue(null); - } - return aggregationFunctionForXml; - } - - /** * Gets operational scope for artifact. * * @return the operational scope for artifact */ - public Set<String> getOperationalScopeForArtifact() { + public OperationalScopeForXml getOperationalScopeForArtifact() { + OperationalScopeForXml obj = new OperationalScopeForXml(); if (operationalScope != null) { - return operationalScope.getResults(); - } else { - return null; + if(operationalScope.getResults().size() > 0) { + obj.setValue(operationalScope.getResults()); + } } + return obj; + } + + //Defined and used only for License Artifcat XMLs + public void setManufacturerReferenceNumber(String manufacturerReferenceNumber) { + this.manufacturerReferenceNumber = manufacturerReferenceNumber; + } + + public String getManufacturerReferenceNumber() { + return manufacturerReferenceNumber; } } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyGroupEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyGroupEntity.java index 654093de28..d5efd59a6b 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyGroupEntity.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/LicenseKeyGroupEntity.java @@ -29,6 +29,8 @@ import com.datastax.driver.mapping.annotations.Table; import org.openecomp.sdc.vendorlicense.dao.types.xml.LicenseKeyTypeForXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitForXml; +import org.openecomp.sdc.vendorlicense.dao.types.xml.OperationalScopeForXml; +import org.openecomp.sdc.vendorlicense.dao.types.xml.ThresholdForXml; import org.openecomp.sdc.versioning.dao.types.Version; import org.openecomp.sdc.versioning.dao.types.VersionableEntity; @@ -61,8 +63,17 @@ public class LicenseKeyGroupEntity implements VersionableEntity { private Set<String> referencingFeatureGroups = new HashSet<>(); @Column(name = "version_uuid") private String versionUuId; + private Integer thresholdValue; + private ThresholdUnit thresholdUnits; + private String increments; private Collection<LimitEntity> limits; + private String startDate; + private String expiryDate; + + //Defined and used only for License Artifcat XMLs + private String manufacturerReferenceNumber; + public LicenseKeyGroupEntity() { } @@ -167,6 +178,37 @@ public class LicenseKeyGroupEntity implements VersionableEntity { this.referencingFeatureGroups = referencingFeatureGroups; } + public Integer getThresholdValue() { + return thresholdValue; + } + + public void setThresholdValue(Integer thresholdValue) { + this.thresholdValue = thresholdValue; + } + + public ThresholdUnit getThresholdUnits() { + return thresholdUnits; + } + + public void setThresholdUnits(ThresholdUnit thresholdUnit) { + this.thresholdUnits = thresholdUnit; + } + + public String getIncrements() { + return increments; + } + + public void setIncrements(String increments) { + this.increments = increments; + } + + public ThresholdForXml getThresholdForArtifact() { + ThresholdForXml threshold = new ThresholdForXml(); + threshold.setUnit(getThresholdUnits() == null ? null : getThresholdUnits().name()); + threshold.setValue(getThresholdValue()); + return threshold; + } + public Collection<LimitEntity> getLimits() { return limits; } @@ -221,11 +263,28 @@ public class LicenseKeyGroupEntity implements VersionableEntity { return null; } + public String getStartDate() { + return startDate; + } + + public void setStartDate(String startDate) { + this.startDate = startDate; + } + + public String getExpiryDate() { + return expiryDate; + } + + public void setExpiryDate(String expiryDate) { + this.expiryDate = expiryDate; + } + @Override public int hashCode() { return Objects .hash(vendorLicenseModelId, version, id, name, description, type, operationalScope, - referencingFeatureGroups); + referencingFeatureGroups, startDate, expiryDate, + thresholdValue, thresholdUnits, increments); } @Override @@ -243,7 +302,12 @@ public class LicenseKeyGroupEntity implements VersionableEntity { && Objects.equals(description, that.description) && type == that.type && Objects.equals(operationalScope, that.operationalScope) - && Objects.equals(referencingFeatureGroups, that.referencingFeatureGroups); + && Objects.equals(referencingFeatureGroups, that.referencingFeatureGroups) + && Objects.equals(startDate, that.startDate) + && Objects.equals(expiryDate, that.expiryDate) + && Objects.equals(thresholdValue, that.thresholdValue) + && Objects.equals(thresholdUnits, that.thresholdUnits) + && Objects.equals(increments, that.increments); } @Override @@ -257,6 +321,11 @@ public class LicenseKeyGroupEntity implements VersionableEntity { + ", operationalScope=" + operationalScope + ", referencingFeatureGroups=" + referencingFeatureGroups + ", versionUuId='" + versionUuId + '\'' + + ", startDate=" + startDate + + ", expiryDate=" + expiryDate + + ", thresholdValue='" + thresholdValue + '\'' + + ", thresholdUnits='" + thresholdUnits + '\'' + + ", increments='" + increments + '\'' + '}'; } @@ -265,12 +334,14 @@ public class LicenseKeyGroupEntity implements VersionableEntity { * * @return the operational scope for artifact */ - public Set<String> getOperationalScopeForArtifact() { + public OperationalScopeForXml getOperationalScopeForArtifact() { + OperationalScopeForXml obj = new OperationalScopeForXml(); if (operationalScope != null) { - return operationalScope.getResults(); - } else { - return null; + if(operationalScope.getResults().size() > 0) { + obj.setValue(operationalScope.getResults()); + } } + return obj; } /** @@ -295,4 +366,13 @@ public class LicenseKeyGroupEntity implements VersionableEntity { } return typeXml; } + + //Defined and used only for License Artifcat XMLs + public String getManufacturerReferenceNumber() { + return manufacturerReferenceNumber; + } + + public void setManufacturerReferenceNumber(String manufacturerReferenceNumber) { + this.manufacturerReferenceNumber = manufacturerReferenceNumber; + } } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/OperationalScopeForXml.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/OperationalScopeForXml.java new file mode 100644 index 0000000000..f51a4127c0 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/xml/OperationalScopeForXml.java @@ -0,0 +1,38 @@ +/*- + * ============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.sdc.vendorlicense.dao.types.xml; + +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; + +import java.util.Set; + +public class OperationalScopeForXml { + Set<String> value; + + @JacksonXmlElementWrapper(localName = "value", useWrapping = false) + public Set<String> getValue() { + return value; + } + + public void setValue(Set<String> value) { + this.value = value; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/facade/VendorLicenseFacade.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/facade/VendorLicenseFacade.java index 9ab7c0c64d..3d27de3a88 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/facade/VendorLicenseFacade.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/facade/VendorLicenseFacade.java @@ -76,6 +76,9 @@ public interface VendorLicenseFacade { LicenseAgreementEntity createLicenseAgreement(LicenseAgreementEntity licenseAgreement, String user); + Collection<FeatureGroupEntity> listFeatureGroups(String vlmId, Version version, + String user); + FeatureGroupEntity createFeatureGroup(FeatureGroupEntity featureGroup, String user); diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/pom.xml.versionsBackup deleted file mode 100644 index b1141fc5cd..0000000000 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/pom.xml.versionsBackup +++ /dev/null @@ -1,53 +0,0 @@ -<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> - - <name>openecomp-sdc-vendor-license-core</name> - <artifactId>openecomp-sdc-vendor-license-core</artifactId> - - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-lib</artifactId> - <version>1.0-SNAPSHOT</version> - <relativePath>../..</relativePath> - </parent> - <dependencies> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-vendor-license-api</artifactId> - <version>${project.version}</version> - </dependency> - - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <scope>test</scope> - <version>1.10.19</version> - </dependency> - <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <scope>test</scope> - <version>6.8.5</version> - <exclusions> - <exclusion> - <artifactId>snakeyaml</artifactId> - <groupId>org.yaml</groupId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - <version>4.11</version> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.dataformat</groupId> - <artifactId>jackson-dataformat-xml</artifactId> - <version>2.7.4</version> - </dependency> - </dependencies> - -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/EntitlementPoolZusammenDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/EntitlementPoolZusammenDaoImpl.java index 4cccb6712a..b880c67cbc 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/EntitlementPoolZusammenDaoImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/EntitlementPoolZusammenDaoImpl.java @@ -11,11 +11,7 @@ import com.amdocs.zusammen.datatypes.item.Info; import org.openecomp.core.zusammen.api.ZusammenAdaptor; import org.openecomp.core.zusammen.api.ZusammenUtil; import org.openecomp.sdc.vendorlicense.dao.EntitlementPoolDao; -import org.openecomp.sdc.vendorlicense.dao.types.AggregationFunction; -import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther; -import org.openecomp.sdc.vendorlicense.dao.types.EntitlementMetric; import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; -import org.openecomp.sdc.vendorlicense.dao.types.EntitlementTime; import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther; import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope; import org.openecomp.sdc.vendorlicense.dao.types.ThresholdUnit; @@ -214,15 +210,11 @@ public class EntitlementPoolZusammenDaoImpl implements EntitlementPoolDao { Info info = new Info(); info.setName(entitlementPool.getName()); info.setDescription(entitlementPool.getDescription()); + info.addProperty("version_uuid", entitlementPool.getVersionUuId()); info.addProperty("thresholdValue", entitlementPool.getThresholdValue()); info.addProperty("threshold_unit", entitlementPool.getThresholdUnit()); - info.addProperty("entitlement_metric", entitlementPool.getEntitlementMetric()); info.addProperty("increments", entitlementPool.getIncrements()); - info.addProperty("aggregation_func", entitlementPool.getAggregationFunction()); info.addProperty("operational_scope", entitlementPool.getOperationalScope()); - info.addProperty("EntitlementTime", entitlementPool.getTime()); - info.addProperty("manufacturerReferenceNumber", - entitlementPool.getManufacturerReferenceNumber()); info.addProperty("startDate", entitlementPool.getStartDate()); info.addProperty("expiryDate", entitlementPool.getExpiryDate()); entitlementPoolElement.setInfo(info); @@ -243,6 +235,7 @@ public class EntitlementPoolZusammenDaoImpl implements EntitlementPoolDao { new EntitlementPoolEntity(vlmId, version, elementInfo.getId().getValue()); entitlmentPool.setName(elementInfo.getInfo().getName()); entitlmentPool.setDescription(elementInfo.getInfo().getDescription()); + entitlmentPool.setVersionUuId(elementInfo.getInfo().getProperty("version_uuid")); entitlmentPool .setThresholdValue(elementInfo.getInfo().getProperty("thresholdValue") != null ? VlmZusammenUtil.toInteger(elementInfo.getInfo().getProperty("thresholdValue")) : null); @@ -250,17 +243,9 @@ public class EntitlementPoolZusammenDaoImpl implements EntitlementPoolDao { Object threshold_unit = elementInfo.getInfo().getProperty("threshold_unit"); entitlmentPool.setThresholdUnit( threshold_unit != null ? ThresholdUnit.valueOf(elementInfo.getInfo().getProperty("threshold_unit")) : null); - entitlmentPool.setEntitlementMetric( - getEntitlementMetricCoiceOrOther(elementInfo.getInfo().getProperty("entitlement_metric"))); entitlmentPool.setIncrements(elementInfo.getInfo().getProperty("increments")); - entitlmentPool.setAggregationFunction( - getAggregationFuncCoiceOrOther(elementInfo.getInfo().getProperty("aggregation_func"))); entitlmentPool.setOperationalScope(getOperationalScopeMultiChoiceOrOther( elementInfo.getInfo().getProperty("operational_scope"))); - entitlmentPool.setTime( - getEntitlementTimeCoiceOrOther(elementInfo.getInfo().getProperty("EntitlementTime"))); - entitlmentPool.setManufacturerReferenceNumber( - elementInfo.getInfo().getProperty("manufacturerReferenceNumber")); entitlmentPool.setStartDate(elementInfo.getInfo().getProperty("startDate")); entitlmentPool.setExpiryDate(elementInfo.getInfo().getProperty("expiryDate")); @@ -272,23 +257,6 @@ public class EntitlementPoolZusammenDaoImpl implements EntitlementPoolDao { return entitlmentPool; } - private ChoiceOrOther<AggregationFunction> getAggregationFuncCoiceOrOther( - Map aggregationFunction) { - return new ChoiceOrOther<> - (AggregationFunction.valueOf((String) aggregationFunction.get("choice")), - (String) aggregationFunction.get("other")); - } - - private ChoiceOrOther<EntitlementMetric> getEntitlementMetricCoiceOrOther(Map entitlementMetric) { - return new ChoiceOrOther<>(EntitlementMetric.valueOf((String) entitlementMetric.get("choice") - ), (String) entitlementMetric.get("other")); - } - - private ChoiceOrOther<EntitlementTime> getEntitlementTimeCoiceOrOther(Map entitlementTime) { - return new ChoiceOrOther<>(EntitlementTime.valueOf((String) entitlementTime.get("choice")), - (String) entitlementTime.get("other")); - } - private MultiChoiceOrOther<OperationalScope> getOperationalScopeMultiChoiceOrOther (Map<String, Object> operationalScope) { diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LicenseKeyGroupZusammenDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LicenseKeyGroupZusammenDaoImpl.java index 95dfd79cb6..976db94f39 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LicenseKeyGroupZusammenDaoImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/LicenseKeyGroupZusammenDaoImpl.java @@ -15,6 +15,7 @@ import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity; import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyType; import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther; import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope; +import org.openecomp.sdc.vendorlicense.dao.types.ThresholdUnit; import org.openecomp.sdc.versioning.dao.types.Version; import java.util.ArrayList; @@ -212,8 +213,15 @@ public class LicenseKeyGroupZusammenDaoImpl implements LicenseKeyGroupDao { Info info = new Info(); info.setName(licenseKeyGroup.getName()); info.setDescription(licenseKeyGroup.getDescription()); + info.addProperty("version_uuid", licenseKeyGroup.getVersionUuId()); info.addProperty("LicenseKeyType", licenseKeyGroup.getType()); + info.addProperty("version_uuid", licenseKeyGroup.getVersionUuId()); info.addProperty("operational_scope", licenseKeyGroup.getOperationalScope()); + info.addProperty("startDate", licenseKeyGroup.getStartDate()); + info.addProperty("expiryDate", licenseKeyGroup.getExpiryDate()); + info.addProperty("thresholdValue", licenseKeyGroup.getThresholdValue()); + info.addProperty("thresholdUnits", licenseKeyGroup.getThresholdUnits()); + info.addProperty("increments", licenseKeyGroup.getIncrements()); lkgElement.setInfo(info); if (licenseKeyGroup.getReferencingFeatureGroups() != null @@ -233,11 +241,23 @@ public class LicenseKeyGroupZusammenDaoImpl implements LicenseKeyGroupDao { new LicenseKeyGroupEntity(vlmId, version, elementInfo.getId().getValue()); licenseKeyGroup.setName(elementInfo.getInfo().getName()); licenseKeyGroup.setDescription(elementInfo.getInfo().getDescription()); - + licenseKeyGroup.setVersionUuId(elementInfo.getInfo().getProperty("version_uuid")); licenseKeyGroup .setType(LicenseKeyType.valueOf(elementInfo.getInfo().getProperty("LicenseKeyType"))); + licenseKeyGroup.setVersionUuId(elementInfo.getInfo().getProperty("version_uuid")); licenseKeyGroup.setOperationalScope(getOperationalScopeMultiChoiceOrOther( elementInfo.getInfo().getProperty("operational_scope"))); + licenseKeyGroup.setStartDate(elementInfo.getInfo().getProperty("startDate")); + licenseKeyGroup.setExpiryDate(elementInfo.getInfo().getProperty("expiryDate")); + if (elementInfo.getInfo().getProperty("thresholdUnits") != null ){ + licenseKeyGroup.setThresholdUnits(ThresholdUnit.valueOf(elementInfo + .getInfo().getProperty("thresholdUnits"))); + } + if (elementInfo.getInfo().getProperty("thresholdValue") != null ){ + licenseKeyGroup.setThresholdValue(toInteger(elementInfo.getInfo().getProperty + ("thresholdValue"))); + } + licenseKeyGroup.setIncrements(elementInfo.getInfo().getProperty("increments")); if (elementInfo.getRelations() != null && elementInfo.getRelations().size() > 0) { licenseKeyGroup @@ -259,4 +279,15 @@ public class LicenseKeyGroupZusammenDaoImpl implements LicenseKeyGroupDao { } return null; } + + private Integer toInteger(Object val) { + if (val instanceof Double) { + return ((Double) val).intValue(); + } else if (val instanceof String) { + return new Integer((String) val); + } else if (val instanceof Integer) { + return (Integer) val; + } + throw new RuntimeException("invalid value for integer:" + val.getClass()); + } } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeImpl.java index 857ee7f9fa..5f9dd10816 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/facade/impl/VendorLicenseFacadeImpl.java @@ -25,6 +25,7 @@ import static org.openecomp.sdc.vendorlicense.errors.UncompletedVendorLicenseMod import static org.openecomp.sdc.vendorlicense.errors.UncompletedVendorLicenseModelErrorType.SUBMIT_UNCOMPLETED_VLM_MSG_LA_MISSING_FG; import static org.openecomp.sdc.vendorlicense.errors.UncompletedVendorLicenseModelErrorType.SUBMIT_UNCOMPLETED_VLM_MSG_MISSING_LA; +import org.apache.commons.collections4.CollectionUtils; import org.openecomp.core.util.UniqueValueUtil; import org.openecomp.core.utilities.CommonMethods; import org.openecomp.sdc.common.errors.CoreException; @@ -70,10 +71,7 @@ import org.openecomp.sdc.versioning.errors.VersionableSubEntityNotFoundErrorBuil import org.openecomp.sdc.versioning.types.VersionInfo; import org.openecomp.sdc.versioning.types.VersionableEntityAction; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; +import java.util.*; public class VendorLicenseFacadeImpl implements VendorLicenseFacade { @@ -128,8 +126,6 @@ public class VendorLicenseFacadeImpl implements VendorLicenseFacade { getVersionInfo(featureGroup.getVendorLicenseModelId(), VersionableEntityAction.Read, user), user); featureGroup.setVersion(version); - - return getFeatureGroup(featureGroup); } @@ -137,19 +133,9 @@ public class VendorLicenseFacadeImpl implements VendorLicenseFacade { FeatureGroupEntity retrieved = featureGroupDao.get(featureGroup); VersioningUtil .validateEntityExistence(retrieved, featureGroup, VendorLicenseModelEntity.ENTITY_TYPE); - if(retrieved.getManufacturerReferenceNumber() == null){ - Object[] entitlementPoolIdsList = retrieved.getEntitlementPoolIds().toArray(); - if(entitlementPoolIdsList != null && entitlementPoolIdsList.length > 0){ - String entitlementPoolId = entitlementPoolIdsList[0].toString(); - EntitlementPoolEntity entitlementPoolEntity = new EntitlementPoolEntity(retrieved.getVendorLicenseModelId(), - retrieved.getVersion(), entitlementPoolId); - entitlementPoolEntity = entitlementPoolDao.get(entitlementPoolEntity); - retrieved.setManufacturerReferenceNumber(entitlementPoolDao.getManufacturerReferenceNumber( - entitlementPoolEntity)); - featureGroupDao.update(retrieved); - } + if (retrieved.getManufacturerReferenceNumber() == null) { + updateManufacturerNumberInFeatureGroup(retrieved); } - return retrieved; } @@ -400,6 +386,20 @@ public class VendorLicenseFacadeImpl implements VendorLicenseFacade { } @Override + public Collection<FeatureGroupEntity> listFeatureGroups(String vlmId, Version version, + String user) { + Collection<FeatureGroupEntity> featureGroupEntities = + featureGroupDao.list(new FeatureGroupEntity(vlmId, VersioningUtil + .resolveVersion(version, getVersionInfo(vlmId, VersionableEntityAction.Read, user), + user), null)); + featureGroupEntities.stream() + .filter(fgEntity -> Objects.isNull(fgEntity.getManufacturerReferenceNumber())) + .forEach(fgEntity -> updateManufacturerNumberInFeatureGroup(fgEntity)); + return featureGroupEntities; + } + + + @Override public Collection<ErrorCode> validateLicensingData(String vlmId, Version version, String licenseAgreementId, Collection<String> featureGroupIds) { @@ -503,41 +503,49 @@ public class VendorLicenseFacadeImpl implements VendorLicenseFacade { return retrieved; } - private void validateCompletedVendorLicenseModel(String vendorLicenseModelId, String user) { - Version version = VersioningUtil.resolveVersion(null, - getVersionInfo(vendorLicenseModelId, VersionableEntityAction.Read, user), user); - Collection<LicenseAgreementEntity> licenseAgreements = licenseAgreementDao - .list(new LicenseAgreementEntity(vendorLicenseModelId, version, null)); - - if (licenseAgreements == null || licenseAgreements.isEmpty()) { - MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - LoggerTragetServiceName.SUBMIT_ENTITY, ErrorLevel.ERROR.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.SUBMIT_ENTITY); - throw new CoreException( - new SubmitUncompletedLicenseModelErrorBuilder(SUBMIT_UNCOMPLETED_VLM_MSG_MISSING_LA).build()); - } - - for (LicenseAgreementEntity licenseAgreement : licenseAgreements) { - if (licenseAgreement.getFeatureGroupIds() == null || licenseAgreement.getFeatureGroupIds().isEmpty()) { - MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - LoggerTragetServiceName.SUBMIT_ENTITY, ErrorLevel.ERROR.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.SUBMIT_ENTITY); - throw new CoreException( - new SubmitUncompletedLicenseModelErrorBuilder(SUBMIT_UNCOMPLETED_VLM_MSG_LA_MISSING_FG).build()); + private void updateManufacturerNumberInFeatureGroup(FeatureGroupEntity featureGroupEntity) { + if (CollectionUtils.isNotEmpty(featureGroupEntity.getEntitlementPoolIds())) { + Object[] entitlementPoolIdsList = featureGroupEntity.getEntitlementPoolIds().toArray(); + if (entitlementPoolIdsList != null && entitlementPoolIdsList.length > 0) { + String entitlementPoolId = entitlementPoolIdsList[0].toString(); + EntitlementPoolEntity entitlementPoolEntity = + new EntitlementPoolEntity(featureGroupEntity.getVendorLicenseModelId(), + featureGroupEntity.getVersion(), entitlementPoolId); + entitlementPoolEntity = entitlementPoolDao.get(entitlementPoolEntity); + featureGroupEntity.setManufacturerReferenceNumber( + entitlementPoolDao.getManufacturerReferenceNumber(entitlementPoolEntity)); + featureGroupDao.update(featureGroupEntity); } } - - Collection<FeatureGroupEntity> featureGroupEntities = - featureGroupDao.list(new FeatureGroupEntity(vendorLicenseModelId, version, null)); - for (FeatureGroupEntity featureGroupEntity : featureGroupEntities) { - if (featureGroupEntity.getEntitlementPoolIds() == null || featureGroupEntity.getEntitlementPoolIds().isEmpty()) { - MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, - LoggerTragetServiceName.SUBMIT_ENTITY, ErrorLevel.ERROR.name(), - LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.SUBMIT_ENTITY); - throw new CoreException( - new SubmitUncompletedLicenseModelErrorBuilder(SUBMIT_UNCOMPLETED_VLM_MSG_FG_MISSING_EP).build()); + } + private void validateCompletedVendorLicenseModel(String vendorLicenseModelId, String user) { + Version version = VersioningUtil.resolveVersion(null, + getVersionInfo(vendorLicenseModelId, VersionableEntityAction.Read, user), user); + Collection<LicenseAgreementEntity> licenseAgreements = licenseAgreementDao + .list(new LicenseAgreementEntity(vendorLicenseModelId, version, null)); + + if (CollectionUtils.isNotEmpty(licenseAgreements)) { + licenseAgreements.forEach(licenseAgreement -> { + if (CollectionUtils.isEmpty(licenseAgreement.getFeatureGroupIds())) { + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, + LoggerTragetServiceName.SUBMIT_ENTITY, ErrorLevel.ERROR.name(), + LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.SUBMIT_ENTITY); + throw new CoreException( + new SubmitUncompletedLicenseModelErrorBuilder(SUBMIT_UNCOMPLETED_VLM_MSG_LA_MISSING_FG).build()); + } + }); + + Collection<FeatureGroupEntity> featureGroupEntities = featureGroupDao.list( + new FeatureGroupEntity(vendorLicenseModelId, version, null)); + featureGroupEntities.forEach(featureGroupEntity -> { + if(CollectionUtils.isEmpty(featureGroupEntity.getEntitlementPoolIds())) { + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB, + LoggerTragetServiceName.SUBMIT_ENTITY, ErrorLevel.ERROR.name(), + LoggerErrorCode.DATA_ERROR.getErrorCode(), LoggerErrorDescription.SUBMIT_ENTITY); + throw new CoreException( + new SubmitUncompletedLicenseModelErrorBuilder(SUBMIT_UNCOMPLETED_VLM_MSG_FG_MISSING_EP).build()); + } + }); } - } - } } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/VendorLicenseArtifactsServiceImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/VendorLicenseArtifactsServiceImpl.java index d91a5107af..7d2cdc5474 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/VendorLicenseArtifactsServiceImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/VendorLicenseArtifactsServiceImpl.java @@ -20,6 +20,7 @@ package org.openecomp.sdc.vendorlicense.licenseartifacts.impl; +import org.apache.commons.collections.CollectionUtils; import org.openecomp.core.utilities.file.FileContentHandler; import org.openecomp.sdc.common.utils.CommonUtil; import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; @@ -41,6 +42,7 @@ import org.openecomp.sdc.versioning.dao.types.Version; import java.util.Collection; import java.util.HashSet; import java.util.List; +import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; @@ -74,11 +76,15 @@ public class VendorLicenseArtifactsServiceImpl implements VendorLicenseArtifacts for(EntitlementPoolEntity entitlementPoolEntity : entitlementPoolEntities){ entitlementPoolEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, vlmVersion, entitlementPoolEntity.getId(), user)); + entitlementPoolEntity.setManufacturerReferenceNumber(featureGroupModel. + getEntityManufacturerReferenceNumber()); } Set<LicenseKeyGroupEntity> licenseKeyGroupEntities = featureGroupModel.getLicenseKeyGroups(); for(LicenseKeyGroupEntity licenseKeyGroupEntity : licenseKeyGroupEntities){ licenseKeyGroupEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, vlmVersion, licenseKeyGroupEntity.getId(), user)); + licenseKeyGroupEntity.setManufacturerReferenceNumber(featureGroupModel. + getEntityManufacturerReferenceNumber()); } featureGroupModel.setEntitlementPools(entitlementPoolEntities.stream().map( @@ -109,18 +115,29 @@ public class VendorLicenseArtifactsServiceImpl implements VendorLicenseArtifacts for (Version finalVersion : finalVersions) { Collection<EntitlementPoolEntity> coll = vendorLicenseFacade.listEntitlementPools(vlmId, finalVersion, user); - for(EntitlementPoolEntity entitlementPoolEntity : coll){ + coll.stream().forEach( entitlementPoolEntity -> { entitlementPoolEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, finalVersion, entitlementPoolEntity.getId(), user)); - } + Optional<String> manufacturerReferenceNumber = getFeatureGroupManufactureRefNumber + (entitlementPoolEntity.getReferencingFeatureGroups(), vlmId, finalVersion, user); + manufacturerReferenceNumber.ifPresent(mrn -> entitlementPoolEntity + .setManufacturerReferenceNumber(mrn)); + }); + entitlementPoolEntities.addAll(coll); Collection<LicenseKeyGroupEntity> coll2 = vendorLicenseFacade.listLicenseKeyGroups(vlmId, finalVersion, user); - for(LicenseKeyGroupEntity licenseKeyGroupEntity : coll2){ + + coll2.stream().forEach( licenseKeyGroupEntity -> { licenseKeyGroupEntity.setLimits(vendorLicenseFacade.listLimits(vlmId, finalVersion, licenseKeyGroupEntity.getId(), user)); - } + Optional<String> manufacturerReferenceNumber = getFeatureGroupManufactureRefNumber + (licenseKeyGroupEntity.getReferencingFeatureGroups(), vlmId, finalVersion, user); + manufacturerReferenceNumber.ifPresent(mrn -> licenseKeyGroupEntity + .setManufacturerReferenceNumber(mrn)); + }); + licenseKeyGroupEntities.addAll(coll2); } @@ -138,6 +155,23 @@ public class VendorLicenseArtifactsServiceImpl implements VendorLicenseArtifacts return vendorLicenseArtifact.toXml().getBytes(); } + private static Optional<String> getFeatureGroupManufactureRefNumber(Set<String> featureGroupIds, + String vlmId, Version finalVersion, String user) { + String manufactureReferenceNumber = null; + if (CollectionUtils.isNotEmpty(featureGroupIds)) { + Object[] featureGroupIdsList = featureGroupIds.toArray(); + if (featureGroupIdsList != null && featureGroupIdsList.length > 0) { + FeatureGroupEntity featureGroup = + vendorLicenseFacade.getFeatureGroup(new FeatureGroupEntity(vlmId, finalVersion, + featureGroupIdsList[0].toString()), user); + manufactureReferenceNumber = featureGroup != null ? featureGroup + .getManufacturerReferenceNumber() : null; + } + } + return manufactureReferenceNumber != null ? Optional.of(manufactureReferenceNumber) : + Optional.empty(); + } + /** * Create License Artifacts. diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVendorLicenseArtifact.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVendorLicenseArtifact.java index 936f4da2a7..dc0db0d96c 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVendorLicenseArtifact.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVendorLicenseArtifact.java @@ -35,6 +35,7 @@ import org.openecomp.sdc.vendorlicense.dao.types.AggregationFunction; import org.openecomp.sdc.vendorlicense.dao.types.xml.AggregationFunctionForXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.EntitlementMetricForXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.EntitlementTimeForXml; +import org.openecomp.sdc.vendorlicense.dao.types.xml.OperationalScopeForXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.ThresholdForXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitForXml; @@ -64,10 +65,10 @@ public abstract class MixinEntitlementPoolEntityForVendorLicenseArtifact { @JsonProperty(value = "version") abstract String getVersionForArtifact(); - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty(value = "start-date") abstract String getStartDate(); - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty(value = "expiry-date") abstract String getExpiryDate(); @JsonIgnore @@ -93,9 +94,8 @@ public abstract class MixinEntitlementPoolEntityForVendorLicenseArtifact { @JsonIgnore abstract String getEntityType(); - @JacksonXmlProperty(localName = "value") - @JacksonXmlElementWrapper(localName = "operational-scope") - abstract String getOperationalScopeForArtifact(); + @JsonProperty(value = "operational-scope") + abstract OperationalScopeForXml getOperationalScopeForArtifact(); @JsonIgnore abstract ChoiceOrOther<OperationalScope> getOperationalScope(); diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVnfArtifact.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVnfArtifact.java index 1a29d5b2c9..8a2d17d9ff 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVnfArtifact.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinEntitlementPoolEntityForVnfArtifact.java @@ -34,6 +34,7 @@ import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope; import org.openecomp.sdc.vendorlicense.dao.types.xml.AggregationFunctionForXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.EntitlementMetricForXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.EntitlementTimeForXml; +import org.openecomp.sdc.vendorlicense.dao.types.xml.OperationalScopeForXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.ThresholdForXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitForXml; @@ -74,10 +75,10 @@ public abstract class MixinEntitlementPoolEntityForVnfArtifact { @JsonIgnore abstract float getThresholdValue(); - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty(value = "start-date") abstract String getStartDate(); - @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty(value = "expiry-date") abstract String getExpiryDate(); @JsonIgnore @@ -92,9 +93,8 @@ public abstract class MixinEntitlementPoolEntityForVnfArtifact { @JsonIgnore abstract String getEntityType(); - @JacksonXmlProperty(isAttribute = false, localName = "value") - @JacksonXmlElementWrapper(localName = "operational-scope") - abstract String getOperationalScopeForArtifact(); + @JsonProperty(value = "operational-scope") + abstract OperationalScopeForXml getOperationalScopeForArtifact(); @JsonIgnore abstract ChoiceOrOther<OperationalScope> getOperationalScope(); diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinFeatureGroupModel.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinFeatureGroupModel.java index 75beee4c6a..b8c45ba4c6 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinFeatureGroupModel.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinFeatureGroupModel.java @@ -41,9 +41,6 @@ public abstract class MixinFeatureGroupModel { @JacksonXmlProperty(isAttribute = false, localName = "part-number") abstract String getEntityPartNumber(); - @JacksonXmlProperty(isAttribute = false, localName = "manufacturer-reference-number") - abstract String getManufacturerReferenceNumber(); - @JacksonXmlProperty(isAttribute = false, localName = "feature-group-uuid") abstract String getEntityId(); @@ -60,5 +57,8 @@ public abstract class MixinFeatureGroupModel { @JsonIgnore abstract String getEntityType(); + @JsonIgnore + abstract String getEntityManufacturerReferenceNumber(); + } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVendorLicenseArtifact.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVendorLicenseArtifact.java index 6238988ece..78bf531e82 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVendorLicenseArtifact.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVendorLicenseArtifact.java @@ -21,6 +21,7 @@ package org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; @@ -28,6 +29,8 @@ import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther; import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity; import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope; import org.openecomp.sdc.vendorlicense.dao.types.xml.LicenseKeyTypeForXml; +import org.openecomp.sdc.vendorlicense.dao.types.xml.OperationalScopeForXml; +import org.openecomp.sdc.vendorlicense.dao.types.xml.ThresholdForXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitForXml; import java.util.Collection; @@ -60,9 +63,8 @@ public abstract class MixinLicenseKeyGroupEntityForVendorLicenseArtifact { @JsonIgnore abstract ChoiceOrOther<OperationalScope> getOperationalScope(); - @JacksonXmlProperty(isAttribute = false, localName = "value") - @JacksonXmlElementWrapper(localName = "operational-scope") - abstract String getOperationalScopeForArtifact(); + @JsonProperty(value = "operational-scope") + abstract OperationalScopeForXml getOperationalScopeForArtifact(); @JsonIgnore @@ -80,4 +82,19 @@ public abstract class MixinLicenseKeyGroupEntityForVendorLicenseArtifact { @JsonIgnore abstract Collection<LimitEntity> getLimits(); + @JsonProperty(value = "start-date") + abstract String getStartDate(); + + @JsonProperty(value = "expiry-date") + abstract String getExpiryDate(); + + @JsonProperty(value = "threshold-value") + abstract ThresholdForXml getThresholdForArtifact(); + + @JsonIgnore + abstract String getThresholdUnits(); + + @JsonIgnore + abstract float getThresholdValue(); + } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVnfArtifact.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVnfArtifact.java index 80ae054db0..b25b93ff7c 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVnfArtifact.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/mixins/MixinLicenseKeyGroupEntityForVnfArtifact.java @@ -21,6 +21,7 @@ package org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types.mixins; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; @@ -29,6 +30,8 @@ import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity; import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope; import org.openecomp.sdc.vendorlicense.dao.types.xml.LicenseKeyTypeForXml; import org.openecomp.sdc.vendorlicense.dao.types.xml.LimitForXml; +import org.openecomp.sdc.vendorlicense.dao.types.xml.OperationalScopeForXml; +import org.openecomp.sdc.vendorlicense.dao.types.xml.ThresholdForXml; import java.util.Collection; import java.util.Set; @@ -37,6 +40,9 @@ public abstract class MixinLicenseKeyGroupEntityForVnfArtifact { @JsonIgnore abstract String getId(); + @JsonProperty(value = "manufacturer-reference-number") + abstract String getManufacturerReferenceNumber(); + @JsonIgnore abstract Set<String> getReferencingFeatureGroups(); @@ -63,9 +69,8 @@ public abstract class MixinLicenseKeyGroupEntityForVnfArtifact { @JsonIgnore abstract ChoiceOrOther<OperationalScope> getOperationalScope(); - @JacksonXmlProperty(isAttribute = false, localName = "value") - @JacksonXmlElementWrapper(localName = "operational-scope") - abstract String getOperationalScopeForArtifact(); + @JsonProperty(value = "operational-scope") + abstract OperationalScopeForXml getOperationalScopeForArtifact(); @JsonIgnore @@ -74,6 +79,8 @@ public abstract class MixinLicenseKeyGroupEntityForVnfArtifact { @JsonIgnore abstract String getVersionableId(); + @JsonProperty(value = "threshold-value") + abstract ThresholdForXml getThresholdForArtifact(); @JsonProperty(value = "sp-limits") abstract LimitForXml getSPLimits(); @@ -83,4 +90,15 @@ public abstract class MixinLicenseKeyGroupEntityForVnfArtifact { @JsonIgnore abstract Collection<LimitEntity> getLimits(); + @JsonProperty(value = "start-date") + abstract String getStartDate(); + + @JsonProperty(value = "expiry-date") + abstract String getExpiryDate(); + + @JsonIgnore + abstract String getThresholdUnits(); + + @JsonIgnore + abstract float getThresholdValue(); } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/pom.xml.versionsBackup deleted file mode 100644 index 0b6ebb62d8..0000000000 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,23 +0,0 @@ -<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> - - <name>openecomp-sdc-vendor-license-lib</name> - <artifactId>openecomp-sdc-vendor-license-lib</artifactId> - - <packaging>pom</packaging> - <parent> - <artifactId>openecomp-sdc-lib</artifactId> - <groupId>org.openecomp.sdc</groupId> - <version>1.0-SNAPSHOT</version> - </parent> - - <modules> - <module>openecomp-sdc-vendor-license-api</module> - <module>openecomp-sdc-vendor-license-core</module> - </modules> - - <dependencies> - - </dependencies> -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/pom.xml.versionsBackup deleted file mode 100644 index 67f6a45c0d..0000000000 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/pom.xml.versionsBackup +++ /dev/null @@ -1,67 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - 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> - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-vendor-software-product-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - - <artifactId>openecomp-sdc-vendor-software-product-api</artifactId> - <version>1.0-SNAPSHOT</version> - - - <dependencies> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-core-lib</artifactId> - <type>pom</type> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-facade-core</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-nosqldb-core</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-versioning-core</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-translator-core</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-enrichment-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-model-core</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.freemarker</groupId> - <artifactId>freemarker</artifactId> - <version>2.3.25-incubating</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-config-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - </dependencies> - - -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductConstants.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductConstants.java index 42dd0086c7..8010c40023 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductConstants.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductConstants.java @@ -29,7 +29,7 @@ public final class VendorSoftwareProductConstants { public static final String INFORMATION_ARTIFACT_NAME = "VSP_%s_Information.txt"; public static final String UNSUPPORTED_OPERATION_ERROR = "An error has occurred: Unsupported operation for 1707 release."; - + public static final String NAME_PATTERN = "^[a-zA-Z0-9_]*$"; public final class UniqueValues { public static final String VENDOR_SOFTWARE_PRODUCT_NAME = "Vendor Software Product name"; diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/composition/CompositionEntityDataManager.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/composition/CompositionEntityDataManager.java index 6c636fddf0..b77012e5cf 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/composition/CompositionEntityDataManager.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/composition/CompositionEntityDataManager.java @@ -87,7 +87,5 @@ public interface CompositionEntityDataManager { componentId); public void saveImagesByComponent(String vspId, Version version, Component component, String componentId); - public void saveDeploymentFlavors(String vspId, Version version, - CompositionData compositionData); } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml index 343f4aef62..afee456fc3 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml @@ -116,6 +116,16 @@ <artifactId>openecomp-tosca-datatype</artifactId> <version>${openecomp.sdc.common.version}</version> </dependency> + <dependency> + <groupId>org.openecomp.sdc</groupId> + <artifactId>openecomp-sdc-tosca-generator-api</artifactId> + <version>1.1.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.openecomp.sdc</groupId> + <artifactId>openecomp-sdc-vendor-license-api</artifactId> + <version>1.1.0-SNAPSHOT</version> + </dependency> </dependencies> <build> diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml.versionsBackup deleted file mode 100644 index 634e0874ac..0000000000 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml.versionsBackup +++ /dev/null @@ -1,108 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - 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>openecomp-sdc-vendor-software-product-core</artifactId> - <version>1.0-SNAPSHOT</version> - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-vendor-software-product-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - - <dependencies> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-vendor-software-product-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-nosqldb-api</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.freemarker</groupId> - <artifactId>freemarker</artifactId> - <version>2.3.23</version> - </dependency> - <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <version>${testng.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-config-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-model-impl</artifactId> - <version>1.0-SNAPSHOT</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.xmlgraphics</groupId> - <artifactId>fop</artifactId> - <version>2.1</version> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.dataformat</groupId> - <artifactId>jackson-dataformat-xml</artifactId> - <version>2.7.4</version> - </dependency> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <version>2.5</version> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <version>1.10.19</version> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.12</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.openecomp.sdc.common</groupId> - <artifactId>openecomp-configuration-management-core</artifactId> - <version>1707.0.0-SNAPSHOT</version> - <scope>runtime</scope> - <exclusions> - <exclusion> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.openecomp.sdc.common</groupId> - <artifactId>openecomp-configuration-management-api</artifactId> - <version>1707.0.0-SNAPSHOT</version> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>2.19.1</version> - <configuration> - <useSystemClassLoader>false</useSystemClassLoader> - <redirectTestOutputToFile>true</redirectTestOutputToFile> - </configuration> - </plugin> - </plugins> - </build> - -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductErrorCodes.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductErrorCodes.java index 5284b9a74f..d87059e89c 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductErrorCodes.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductErrorCodes.java @@ -64,6 +64,7 @@ public class VendorSoftwareProductErrorCodes { "VSP_ONBOARD_METHOD_UPDATE_NOT_ALLOWED"; public static final String DUPLICATE_NIC_NAME_NOT_ALLOWED = "DUPLICATE_NIC_NAME_NOT_ALLOWED"; + public static final String NIC_NAME_FORMAT_NOT_ALLOWED = "NIC_NAME_FORMAT_NOT_ALLOWED"; public static final String NULL_NETWORKID_NOT_ALLOWED = "NULL_NETWORKID_NOT_ALLOWED"; @@ -102,6 +103,7 @@ public class VendorSoftwareProductErrorCodes { ADD_IMAGE_NOT_ALLOWED_IN_HEAT_ONBOARDING = "ADD_IMAGE_NOT_ALLOWED_IN_HEAT_ONBOARDING"; public static final String DUPLICATE_IMAGE_NAME_NOT_ALLOWED = "DUPLICATE_IMAGE_NAME_NOT_ALLOWED"; + public static final String IMAGE_NAME_FORMAT_NOT_ALLOWED = "IMAGE_NAME_FORMAT_NOT_ALLOWED"; public static final String VFC_IMAGE_INVALID_FORMAT = "VFC_IMAGE_INVALID_FORMAT"; public static final String FEATURE_GROUP_NOT_EXIST_FOR_VSP = "FEATURE_GROUP_NOT_EXIST_FOR_VSP"; @@ -115,8 +117,11 @@ public class VendorSoftwareProductErrorCodes { = "SAME_VFC_ASSOCIATION_MORE_THAN_ONCE_NOT_ALLOWED"; public static final String DUPLICATE_DEPLOYMENT_FLAVOR_MODEL_NOT_ALLOWED = "DUPLICATE_DEPLOYMENT_FLAVOR_MODEL_NOT_ALLOWED"; + public static final String DEPLOYMENT_FLAVOR_NAME_FORMAT_NOT_ALLOWED = + "DEPLOYMENT_FLAVOR_NAME_FORMAT_NOT_ALLOWED"; public static final String INVALID_COMPUTE_FLAVOR_ID = "INVALID_COMPUTE_FLAVOR_ID"; public static final String DUPLICATE_COMPUTE_NAME_NOT_ALLOWED = "DUPLICATE_COMPUTE_NAME_NOT_ALLOWED"; + public static final String COMPUTE_NAME_FORMAT_NOT_ALLOWED = "COMPUTE_NAME_FORMAT_NOT_ALLOWED"; public static final String DELETE_IMAGE_NOT_ALLOWED = "DELETE_IMAGE_NOT_ALLOWED"; public static final String UPDATE_IMAGE_NOT_ALLOWED = "UPDATE_IMAGE_NOT_ALLOWED"; diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/ManualVspDataCollectionService.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/ManualVspDataCollectionService.java index 981bfe941a..1499bccec2 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/ManualVspDataCollectionService.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/ManualVspDataCollectionService.java @@ -1,35 +1,40 @@ -package org.openecomp.sdc.vendorsoftwareproduct.utils; +package org.openecomp.sdc.vendorsoftwareproduct.services; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang.StringUtils; import org.openecomp.core.utilities.json.JsonUtil; +import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.generator.datatypes.tosca.ComputeFlavor; import org.openecomp.sdc.generator.datatypes.tosca.DeploymentFlavorModel; import org.openecomp.sdc.generator.datatypes.tosca.LicenseFlavor; import org.openecomp.sdc.generator.datatypes.tosca.MultiFlavorVfcImage; import org.openecomp.sdc.generator.datatypes.tosca.VendorInfo; +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.LoggerTragetServiceName; import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity; import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupModel; import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade; import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacadeFactory; -import org.openecomp.sdc.vendorsoftwareproduct.ComponentManager; -import org.openecomp.sdc.vendorsoftwareproduct.ComponentManagerFactory; -import org.openecomp.sdc.vendorsoftwareproduct.ComputeManager; -import org.openecomp.sdc.vendorsoftwareproduct.ComputeManagerFactory; -import org.openecomp.sdc.vendorsoftwareproduct.DeploymentFlavorManager; -import org.openecomp.sdc.vendorsoftwareproduct.DeploymentFlavorManagerFactory; -import org.openecomp.sdc.vendorsoftwareproduct.ImageManager; -import org.openecomp.sdc.vendorsoftwareproduct.ImageManagerFactory; -import org.openecomp.sdc.vendorsoftwareproduct.NicManager; -import org.openecomp.sdc.vendorsoftwareproduct.NicManagerFactory; -import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager; -import org.openecomp.sdc.vendorsoftwareproduct.VspManagerFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComputeEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.DeploymentFlavorEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ImageEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; -import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse; -import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentComputeAssociation; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.DeploymentFlavor; @@ -50,18 +55,19 @@ import java.util.Optional; public class ManualVspDataCollectionService { - private static final DeploymentFlavorManager deploymentFlavorManager = - DeploymentFlavorManagerFactory.getInstance().createInterface(); - private static final ComputeManager computeManager = - ComputeManagerFactory.getInstance().createInterface(); - private static final ImageManager imageManager = - ImageManagerFactory.getInstance().createInterface(); - private static final ComponentManager componentManager = - ComponentManagerFactory.getInstance().createInterface(); - private static final VendorSoftwareProductManager vendorSoftwareProductManager = - VspManagerFactory.getInstance().createInterface(); - private static final NicManager nicManager = - NicManagerFactory.getInstance().createInterface(); + private static final VendorSoftwareProductDao vendorSoftwareProductDao = + VendorSoftwareProductDaoFactory.getInstance().createInterface(); + private static final VendorSoftwareProductInfoDao vendorSoftwareProductInfoDao = + VendorSoftwareProductInfoDaoFactory.getInstance().createInterface(); + private static final ComputeDao computeDao = + ComputeDaoFactory.getInstance().createInterface(); + private static final ImageDao imageDao = + ImageDaoFactory.getInstance().createInterface(); + private static final ComponentDao componentDao = + ComponentDaoFactory.getInstance().createInterface(); + + private static final NicDao nicDao = + NicDaoFactory.getInstance().createInterface(); private static final VendorLicenseFacade vendorLicenseFacade = VendorLicenseFacadeFactory.getInstance().createInterface(); @@ -76,7 +82,7 @@ public class ManualVspDataCollectionService { */ public Optional<String> getReleaseVendor(String vspId, Version version, String user) { String vendorName = null; - VspDetails vspDetails = vendorSoftwareProductManager.getVsp(vspId, version, user); + VspDetails vspDetails = vendorSoftwareProductInfoDao.get(new VspDetails(vspId, version)); if (Objects.nonNull(vspDetails)) { vendorName = vspDetails.getVendorName(); } @@ -95,13 +101,13 @@ public class ManualVspDataCollectionService { String user) { Map<String, DeploymentFlavorModel> allowedFlavors = new HashMap<>(); Collection<DeploymentFlavorEntity> deploymentFlavorEntities = - deploymentFlavorManager.listDeploymentFlavors(vspId, version, user); + vendorSoftwareProductDao.listDeploymentFlavors(vspId, version); if (CollectionUtils.isNotEmpty(deploymentFlavorEntities)) { for (DeploymentFlavorEntity deploymentFlavorEntity : deploymentFlavorEntities) { DeploymentFlavor deploymentFlavorCompositionData = deploymentFlavorEntity.getDeploymentFlavorCompositionData(); - VspDetails vspDetails = vendorSoftwareProductManager.getVsp(vspId, version, user); + VspDetails vspDetails = vendorSoftwareProductInfoDao.get(new VspDetails(vspId, version)); String vspVlmId; Version vlmVersion; if (Objects.nonNull(vspDetails)) { @@ -123,8 +129,9 @@ public class ManualVspDataCollectionService { user); partNumber.ifPresent(deploymentFlavorModel::setSp_part_number); //Gather and set Vendor Info - Optional<VendorInfo> vendorInfo = getVendorInfo(vspVlmId, vlmVersion, featureGroupId, - user); + String vendorModel = deploymentFlavorCompositionData.getModel(); + Optional<VendorInfo> vendorInfo = getVendorInfo(vspVlmId, vendorModel, vlmVersion, + featureGroupId, user); vendorInfo.ifPresent(deploymentFlavorModel::setVendor_info); //Gather and set Compute info List<ComponentComputeAssociation> componentComputeAssociations = @@ -161,7 +168,7 @@ public class ManualVspDataCollectionService { String user) { Map<String, List<MultiFlavorVfcImage>> vspComponentImages = new HashMap<>(); Collection<DeploymentFlavorEntity> deploymentFlavorEntities = - deploymentFlavorManager.listDeploymentFlavors(vspId, version, user); + vendorSoftwareProductDao.listDeploymentFlavors(vspId, version); for (DeploymentFlavorEntity deploymentFlavorEntity : deploymentFlavorEntities) { DeploymentFlavor deploymentFlavorCompositionData = deploymentFlavorEntity.getDeploymentFlavorCompositionData(); @@ -194,7 +201,7 @@ public class ManualVspDataCollectionService { public Map<String, String> getVspComponents(String vspId, Version version, String user) { Map<String, String> componentIdNameMap = new HashMap<>(); Collection<DeploymentFlavorEntity> deploymentFlavorEntities = - deploymentFlavorManager.listDeploymentFlavors(vspId, version, user); + vendorSoftwareProductDao.listDeploymentFlavors(vspId, version); for (DeploymentFlavorEntity deploymentFlavorEntity : deploymentFlavorEntities) { DeploymentFlavor deploymentFlavorCompositionData = deploymentFlavorEntity.getDeploymentFlavorCompositionData(); @@ -224,7 +231,7 @@ public class ManualVspDataCollectionService { public Map<String, List<Nic>> getVspComponentNics(String vspId, Version version, String user) { Map<String, List<Nic>> vspComponentNics = new HashMap<>(); Collection<DeploymentFlavorEntity> deploymentFlavorEntities = - deploymentFlavorManager.listDeploymentFlavors(vspId, version, user); + vendorSoftwareProductDao.listDeploymentFlavors(vspId, version); if (CollectionUtils.isNotEmpty(deploymentFlavorEntities)) { for (DeploymentFlavorEntity deploymentFlavorEntity : deploymentFlavorEntities) { DeploymentFlavor deploymentFlavorCompositionData = @@ -251,15 +258,14 @@ public class ManualVspDataCollectionService { private List<Nic> getComponentNics(String vspId, Version version, String componentId, String user) { List<Nic> componentNics = new ArrayList<>(); - Collection<NicEntity> nics = nicManager.listNics(vspId, version, componentId, user); + Collection<NicEntity> nics = nicDao.list(new NicEntity(vspId, version, componentId, null)); if (Objects.nonNull(nics)) { - for (NicEntity nicEntity : nics) { - String nicId = nicEntity.getId(); - CompositionEntityResponse<Nic> nicCompositionEntityResponse = - nicManager.getNic(vspId, version, componentId, nicId, user); - if (Objects.nonNull(nicCompositionEntityResponse) - && Objects.nonNull(nicCompositionEntityResponse.getData())) { - componentNics.add(nicCompositionEntityResponse.getData()); + for (NicEntity nic : nics) { + String nicId = nic.getId(); + NicEntity nicEntity = nicDao.get(new NicEntity(vspId, version, componentId, nicId)); + if (Objects.nonNull(nicEntity) + && Objects.nonNull(nicEntity.getCompositionData())) { + componentNics.add(nicEntity.getNicCompositionData()); } } } @@ -281,7 +287,7 @@ public class ManualVspDataCollectionService { return Optional.empty(); } - private Optional<VendorInfo> getVendorInfo(String vlmId, Version version, + private Optional<VendorInfo> getVendorInfo(String vlmId, String vendorModel, Version version, String featureGroupId, String user) { VendorInfo vendorInfo = null; FeatureGroupModel featureGroup = getFeatureGroup(vlmId, version, featureGroupId, user); @@ -289,7 +295,7 @@ public class ManualVspDataCollectionService { //Process Feature group to get Manufacturer ref no. String manufacturerReferenceNumber = featureGroup.getEntityManufacturerReferenceNumber(); vendorInfo = new VendorInfo(); - vendorInfo.setVendor_model(vlmId); + vendorInfo.setVendor_model(vendorModel); if (Objects.nonNull(manufacturerReferenceNumber)) { vendorInfo.setManufacturer_reference_number(manufacturerReferenceNumber); } @@ -301,21 +307,29 @@ public class ManualVspDataCollectionService { String componentId, String computeFlavorId, String user) { ComputeFlavor computeFlavor = null; - QuestionnaireResponse computeQuestionnaire; + ComputeEntity computeQuestionnaire = null; try { - computeQuestionnaire = computeManager.getComputeQuestionnaire(vspId, version, componentId, - computeFlavorId, user); + computeQuestionnaire = computeDao.getQuestionnaireData(vspId, version, componentId, + computeFlavorId); } catch (Exception ex) { computeQuestionnaire = null; + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API, + LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(), + LoggerErrorCode.DATA_ERROR.getErrorCode(), "Failed to get compute questionnaire : " + + ex.getMessage()); } if (Objects.nonNull(computeQuestionnaire)) { - String computeQuestionnaireData = computeQuestionnaire.getData(); + String computeQuestionnaireData = computeQuestionnaire.getQuestionnaireData(); if (Objects.nonNull(computeQuestionnaireData)) { Compute compute; try { compute = JsonUtil.json2Object(computeQuestionnaireData, Compute.class); } catch (Exception ex) { compute = null; + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API, + LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(), + LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to parse compute questionnaire : " + + ex.getMessage()); } if (Objects.nonNull(compute.getVmSizing())) { computeFlavor = new ComputeFlavor(); @@ -323,10 +337,10 @@ public class ManualVspDataCollectionService { computeFlavor.setNum_cpus(compute.getVmSizing().getNumOfCPUs()); } if (Objects.nonNull(compute.getVmSizing().getFileSystemSizeGB())) { - computeFlavor.setDisk_size(compute.getVmSizing().getFileSystemSizeGB() + "GB"); + computeFlavor.setDisk_size(compute.getVmSizing().getFileSystemSizeGB() + " GB"); } if (Objects.nonNull(compute.getVmSizing().getMemoryRAM())) { - computeFlavor.setMem_size(compute.getVmSizing().getMemoryRAM() + "GB"); + computeFlavor.setMem_size(compute.getVmSizing().getMemoryRAM()); } } } @@ -345,74 +359,63 @@ public class ManualVspDataCollectionService { private Optional<String> getComponentName(String vspId, Version version, String componentId, String user) { - CompositionEntityResponse<ComponentData> component = - componentManager.getComponent(vspId, version, componentId, user); - if (Objects.nonNull(component.getData())) { - return Optional.ofNullable(component.getData().getDisplayName()); + + ComponentEntity componentEntity = + componentDao.get(new ComponentEntity(vspId, version, componentId)); + if (Objects.nonNull(componentEntity) + && Objects.nonNull(componentEntity.getComponentCompositionData())) { + ComponentData componentCompositionData = componentEntity.getComponentCompositionData(); + return Optional.ofNullable(componentCompositionData.getDisplayName()); } return Optional.empty(); } private List<MultiFlavorVfcImage> getComponentImages(String vspId, Version version, String componentId, String user) { - List<MultiFlavorVfcImage> componentImages = new ArrayList<>(); + List<MultiFlavorVfcImage> multiFlavorVfcImages = new ArrayList<>(); MultiFlavorVfcImage multiFlavorVfcImage = null; - Collection<ImageEntity> imageEntities = - imageManager.listImages(vspId, version, componentId, user); - if (Objects.nonNull(imageEntities)) { - for (ImageEntity imageEntity : imageEntities) { - String imageId = imageEntity.getId(); - QuestionnaireResponse imageQuestionnaire = - imageManager.getImageQuestionnaire(vspId, version, componentId, imageId, user); - CompositionEntityResponse<Image> imageCompositionData = - imageManager.getImage(vspId, version, componentId, imageId, user); - if (Objects.nonNull(imageQuestionnaire) - && Objects.nonNull(imageQuestionnaire.getData()) + Collection<ImageEntity> componentImages = + vendorSoftwareProductDao.listImages(vspId, version, componentId); + if (Objects.nonNull(componentImages)) { + for (ImageEntity componentImage : componentImages) { + String imageId = componentImage.getId(); + ImageEntity imageEntity = vendorSoftwareProductDao.getImage(vspId, version, componentId, + imageId); + ImageEntity imageQuestionnaireDataEntity = imageDao.getQuestionnaireData(vspId, version, + componentId, imageId); + Image imageCompositionData = imageEntity.getImageCompositionData(); + if (Objects.nonNull(imageEntity) + && Objects.nonNull(imageQuestionnaireDataEntity) && Objects.nonNull(imageCompositionData)) { ImageDetails imageDetails; try { - imageDetails = JsonUtil.json2Object(imageQuestionnaire.getData(), - ImageDetails.class); + imageDetails = JsonUtil.json2Object(imageQuestionnaireDataEntity + .getQuestionnaireData(), ImageDetails.class); } catch (Exception ex) { imageDetails = null; + MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API, + LoggerTragetServiceName.COLLECT_MANUAL_VSP_TOSCA_DATA, ErrorLevel.INFO.name(), + LoggerErrorCode.DATA_ERROR.getErrorCode(), "Unable to parse image questionnaire : " + + ex.getMessage()); } if (Objects.nonNull(imageDetails) && Objects.nonNull(imageDetails.getVersion())) { //Image version is used as a key for the image block //So excluding the population if questionnaire data is absent or invalid multiFlavorVfcImage = new MultiFlavorVfcImage(); - Image image = imageCompositionData.getData(); - Optional<String> toscaImageFileName = getToscaImageFileName(image, imageDetails); - toscaImageFileName.ifPresent(multiFlavorVfcImage::setFile_name); multiFlavorVfcImage.setSoftware_version(imageDetails.getVersion()); + if (Objects.nonNull(imageCompositionData.getFileName())) { + multiFlavorVfcImage.setFile_name(imageCompositionData.getFileName()); + } if (Objects.nonNull(imageDetails.getMd5())) { multiFlavorVfcImage.setFile_hash(imageDetails.getMd5()); } multiFlavorVfcImage.setFile_hash_type("md5"); - componentImages.add(multiFlavorVfcImage); + multiFlavorVfcImages.add(multiFlavorVfcImage); } } } } - return componentImages; - } - - private Optional<String> getToscaImageFileName(Image image, ImageDetails imageDetails) { - String toscaImageFileName = null; - StringBuilder builder = new StringBuilder(); - if (Objects.nonNull(image.getFileName())) { - builder.append(image.getFileName()); - builder.append("-"); - builder.append(imageDetails.getVersion()); - if (Objects.nonNull(imageDetails.getFormat())) { - builder.append("."); - builder.append(imageDetails.getFormat()); - } - } - toscaImageFileName = builder.toString(); - if (toscaImageFileName.isEmpty()) { - return Optional.empty(); - } - return Optional.ofNullable(toscaImageFileName); + return multiFlavorVfcImages; } } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImpl.java index 6b55ffc714..a16fea19ab 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImpl.java @@ -338,7 +338,7 @@ public class CompositionDataExtractorImpl implements CompositionDataExtractor { if (obj instanceof String) { images.add((String) obj); } else { - HashMap<String,String> objMap = new ObjectMapper().convertValue(obj,HashMap.class); + Map<String,String> objMap = new ObjectMapper().convertValue(obj,Map.class); images.add(getInputs(toscaServiceModel,objMap.get("get_input"))); } } @@ -364,7 +364,7 @@ public class CompositionDataExtractorImpl implements CompositionDataExtractor { if (obj instanceof String) { computes.add((String) obj); } else { - HashMap<String, String> objMap = new ObjectMapper().convertValue(obj, HashMap.class); + Map<String, String> objMap = new ObjectMapper().convertValue(obj, Map.class); computes.add(getInputs(toscaServiceModel, objMap.get("get_input"))); } } @@ -387,7 +387,13 @@ public class CompositionDataExtractorImpl implements CompositionDataExtractor { for (Map.Entry<String, ParameterDefinition> inputEntry : serviceTemplate .getTopology_template().getInputs().entrySet()) { if (inputEntry.getKey().equals(inputValue)) { - return (String)inputEntry.getValue().get_default(); + String value; + try { + value= (String) inputEntry.getValue().get_default(); + } catch (Exception e) { + value = inputEntry.getValue().get_default().toString(); + } + return value; } } } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionEntityDataManagerImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionEntityDataManagerImpl.java index 71f5fa1d41..7d5d57dc37 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionEntityDataManagerImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionEntityDataManagerImpl.java @@ -224,7 +224,6 @@ public class CompositionEntityDataManagerImpl implements CompositionEntityDataMa Map<String, String> networkIdByName = saveNetworks(vspId, version, compositionData); saveComponents(vspId, version, compositionData, networkIdByName); - saveDeploymentFlavors(vspId, version, compositionData); mdcDataDebugMessage.debugExitMessage(null); } @@ -688,38 +687,4 @@ public class CompositionEntityDataManagerImpl implements CompositionEntityDataMa } } - public void saveDeploymentFlavors(String vspId, Version version, - CompositionData compositionData) { - - mdcDataDebugMessage.debugEntryMessage(null, null); - - if (CollectionUtils.isNotEmpty(compositionData.getComponents())) { - DeploymentFlavorEntity deploymentFlavorEntity = new DeploymentFlavorEntity(vspId, version, - null); - DeploymentFlavor deploymentFlavor = new DeploymentFlavor(); - VspDetails vendorSoftwareProductInfo = - vspInfoDao.get(new VspDetails(vspId, version)); - if (vendorSoftwareProductInfo.getName() != null) { - deploymentFlavor.setModel(vendorSoftwareProductInfo.getName()); - List<ComponentComputeAssociation> componentComputeAssociationList = new ArrayList<>(); - Collection<ComputeEntity> computes= vendorSoftwareProductDao.listComputesByVsp(vspId, - version); - for (ComputeEntity compute : computes) { - ComponentComputeAssociation componentComputeAssociation = new - ComponentComputeAssociation(); - if (compute.getComponentId() != null && compute.getId() != null){ - componentComputeAssociation.setComponentId(compute.getComponentId()); - componentComputeAssociation.setComputeFlavorId(compute.getId()); - componentComputeAssociationList.add(componentComputeAssociation); - } - } - deploymentFlavor.setComponentComputeAssociations(componentComputeAssociationList); - } - deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor); - createDeploymentFlavor(deploymentFlavorEntity); - } - - mdcDataDebugMessage.debugExitMessage(null, null); - } - } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/pom.xml.versionsBackup deleted file mode 100644 index a1ee8d3985..0000000000 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - 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>openecomp-sdc-vendor-software-product-lib</artifactId> - <packaging>pom</packaging> - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - - - <modules> - <module>openecomp-sdc-vendor-software-product-api</module> - <module>openecomp-sdc-vendor-software-product-core</module> - </modules> - - -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/pom.xml.versionsBackup deleted file mode 100644 index 3c9a34a189..0000000000 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/pom.xml.versionsBackup +++ /dev/null @@ -1,75 +0,0 @@ -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - 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> - - <name>openecomp-sdc-versioning-api</name> - <artifactId>openecomp-sdc-versioning-api</artifactId> - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-lib</artifactId> - <version>1.0-SNAPSHOT</version> - <relativePath>../..</relativePath> - </parent> - <dependencies> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-facade-core</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-facade-api</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-nosqldb-core</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-validator</artifactId> - <version>${hibernate.validator.version}</version> - </dependency> - <dependency> - <groupId>javax.el</groupId> - <artifactId>javax.el-api</artifactId> - <version>${javax.el-api.version}</version> - </dependency> - <dependency> - <groupId>org.glassfish.web</groupId> - <artifactId>javax.el</artifactId> - <version>2.2.4</version> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <scope>test</scope> - <version>1.10.19</version> - </dependency> - <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <scope>test</scope> - <version>6.8.5</version> - <exclusions> - <exclusion> - <artifactId>snakeyaml</artifactId> - <groupId>org.yaml</groupId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - <version>4.11</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-logging-core</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - </dependencies> -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/pom.xml.versionsBackup deleted file mode 100644 index ce41a59e20..0000000000 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/pom.xml.versionsBackup +++ /dev/null @@ -1,54 +0,0 @@ -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - 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> - - <name>openecomp-sdc-versioning-core</name> - <artifactId>openecomp-sdc-versioning-core</artifactId> - - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-lib</artifactId> - <version>1.0-SNAPSHOT</version> - <relativePath>../..</relativePath> - </parent> - <dependencies> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-versioning-api</artifactId> - <version>${project.version}</version> - </dependency> - - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <scope>test</scope> - <version>1.10.19</version> - </dependency> - <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <scope>test</scope> - <version>6.8.5</version> - <exclusions> - <exclusion> - <artifactId>snakeyaml</artifactId> - <groupId>org.yaml</groupId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - <version>4.11</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-logging-core</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - </dependencies> - -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-versioning-lib/pom.xml.versionsBackup deleted file mode 100644 index 7804ebfabc..0000000000 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,24 +0,0 @@ -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - 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> - - <name>openecomp-sdc-versioning-lib</name> - <artifactId>openecomp-sdc-versioning-lib</artifactId> - - <packaging>pom</packaging> - <parent> - <artifactId>openecomp-sdc-lib</artifactId> - <groupId>org.openecomp.sdc</groupId> - <version>1.0-SNAPSHOT</version> - </parent> - - <modules> - <module>openecomp-sdc-versioning-api</module> - <module>openecomp-sdc-versioning-core</module> - </modules> - - <dependencies> - - </dependencies> -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-tosca-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-tosca-lib/pom.xml.versionsBackup deleted file mode 100644 index be3c3509ad..0000000000 --- a/openecomp-be/lib/openecomp-tosca-lib/pom.xml.versionsBackup +++ /dev/null @@ -1,87 +0,0 @@ -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://maven.apache.org/POM/4.0.0" - 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> - - <groupId>org.openecomp.core</groupId> - <name>openecomp-tosca-lib</name> - <dependencies> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-utilities-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-datatypes-lib</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.core</groupId> - <artifactId>openecomp-common-lib</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <version>${logback.version}</version> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>RELEASE</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-logging-core</artifactId> - <version>1.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc.common</groupId> - <artifactId>openecomp-configuration-management-core</artifactId> - <version>1707.0.0-SNAPSHOT</version> - <scope>runtime</scope> - <exclusions> - <exclusion> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.openecomp.sdc.common</groupId> - <artifactId>openecomp-configuration-management-api</artifactId> - <version>1707.0.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc.common</groupId> - <artifactId>openecomp-tosca-datatype</artifactId> - <version>1707.0.0-SNAPSHOT</version> - </dependency> - </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>2.19.1</version> - <configuration> - <useSystemClassLoader>false</useSystemClassLoader> - <redirectTestOutputToFile>true</redirectTestOutputToFile> - </configuration> - </plugin> - </plugins> - </build> - - - <artifactId>openecomp-tosca-lib</artifactId> - - <parent> - <artifactId>openecomp-sdc-lib</artifactId> - <groupId>org.openecomp.sdc</groupId> - <version>1.0-SNAPSHOT</version> - </parent> - - -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaNodeType.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaNodeType.java index b5b3e172fe..745f77f7f5 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaNodeType.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaNodeType.java @@ -87,6 +87,6 @@ public class ToscaNodeType { public static String VNF_CONFIG_NODE_TYPE = ABSTRACT_NODE_TYPE_PREFIX + "VnfConfiguration"; public static String MULTIFLAVOR_VFC_NODE_TYPE = ABSTRACT_NODE_TYPE_PREFIX + "MultiFlavorVFC"; public static String MULTIDEPLOYMENTFLAVOR_NODE_TYPE = ABSTRACT_NODE_TYPE_PREFIX - + "MultiDeploymentFlavor"; + + "MultiDeploymentFlavor.CVFC"; } diff --git a/openecomp-be/lib/pom.xml.versionsBackup b/openecomp-be/lib/pom.xml.versionsBackup deleted file mode 100644 index 18594461f4..0000000000 --- a/openecomp-be/lib/pom.xml.versionsBackup +++ /dev/null @@ -1,33 +0,0 @@ -<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> - - <name>openecomp-sdc-lib</name> - <artifactId>openecomp-sdc-lib</artifactId> - - <packaging>pom</packaging> - <parent> - <artifactId>openecomp-sdc</artifactId> - <groupId>org.openecomp.sdc</groupId> - <version>1.0-SNAPSHOT</version> - </parent> - - <modules> - <module>openecomp-core-lib</module> - <module>openecomp-common-lib</module> - <module>openecomp-sdc-versioning-lib</module> - <module>openecomp-sdc-vendor-license-lib</module> - <module>openecomp-sdc-vendor-software-product-lib</module> - <module>openecomp-sdc-translator-lib</module> - <module>openecomp-sdc-model-lib</module> - <module>openecomp-sdc-validation-lib</module> - <module>openecomp-sdc-datatypes-lib</module> - <module>openecomp-heat-lib</module> - <module>openecomp-tosca-lib</module> - <module>openecomp-sdc-action-lib</module> - <module>openecomp-sdc-enrichment-lib</module> - <module>openecomp-logging-lib</module> - <module>openecomp-healing-lib</module> - <module>openecomp-migration-lib</module> - </modules> -</project>
\ No newline at end of file diff --git a/openecomp-be/tools/install/database/schemaTemplates/questionnaire/compute.ftl b/openecomp-be/tools/install/database/schemaTemplates/questionnaire/compute.ftl index 3dc85cf192..748f4da23e 100644 --- a/openecomp-be/tools/install/database/schemaTemplates/questionnaire/compute.ftl +++ b/openecomp-be/tools/install/database/schemaTemplates/questionnaire/compute.ftl @@ -40,12 +40,12 @@ "memoryRAM": { "type": "string", "enum": [ - "1", - "2", - "4", - "8" + "1 GB", + "2 GB", + "4 GB", + "8 GB" ], - "default": "1" + "default": "1 GB" } }, "additionalProperties": false diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/EntitlementPoolConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/EntitlementPoolConvertor.java index c8037cecf4..86faf15837 100644 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/EntitlementPoolConvertor.java +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/EntitlementPoolConvertor.java @@ -77,13 +77,10 @@ public class EntitlementPoolConvertor { info.setDescription(entitlementPool.getDescription()); info.addProperty("thresholdValue", entitlementPool.getThresholdValue()); info.addProperty("threshold_unit", entitlementPool.getThresholdUnit()); - info.addProperty("entitlement_metric", entitlementPool.getEntitlementMetric()); + //info.addProperty("entitlement_metric", entitlementPool.getEntitlementMetric()); info.addProperty("increments", entitlementPool.getIncrements()); - info.addProperty("aggregation_func", entitlementPool.getAggregationFunction()); info.addProperty("operational_scope", entitlementPool.getOperationalScope()); - info.addProperty("EntitlementTime", entitlementPool.getTime()); - info.addProperty("manufacturerReferenceNumber", - entitlementPool.getManufacturerReferenceNumber()); + return info; } diff --git a/openecomp-be/tools/migration/cassandra2zusammen.sh b/openecomp-be/tools/migration/cassandra2zusammen.sh index 6ef90ad3bf..99853b8336 100644 --- a/openecomp-be/tools/migration/cassandra2zusammen.sh +++ b/openecomp-be/tools/migration/cassandra2zusammen.sh @@ -9,7 +9,6 @@ # change exist package and service templates in db -java -Dlog.home=/apps/jetty/base/be/logs -Dconfiguration.yaml=/apps/jetty/base/be/config/catalog-be/configuration.yaml -jar openecomp-zusammen-migration-1.0-SNAPSHOT.jar org.openecomp.core.migration.MigrationMain - -STATUS="${?}" -echo "${STATUS}" +## Code removed but script is kept for future hook use ## +##STATUS="${?}" +##echo "${STATUS}" diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ExportDataCommand.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ExportDataCommand.java index b92ba52000..685f70db98 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ExportDataCommand.java +++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ExportDataCommand.java @@ -18,6 +18,10 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import static java.nio.file.Files.createDirectories; public class ExportDataCommand { @@ -25,6 +29,8 @@ public class ExportDataCommand { public static void exportData(SessionContext context, String filterItem) { try { + Set<String> filteredItem = new HashSet<>(); + filteredItem.add(filterItem); ImportProperties.initParams(); CassandraConnectionInitializer.setCassandraConnectionPropertiesToSystem(); Path rootDir = Paths.get(ImportProperties.ROOT_DIRECTORY); @@ -32,10 +38,10 @@ public class ExportDataCommand { if (filterItem != null) { filterItem = filterItem.replaceAll("\\r", ""); } - new ItemHandler().createItemsData(context, filterItem); - new VersionHandler().loadVersions(filterItem); - new ElementHandler().loadElements(filterItem); - zipPath(rootDir,filterItem); + new ItemHandler().createItemsData(context, filteredItem); + new VersionHandler().loadVersions(filteredItem); + new ElementHandler().loadElements(filteredItem); + zipPath(rootDir,filteredItem); FileUtils.forceDelete(rootDir.toFile()); } catch (Exception ex) { logger.error(ex.getMessage(), ex); @@ -43,12 +49,14 @@ public class ExportDataCommand { } } - private static void zipPath(Path rootDir,String filterItem ) throws Exception{ + private static void zipPath(Path rootDir,Set<String> filterItem ) throws Exception{ LocalDateTime date = LocalDateTime.now(); DateTimeFormatter formatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME; String dateStr = date.format(formatter); String zipFile = System.getProperty("user.home")+ File.separatorChar+"onboarding_import"+ dateStr + ".zip"; ZipUtils.createZip(zipFile, rootDir,filterItem); + logger.info("Exported file :" + zipFile); + System.out.println("Exported file :" + zipFile); } diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ElementHandler.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ElementHandler.java index ebce90fb4a..49eaaeaa76 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ElementHandler.java +++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ElementHandler.java @@ -10,6 +10,7 @@ import java.nio.ByteBuffer; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Objects; +import java.util.Set; import static java.io.File.separator; import static java.nio.file.Files.*; @@ -22,15 +23,16 @@ public class ElementHandler { public ElementHandler() { } - public void loadElements(String filteredItem) { + public void loadElements(Set<String> filteredItem) { ElementCassandraLoader elementCassandraLoader = new ElementCassandraLoader(); - elementCassandraLoader.list().forEach(elementEntity -> handleElementEntity(elementEntity,filteredItem)); + elementCassandraLoader.list().forEach(elementEntity -> handleElementEntity(elementEntity,filteredItem)); } - private void handleElementEntity(ElementEntity elementEntity, String filteredItem) { + private void handleElementEntity(ElementEntity elementEntity, Set<String> filteredItem) { try { String itemId = elementEntity.getItemId(); - if (filteredItem != null && !itemId.contains(filteredItem)){ + + if (!filteredItem.isEmpty() && !filteredItem.contains(itemId)){ return; } String versionId = elementEntity.getVersionId(); @@ -42,11 +44,18 @@ public class ElementHandler { if (!isNull(namespace)){ namespacePath = namespace.replace(ELEMENT_NAMESPACE_SPLITTER,separator)+separator; } - Path elementDirectoryPath = Paths.get( ROOT_DIRECTORY + separator + itemId - + separator + versionId + separator + space + separator + namespacePath+ separator + elementId); + Path elementDirectoryPath; + if (!isNull(namespace)){ + elementDirectoryPath = Paths.get( ROOT_DIRECTORY + separator + itemId + + separator + versionId + separator + space + separator + namespacePath+ separator + elementId); + } else { + elementDirectoryPath = Paths.get( ROOT_DIRECTORY + separator + itemId + + separator + versionId + separator + space + separator + elementId); + } + if (notExists(elementDirectoryPath)) { - createDirectories(elementDirectoryPath); - } + Path created = createDirectories(elementDirectoryPath); + } String info = elementEntity.getInfo(); if (!isNull(info)) { diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ItemHandler.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ItemHandler.java index 9eea182609..710b731f8b 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ItemHandler.java +++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ItemHandler.java @@ -1,9 +1,11 @@ package org.openecomp.core.tools.Commands.exportdata; +import com.amdocs.zusammen.datatypes.Id; import com.amdocs.zusammen.datatypes.SessionContext; import com.amdocs.zusammen.datatypes.item.Item; import com.amdocs.zusammen.plugin.statestore.cassandra.dao.ItemDao; import com.amdocs.zusammen.plugin.statestore.cassandra.dao.ItemDaoFactory; +import com.google.common.base.Strings; import org.openecomp.core.tools.Commands.ExportDataCommand; import org.openecomp.core.utilities.json.JsonUtil; import org.openecomp.sdc.logging.api.Logger; @@ -13,11 +15,14 @@ import java.io.IOException; import java.net.URISyntaxException; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.ArrayList; import java.util.List; +import java.util.Optional; +import java.util.Set; -import static java.nio.file.Files.*; import static java.io.File.separator; -import static org.openecomp.core.tools.Commands.exportdata.ImportProperties.*; +import static java.nio.file.Files.*; +import static org.openecomp.core.tools.Commands.exportdata.ImportProperties.JSON_POSTFIX; public class ItemHandler { private static final Logger logger = LoggerFactory.getLogger(ExportDataCommand.class); @@ -27,21 +32,42 @@ public class ItemHandler { ImportProperties.initParams(); } - public void createItemsData(SessionContext context, String filteredItem) throws URISyntaxException, IOException { + public void createItemsData(SessionContext context, Set<String> filteredItem) throws URISyntaxException, IOException { + final List<Item> items = new ArrayList<>(); + if (filteredItem.isEmpty()) { + items.addAll(getItemDao(context).list(context)); + } else { + Optional<Item> item = addItem(context, filteredItem.iterator().next(), items); + item.ifPresent(foundedItem -> { + Object vendorId = foundedItem.getInfo().getProperty("vendorId"); + if (vendorId != null) { + String vendorIdStr = vendorId.toString(); + addItem(context, vendorIdStr, items); + filteredItem.add(vendorIdStr); + } + }); + } + + items.parallelStream().forEach(item -> createItemDirectoryAndFiles(item, filteredItem)); + + } + - List<Item> items = getItemDao(context).list(context); - items.parallelStream().forEach(item -> createItemDirectoryAndFiles(item,filteredItem)); + private Optional<Item> addItem(SessionContext context, String filteredItem, List<Item> items) { + Optional<Item> item = getItemDao(context).get(context, new Id(filteredItem)); + item.ifPresent(itemData -> items.add(itemData)); + return item; } - private final void createItemDirectoryAndFiles(Item item,String filteredItem) { + private final void createItemDirectoryAndFiles(Item item, Set<String> filteredItem) { try { String itemId = item.getId().getValue(); - if (filteredItem != null && !itemId.contains(filteredItem)){ + if (!filteredItem.isEmpty() && !filteredItem.contains(itemId)) { return; } - Path itemPath = Paths.get( ImportProperties.ROOT_DIRECTORY + separator + itemId); - Path itemFilePath = Paths.get( ImportProperties.ROOT_DIRECTORY + separator + + Path itemPath = Paths.get(ImportProperties.ROOT_DIRECTORY + separator + itemId); + Path itemFilePath = Paths.get(ImportProperties.ROOT_DIRECTORY + separator + itemId + separator + itemId + JSON_POSTFIX); if (notExists(itemPath)) { createDirectories(itemPath); diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/VersionHandler.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/VersionHandler.java index b8d82958c9..e8e703bff0 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/VersionHandler.java +++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/VersionHandler.java @@ -17,6 +17,7 @@ import static org.openecomp.core.tools.Commands.exportdata.ImportProperties.ROOT import java.nio.file.Path; import java.nio.file.Paths; +import java.util.Set; public class VersionHandler { private static final Logger logger = LoggerFactory.getLogger(ExportDataCommand.class); @@ -24,17 +25,17 @@ public class VersionHandler { public VersionHandler() { } - public void loadVersions(String filteredItem) { + public void loadVersions(Set<String> filteredItem) { VersionCassandraLoader versionCassandraLoader = new VersionCassandraLoader(); versionCassandraLoader.list().forEach(versionEntity -> handleVersionEntity(versionEntity,filteredItem)); VersionInfoCassandraLoader versionInfoCassandraLoader = new VersionInfoCassandraLoader(); versionInfoCassandraLoader.list().forEach(versionInfoEntity -> handleVersionInfo(versionInfoEntity,filteredItem)); } - private void handleVersionEntity(VersionEntity versionEntity, String filteredItem) { + private void handleVersionEntity(VersionEntity versionEntity, Set<String> filteredItem) { try { String itemId = versionEntity.getItemId(); - if (filteredItem != null && !itemId.contains(filteredItem)){ + if (!filteredItem.isEmpty() && !filteredItem.contains(itemId)){ return; } String versionId = versionEntity.getVersionId(); @@ -55,7 +56,7 @@ public class VersionHandler { } - private void handleVersionInfo(VersionInfoEntity versionInfoEntity, String filteredItem) { + private void handleVersionInfo(VersionInfoEntity versionInfoEntity, Set<String> filteredItem) { try { String itemId = versionInfoEntity.getEntityId(); Path itemDirectory = Paths.get( ROOT_DIRECTORY + separator + itemId); diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ElementImport.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ElementImport.java index 7ba830906c..d51458aff1 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ElementImport.java +++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ElementImport.java @@ -1,5 +1,6 @@ package org.openecomp.core.tools.Commands.importdata; +import com.amdocs.zusammen.datatypes.Id; import com.amdocs.zusammen.datatypes.SessionContext; import org.openecomp.core.tools.store.ElementCassandraLoader; import org.openecomp.core.tools.store.ElementNamespaceHandler; @@ -15,21 +16,26 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Arrays; +import java.util.HashSet; import java.util.Set; -import java.util.stream.Collectors; -import java.util.stream.Stream; import static java.io.File.separator; import static org.openecomp.core.tools.Commands.exportdata.ImportProperties.*; public class ElementImport { private static final Logger logger = LoggerFactory.getLogger(ElementImport.class); + public static final String ROOT_ITEM = Id.ZERO.getValue(); + private ElementCassandraLoader elementCassandraLoader = new ElementCassandraLoader(); private ElementNamespaceHandler cassandraElementRepository = new ElementNamespaceHandler(); private VersionCassandraLoader versionCassandraLoader = new VersionCassandraLoader(); - public void loadPath(SessionContext sessionContext, Path elementDir, String elementId, String[] pathObjects) { + public void loadPath(SessionContext sessionContext, Path elementDir, String elementId, String[] + pathObjects) { try { + if (!Files.isDirectory(elementDir)){ + return; + } // load info file ElementEntity elementEntity = new ElementEntity(); Path infoFilePath = Paths.get(elementDir.toString() + separator + ELEMENT_INFO_PREFIX @@ -38,7 +44,6 @@ public class ElementImport { String info = new String(Files.readAllBytes(infoFilePath)); elementEntity.setInfo(info); } - // load relation file Path realtionsFilePath = Paths.get(elementDir.toString() + separator + ELEMENT_RELATION_PREFIX + elementId + JSON_POSTFIX); @@ -58,7 +63,7 @@ public class ElementImport { //load visualization Path visualFilePath = Paths.get(elementDir.toString() + separator - + ELEMENT_VISUALIZATION_PREFIX + elementId ); + + ELEMENT_VISUALIZATION_PREFIX + elementId); if (Files.exists(visualFilePath)) { byte[] bytes = Files.readAllBytes(visualFilePath); ByteBuffer visualization = ByteBuffer.wrap(bytes); @@ -67,45 +72,60 @@ public class ElementImport { //load searchable Path searchableFilePath = Paths.get(elementDir.toString() + separator - + ELEMENT_SEARCHABLE_PREFIX + elementId ); + + ELEMENT_SEARCHABLE_PREFIX + elementId); if (Files.exists(searchableFilePath)) { byte[] bytes = Files.readAllBytes(searchableFilePath); ByteBuffer searchable = ByteBuffer.wrap(bytes); elementEntity.setSearchableData(searchable); } - + String element_Id = pathObjects[pathObjects.length - 1]; elementEntity.setSpace(pathObjects[2]); elementEntity.setItemId(pathObjects[0]); elementEntity.setVersionId(pathObjects[1]); - elementEntity.setElement_id(pathObjects[pathObjects.length - 1]); + elementEntity.setElement_id(element_Id); elementEntity.setNamespace(getNameSpace(pathObjects)); elementEntity.setParentId(getParentId(pathObjects)); - elementEntity.setSubElementIds(getAllSubElementsIds(elementDir)); + elementEntity.setSubElementIds(getAllSubElementsIds(elementDir, element_Id)); elementCassandraLoader.createEntity(elementEntity); cassandraElementRepository.createElementNamespace(elementEntity); versionCassandraLoader.insertElementToVersion(elementEntity); } catch (Exception ex) { logger.error(ex.getMessage(), ex); + ex.printStackTrace(); } } private String getParentId(String[] pathObjects) { - if (pathObjects.length <= 4) { + + if (pathObjects[pathObjects.length - 1].equals(ROOT_ITEM)) { return null; } + if (pathObjects.length == 4) { + return ROOT_ITEM; + } return pathObjects[pathObjects.length - 2]; } - private Set<String> getAllSubElementsIds(Path root) throws IOException { - try (Stream<Path> walk = Files.walk(root)) { - return walk.filter(path -> Files.isDirectory(path)) - .map(path -> path.toFile().getName() ).collect(Collectors.toSet()); + private Set<String> getAllSubElementsIds(Path root, String elementId) throws IOException { + if (elementId.equals(ROOT_ITEM)) { + root = root.getParent(); + } + File file = root.toFile(); + Set<String> retVal = new HashSet<>(); + File[] files = file.listFiles(); + for (File f : files){ + if (f.isDirectory()){ + retVal.add(f.getName()); + } } + retVal.remove(ROOT_ITEM); + return retVal; + } private String getNameSpace(String[] pathObjects) { if (pathObjects.length <= 4) { - return null; + return ""; } if (pathObjects.length == 5) { return pathObjects[3]; diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ItemImport.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ItemImport.java index c7042743c2..9ec5d639c2 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ItemImport.java +++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ItemImport.java @@ -31,8 +31,11 @@ public class ItemImport { Item item = JsonUtil.json2Object(itemJson, Item.class); ItemDao itemDao = getItemDao(sessionContext); itemDao.create(sessionContext, item.getId(), item.getInfo(), item.getCreationTime()); + logger.info("Item Created :"+item.getInfo().getName()+" , "+item.getId()); + System.out.println("Item Created :"+item.getInfo().getName()+" , "+item.getId()); } catch (Exception ex) { logger.error(ex.getMessage(), ex); + ex.printStackTrace(); } } diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/TreeWalker.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/TreeWalker.java index 020b2f3c47..15f8b02e2b 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/TreeWalker.java +++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/TreeWalker.java @@ -4,10 +4,14 @@ import com.amdocs.zusammen.datatypes.SessionContext; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; +import javax.validation.constraints.Min; import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import java.util.stream.Stream; public class TreeWalker { @@ -21,7 +25,10 @@ public class TreeWalker { } private static final void handlePath(SessionContext sessionContext, Path path, Path root,String filterItem) { - String logicalPath = path.toString().replace(root.toString()+File.separator, ""); + String logicalPath = path.toString().replace(root.toString(), ""); + if (logicalPath.startsWith(File.separator)){ + logicalPath = logicalPath.substring(1); + } String[] splitted = logicalPath.split(File.separator); if(filterItem != null && splitted.length > 0 && !splitted[0].contains(filterItem)){ return; @@ -42,7 +49,7 @@ public class TreeWalker { break; default: //handle elements - new ElementImport().loadPath(sessionContext,path,splitted[splitted.length -1],splitted); + new ElementImport().loadPath(sessionContext,path,splitted[splitted.length -1],splitted); break; } diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/ZipUtils.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/ZipUtils.java index 6447f85ea7..2f6693d133 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/ZipUtils.java +++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/ZipUtils.java @@ -10,12 +10,14 @@ import java.nio.file.Files; import java.nio.file.Path; import java.util.Objects; import java.util.Scanner; +import java.util.Set; +import java.util.stream.Collectors; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import java.util.zip.ZipOutputStream; public class ZipUtils { - public static void createZip(String zipFileName, Path dir, String filterItem) throws Exception { + public static void createZip(String zipFileName, Path dir, Set<String> filterItem) throws Exception { File dirObj = dir.toFile(); try ( FileOutputStream fileOutputStream = new FileOutputStream(zipFileName); @@ -24,29 +26,34 @@ public class ZipUtils { } } - public static final String cleanStr(String inFilterStr) { - if (Objects.isNull(inFilterStr)) { - return inFilterStr; - } - Scanner scan = new Scanner(inFilterStr); - while (scan.hasNextLine()) { - inFilterStr = scan.nextLine().replaceAll("[^a-zA-Z0-9]", ""); - } - return inFilterStr; + public static final Set<String> cleanStr(Set<String> inFilterStrs) { + return inFilterStrs.stream().map(inFilterStr -> { + if (Objects.isNull(inFilterStr)) { + return inFilterStr; + } + Scanner scan = new Scanner(inFilterStr); + while (scan.hasNextLine()) { + inFilterStr = scan.nextLine().replaceAll("[^a-zA-Z0-9]", ""); + } + return inFilterStr; + } + ).collect(Collectors.toSet()); } - static void addDir(File dirObj, ZipOutputStream out, String root, String filterItem) throws IOException { + static void addDir(File dirObj, ZipOutputStream out, String root, Set<String> filterItem) throws IOException { File[] files = dirObj.listFiles(); filterItem = cleanStr(filterItem); for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) { addDir(files[i], out, root, filterItem); + String filePath = files[i].getAbsolutePath().replace(root + File.separator, "") + "/"; + out.putNextEntry(new ZipEntry(filePath)); continue; } try (FileInputStream in = new FileInputStream((files[i].getAbsolutePath()))) { String filePath = files[i].getAbsolutePath().replace(root + File.separator, ""); - if (filterItem == null || filePath.contains(filterItem)) { + if (filterItem.isEmpty() || filterItem.stream().anyMatch(s -> filePath.contains(s))) { out.putNextEntry(new ZipEntry(filePath)); try { ByteStreams.copy(in, out); @@ -74,9 +81,16 @@ public class ZipUtils { while (ze != null) { String fileName = ze.getName(); File newFile = new File(outputFolder.toString() + File.separator + fileName); - new File(newFile.getParent()).mkdirs(); - try (FileOutputStream fos = new FileOutputStream(newFile)) { - ByteStreams.copy(zis, fos); + if (ze.isDirectory()) { + Path path = newFile.toPath(); + if (!Files.exists(path)) { + Files.createDirectories(path); + } + } else { + new File(newFile.getParent()).mkdirs(); + try (FileOutputStream fos = new FileOutputStream(newFile)) { + ByteStreams.copy(zis, fos); + } } ze = zis.getNextEntry(); } diff --git a/openecomp-be/tools/zusammen-tools/src/main/resources/logback.xml b/openecomp-be/tools/zusammen-tools/src/main/resources/logback.xml index b1c1335302..a13dc82e22 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/resources/logback.xml +++ b/openecomp-be/tools/zusammen-tools/src/main/resources/logback.xml @@ -1,282 +1,17 @@ -<?xml version="1.0" encoding="UTF-8"?> -<configuration scan="true" scanPeriod="5 seconds"> +<configuration> - <property scope="system" name="ECOMP-component-name" value="ASDC" /> - <property scope="system" name="ECOMP-subcomponent-name" value="ASDC-BE" /> - <property file="${config.home}/catalog-be/configuration.yaml" /> - <property scope="context" name="enable-all-log" value="false" /> - - <!--statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" /> - <include resource="asdc_debug_logback.xml"/--> - - <!-- value used by pattern field list (| - is inter-field separator, || - unavailable or not applicable field value) (m - mandatory, o- optional)--> - <!--timestamp(m)| requestID(m)| serviceInstanceID(o)| threadID(m)| physicalServerName(o)| serviceName(m)| userID(m)| logLevel(m)| severity(o)| serverIpAddress(m)| serverName(m)| clientIpAddress(o)| className(m)| timer(o)| detailedMessage(o)--> - <property name="default-log-pattern" - value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{uuid}|%X{serviceInstanceID}|%thread||${ECOMP-subcomponent-name}|%X{userId}|%level|%X{alarmSeverity}|%X{localAddr}|${beFqdn}|%X{remoteAddr}|%logger{35}|%X{timer}|ActivityType=<%M>, Desc=<%msg>%n" /> - - <property name="asdc-debug-log-pattern" value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestId}|%msg %n"/> - - <!-- All log --> - <if condition='property("enable-all-log").equalsIgnoreCase("true")'> - <then> - <appender name="ALL_ROLLING" - class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/all.log - </file> - - <rollingPolicy - class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> - <fileNamePattern>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/all.log.%i - </fileNamePattern> - <minIndex>1</minIndex> - <maxIndex>10</maxIndex> - </rollingPolicy> - - <triggeringPolicy - class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> - <maxFileSize>20MB</maxFileSize> - </triggeringPolicy> - <encoder> - <pattern>${default-log-pattern}</pattern> - </encoder> - </appender> - - <appender name="ASYNC_ALL" class="ch.qos.logback.classic.AsyncAppender"> - <appender-ref ref="ALL_ROLLING" /> - </appender> - </then> - </if> - - <!-- Error log --> - <appender name="ERROR_ROLLING" - class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/Error.log - </file> - - <!-- Audit messages filter - deny audit messages --> - <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> - <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator"> - <marker>AUDIT_MARKER</marker> - </evaluator> - <onMismatch>NEUTRAL</onMismatch> - <onMatch>DENY</onMatch> - </filter> - - <!-- Transaction messages filter - deny Transaction messages --> - <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> - <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator"> - <marker>TRANSACTION_MARKER</marker> - </evaluator> - <onMismatch>NEUTRAL</onMismatch> - <onMatch>DENY</onMatch> - </filter> - - <!-- deny all events with a level below INFO, that is TRACE and DEBUG --> - <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> - <level>INFO</level> - </filter> - - <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> - <fileNamePattern>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/Error.log.%i - </fileNamePattern> - <minIndex>1</minIndex> - <maxIndex>10</maxIndex> - </rollingPolicy> - - <triggeringPolicy - class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> - <maxFileSize>20MB</maxFileSize> - </triggeringPolicy> + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <!-- encoders are assigned the type + ch.qos.logback.classic.encoder.PatternLayoutEncoder by default --> <encoder> - <pattern>${default-log-pattern}</pattern> + <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> </encoder> </appender> - <!-- Debug log --> - <appender name="DEBUG_ROLLING" - class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/debug.log - </file> - - <!-- No need to deny audit messages - they are INFO only, will be denied - anyway --> - <!-- Transaction messages filter - deny Transaction messages, there are - some DEBUG level messages among them --> - <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> - <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator"> - <marker>TRANSACTION_MARKER</marker> - </evaluator> - <onMismatch>NEUTRAL</onMismatch> - <onMatch>DENY</onMatch> - </filter> - <!-- accept DEBUG and TRACE level --> - <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> - <evaluator class="ch.qos.logback.classic.boolex.GEventEvaluator"> - <expression> - e.level.toInt() <= DEBUG.toInt() - </expression> - </evaluator> - <OnMismatch>DENY</OnMismatch> - <OnMatch>NEUTRAL</OnMatch> - </filter> - - <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> - <fileNamePattern>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/debug.log.%i - </fileNamePattern> - <minIndex>1</minIndex> - <maxIndex>10</maxIndex> - </rollingPolicy> - - <triggeringPolicy - class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> - <maxFileSize>20MB</maxFileSize> - </triggeringPolicy> - <encoder> - <pattern>${default-log-pattern}</pattern> - </encoder> - </appender> - - <!-- Debug log --> - <appender name="MIGRATION_DEBUG_ROLLING" - class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/cassandra2zusammen_migration_debug.log - </file> - - <!-- No need to deny audit messages - they are INFO only, will be denied - anyway --> - <!-- Transaction messages filter - deny Transaction messages, there are - some DEBUG level messages among them --> - <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> - <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator"> - <marker>TRANSACTION_MARKER</marker> - </evaluator> - <onMismatch>NEUTRAL</onMismatch> - <onMatch>DENY</onMatch> - </filter> - - <!-- accept DEBUG and TRACE level --> - <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> - <evaluator class="ch.qos.logback.classic.boolex.GEventEvaluator"> - <expression> - e.level.toInt() <= DEBUG.toInt() - </expression> - </evaluator> - <OnMismatch>DENY</OnMismatch> - <OnMatch>NEUTRAL</OnMatch> - </filter> - - <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> - <fileNamePattern>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/debug_by_package.log.%i - </fileNamePattern> - <minIndex>1</minIndex> - <maxIndex>10</maxIndex> - </rollingPolicy> - - <triggeringPolicy - class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> - <maxFileSize>20MB</maxFileSize> - </triggeringPolicy> - <encoder> - <pattern>${asdc-debug-log-pattern}</pattern> - </encoder> - </appender> - <!-- Audit log --> - <appender name="AUDIT_ROLLING" - class="ch.qos.logback.core.rolling.RollingFileAppender"> - - <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/audit.log - </file> - - <!-- Audit messages filter - accept audit messages --> - <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> - <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator"> - <marker>AUDIT_MARKER</marker> - </evaluator> - <onMismatch>DENY</onMismatch> - <onMatch>ACCEPT</onMatch> - </filter> - - <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> - <fileNamePattern>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/audit.log.%i - </fileNamePattern> - <minIndex>1</minIndex> - <maxIndex>10</maxIndex> - </rollingPolicy> - - <triggeringPolicy - class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> - <maxFileSize>20MB</maxFileSize> - </triggeringPolicy> - <encoder> - <pattern>${default-log-pattern}</pattern> - </encoder> - </appender> - - <!-- SdncTransaction log --> - <appender name="TRANSACTION_ROLLING" - class="ch.qos.logback.core.rolling.RollingFileAppender"> - - <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/transaction.log - </file> - - <!-- Transaction messages filter - accept audit messages --> - <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> - <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator"> - <marker>TRANSACTION_MARKER</marker> - </evaluator> - <onMismatch>DENY</onMismatch> - <onMatch>ACCEPT</onMatch> - </filter> - - <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> - <fileNamePattern>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/transaction.log.%i - </fileNamePattern> - <minIndex>1</minIndex> - <maxIndex>10</maxIndex> - </rollingPolicy> - - <triggeringPolicy - class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> - <maxFileSize>20MB</maxFileSize> - </triggeringPolicy> - <encoder> - <pattern>${default-log-pattern}</pattern> - </encoder> - </appender> - - <!-- Asynchronicity Configurations --> - <appender name="ASYNC_DEBUG" class="ch.qos.logback.classic.AsyncAppender"> - <appender-ref ref="DEBUG_ROLLING" /> - </appender> - - <appender name="ASYNC_TRANSACTION" class="ch.qos.logback.classic.AsyncAppender"> - <appender-ref ref="TRANSACTION_ROLLING" /> - </appender> - - <appender name="ASYNC_ERROR" class="ch.qos.logback.classic.AsyncAppender"> - <appender-ref ref="ERROR_ROLLING" /> - </appender> - - - <root level="INFO"> - <appender-ref ref="ASYNC_ERROR" /> - <appender-ref ref="ASYNC_DEBUG" /> - <appender-ref ref="AUDIT_ROLLING" /> - <appender-ref ref="ASYNC_TRANSACTION" /> - <if condition='property("enable-all-log").equalsIgnoreCase("true")'> - <then> - <appender-ref ref="ALL_ROLLING" /> - </then> - </if> + <root level="warn"> + <appender-ref ref="STDOUT"/> </root> - <logger name="org.openecomp.sdc" level="INFO" /> - - <logger name="org.openecomp.core" level="DEBUG" additivity="false"> - <appender-ref ref="MIGRATION_DEBUG_ROLLING" /> - </logger> -</configuration> - - +</configuration>
\ No newline at end of file |