diff options
32 files changed, 1605 insertions, 1079 deletions
diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/pom.xml b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/pom.xml index 22a518aa36..ca8f6f8792 100644 --- a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/pom.xml +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/pom.xml @@ -61,24 +61,6 @@ <artifactId>reflections</artifactId> <version>${org.reflections.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> - <scope>test</scope> - <version>${junit.version}</version> - </dependency> </dependencies> <build> @@ -86,7 +68,7 @@ <plugin> <groupId>org.jvnet.jaxb2.maven2</groupId> <artifactId>maven-jaxb2-plugin</artifactId> - <version>${mvn.jaxb2.version}</version> + <version>${mvn.jaxb2.version}</version> <executions> <execution> <phase>generate-sources</phase> @@ -98,7 +80,12 @@ <configuration> <schemaDirectory>src/main/resources</schemaDirectory> <generatePackage>org.openecomp.sdc.generator.aai.xml</generatePackage> - <generateDirectory>target/generated-sources/aai/xml</generateDirectory> + <generateDirectory>target/generated-sources/custom/aai/xml</generateDirectory> + <removeOldOutput>false</removeOldOutput> + <cleanPackageDirectories>true</cleanPackageDirectories> + <forceRegenerate>false</forceRegenerate> + <debug>false</debug> + <verbose>false</verbose> <schemaIncludes> <include>aai_schema_v11.xsd</include> </schemaIncludes> diff --git a/common/pom.xml b/common/pom.xml index 092c8994a8..54d3a1b3c3 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -11,7 +11,7 @@ <groupId>org.openecomp.sdc</groupId> <artifactId>sdc-onboarding</artifactId> <version>1.2.0-SNAPSHOT</version> - <relativePath>../onboarding</relativePath> + <relativePath>../onboarding</relativePath> </parent> <properties> @@ -163,6 +163,56 @@ <target>${java.target}</target> </configuration> </plugin> + <plugin> + <groupId>org.openecomp.sdc.onboarding</groupId> + <artifactId>compile-helper-plugin</artifactId> + <version>${project.version}</version> + <executions> + <execution> + <goals> + <goal>pre-compile-helper</goal> + <goal>pre-test-compile-helper</goal> + <goal>post-compile-helper</goal> + <goal>post-test-run-helper</goal> + <goal>init-helper</goal> + </goals> + </execution> + </executions> + <configuration> + <excludePackaging>pom</excludePackaging> + <excludeDependencies>test,runtime</excludeDependencies> + <staleThreshold>10000</staleThreshold> + <mainSourceLocation>${basedir}/src/main/java</mainSourceLocation> + <testSourceLocation>${basedir}/src/test/java</testSourceLocation> + <mainResourceLocation>${basedir}/src/main/resources</mainResourceLocation> + <testResourceLocation>${basedir}/src/test/resources</testResourceLocation> + <mainCompiledLocation>${project.build.directory}/classes</mainCompiledLocation> + <testCompiledLocation>${project.build.directory}/test-classes</testCompiledLocation> + <compiledFilesList> + ${project.build.directory}/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst + </compiledFilesList> + <inputSourceFilesList> + ${project.build.directory}/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst + </inputSourceFilesList> + <inputTestFilesList> + ${project.build.directory}/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst + </inputTestFilesList> + <compiledTestFilesList> + ${project.build.directory}/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst + </compiledTestFilesList> + <buildState> + <moduleBuildDataFile>${project.build.directory}/build-data/ModuleDependencies.dat + </moduleBuildDataFile> + <resourceBuildDataFile>${project.build.directory}/build-data/ResourceDependencies.dat + </resourceBuildDataFile> + <project>${project}</project> + <buildStateFilePath>org.openecomp.sdc:sdc-onboarding/target/build-data/BuildState.dat + </buildStateFilePath> + <resourceStateFilePath>org.openecomp.sdc:sdc-onboarding/target/build-data/ResourceState.dat + </resourceStateFilePath> + </buildState> + </configuration> + </plugin> <!-- blackduck maven plugin --> <!--<plugin> diff --git a/onboarding/pom.xml b/onboarding/pom.xml index 9d2c5cb599..bbe52ac675 100644 --- a/onboarding/pom.xml +++ b/onboarding/pom.xml @@ -13,7 +13,7 @@ </parent> <modules> - <module>../openecomp-be/tools/build-helper</module> + <module>../openecomp-be/tools/compile-helper-plugin</module> <module>../common</module> <module>../openecomp-be</module> <module>../openecomp-ui</module> @@ -24,16 +24,20 @@ <jacoco.version>0.7.9</jacoco.version> <mvn.assembly.version>2.1</mvn.assembly.version> <mvn.compiler.version>3.7.0</mvn.compiler.version> + <mvn.clean.version>2.5</mvn.clean.version> <mvn.deploy.version>2.4</mvn.deploy.version> <mvn.hub.version>1.4.0</mvn.hub.version> <mvn.install.version>2.3.1</mvn.install.version> <mvn.jar.version>2.4</mvn.jar.version> - <mvn.jaxb2.version>0.13.2</mvn.jaxb2.version> + <mvn.jaxb2.version>0.13.3</mvn.jaxb2.version> <mvn.license.version>1.10</mvn.license.version> <mvn.shade.version>2.3</mvn.shade.version> <mvn.surefire.version>2.19.1</mvn.surefire.version> <mvn.swagger.version>3.1.5</mvn.swagger.version> <mvn.war.version>2.1.1</mvn.war.version> + <maven-core.version>3.5.3</maven-core.version> + <maven-plugin-plugin.version>3.5.1</maven-plugin-plugin.version> + <maven-plugin-annotations.version>3.5.1</maven-plugin-annotations.version> <mvn.antrun.version>1.8</mvn.antrun.version> <!-- Onboarding artifacts version --> @@ -99,7 +103,8 @@ <swagger.version>1.5.3</swagger.version> <testng.version>6.9.10</testng.version> <!--new 6.9.13.6 still shows blackduck risk --> <woodstox.version>4.4.1</woodstox.version> - <ws.rs.version>2.0.1</ws.rs.version> <!-- New version 2.0.1 to fix blackduck violation Failing with comiplation issues--> + <ws.rs.version>2.0.1 + </ws.rs.version> <!-- New version 2.0.1 to fix blackduck violation Failing with comiplation issues--> <zusammen.version>0.3.0</zusammen.version> <zusammen-state-store.version>0.3.0</zusammen-state-store.version> <zusammen-collaboration-store.version>0.3.2</zusammen-collaboration-store.version> @@ -169,16 +174,19 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-clean-plugin</artifactId> - <version>2.5</version> + <version>${mvn.clean.version}</version> <configuration> <excludeDefaultDirectories>true</excludeDefaultDirectories> <filesets> <fileset> <directory>${project.build.directory}</directory> <excludes> - <exclude>test-classes/**/*.class</exclude> - <exclude>pmd/**</exclude> - <exclude>maven-status/**</exclude> + <exclude>${classes}</exclude> + <exclude>${testClasses}</exclude> + <exclude>${pmd}</exclude> + <exclude>${mavenStatus}</exclude> + <exclude>${customGeneratedSources}</exclude> + <exclude>build-data/**</exclude> </excludes> </fileset> </filesets> @@ -189,7 +197,7 @@ <artifactId>maven-surefire-plugin</artifactId> <version>${mvn.surefire.version}</version> <configuration> - <forkCount>0</forkCount> + <forkCount>${fork.count}</forkCount> <printSummary>false</printSummary> <redirectTestOutputToFile>true</redirectTestOutputToFile> <additionalClasspathElements> @@ -197,12 +205,13 @@ </additionalClasspathElements> <systemPropertyVariables> <logback.configurationFile>src/test/resources/logback-test.xml</logback.configurationFile> - <artifactgenerator.config>${project.basedir}/src/test/resources/config/Artifact-Generator.properties</artifactgenerator.config> + <artifactgenerator.config> + ${project.basedir}/src/test/resources/config/Artifact-Generator.properties + </artifactgenerator.config> <config.location>${project.basedir}/configuration</config.location> </systemPropertyVariables> - <dependenciesToScan> - org.openecomp.sdc:build-helper - </dependenciesToScan> + <useSystemClassLoader>${useSystemClassLoader}</useSystemClassLoader> + <skip>${skipTestRun}</skip> </configuration> </plugin> </plugins> diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml index 22004c2808..2b4057802e 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml @@ -200,11 +200,6 @@ </dependency> <dependency> <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-orchesrtation-core</artifactId> - <version>1.2.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> <artifactId>openecomp-tosca-converter-api</artifactId> <version>1.2.0-SNAPSHOT</version> </dependency> @@ -216,4 +211,8 @@ </dependencies> + <properties> + <useSystemClassLoader>false</useSystemClassLoader> + </properties> + </project> diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/informationartifact/InformationArtifactGeneratorImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/informationartifact/InformationArtifactGeneratorImplTest.java deleted file mode 100644 index 925eb7157e..0000000000 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/informationartifact/InformationArtifactGeneratorImplTest.java +++ /dev/null @@ -1,79 +0,0 @@ -/*- - * ============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.vendorsoftwareproduct.informationartifact; -// -//import org.openecomp.core.util.UniqueValueUtil; -//import org.openecomp.sdc.vendorsoftwareproduct.utils.VSPCommon; -//import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants; -//import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager; -//import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; -//import org.openecomp.sdc.vendorsoftwareproduct.impl.VendorSoftwareProductManagerImpl; -//import org.openecomp.sdc.versioning.dao.types.Version; -//import org.testng.Assert; -//import org.testng.annotations.BeforeClass; -//import org.testng.annotations.Test; -// -//import java.io.File; -//import java.io.IOException; -// -//import static org.testng.Assert.*; -// -///** -// * Created by Talio on 12/6/2016. -// */ -//public class InformationArtifactGeneratorImplTest { -// private static VendorSoftwareProductManager vendorSoftwareProductManager = -// new VendorSoftwareProductManagerImpl(); -// private static String vspId; -// private static Version vspActiveVersion; -// private static final String USER1 = "vspTestUser1"; -// -// -// @BeforeClass -// public void init(){ -// UniqueValueUtil.deleteUniqueValue(VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME, "Test_download_info"); -// VspDetails vspDetails = vendorSoftwareProductManager.createVsp -// (VSPCommon.createVspDetails(null, null, "Test_download_info", "Test-vsp-empty", -// "vendorName", "vlm1Id", "icon", "category", "subCategory", "123", null), USER1); -// vspId = vspDetails.getId(); -// vspActiveVersion = vspDetails.getVersion(); -// } -// -// @Test -// public void testDownloadInformationArtifact() throws IOException { -// File informationArtifact = -// vendorSoftwareProductManager.getInformationArtifact(vspId, vspActiveVersion, USER1); -// -// Assert.assertNotNull(informationArtifact); -// } -// -// @Test -// public void negativeTestDownloadInformationArtifactOnNoneExistiongVsp() throws IOException { -// try { -// File informationArtifact = vendorSoftwareProductManager -// .getInformationArtifact("non_existing_id", vspActiveVersion, USER1); -// }catch(Exception e){ -// Assert.assertEquals(e.getMessage(), "Versionable entity VendorSoftwareProduct with id " + -// "non_existing_id does not exist."); -// } -// } -// -//} diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/pom.xml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/pom.xml index 0e6015236b..3a4ae67125 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/pom.xml @@ -109,4 +109,7 @@ </dependencies> + <properties> + <useSystemClassLoader>false</useSystemClassLoader> + </properties> </project> diff --git a/openecomp-be/lib/openecomp-sdc-orchestration-lib/openecomp-sdc-orchesrtation-api/pom.xml b/openecomp-be/lib/openecomp-sdc-orchestration-lib/openecomp-sdc-orchesrtation-api/pom.xml deleted file mode 100644 index f3ee4de5ff..0000000000 --- a/openecomp-be/lib/openecomp-sdc-orchestration-lib/openecomp-sdc-orchesrtation-api/pom.xml +++ /dev/null @@ -1,25 +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-datatypes-lib</artifactId> - <version>1.2.0-SNAPSHOT</version> - </dependency> - </dependencies> - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-orchestration-lib</artifactId> - <version>1.2.0-SNAPSHOT</version> - </parent> - - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-orchesrtation-api</artifactId> - <version>1.2.0-SNAPSHOT</version> - - -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-orchestration-lib/openecomp-sdc-orchesrtation-core/pom.xml b/openecomp-be/lib/openecomp-sdc-orchestration-lib/openecomp-sdc-orchesrtation-core/pom.xml deleted file mode 100644 index 695b929543..0000000000 --- a/openecomp-be/lib/openecomp-sdc-orchestration-lib/openecomp-sdc-orchesrtation-core/pom.xml +++ /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> - <dependencies> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-orchesrtation-api</artifactId> - <version>1.2.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc.core</groupId> - <artifactId>openecomp-utilities-lib</artifactId> - <version>1.2.0-SNAPSHOT</version> - </dependency> - </dependencies> - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-orchestration-lib</artifactId> - <version>1.2.0-SNAPSHOT</version> - </parent> - - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-orchesrtation-core</artifactId> - <version>1.2.0-SNAPSHOT</version> - - -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-orchestration-lib/openecomp-sdc-orchesrtation-impl/pom.xml b/openecomp-be/lib/openecomp-sdc-orchestration-lib/openecomp-sdc-orchesrtation-impl/pom.xml deleted file mode 100644 index d663ad1d67..0000000000 --- a/openecomp-be/lib/openecomp-sdc-orchestration-lib/openecomp-sdc-orchesrtation-impl/pom.xml +++ /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> - <dependencies> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-orchesrtation-api</artifactId> - <version>1.2.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-logging-api</artifactId> - <version>1.2.0-SNAPSHOT</version> - </dependency> - </dependencies> - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-orchestration-lib</artifactId> - <version>1.2.0-SNAPSHOT</version> - </parent> - - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-orchesrtation-impl</artifactId> - <version>1.2.0-SNAPSHOT</version> - - -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-orchestration-lib/pom.xml b/openecomp-be/lib/openecomp-sdc-orchestration-lib/pom.xml deleted file mode 100644 index 08fcf78942..0000000000 --- a/openecomp-be/lib/openecomp-sdc-orchestration-lib/pom.xml +++ /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> - - <artifactId>openecomp-sdc-orchestration-lib</artifactId> - <version>1.2.0-SNAPSHOT</version> - <packaging>pom</packaging> - - <parent> - <artifactId>openecomp-sdc-lib</artifactId> - <groupId>org.openecomp.sdc</groupId> - <version>1.2.0-SNAPSHOT</version> - <relativePath>..</relativePath> - </parent> - - <modules> - <module>openecomp-sdc-orchesrtation-api</module> - <module>openecomp-sdc-orchesrtation-core</module> - <module>openecomp-sdc-orchesrtation-impl</module> - </modules> -</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/pom.xml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/pom.xml index b08067b6b4..0535d9dba1 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/pom.xml @@ -93,7 +93,7 @@ <configuration> <parallel>classes</parallel> <threadCount>1</threadCount> - <forkCount>0</forkCount> + <forkCount>${fork.count}</forkCount> <printSummary>false</printSummary> <redirectTestOutputToFile>true</redirectTestOutputToFile> <rerunFailingTestsCount>1</rerunFailingTestsCount> @@ -103,12 +103,14 @@ <systemPropertyVariables> <logback.configurationFile>src/test/resources/logback-test.xml</logback.configurationFile> </systemPropertyVariables> - <dependenciesToScan> - org.openecomp.sdc:build-helper - </dependenciesToScan> + <useSystemClassLoader>${useSystemClassLoader}</useSystemClassLoader> </configuration> </plugin> </plugins> </build> + <properties> + <useSystemClassLoader>false</useSystemClassLoader> + </properties> + </project> diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/helper/impl/NameExtractorServiceImpl.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/helper/impl/NameExtractorServiceImpl.java deleted file mode 100644 index 3867dadaeb..0000000000 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/helper/impl/NameExtractorServiceImpl.java +++ /dev/null @@ -1,19 +0,0 @@ -/*- - * ============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========================================================= - */ diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java index 2387390df9..801f2c67a0 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java @@ -18,11 +18,22 @@ package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslati import static org.junit.Assert.assertEquals; +import java.io.BufferedInputStream; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.net.URL; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; import org.apache.commons.collections4.MapUtils; import org.junit.Assert; import org.junit.BeforeClass; -import org.junit.Rule; -import org.junit.rules.TestName; import org.openecomp.core.translator.api.HeatToToscaTranslator; import org.openecomp.core.translator.datatypes.TranslatorOutput; import org.openecomp.core.translator.factory.HeatToToscaTranslatorFactory; @@ -39,133 +50,116 @@ import org.openecomp.sdc.translator.TestUtils; import org.togglz.testing.TestFeatureManager; import org.togglz.testing.TestFeatureManagerProvider; -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.net.URL; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; - public class BaseFullTranslationTest { - public static final String IN_POSTFIX = "/in"; - public static final String OUT_POSTFIX = "/out"; - - @Rule - public TestName name = new TestName(); - - protected static TestFeatureManager manager; - private static File tempDir = new File(System.getProperty("java.io.tmpdir")); - - @BeforeClass - public static void enableToggleableFeatures(){ - manager = new TestFeatureManager(ToggleableFeature.class); - manager.enableAll(); - TestFeatureManagerProvider.setFeatureManager(manager); - } - - - public static void disableToggleableFeatures() { - manager.disableAll(); - manager = null; - TestFeatureManagerProvider.setFeatureManager(null); - } - - protected void testTranslationWithInit(String path) throws IOException { - byte[] translatedZipFile = initTranslatorAndTranslate(path); - testTranslation(path, translatedZipFile); - } - - protected byte[] initTranslatorAndTranslate(String path) throws IOException { - HeatToToscaTranslator heatToToscaTranslator = HeatToToscaTranslatorFactory.getInstance().createInterface(); - return translateZipFile(path, heatToToscaTranslator); - } - - protected void testTranslation(String basePath, byte[] translatedZipFile) throws IOException { - - URL url = BaseFullTranslationTest.class.getResource(basePath + OUT_POSTFIX); - Set<String> expectedResultFileNameSet = new HashSet<>(); - Map<String, byte[]> expectedResultMap = new HashMap<>(); - - String path = url.getPath(); - File pathFile = new File(path); - File[] files = pathFile.listFiles(); - Assert.assertNotNull("manifest files is empty", files); - for (File expectedFile : files) { - expectedResultFileNameSet.add(expectedFile.getName()); - try (FileInputStream input = new FileInputStream(expectedFile)) { - expectedResultMap.put(expectedFile.getName(), FileUtils.toByteArray(input)); - } + public static final String IN_POSTFIX = "/in"; + public static final String OUT_POSTFIX = "/out"; + + + protected static TestFeatureManager manager; + + @BeforeClass + public static void enableToggleableFeatures() { + manager = new TestFeatureManager(ToggleableFeature.class); + manager.enableAll(); + TestFeatureManagerProvider.setFeatureManager(manager); } - try (ByteArrayInputStream fis = new ByteArrayInputStream(translatedZipFile);BufferedInputStream bis = new BufferedInputStream(fis); - ZipInputStream zis = new ZipInputStream(bis)) { - ZipEntry entry; - String name; - String expected; - String actual; - while ((entry = zis.getNextEntry()) != null) { + public static void disableToggleableFeatures() { + manager.disableAll(); + manager = null; + TestFeatureManagerProvider.setFeatureManager(null); + } - name = entry.getName() - .substring(entry.getName().lastIndexOf(File.separator) + 1, entry.getName().length()); - if (expectedResultFileNameSet.contains(name)) { - expected = new String(expectedResultMap.get(name)).trim().replace("\r", ""); - actual = new String(FileUtils.toByteArray(zis)).trim().replace("\r", ""); - assertEquals("difference in file: " + name, expected, actual); + protected void testTranslationWithInit(String path) throws IOException { + byte[] translatedZipFile = initTranslatorAndTranslate(path); + testTranslation(path, translatedZipFile); + } - expectedResultFileNameSet.remove(name); - } - } - if (expectedResultFileNameSet.isEmpty()) { - expectedResultFileNameSet.forEach(System.out::println); - } + protected byte[] initTranslatorAndTranslate(String path) throws IOException { + HeatToToscaTranslator heatToToscaTranslator = HeatToToscaTranslatorFactory.getInstance().createInterface(); + return translateZipFile(path, heatToToscaTranslator); } - assertEquals(0, expectedResultFileNameSet.size()); - } - - private byte[] translateZipFile(String basePath, HeatToToscaTranslator heatToToscaTranslator) throws IOException { - URL inputFilesUrl = this.getClass().getResource(basePath + IN_POSTFIX); - String path = inputFilesUrl.getPath(); - TestUtils.addFilesToTranslator(heatToToscaTranslator, path); - TranslatorOutput translatorOutput = heatToToscaTranslator.translate(); - Assert.assertNotNull(translatorOutput); - if (MapUtils.isNotEmpty(translatorOutput.getErrorMessages()) && MapUtils.isNotEmpty( - MessageContainerUtil - .getMessageByLevel(ErrorLevel.ERROR, translatorOutput.getErrorMessages()))) { - throw new CoreException((new ErrorCode.ErrorCodeBuilder()).withMessage( - "Error in validation " + getErrorAsString(translatorOutput.getErrorMessages())) - .withId("Validation Error").withCategory(ErrorCategory.APPLICATION).build()); + + protected void testTranslation(String basePath, byte[] translatedZipFile) throws IOException { + + URL url = BaseFullTranslationTest.class.getResource(basePath + OUT_POSTFIX); + Set<String> expectedResultFileNameSet = new HashSet<>(); + Map<String, byte[]> expectedResultMap = new HashMap<>(); + + String path = url.getPath(); + File pathFile = new File(path); + File[] files = pathFile.listFiles(); + Assert.assertNotNull("manifest files is empty", files); + for (File expectedFile : files) { + expectedResultFileNameSet.add(expectedFile.getName()); + try (FileInputStream input = new FileInputStream(expectedFile)) { + expectedResultMap.put(expectedFile.getName(), FileUtils.toByteArray(input)); + } + } + + try (ByteArrayInputStream fis = new ByteArrayInputStream(translatedZipFile); + BufferedInputStream bis = new BufferedInputStream(fis); ZipInputStream zis = new ZipInputStream(bis)) { + ZipEntry entry; + String name; + String expected; + String actual; + + while ((entry = zis.getNextEntry()) != null) { + + name = entry.getName() + .substring(entry.getName().lastIndexOf(File.separator) + 1, entry.getName().length()); + if (expectedResultFileNameSet.contains(name)) { + expected = new String(expectedResultMap.get(name)).trim().replace("\r", ""); + actual = new String(FileUtils.toByteArray(zis)).trim().replace("\r", ""); + assertEquals("difference in file: " + name, expected, actual); + + expectedResultFileNameSet.remove(name); + } + } + if (expectedResultFileNameSet.isEmpty()) { + expectedResultFileNameSet.forEach(System.out::println); + } + } + assertEquals(0, expectedResultFileNameSet.size()); } - byte[] data = new ToscaFileOutputServiceCsarImpl().createOutputFile(translatorOutput.getToscaServiceModel(), null); + private byte[] translateZipFile(String basePath, HeatToToscaTranslator heatToToscaTranslator) throws IOException { + URL inputFilesUrl = this.getClass().getResource(basePath + IN_POSTFIX); + String path = inputFilesUrl.getPath(); + TestUtils.addFilesToTranslator(heatToToscaTranslator, path); + TranslatorOutput translatorOutput = heatToToscaTranslator.translate(); + Assert.assertNotNull(translatorOutput); + if (MapUtils.isNotEmpty(translatorOutput.getErrorMessages()) && MapUtils.isNotEmpty( + MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, translatorOutput.getErrorMessages()))) { + throw new CoreException((new ErrorCode.ErrorCodeBuilder()).withMessage( + "Error in validation " + getErrorAsString(translatorOutput.getErrorMessages())) + .withId("Validation Error") + .withCategory(ErrorCategory.APPLICATION).build()); + } - return data; - } + byte[] data = + new ToscaFileOutputServiceCsarImpl().createOutputFile(translatorOutput.getToscaServiceModel(), null); - private String getErrorAsString(Map<String, List<ErrorMessage>> errorMessages) { - StringBuilder sb = new StringBuilder(); - errorMessages.entrySet().forEach( - entry -> sb.append("File:").append(entry.getKey()).append(System.lineSeparator()) - .append(getErrorList(entry.getValue()))); + return data; + } - return sb.toString(); - } + private String getErrorAsString(Map<String, List<ErrorMessage>> errorMessages) { + StringBuilder sb = new StringBuilder(); + errorMessages.entrySet().forEach( + entry -> sb.append("File:").append(entry.getKey()).append(System.lineSeparator()) + .append(getErrorList(entry.getValue()))); - private String getErrorList(List<ErrorMessage> errors) { - StringBuilder sb = new StringBuilder(); - errors.forEach( - error -> sb.append(error.getMessage()).append("[").append(error.getLevel()).append("]") - .append(System.lineSeparator())); - return sb.toString(); - } + return sb.toString(); + } + + private String getErrorList(List<ErrorMessage> errors) { + StringBuilder sb = new StringBuilder(); + errors.forEach(error -> sb.append(error.getMessage()).append("[").append(error.getLevel()).append("]") + .append(System.lineSeparator())); + return sb.toString(); + } } diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-impl/pom.xml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-impl/pom.xml deleted file mode 100644 index 8b59f02f95..0000000000 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-impl/pom.xml +++ /dev/null @@ -1,52 +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.2.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>${junit.version}</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.sdc.core</groupId> - <artifactId>openecomp-heat-lib</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc.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> - -</project> diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-sdk/pom.xml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-sdk/pom.xml deleted file mode 100644 index 6e48011eb2..0000000000 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-sdk/pom.xml +++ /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.2.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>${junit.version}</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.sdc.core</groupId> - <artifactId>openecomp-heat-lib</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc.core</groupId> - <artifactId>openecomp-tosca-lib</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> -</project> diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/pom.xml b/openecomp-be/lib/openecomp-sdc-translator-lib/pom.xml index bf7f5aa957..814b152daf 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/pom.xml @@ -16,9 +16,7 @@ <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> </modules> <dependencies> diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterManagerImpl.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterManagerImpl.java deleted file mode 100644 index 4917533dd8..0000000000 --- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterManagerImpl.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.openecomp.core.impl; - -import org.openecomp.core.converter.ToscaConverter; -import org.openecomp.core.converter.api.ToscaConverterManager; -import org.openecomp.core.utilities.file.FileContentHandler; -import org.openecomp.core.utilities.file.FileUtils; -import org.openecomp.core.utilities.json.JsonUtil; -import org.openecomp.sdc.logging.api.Logger; -import org.openecomp.sdc.logging.api.LoggerFactory; -import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; - -import java.lang.reflect.Constructor; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -public class ToscaConverterManagerImpl implements ToscaConverterManager { - - private static final Logger LOGGER = LoggerFactory.getLogger(ToscaConverterManagerImpl.class.getName()); - private static List<ToscaConverter> toscaConverters; - private static final String toscaConverterFileName = "ToscaConverters.json"; - private static final String TOSCA_CONVERTER_IMPL_FORMAT_ERROR = "Failed to construct TOSCA converter for '%s' implementation."; - - static { - toscaConverters = getConvertersList(); - } - - @Override - public ToscaServiceModel convert(String csarName, FileContentHandler fileContentHandler) { - return null; - } - - private static List<ToscaConverter> getConvertersList(){ - List<ToscaConverter> toscaConvertersList = new ArrayList<>(); - Map<String, String> convertersMap = FileUtils.readViaInputStream(toscaConverterFileName, - stream -> JsonUtil.json2Object(stream, Map.class)); - return getToscaConvertersList(toscaConvertersList, convertersMap); - } - - private static List<ToscaConverter> getToscaConvertersList( - List<ToscaConverter> toscaConvertersList, Map<String, String> convertersMap) { - for(String implClassName : convertersMap.values()){ - try{ - Class<?> clazz = Class.forName(implClassName); - Constructor<?> constructor = clazz.getConstructor(); - toscaConvertersList.add((ToscaConverter) constructor.newInstance()); - }catch (Exception ex){ - LOGGER.debug(String.format(TOSCA_CONVERTER_IMPL_FORMAT_ERROR, implClassName), ex); - continue; - } - } - return toscaConvertersList; - } -} diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/resources/ToscaConverters.json b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/resources/ToscaConverters.json deleted file mode 100644 index e1cddeb854..0000000000 --- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/resources/ToscaConverters.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "ToscaConverter" : "org.openecomp.core.converter.impl.ToscaConverterImpl" -}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-tosca-lib/pom.xml b/openecomp-be/lib/openecomp-tosca-lib/pom.xml index c6f8aa17a0..eedc6cb521 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/pom.xml +++ b/openecomp-be/lib/openecomp-tosca-lib/pom.xml @@ -86,6 +86,9 @@ <version>${sdc-tosca-parser.version}</version> </dependency> </dependencies> + <properties> + <useSystemClassLoader>false</useSystemClassLoader> + </properties> </project> diff --git a/openecomp-be/lib/pom.xml b/openecomp-be/lib/pom.xml index d031dd4d04..f59c05628d 100644 --- a/openecomp-be/lib/pom.xml +++ b/openecomp-be/lib/pom.xml @@ -32,7 +32,6 @@ <module>openecomp-healing-lib</module> <module>openecomp-sdc-activity-log-lib</module> <module>openecomp-tosca-converter-lib</module> - <module>openecomp-sdc-orchestration-lib</module> <module>openecomp-sdc-notification-lib</module> <module>openecomp-item-permissions-lib</module> <module>openecomp-conflict-lib</module> diff --git a/openecomp-be/pom.xml b/openecomp-be/pom.xml index 03613c4438..786ef92d38 100644 --- a/openecomp-be/pom.xml +++ b/openecomp-be/pom.xml @@ -36,13 +36,6 @@ <version>${togglz.version}</version> <scope>test</scope> </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>build-helper</artifactId> - <version>${project.version}</version> - <scope>runtime</scope> - </dependency> - </dependencies> <build> @@ -59,9 +52,62 @@ <configuration> <source>${java.source}</source> <target>${java.target}</target> + <excludes> + <exclude>**/package-info.java</exclude> + </excludes> + </configuration> + </plugin> + <plugin> + <groupId>org.openecomp.sdc.onboarding</groupId> + <artifactId>compile-helper-plugin</artifactId> + <version>${project.version}</version> + <executions> + <execution> + <goals> + <goal>pre-compile-helper</goal> + <goal>pre-test-compile-helper</goal> + <goal>post-compile-helper</goal> + <goal>post-test-run-helper</goal> + <goal>init-helper</goal> + </goals> + </execution> + </executions> + <configuration> + <excludePackaging>pom</excludePackaging> + <excludeDependencies>test,runtime</excludeDependencies> + <staleThreshold>10000</staleThreshold> + <mainSourceLocation>${basedir}/src/main/java</mainSourceLocation> + <testSourceLocation>${basedir}/src/test/java</testSourceLocation> + <mainResourceLocation>${basedir}/src/main/resources</mainResourceLocation> + <testResourceLocation>${basedir}/src/test/resources</testResourceLocation> + <mainCompiledLocation>${project.build.directory}/classes</mainCompiledLocation> + <testCompiledLocation>${project.build.directory}/test-classes</testCompiledLocation> + <compiledFilesList> + ${project.build.directory}/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst + </compiledFilesList> + <inputSourceFilesList> + ${project.build.directory}/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst + </inputSourceFilesList> + <inputTestFilesList> + ${project.build.directory}/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst + </inputTestFilesList> + <compiledTestFilesList> + ${project.build.directory}/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst + </compiledTestFilesList> + <buildState> + <moduleBuildDataFile>${project.build.directory}/build-data/ModuleDependencies.dat + </moduleBuildDataFile> + <resourceBuildDataFile>${project.build.directory}/build-data/ResourceDependencies.dat + </resourceBuildDataFile> + <project>${project}</project> + <buildStateFilePath>org.openecomp.sdc:sdc-onboarding/target/build-data/BuildState.dat + </buildStateFilePath> + <resourceStateFilePath>org.openecomp.sdc:sdc-onboarding/target/build-data/ResourceState.dat + </resourceStateFilePath> + </buildState> </configuration> </plugin> - <plugin> + <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>license-maven-plugin</artifactId> <version>${mvn.license.version}</version> @@ -202,20 +248,20 @@ </dependencies> </dependencyManagement> - <modules> - <module>/api</module> - <module>/lib</module> - <module>/tools/swagger-ui</module> - <module>/tools/zusammen-tools</module> - <module>/backend</module> - </modules> + <modules> + <module>/api</module> + <module>/lib</module> + <module>/tools/swagger-ui</module> + <module>/tools/zusammen-tools</module> + <module>/backend</module> + </modules> <profiles> <!--<profile>--> - <!--<id>docker-staging</id>--> - <!--<properties>--> - <!--<docker.tag>${project.version}-STAGING-${maven.build.timestamp}</docker.tag>--> - <!--<docker.latest.tag>${project.version}-STAGING-latest</docker.latest.tag>--> - <!--</properties>--> + <!--<id>docker-staging</id>--> + <!--<properties>--> + <!--<docker.tag>${project.version}-STAGING-${maven.build.timestamp}</docker.tag>--> + <!--<docker.latest.tag>${project.version}-STAGING-latest</docker.latest.tag>--> + <!--</properties>--> <!--</profile>--> <profile> diff --git a/openecomp-be/tools/build-helper/pom.xml b/openecomp-be/tools/build-helper/pom.xml deleted file mode 100644 index bcdf52a79e..0000000000 --- a/openecomp-be/tools/build-helper/pom.xml +++ /dev/null @@ -1,31 +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>build-helper</artifactId> - - <parent> - <artifactId>sdc-onboarding</artifactId> - <groupId>org.openecomp.sdc</groupId> - <version>1.2.0-SNAPSHOT</version> - <relativePath>../../../onboarding</relativePath> - </parent> - - <properties> - <jacoco.skip>true</jacoco.skip> - <pmd.skip>true</pmd.skip> - </properties> - - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>${junit.version}</version> - <scope>provided</scope> - </dependency> - </dependencies> - - -</project> diff --git a/openecomp-be/tools/build-helper/src/main/java/org/openecomp/onboarding/build/test/StaleCodeDetectionTest.java b/openecomp-be/tools/build-helper/src/main/java/org/openecomp/onboarding/build/test/StaleCodeDetectionTest.java deleted file mode 100644 index 69f77357ae..0000000000 --- a/openecomp-be/tools/build-helper/src/main/java/org/openecomp/onboarding/build/test/StaleCodeDetectionTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright © 2016-2017 European Support Limited - * - * 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 a "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. - */ - -package org.openecomp.onboarding.build.test; - -import org.junit.Assert; -import org.junit.Test; - -import java.io.File; -import java.nio.file.Paths; -import java.util.Arrays; -import java.util.Collections; - -public class StaleCodeDetectionTest { - - private static final String JAVA_EXT = ".java"; - private static final String CLASS_EXT = ".class"; - - @Test - public void checkIfStale() { - - String moduleLocation = System.getProperty("basedir"); - if (isStale(moduleLocation + File.separator + "target" + File.separator + "test-classes", - moduleLocation + File.separator + "src" + File.separator + "test" + File.separator + "java")) { - Assert.fail("****** Please remove 'target' directory manually under path " + moduleLocation); - } - } - - private boolean isStale(String compiledCodeLocation, String javaSourceLocation) { - File compiledFiles = new File(compiledCodeLocation); - File[] list = compiledFiles.listFiles((dir, file) -> file.endsWith(CLASS_EXT) && file.indexOf('$') == -1); - if (list == null || list.length == 0) { - return false; - } - File candidate = Collections.min(Arrays.asList(list), - (file1, file2) -> file1.lastModified() >= file2.lastModified() ? 1 : -1); - String sourceFilePath = javaSourceLocation + candidate.getAbsolutePath().replace(compiledCodeLocation, "") - .replace(CLASS_EXT, JAVA_EXT); - return !Paths.get(sourceFilePath).toFile().exists(); - } -} diff --git a/openecomp-be/tools/compile-helper-plugin/pom.xml b/openecomp-be/tools/compile-helper-plugin/pom.xml new file mode 100644 index 0000000000..3891558b66 --- /dev/null +++ b/openecomp-be/tools/compile-helper-plugin/pom.xml @@ -0,0 +1,41 @@ +<?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>compile-helper-plugin</artifactId> + <packaging>maven-plugin</packaging> + + <parent> + <artifactId>sdc-onboarding</artifactId> + <groupId>org.openecomp.sdc</groupId> + <version>1.2.0-SNAPSHOT</version> + <relativePath>../../../onboarding</relativePath> + </parent> + + <dependencies> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-core</artifactId> + <version>${maven-core.version}</version> + </dependency> + <dependency> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-annotations</artifactId> + <version>${maven-plugin-annotations.version}</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-plugin-plugin</artifactId> + <version>${maven-plugin-plugin.version}</version> + </plugin> + </plugins> + </build> + +</project>
\ No newline at end of file diff --git a/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/BuildState.java b/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/BuildState.java new file mode 100644 index 0000000000..888622f959 --- /dev/null +++ b/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/BuildState.java @@ -0,0 +1,238 @@ +/* + * Copyright © 2018 European Support Limited + * + * 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 a "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. + */ + +package org.openecomp.sdc.onboarding; + +import static org.openecomp.sdc.onboarding.Constants.RESOURCES_CHANGED; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.function.BiFunction; +import java.util.function.Function; +import java.util.stream.Stream; +import org.apache.maven.project.MavenProject; + +public class BuildState { + + private static Map<String, Long> fullBuildData = new HashMap<>(); + private static Map<String, Long> fullResourceBuildData = new HashMap<>(); + private static Map<String, Object> moduleBuildData = new HashMap<>(); + private static Map<String, Object> resourceBuildData = new HashMap<>(); + + private static File buildStateFile; + private static File resourceStateFile; + private File moduleBuildDataFile; + private File resourceBuildDataFile; + private MavenProject project; + private String buildStateFilePath; + private String resourceStateFilePath; + + private void readFullBuildState() { + buildStateFile = initialize(this::getBuildStateFile, fullBuildData, + buildStateFilePath.substring(0, buildStateFilePath.indexOf('/')), project); + } + + private void readResourceBuildState() { + resourceStateFile = initialize(this::getResourceStateFile, fullResourceBuildData, + resourceStateFilePath.substring(0, resourceStateFilePath.indexOf('/')), project); + + } + + private File initialize(BiFunction<String, MavenProject, File> funct, Map store, String moduleCoordinate, + MavenProject proj) { + File file = funct.apply(moduleCoordinate, proj); + file.getParentFile().mkdirs(); + try (FileInputStream fis = new FileInputStream(file); ObjectInputStream ois = new ObjectInputStream(fis);) { + if (store.isEmpty()) { + store.putAll(HashMap.class.cast(ois.readObject())); + } + } catch (Exception e) { + store.clear(); + } + return file; + } + + private void writeFullBuildState() throws IOException { + writeState(buildStateFile, fullBuildData); + } + + private void writeFullResourceBuildState() throws IOException { + writeState(resourceStateFile, fullResourceBuildData); + } + + private void writeState(File file, Map store) throws IOException { + try (FileOutputStream fos = new FileOutputStream(file); ObjectOutputStream oos = new ObjectOutputStream(fos)) { + oos.writeObject(store); + } + } + + private File getBuildStateFile(String moduleCoordinate, MavenProject proj) { + return getStateFile(moduleCoordinate, proj, buildStateFilePath); + } + + private File getResourceStateFile(String moduleCoordinate, MavenProject proj) { + return getStateFile(moduleCoordinate, proj, resourceStateFilePath); + } + + private File getStateFile(String moduleCoordinate, MavenProject proj, String filePath) { + return new File(getTopParentProject(moduleCoordinate, proj).getBasedir(), + filePath.substring(filePath.indexOf('/') + 1)); + } + + private MavenProject getTopParentProject(String moduleCoordinate, MavenProject proj) { + if (getModuleCoordinate(proj).equals(moduleCoordinate) || proj.getParent() == null) { + return proj; + } else { + return getTopParentProject(moduleCoordinate, proj.getParent()); + } + } + + private String getModuleCoordinate(MavenProject project) { + return project.getGroupId() + ":" + project.getArtifactId(); + } + + void addModuleBuildTime(String moduleCoordinates, Long buildTime) { + Long lastTime = fullBuildData.put(moduleCoordinates, buildTime); + try { + if (lastTime == null || !lastTime.equals(buildTime)) { + writeFullBuildState(); + } + } catch (IOException ignored) { + // ignored. No need to handle. System will take care. + } + } + + void addResourceBuildTime(String moduleCoordinates, Long buildTime) { + if (project.getProperties().containsKey(RESOURCES_CHANGED)) { + Long lastTime = fullResourceBuildData.put(moduleCoordinates, buildTime); + try { + writeFullResourceBuildState(); + } catch (IOException ignored) { + // ignored. No need to handle. System will take care. + } + } + } + + void addModuleBuildData(String moduleCoordinates, Map moduleBuildDependencies) { + moduleBuildData.put(moduleCoordinates, moduleBuildDependencies); + } + + Map<String, Object> readModuleBuildData() { + return readBuildData(moduleBuildDataFile); + } + + void saveModuleBuildData(String moduleCoordinate) { + saveBuildData(moduleBuildDataFile, moduleBuildData.get(moduleCoordinate)); + } + + void saveResourceBuildData(String moduleCoordinate) { + saveBuildData(resourceBuildDataFile, resourceBuildData.get(moduleCoordinate)); + } + + private void saveBuildData(File file, Object dataToSave) { + file.getParentFile().mkdirs(); + if (dataToSave != null) { + try (FileOutputStream fos = new FileOutputStream(file); + ObjectOutputStream ois = new ObjectOutputStream(fos)) { + ois.writeObject(dataToSave); + } catch (IOException ignored) { + //ignored. do nothing. system will take care. + } + } + } + + Map<String, Object> readResourceBuildData() { + return readBuildData(resourceBuildDataFile); + } + + private Map<String, Object> readBuildData(File file) { + try (FileInputStream fis = new FileInputStream(file); ObjectInputStream ois = new ObjectInputStream(fis)) { + return HashMap.class.cast(ois.readObject()); + } catch (Exception e) { + return new HashMap<>(); + } + } + + void addResourceBuildData(String moduleCoordinates, Map currentModuleResourceBuildData) { + resourceBuildData.put(moduleCoordinates, currentModuleResourceBuildData); + } + + Long getBuildTime(String moduleCoordinates) { + if (fullBuildData.isEmpty()) { + readFullBuildState(); + readResourceBuildState(); + } + Long buildTime = fullBuildData.get(moduleCoordinates); + return buildTime == null ? 0 : buildTime; + } + + Long getResourceBuildTime(String moduleCoordinates) { + Long resourceBuildTime = fullResourceBuildData.get(moduleCoordinates); + return resourceBuildTime == null ? 0 : resourceBuildTime; + } + + boolean isCompileMust(String moduleCoordinates, Collection<String> dependencies) { + return isMust(this::getBuildTime, moduleCoordinates, dependencies); + } + + boolean isTestMust(String moduleCoordinates, Collection<String> dependencies) { + return isMust(this::getResourceBuildTime, moduleCoordinates, dependencies); + } + + private boolean isMust(Function<String, Long> funct, String moduleCoordinates, Collection<String> dependencies) { + Long time = funct.apply(moduleCoordinates); + if (time == null || time == 0) { + return true; + } + for (String module : dependencies) { + Long buildTime = funct.apply(module); + if (buildTime >= time) { + return true; + } + } + return false; + } + + void markModuleDirty(File file) throws IOException { + if (file.exists()) { + Stream<String> lines = Files.lines(file.toPath()); + Iterator<String> itr = lines.iterator(); + while (itr.hasNext()) { + String line = itr.next(); + Path path = Paths.get(line); + if (path.toFile().exists()) { + if (path.toFile().setLastModified(System.currentTimeMillis())) { + break; + } else { + continue; + } + } + } + } + } + +} diff --git a/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/Constants.java b/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/Constants.java new file mode 100644 index 0000000000..96abc47882 --- /dev/null +++ b/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/Constants.java @@ -0,0 +1,15 @@ +package org.openecomp.sdc.onboarding; + +public class Constants { + + public static final String JACOCO_SKIP = "jacoco.skip"; + public static final String FORK_COUNT = "fork.count"; + public static final String JAVA_EXT = ".java"; + public static final String CLASS_EXT = ".class"; + public static final String SKIP_TEST_RUN = "skipTestRun"; + public static final String MAIN = "main"; + public static final String TEST = "test"; + public static final String JAVA = "java"; + public static final String RESOURCES_CHANGED = "resourcesChanged"; + public static final String UNICORN = "unicorn"; +} diff --git a/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/InitializationHelperMojo.java b/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/InitializationHelperMojo.java new file mode 100644 index 0000000000..cbf6f69c8a --- /dev/null +++ b/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/InitializationHelperMojo.java @@ -0,0 +1,59 @@ +/* + * Copyright © 2018 European Support Limited + * + * 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 a "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. + */ + +package org.openecomp.sdc.onboarding; + +import static org.openecomp.sdc.onboarding.Constants.FORK_COUNT; +import static org.openecomp.sdc.onboarding.Constants.JACOCO_SKIP; +import static org.openecomp.sdc.onboarding.Constants.UNICORN; + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.plugins.annotations.ResolutionScope; +import org.apache.maven.project.MavenProject; + +@Mojo(name = "init-helper", threadSafe = true, defaultPhase = LifecyclePhase.PRE_CLEAN, + requiresDependencyResolution = ResolutionScope.NONE) +public class InitializationHelperMojo extends AbstractMojo { + + @Parameter(defaultValue = "${project}", readonly = true) + private MavenProject project; + + public void execute() throws MojoExecutionException, MojoFailureException { + + if (System.getProperties().containsKey(JACOCO_SKIP) && Boolean.FALSE.equals(Boolean.valueOf( + System.getProperties().getProperty(JACOCO_SKIP)))) { + project.getProperties().setProperty(FORK_COUNT, "1"); + } else { + project.getProperties().setProperty(FORK_COUNT, "0"); + } + + if (System.getProperties().containsKey(UNICORN)) { + project.getProperties().setProperty("classes", "classes/**/*.class"); + project.getProperties().setProperty("testClasses", "test-classes/**/*.class"); + project.getProperties().setProperty("mavenStatus", "maven-status/**"); + project.getProperties().setProperty("pmd", "pmd/**"); + project.getProperties().setProperty("customGeneratedSources", "generated-sources/custom/**"); + + } + + } + +} diff --git a/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/PostCompileHelperMojo.java b/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/PostCompileHelperMojo.java new file mode 100644 index 0000000000..9ab373509e --- /dev/null +++ b/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/PostCompileHelperMojo.java @@ -0,0 +1,235 @@ +/* + * Copyright © 2018 European Support Limited + * + * 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 a "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. + */ + +package org.openecomp.sdc.onboarding; + +import static org.openecomp.sdc.onboarding.Constants.CLASS_EXT; +import static org.openecomp.sdc.onboarding.Constants.JAVA_EXT; +import static org.openecomp.sdc.onboarding.Constants.MAIN; +import static org.openecomp.sdc.onboarding.Constants.RESOURCES_CHANGED; +import static org.openecomp.sdc.onboarding.Constants.SKIP_TEST_RUN; +import static org.openecomp.sdc.onboarding.Constants.UNICORN; + +import java.io.File; +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import org.apache.maven.artifact.Artifact; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.plugins.annotations.ResolutionScope; +import org.apache.maven.project.MavenProject; + +@Mojo(name = "post-compile-helper", threadSafe = true, defaultPhase = LifecyclePhase.PROCESS_TEST_CLASSES, + requiresDependencyResolution = ResolutionScope.TEST) +public class PostCompileHelperMojo extends AbstractMojo { + + @Parameter(defaultValue = "${project}", readonly = true) + private MavenProject project; + @Parameter(defaultValue = "${project.artifact.groupId}:${project.artifact.artifactId}") + private String moduleCoordinates; + @Parameter + private Long staleThreshold; + @Parameter + private String excludePackaging; + @Parameter + private List<String> excludeDependencies; + @Parameter + private File mainSourceLocation; + @Parameter + private File testSourceLocation; + @Parameter + private File mainCompiledLocation; + @Parameter + private File testCompiledLocation; + @Parameter + private File inputSourceFilesList; + @Parameter + private File inputTestFilesList; + @Parameter + private BuildState buildState; + @Parameter + private File mainResourceLocation; + @Parameter + private File testResourceLocation; + @Parameter + private File compiledTestFilesList; + + + private File[] getCompiledClasses(File compiledFiles) { + if (!compiledFiles.exists()) { + return new File[0]; + } + File[] list = null; + try { + list = Files.walk(Paths.get(compiledFiles.getAbsolutePath())) + .filter(p -> p.toFile().getAbsolutePath().endsWith(CLASS_EXT)).map(p -> p.toFile()) + .sorted(this::compare).collect(Collectors.toList()).toArray(new File[0]); + } catch (IOException e) { + e.printStackTrace(); + } + if (list == null || list.length == 0) { + return new File[0]; + } + return list; + } + + private int compare(File file1, File file2) { + if (file1.lastModified() > file2.lastModified()) { + return 1; + } + if (file1.lastModified() < file2.lastModified()) { + return -1; + } + return 0; + } + + private File[] getStaleCompiledClasses(File[] compiledClasses, File javaSourceLocation) { + List<File> staleFiles = new ArrayList<>(); + for (File file : compiledClasses) { + String classLocation = file.getAbsolutePath().replace( + project.getBasedir().getAbsolutePath() + File.separator + "target" + File.separator, ""); + String classLocationWithPackageOnly = + classLocation.substring(classLocation.indexOf(File.separatorChar) + 1); + String sourceFilePath = javaSourceLocation.getAbsolutePath() + File.separator + classLocationWithPackageOnly + .replace(CLASS_EXT, + JAVA_EXT); + if (Paths.get(sourceFilePath).toFile().exists()) { + return staleFiles.toArray(new File[0]); + } else { + staleFiles.add(file); + } + } + return staleFiles.toArray(new File[0]); + } + + private boolean deleteAll(File[] files) { + for (File file : files) { + if (!file.delete()) { + return false; + } + } + return true; + } + + public void execute() throws MojoExecutionException { + if (!System.getProperties().containsKey(UNICORN)) { + return; + } + if (project.getPackaging().equals(excludePackaging)) { + return; + } + String moduleLocation = project.getBasedir().getAbsolutePath(); + + File[] mainClasses = getCompiledClasses(mainCompiledLocation); + processStaleClassesIfAny(mainClasses, mainSourceLocation, inputSourceFilesList); + + File[] testClasses = getCompiledClasses(testCompiledLocation); + processStaleClassesIfAny(testClasses, testSourceLocation, inputTestFilesList); + + if (mainClasses.length == 0 && testClasses.length == 0) { + return; + } + buildState.addModuleBuildTime(project.getGroupId() + ":" + project.getArtifactId(), + mainClasses.length > 0 ? mainClasses[mainClasses.length - 1].lastModified() : + testClasses.length > 0 ? testClasses[testClasses.length - 1].lastModified() : 0); + buildState.saveModuleBuildData(moduleCoordinates); + Map<String, Object> resourceBuildData = getCurrentResourceBuildData(); + Map<String, Object> lastTimeResourceBuildData = buildState.readResourceBuildData(); + boolean resourceDataSame = resourceBuildData.equals(lastTimeResourceBuildData); + if (!resourceDataSame) { + buildState.addResourceBuildData(moduleCoordinates, resourceBuildData); + project.getProperties().setProperty(SKIP_TEST_RUN, Boolean.FALSE.toString()); + } + boolean resourceMainBuildDataSameWithPreviousBuild = + lastTimeResourceBuildData.get(MAIN) != null && resourceBuildData.get(MAIN) + .equals(lastTimeResourceBuildData + .get(MAIN)); + if (!resourceMainBuildDataSameWithPreviousBuild) { + project.getProperties().setProperty(RESOURCES_CHANGED, Boolean.TRUE.toString()); + } + if (!project.getProperties().containsKey(SKIP_TEST_RUN)) { + if (compiledTestFilesList.exists() + && compiledTestFilesList.lastModified() > System.currentTimeMillis() - staleThreshold) { + project.getProperties().setProperty(SKIP_TEST_RUN, Boolean.FALSE.toString()); + } + } + } + + private void processStaleClassesIfAny(File[] classes, File sourceLocation, File listFile) + throws MojoExecutionException { + if (classes.length > 0) { + List<File> list = new ArrayList<>(Arrays.asList(classes)); + File[] staleClasses = null; + boolean allStale = listFile.isFile() && listFile.length() == 0; + if (allStale) { + staleClasses = classes; + listFile.delete(); + } else { + list.removeIf(f -> f.lastModified() > classes[classes.length - 1].lastModified() - staleThreshold); + staleClasses = getStaleCompiledClasses(list.toArray(new File[0]), sourceLocation); + } + if (!deleteAll(staleClasses)) { + throw new MojoExecutionException( + "****** Please remove 'target' directory manually under path " + project.getBasedir() + .getAbsolutePath()); + } + } + } + + private Map<String, Object> getCurrentResourceBuildData() { + HashMap<String, Object> resourceBuildStateData = new HashMap<>(); + try { + resourceBuildStateData.put("main", readResources(mainResourceLocation)); + resourceBuildStateData.put("test", readResources(testResourceLocation)); + resourceBuildStateData.put("dependency", getDependencies()); + } catch (IOException ioException) { + throw new UncheckedIOException(ioException); + } + return resourceBuildStateData; + } + + private Map<String, Long> readResources(File file) throws IOException { + Map<String, Long> resources = new HashMap<>(); + if (file.exists()) { + List<Path> list = Files.walk(Paths.get(file.getAbsolutePath())).filter(Files::isRegularFile) + .collect(Collectors.toList()); + for (Path path : list) { + resources.put(path.toFile().getAbsolutePath(), path.toFile().lastModified()); + } + } + return resources; + } + + private Map<String, String> getDependencies() { + Map<String, String> dependencies = new HashMap<>(); + for (Artifact d : project.getArtifacts()) { + dependencies.put(d.getGroupId() + ":" + d.getArtifactId(), d.getVersion()); + } + return dependencies; + } +} diff --git a/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/PostTestRunHelperMojo.java b/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/PostTestRunHelperMojo.java new file mode 100644 index 0000000000..5b326f3ddf --- /dev/null +++ b/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/PostTestRunHelperMojo.java @@ -0,0 +1,61 @@ +/* + * Copyright © 2018 European Support Limited + * + * 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 a "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. + */ + +package org.openecomp.sdc.onboarding; + +import static org.openecomp.sdc.onboarding.Constants.SKIP_TEST_RUN; +import static org.openecomp.sdc.onboarding.Constants.UNICORN; + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.plugins.annotations.ResolutionScope; +import org.apache.maven.project.MavenProject; + +@Mojo(name = "post-test-run-helper", threadSafe = true, defaultPhase = LifecyclePhase.TEST, + requiresDependencyResolution = ResolutionScope.NONE) +public class PostTestRunHelperMojo extends AbstractMojo { + + @Parameter + private BuildState buildState; + @Parameter(defaultValue = "${project.artifact.groupId}:${project.artifact.artifactId}") + private String moduleCoordinates; + @Parameter(defaultValue = "${project}", readonly = true) + private MavenProject project; + @Parameter + private String excludePackaging; + + + public void execute() throws MojoExecutionException, MojoFailureException { + if (!System.getProperties().containsKey(UNICORN)) { + return; + } + if (project.getPackaging().equals(excludePackaging)) { + return; + } + buildState.saveResourceBuildData(moduleCoordinates); + if (project.getProperties().containsKey(SKIP_TEST_RUN) && !Boolean.valueOf( + project.getProperties().getProperty(SKIP_TEST_RUN))) { + if (!System.getProperties().containsKey("skipTests")) { + buildState.addResourceBuildTime(moduleCoordinates, System.currentTimeMillis()); + } + } + + } +} diff --git a/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/PreCompileHelperMojo.java b/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/PreCompileHelperMojo.java new file mode 100644 index 0000000000..faa3167e37 --- /dev/null +++ b/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/PreCompileHelperMojo.java @@ -0,0 +1,142 @@ +/* + * Copyright © 2018 European Support Limited + * + * 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 a "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. + */ + +package org.openecomp.sdc.onboarding; + +import static org.openecomp.sdc.onboarding.Constants.MAIN; +import static org.openecomp.sdc.onboarding.Constants.SKIP_TEST_RUN; +import static org.openecomp.sdc.onboarding.Constants.TEST; +import static org.openecomp.sdc.onboarding.Constants.UNICORN; + +import java.io.File; +import java.io.IOException; +import java.io.UncheckedIOException; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.apache.maven.artifact.Artifact; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.plugins.annotations.ResolutionScope; +import org.apache.maven.project.MavenProject; + +@Mojo(name = "pre-compile-helper", threadSafe = true, defaultPhase = LifecyclePhase.GENERATE_SOURCES, + requiresDependencyResolution = ResolutionScope.TEST) +public class PreCompileHelperMojo extends AbstractMojo { + + @Parameter(defaultValue = "${project}", readonly = true) + private MavenProject project; + @Parameter(defaultValue = "${project.artifact.groupId}:${project.artifact.artifactId}") + private String moduleCoordinates; + @Parameter + private String excludePackaging; + @Parameter + private List<String> excludeDependencies; + @Parameter + private File mainCompiledLocation; + @Parameter + private File testCompiledLocation; + @Parameter + private File inputSourceFilesList; + @Parameter + private File inputTestFilesList; + @Parameter + private BuildState buildState; + + public void execute() throws MojoExecutionException { + if (!System.getProperties().containsKey(UNICORN)) { + return; + } + if (project.getPackaging().equals(excludePackaging)) { + return; + } + + Map<String, Object> moduleBuildData = getCurrentModuleBuildData(); + Map<String, Object> lastTimeModuleBuildData = buildState.readModuleBuildData(); + + boolean buildDataSameWithPreviousBuild = lastTimeModuleBuildData.get(MAIN) != null && moduleBuildData.get(MAIN) + .equals(lastTimeModuleBuildData + .get(MAIN)); + boolean isFirstBuild = buildState.getBuildTime(moduleCoordinates) == 0; + + if (isCompileNeeded(HashMap.class.cast(moduleBuildData.get(MAIN)).keySet(), isFirstBuild, + buildDataSameWithPreviousBuild)) { + try { + buildState.markModuleDirty(inputSourceFilesList); + buildState.markModuleDirty(inputTestFilesList); + project.getProperties().setProperty(SKIP_TEST_RUN, "false"); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } + + if (!moduleBuildData.get(TEST).equals(lastTimeModuleBuildData.get(TEST))) { + try { + buildState.markModuleDirty(inputTestFilesList); + project.getProperties().setProperty(SKIP_TEST_RUN, Boolean.FALSE.toString()); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } + + if (!moduleBuildData.equals(lastTimeModuleBuildData)) { + buildState.addModuleBuildData(moduleCoordinates, moduleBuildData); + } + + if (inputSourceFilesList.isFile() && inputSourceFilesList.length() == 0) { + if (!inputSourceFilesList.delete()) { + throw new MojoExecutionException( + "****** Please remove 'target' directory manually under path " + project.getBasedir() + .getAbsolutePath()); + } + } + if (inputTestFilesList.isFile() && inputTestFilesList.length() == 0) { + if (!inputTestFilesList.delete()) { + throw new MojoExecutionException( + "****** Please remove 'target' directory manually under path " + project.getBasedir() + .getAbsolutePath()); + } + } + } + + private boolean isCompileNeeded(Collection<String> dependencyCoordinates, boolean isFirstBuild, + boolean buildDataSame) { + return isFirstBuild || !buildDataSame || buildState.isCompileMust(moduleCoordinates, dependencyCoordinates); + } + + private Map<String, Object> getCurrentModuleBuildData() { + Map<String, Object> moduleBuildData = new HashMap<>(); + moduleBuildData.put(MAIN, new HashMap<String, String>()); + moduleBuildData.put(TEST, new HashMap<String, String>()); + if (project.getArtifacts() == null || project.getArtifacts().isEmpty()) { + return moduleBuildData; + } + for (Artifact dependency : project.getArtifacts()) { + if (excludeDependencies.contains(dependency.getScope())) { + HashMap.class.cast(moduleBuildData.get(TEST)) + .put(dependency.getGroupId() + ":" + dependency.getArtifactId(), dependency.getVersion()); + continue; + } + HashMap.class.cast(moduleBuildData.get(MAIN)) + .put(dependency.getGroupId() + ":" + dependency.getArtifactId(), dependency.getVersion()); + } + return moduleBuildData; + } +} diff --git a/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/PreTestCompileHelperMojo.java b/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/PreTestCompileHelperMojo.java new file mode 100644 index 0000000000..e711cb0ae7 --- /dev/null +++ b/openecomp-be/tools/compile-helper-plugin/src/main/java/org/openecomp/sdc/onboarding/PreTestCompileHelperMojo.java @@ -0,0 +1,90 @@ +/* + * Copyright © 2018 European Support Limited + * + * 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 a "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. + */ + +package org.openecomp.sdc.onboarding; + +import static org.openecomp.sdc.onboarding.Constants.JACOCO_SKIP; +import static org.openecomp.sdc.onboarding.Constants.SKIP_TEST_RUN; +import static org.openecomp.sdc.onboarding.Constants.RESOURCES_CHANGED; +import static org.openecomp.sdc.onboarding.Constants.UNICORN; + +import java.io.File; +import java.io.IOException; +import java.io.UncheckedIOException; +import java.util.stream.Collectors; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.plugins.annotations.ResolutionScope; +import org.apache.maven.project.MavenProject; + +@Mojo(name = "pre-test-compile-helper", threadSafe = true, defaultPhase = LifecyclePhase.GENERATE_TEST_RESOURCES, + requiresDependencyResolution = ResolutionScope.TEST) +public class PreTestCompileHelperMojo extends AbstractMojo { + + @Parameter + private File compiledFilesList; + @Parameter + private Long staleThreshold; + @Parameter + private File inputTestFilesList; + @Parameter + private BuildState buildState; + @Parameter(defaultValue = "${project}", readonly = true) + private MavenProject project; + @Parameter(defaultValue = "${project.artifact.groupId}:${project.artifact.artifactId}") + private String moduleCoordinates; + @Parameter + private String excludePackaging; + + + public void execute() throws MojoExecutionException, MojoFailureException { + if (!System.getProperties().containsKey(UNICORN)) { + return; + } + if (project.getPackaging().equals(excludePackaging)) { + return; + } + if (compiledFilesList.exists() + && compiledFilesList.lastModified() > System.currentTimeMillis() - staleThreshold) { + try { + buildState.markModuleDirty(inputTestFilesList); + project.getProperties().setProperty(SKIP_TEST_RUN, Boolean.FALSE.toString()); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } + boolean isTestMust = buildState.isTestMust(moduleCoordinates, + project.getDependencies().stream().map(d -> d.getGroupId() + ":" + d.getArtifactId()) + .collect(Collectors.toList())); + if (isTestMust) { + project.getProperties().setProperty(RESOURCES_CHANGED, Boolean.TRUE.toString()); + if (!project.getProperties().containsKey(SKIP_TEST_RUN)) { + project.getProperties().setProperty(SKIP_TEST_RUN, Boolean.FALSE.toString()); + } + } + if (!project.getProperties().containsKey(SKIP_TEST_RUN)) { + project.getProperties().setProperty(SKIP_TEST_RUN, Boolean.TRUE.toString()); + } + if (System.getProperties().containsKey(JACOCO_SKIP) && Boolean.FALSE.equals(Boolean.valueOf( + System.getProperties().getProperty(JACOCO_SKIP)))) { + project.getProperties().setProperty(SKIP_TEST_RUN, Boolean.FALSE.toString()); + } + } +} @@ -1,158 +1,157 @@ <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>sdc-main</artifactId> - <version>1.2.0-SNAPSHOT</version> - <packaging>pom</packaging> - <name>sdc</name> - <properties> - - <maven.compiler.source>1.8</maven.compiler.source> - <maven.compiler.target>1.8</maven.compiler.target> - - <!-- ==================== --> - <!-- Generic properties --> - <!-- ==================== --> - <build.type>-SNAPSHOT</build.type> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <sprint.number>74</sprint.number> - - <!-- 3rd parties versions --> - <lang3.version>3.3.2</lang3.version> - <guava.version>18.0</guava.version> - <titan.version>1.0.0</titan.version> - <sdc.titan.version>1.2.0</sdc.titan.version> - <spring-boot.version>1.1.6.RELEASE</spring-boot.version> - <spring.version>4.3.13.RELEASE</spring.version> - <spring.security.version>3.2.3.RELEASE</spring.security.version> - <spring.ldap.version>2.0.1.RELEASE</spring.ldap.version> + 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>sdc-main</artifactId> + <version>1.2.0-SNAPSHOT</version> + <packaging>pom</packaging> + <name>sdc</name> + <properties> + + <maven.compiler.source>1.8</maven.compiler.source> + <maven.compiler.target>1.8</maven.compiler.target> + + <!-- ==================== --> + <!-- Generic properties --> + <!-- ==================== --> + <build.type>-SNAPSHOT</build.type> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <sprint.number>74</sprint.number> + + <!-- 3rd parties versions --> + <lang3.version>3.3.2</lang3.version> + <guava.version>18.0</guava.version> + <titan.version>1.0.0</titan.version> + <sdc.titan.version>1.2.0</sdc.titan.version> + <spring-boot.version>1.1.6.RELEASE</spring-boot.version> + <spring.version>4.3.13.RELEASE</spring.version> + <spring.security.version>3.2.3.RELEASE</spring.security.version> + <spring.ldap.version>2.0.1.RELEASE</spring.ldap.version> <jersey-bom.version>2.26</jersey-bom.version> <servlet-api.version>2.5</servlet-api.version> - <wire-mock.version>2.11.0</wire-mock.version> - - <artifact-generator-api.version>${project.version}</artifact-generator-api.version> - <artifact-generator-core.version>${project.version}</artifact-generator-core.version> - <ecomp.version>1.1.0</ecomp.version> - <dox-common-lib.version>${project.version}</dox-common-lib.version> - - <!-- Elastic Search mapper (reference the elastic search version actually). --> - <elastic-search.version>2.4.0</elastic-search.version> - <catalog-artifacts.version>1.0.0-SNAPSHOT</catalog-artifacts.version> - <catalog-builders.version>1.0.0-SNAPSHOT</catalog-builders.version> - <jetty.version>9.2.10.v20150310</jetty.version> - - <!-- JSON and YAML Parsing --> - <jackson.version>2.9.4</jackson.version> - <jackson.yaml.version>2.9.4</jackson.yaml.version> - <jackson.annotations.version>2.9.4</jackson.annotations.version> - - <!-- Yaml for properties --> - <snakeyaml.version>1.14</snakeyaml.version> - <functionaljava.version>4.4</functionaljava.version> - <httpclient.version>4.4.1</httpclient.version> - <httpcore.version>4.4.1</httpcore.version> - <json-simple.version>1.1</json-simple.version> - - - <!-- Logging start --> - <!-- logback --> + <wire-mock.version>2.11.0</wire-mock.version> + + <artifact-generator-api.version>${project.version}</artifact-generator-api.version> + <artifact-generator-core.version>${project.version}</artifact-generator-core.version> + <ecomp.version>1.1.0</ecomp.version> + <dox-common-lib.version>${project.version}</dox-common-lib.version> + + <!-- Elastic Search mapper (reference the elastic search version actually). --> + <elastic-search.version>2.4.0</elastic-search.version> + <catalog-artifacts.version>1.0.0-SNAPSHOT</catalog-artifacts.version> + <catalog-builders.version>1.0.0-SNAPSHOT</catalog-builders.version> + <jetty.version>9.2.10.v20150310</jetty.version> + + <!-- JSON and YAML Parsing --> + <jackson.version>2.9.4</jackson.version> + <jackson.yaml.version>2.9.4</jackson.yaml.version> + <jackson.annotations.version>2.9.4</jackson.annotations.version> + + <!-- Yaml for properties --> + <snakeyaml.version>1.14</snakeyaml.version> + <functionaljava.version>4.4</functionaljava.version> + <httpclient.version>4.4.1</httpclient.version> + <httpcore.version>4.4.1</httpcore.version> + <json-simple.version>1.1</json-simple.version> + + <!-- Logging start --> + <!-- logback --> <logback.version>1.2.3</logback.version> <slf4j-api.version>1.7.10</slf4j-api.version> <commons-codec>1.10</commons-codec> <commons-logging>1.2</commons-logging> - <groovy.version>2.4.13</groovy.version> - <janino.version>3.0.6</janino.version> + <groovy.version>2.4.13</groovy.version> + <janino.version>3.0.6</janino.version> - <!-- aspects --> - <jcabi.version>0.20.1</jcabi.version> - <aspectjrt.version>1.8.4</aspectjrt.version> - <aspectj.version>1.7.4</aspectj.version> - <jcabi.plugin.version>0.13.2</jcabi.plugin.version> + <!-- aspects --> + <jcabi.version>0.20.1</jcabi.version> + <aspectjrt.version>1.8.4</aspectjrt.version> + <aspectj.version>1.7.4</aspectj.version> + <jcabi.plugin.version>0.13.2</jcabi.plugin.version> - <!-- Logging end --> - <!-- System Metrics --> - <sigar.version>1.6.4</sigar.version> + <!-- Logging end --> + <!-- System Metrics --> + <sigar.version>1.6.4</sigar.version> - <regex.version>3.0.3</regex.version> + <regex.version>3.0.3</regex.version> - <!--GSON--> - <gson.version>2.3.1</gson.version> + <!--GSON--> + <gson.version>2.3.1</gson.version> <!--listen to file changes--> <commons-jci-core.version>1.1</commons-jci-core.version> - <!--TESTING--> - <mockito.version>2.12.0</mockito.version> - <junit.version>4.12</junit.version> - <assertj.version>3.8.0</assertj.version> - <testng.version>6.9.10</testng.version> - <extentreports.version>3.0.3</extentreports.version> - <cucumber.version>2.3.1</cucumber.version> - - <!-- parser--> - <sdc-tosca-parser.version>1.2.3-SNAPSHOT</sdc-tosca-parser.version> - - <!--JaCoCO --> - <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin> - <sonar.language>java</sonar.language> - <!-- Sonar properties --> - <sonar.sourceEncoding>${project.build.sourceEncoding}</sonar.sourceEncoding> - <sonar.projectBaseDir>${project.basedir}</sonar.projectBaseDir> - <sonar.branch>${project.version}</sonar.branch> - - <!--cassandra --> - <cassandra.driver.version>3.0.0</cassandra.driver.version> - <!-- maven central (Nexus) --> - <nexus.id.release>nexus</nexus.id.release> - <nexus.id.snapshot>nexus</nexus.id.snapshot> - - <!--nexus--> - <nexus.proxy>https://nexus.onap.org</nexus.proxy> - <sitePath>/content/sites/site/org/openecomp/sdc/${project.version}</sitePath> - <staging.profile.id>176c31dfe190a</staging.profile.id> - <!--maven--> - <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format> - <!--io.fabric8--> - <fabric8.version>0.23.0</fabric8.version> - <!--docker tags--> - <docker.tag>${project.version}-${maven.build.timestamp}</docker.tag> - <!--<docker.latest.tag>${project.version}-latest</docker.latest.tag>--> - - </properties> - - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.glassfish.jersey.ext</groupId> - <artifactId>jersey-bean-validation</artifactId> - <version>${jersey-bom.version}</version> - </dependency> - - <dependency> - <groupId>org.glassfish.hk2.external</groupId> - <artifactId>asm-all-repackaged</artifactId> - <version>2.4.0</version> - </dependency> - - <dependency> - <groupId>org.assertj</groupId> - <artifactId>assertj-core</artifactId> - <version>${assertj.version}</version> - </dependency> - - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <version>${mockito.version}</version> - </dependency> - - <dependency> - <groupId>com.github.tomakehurst</groupId> - <artifactId>wiremock</artifactId> - <version>${wire-mock.version}</version> - </dependency> + <!--TESTING--> + <mockito.version>2.12.0</mockito.version> + <junit.version>4.12</junit.version> + <assertj.version>3.8.0</assertj.version> + <testng.version>6.9.10</testng.version> + <extentreports.version>3.0.3</extentreports.version> + <cucumber.version>2.3.1</cucumber.version> + + <!-- parser--> + <sdc-tosca-parser.version>1.2.3-SNAPSHOT</sdc-tosca-parser.version> + + <!--JaCoCO --> + <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin> + <sonar.language>java</sonar.language> + <!-- Sonar properties --> + <sonar.sourceEncoding>${project.build.sourceEncoding}</sonar.sourceEncoding> + <sonar.projectBaseDir>${project.basedir}</sonar.projectBaseDir> + <sonar.branch>${project.version}</sonar.branch> + + <!--cassandra --> + <cassandra.driver.version>3.0.0</cassandra.driver.version> + <!-- maven central (Nexus) --> + <nexus.id.release>nexus</nexus.id.release> + <nexus.id.snapshot>nexus</nexus.id.snapshot> + + <!--nexus--> + <nexus.proxy>https://nexus.onap.org</nexus.proxy> + <sitePath>/content/sites/site/org/openecomp/sdc/${project.version}</sitePath> + <staging.profile.id>176c31dfe190a</staging.profile.id> + <!--maven--> + <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format> + <!--io.fabric8--> + <fabric8.version>0.23.0</fabric8.version> + <!--docker tags--> + <docker.tag>${project.version}-${maven.build.timestamp}</docker.tag> + <!--<docker.latest.tag>${project.version}-latest</docker.latest.tag>--> + + </properties> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.glassfish.jersey.ext</groupId> + <artifactId>jersey-bean-validation</artifactId> + <version>${jersey-bom.version}</version> + </dependency> + + <dependency> + <groupId>org.glassfish.hk2.external</groupId> + <artifactId>asm-all-repackaged</artifactId> + <version>2.4.0</version> + </dependency> + + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <version>${assertj.version}</version> + </dependency> + + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <version>${mockito.version}</version> + </dependency> + + <dependency> + <groupId>com.github.tomakehurst</groupId> + <artifactId>wiremock</artifactId> + <version>${wire-mock.version}</version> + </dependency> <dependency> <groupId>io.cucumber</groupId> @@ -165,318 +164,319 @@ <artifactId>cucumber-junit</artifactId> <version>${cucumber.version}</version> </dependency> - </dependencies> - </dependencyManagement> - - <reporting> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - <version>3.0.0-M1</version> - <configuration> - <failOnError>false</failOnError> - <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet> - <docletArtifact> - <groupId>org.umlgraph</groupId> - <artifactId>umlgraph</artifactId> - <version>5.6</version> - </docletArtifact> - <additionalparam>-views</additionalparam> - <useStandardDocletOptions>true</useStandardDocletOptions> - </configuration> - </plugin> - </plugins> - </reporting> - - <build> - <pluginManagement> - <plugins> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-site-plugin</artifactId> - <version>3.4</version> - <dependencies> - <dependency> - <groupId>org.apache.maven.wagon</groupId> - <artifactId>wagon-webdav-jackrabbit</artifactId> - <version>2.10</version> - </dependency> - </dependencies> - </plugin> - - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-assembly-plugin</artifactId> - <version>3.1.0</version> - </plugin> - - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>exec-maven-plugin</artifactId> - <version>1.4.0</version> - </plugin> - <plugin> - <groupId>org.sonarsource.scanner.maven</groupId> - <artifactId>sonar-maven-plugin</artifactId> - <version>3.0.2</version> - </plugin> - </plugins> - </pluginManagement> - - <plugins> - - <!-- Staging Plugin --> - <plugin> - <groupId>org.sonatype.plugins</groupId> - <artifactId>nexus-staging-maven-plugin</artifactId> - <version>1.6.7</version> - <extensions>true</extensions> - <configuration> - <nexusUrl>${nexus.proxy}</nexusUrl> - <stagingProfileId>${staging.profile.id}</stagingProfileId> - <serverId>ecomp-staging</serverId> - </configuration> - </plugin> - - <plugin> - <artifactId>maven-surefire-plugin</artifactId> - <version>2.19.1</version> - <configuration> - <systemPropertyVariables> - <logback.configurationFile>src/test/resources/logback-test.xml</logback.configurationFile> - </systemPropertyVariables> - </configuration> - </plugin> - <!-- plugin for parsing the project version --> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>build-helper-maven-plugin</artifactId> - <version>1.8</version> - <executions> - <execution> - <id>parse-version</id> - <goals> - <goal>parse-version</goal> - </goals> - </execution> - </executions> - </plugin> - - <!-- Java Code Coverage --> - <plugin> - <groupId>org.jacoco</groupId> - <artifactId>jacoco-maven-plugin</artifactId> - <version>0.7.9</version> - <executions> - <execution> - <id>default-prepare-agent</id> - <goals> - <goal>prepare-agent</goal> - </goals> - </execution> - <execution> - <id>default-report</id> - <goals> - <goal>report</goal> - </goals> - </execution> - </executions> - </plugin> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-site-plugin</artifactId> - <dependencies> - <dependency> - <groupId>org.apache.maven.wagon</groupId> - <artifactId>wagon-webdav-jackrabbit</artifactId> - <version>2.10</version> - </dependency> - </dependencies> - </plugin> - - <!-- Set the deployment repositories properties. --> - <plugin> - <groupId>org.codehaus.gmaven</groupId> - <artifactId>gmaven-plugin</artifactId> - <version>1.4</version> - <executions> - <execution> - <inherited>false</inherited> - <phase>integration-test</phase> - <goals> - <goal>execute</goal> - </goals> - <configuration> - <source> - pom.properties['deploy.url']= - pom.version.contains('-SNAPSHOT') ? - project.distributionManagement.snapshotRepository.url : - project.distributionManagement.repository.url; - pom.properties['repo.id']= pom.version.contains('-SNAPSHOT') ? - project.distributionManagement.snapshotRepository.id : - project.distributionManagement.repository.id; - </source> - </configuration> - </execution> - </executions> - </plugin> - - <!-- license plugin --> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>license-maven-plugin</artifactId> - <version>1.10</version> - <configuration> - <addJavaLicenseAfterPackage>false</addJavaLicenseAfterPackage> - <processStartTag>============LICENSE_START=======================================================</processStartTag> - <processEndTag>============LICENSE_END=========================================================</processEndTag> - <sectionDelimiter>================================================================================</sectionDelimiter> - <licenseName>apache_v2</licenseName> - <inceptionYear>2017</inceptionYear> - <organizationName>AT&T Intellectual Property. All rights - reserved.</organizationName> - <projectName>SDC</projectName> - <canUpdateCopyright>true</canUpdateCopyright> - <canUpdateDescription>true</canUpdateDescription> - <canUpdateLicense>true</canUpdateLicense> - <emptyLineAfterHeader>true</emptyLineAfterHeader> - <verbose>false</verbose> - <includes> - <include>**/*.java</include> - <include>**/*.ts</include> - </includes> - <excludes> - <exclude>**/*.d.ts</exclude> - </excludes> - <roots> - <root>src</root> - <root>app</root> - <root>server-mock</root> - <root>typings</root> - </roots> - <extraExtensions> - <ts>java</ts> - </extraExtensions> - </configuration> - <executions> - <execution> - <id>first</id> - <goals> - <goal>update-file-header</goal> - </goals> - <!--phase>process-sources</phase --> - </execution> - </executions> - </plugin> - </plugins> - </build> - - <profiles> - <profile> - <id>all</id> - <activation> - <activeByDefault>true</activeByDefault> - </activation> - <modules> - <module>build-tools</module> - <module>onboarding</module> - <module>services/activity-spec</module> - <module>security-utils</module> - <module>common-app-api</module> - <module>common-be</module> - <module>catalog-dao</module> - <module>catalog-model</module> - <module>catalog-be</module> - <module>asdctool</module> - <module>catalog-ui</module> - <module>catalog-fe</module> - <module>test-apis-ci</module> - <module>ui-ci</module> - <module>sdc-os-chef</module> - <module>utils/webseal-simulator</module> - </modules> - - </profile> - - <profile> - <id>catalog</id> - <activation> - <activeByDefault>false</activeByDefault> - </activation> - <modules> - <module>security-utils</module> - <module>common-app-api</module> - <module>common-be</module> - <module>catalog-dao</module> - <module>catalog-model</module> - <module>catalog-be</module> - <module>asdctool</module> - <module>catalog-ui</module> - <module>catalog-fe</module> - <module>test-apis-ci</module> - <module>ui-ci</module> - </modules> - - <properties> - <ecomp.version>1.2.7</ecomp.version> - <artifact-generator-api.version>1802.0.1.167</artifact-generator-api.version> - <artifact-generator-core.version>1802.0.1.167</artifact-generator-core.version> - <dox-common-lib.version>1802.0.1.167</dox-common-lib.version> - <sdc-tosca-parser.version>1.1.32</sdc-tosca-parser.version> - </properties> - </profile> - - <profile> - <id>onboarding</id> - <activation> - <activeByDefault>false</activeByDefault> - </activation> - <modules> - <module>build-tools</module> - <module>onboarding</module> - </modules> - </profile> - - </profiles> - - <repositories> - <!-- LF repositories --> - <repository> - <id>ecomp-releases</id> - <name>Release Repository</name> - <url>${nexus.proxy}/content/repositories/releases/</url> - </repository> - <repository> - <id>ecomp-snapshots</id> - <name>Snapshots Repository</name> - <url>${nexus.proxy}/content/repositories/snapshots/</url> - </repository> - <repository> - <id>ecomp-public</id> - <name>Public Repository</name> - <url>${nexus.proxy}/content/repositories/public/</url> - </repository> - <!-- LF repositories END--> - </repositories> - - <distributionManagement> - <repository> - <id>ecomp-releases</id> - <name>Release Repository</name> - <url>${nexus.proxy}/content/repositories/releases/</url> - </repository> - <snapshotRepository> - <id>ecomp-snapshots</id> - <name>Snapshot Repository</name> - <url>${nexus.proxy}/content/repositories/snapshots/</url> - </snapshotRepository> - <site> - <id>ecomp-site</id> - <url>dav:${nexus.proxy}${sitePath}</url> - </site> - </distributionManagement> + </dependencies> + </dependencyManagement> + + <reporting> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <version>3.0.0-M1</version> + <configuration> + <failOnError>false</failOnError> + <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet> + <docletArtifact> + <groupId>org.umlgraph</groupId> + <artifactId>umlgraph</artifactId> + <version>5.6</version> + </docletArtifact> + <additionalparam>-views</additionalparam> + <useStandardDocletOptions>true</useStandardDocletOptions> + </configuration> + </plugin> + </plugins> + </reporting> + + <build> + <pluginManagement> + <plugins> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-site-plugin</artifactId> + <version>3.4</version> + <dependencies> + <dependency> + <groupId>org.apache.maven.wagon</groupId> + <artifactId>wagon-webdav-jackrabbit</artifactId> + <version>2.10</version> + </dependency> + </dependencies> + </plugin> + + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-assembly-plugin</artifactId> + <version>3.1.0</version> + </plugin> + + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>1.4.0</version> + </plugin> + <plugin> + <groupId>org.sonarsource.scanner.maven</groupId> + <artifactId>sonar-maven-plugin</artifactId> + <version>3.0.2</version> + </plugin> + </plugins> + </pluginManagement> + + <plugins> + + <!-- Staging Plugin --> + <plugin> + <groupId>org.sonatype.plugins</groupId> + <artifactId>nexus-staging-maven-plugin</artifactId> + <version>1.6.7</version> + <extensions>true</extensions> + <configuration> + <nexusUrl>${nexus.proxy}</nexusUrl> + <stagingProfileId>${staging.profile.id}</stagingProfileId> + <serverId>ecomp-staging</serverId> + </configuration> + </plugin> + + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <version>2.19.1</version> + <configuration> + <systemPropertyVariables> + <logback.configurationFile>src/test/resources/logback-test.xml</logback.configurationFile> + </systemPropertyVariables> + </configuration> + </plugin> + <!-- plugin for parsing the project version --> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>1.8</version> + <executions> + <execution> + <id>parse-version</id> + <goals> + <goal>parse-version</goal> + </goals> + </execution> + </executions> + </plugin> + + <!-- Java Code Coverage --> + <plugin> + <groupId>org.jacoco</groupId> + <artifactId>jacoco-maven-plugin</artifactId> + <version>0.7.9</version> + <executions> + <execution> + <id>default-prepare-agent</id> + <goals> + <goal>prepare-agent</goal> + </goals> + </execution> + <execution> + <id>default-report</id> + <goals> + <goal>report</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-site-plugin</artifactId> + <dependencies> + <dependency> + <groupId>org.apache.maven.wagon</groupId> + <artifactId>wagon-webdav-jackrabbit</artifactId> + <version>2.10</version> + </dependency> + </dependencies> + </plugin> + + <!-- Set the deployment repositories properties. --> + <plugin> + <groupId>org.codehaus.gmaven</groupId> + <artifactId>gmaven-plugin</artifactId> + <version>1.4</version> + <executions> + <execution> + <inherited>false</inherited> + <phase>integration-test</phase> + <goals> + <goal>execute</goal> + </goals> + <configuration> + <source> + pom.properties['deploy.url'] = + pom.version.contains('-SNAPSHOT') ? + project.distributionManagement.snapshotRepository.url : + project.distributionManagement.repository.url; + pom.properties['repo.id'] = pom.version.contains('-SNAPSHOT') ? + project.distributionManagement.snapshotRepository.id : + project.distributionManagement.repository.id; + </source> + </configuration> + </execution> + </executions> + </plugin> + + <!-- license plugin --> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>license-maven-plugin</artifactId> + <version>1.10</version> + <configuration> + <addJavaLicenseAfterPackage>false</addJavaLicenseAfterPackage> + <processStartTag>============LICENSE_START=======================================================</processStartTag> + <processEndTag>============LICENSE_END=========================================================</processEndTag> + <sectionDelimiter>================================================================================</sectionDelimiter> + <licenseName>apache_v2</licenseName> + <inceptionYear>2017</inceptionYear> + <organizationName>AT&T Intellectual Property. All rights + reserved. + </organizationName> + <projectName>SDC</projectName> + <canUpdateCopyright>true</canUpdateCopyright> + <canUpdateDescription>true</canUpdateDescription> + <canUpdateLicense>true</canUpdateLicense> + <emptyLineAfterHeader>true</emptyLineAfterHeader> + <verbose>false</verbose> + <includes> + <include>**/*.java</include> + <include>**/*.ts</include> + </includes> + <excludes> + <exclude>**/*.d.ts</exclude> + </excludes> + <roots> + <root>src</root> + <root>app</root> + <root>server-mock</root> + <root>typings</root> + </roots> + <extraExtensions> + <ts>java</ts> + </extraExtensions> + </configuration> + <executions> + <execution> + <id>first</id> + <goals> + <goal>update-file-header</goal> + </goals> + <!--phase>process-sources</phase --> + </execution> + </executions> + </plugin> + </plugins> + </build> + + <profiles> + <profile> + <id>all</id> + <activation> + <activeByDefault>true</activeByDefault> + </activation> + <modules> + <module>build-tools</module> + <module>onboarding</module> + <module>services/activity-spec</module> + <module>security-utils</module> + <module>common-app-api</module> + <module>common-be</module> + <module>catalog-dao</module> + <module>catalog-model</module> + <module>catalog-be</module> + <module>asdctool</module> + <module>catalog-ui</module> + <module>catalog-fe</module> + <module>test-apis-ci</module> + <module>ui-ci</module> + <module>sdc-os-chef</module> + <module>utils/webseal-simulator</module> + </modules> + + </profile> + + <profile> + <id>catalog</id> + <activation> + <activeByDefault>false</activeByDefault> + </activation> + <modules> + <module>security-utils</module> + <module>common-app-api</module> + <module>common-be</module> + <module>catalog-dao</module> + <module>catalog-model</module> + <module>catalog-be</module> + <module>asdctool</module> + <module>catalog-ui</module> + <module>catalog-fe</module> + <module>test-apis-ci</module> + <module>ui-ci</module> + </modules> + + <properties> + <ecomp.version>1.2.7</ecomp.version> + <artifact-generator-api.version>1802.0.1.167</artifact-generator-api.version> + <artifact-generator-core.version>1802.0.1.167</artifact-generator-core.version> + <dox-common-lib.version>1802.0.1.167</dox-common-lib.version> + <sdc-tosca-parser.version>1.1.32</sdc-tosca-parser.version> + </properties> + </profile> + + <profile> + <id>onboarding</id> + <activation> + <activeByDefault>false</activeByDefault> + </activation> + <modules> + <module>build-tools</module> + <module>onboarding</module> + </modules> + </profile> + + </profiles> + + <repositories> + <!-- LF repositories --> + <repository> + <id>ecomp-releases</id> + <name>Release Repository</name> + <url>${nexus.proxy}/content/repositories/releases/</url> + </repository> + <repository> + <id>ecomp-snapshots</id> + <name>Snapshots Repository</name> + <url>${nexus.proxy}/content/repositories/snapshots/</url> + </repository> + <repository> + <id>ecomp-public</id> + <name>Public Repository</name> + <url>${nexus.proxy}/content/repositories/public/</url> + </repository> + <!-- LF repositories END--> + </repositories> + + <distributionManagement> + <repository> + <id>ecomp-releases</id> + <name>Release Repository</name> + <url>${nexus.proxy}/content/repositories/releases/</url> + </repository> + <snapshotRepository> + <id>ecomp-snapshots</id> + <name>Snapshot Repository</name> + <url>${nexus.proxy}/content/repositories/snapshots/</url> + </snapshotRepository> + <site> + <id>ecomp-site</id> + <url>dav:${nexus.proxy}${sitePath}</url> + </site> + </distributionManagement> </project> |