Implement DMI Registration (NCMP-Side)
[cps.git] / cps-parent / pom.xml
old mode 100644 (file)
new mode 100755 (executable)
index 643d2cc..40840db
@@ -1,30 +1,62 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ============LICENSE_START=======================================================
+  Copyright (c) 2021 Pantheon.tech.
+  Modifications Copyright (C) 2021 Bell Canada.
+  Modifications Copyright (C) 2021 Nordix Foundation.
+  ================================================================================
+  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=========================================================
+-->
+
 <project xmlns="http://maven.apache.org/POM/4.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <parent>
         <groupId>org.onap.oparent</groupId>
         <artifactId>oparent</artifactId>
-        <version>3.1.0</version>
+        <version>3.2.0</version>
         <relativePath/>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
     <groupId>org.onap.cps</groupId>
     <artifactId>cps-parent</artifactId>
-    <version>0.0.1-SNAPSHOT</version>
+    <version>1.1.0-SNAPSHOT</version>
     <packaging>pom</packaging>
 
     <properties>
         <app>org.onap.cps.Application</app>
-        <base.image>openjdk:11-jre-slim</base.image>
         <java.version>11</java.version>
-        <jib-maven-plugin.version>2.6.0</jib-maven-plugin.version>
-        <oparent.version>3.1.0</oparent.version>
-        <repository.name>nexus3.onap.org:10001/onap/cps-service</repository.name>
-        <spring-boot-maven-plugin.version>2.3.3.RELEASE</spring-boot-maven-plugin.version>
-        <swagger-codegen-maven-plugin.version>3.0.18</swagger-codegen-maven-plugin.version>
-        <tag.version>${project.version}</tag.version>
+        <minimum-coverage>0.9</minimum-coverage>
+
+        <jacoco.reportDirectory.aggregate>${project.reporting.outputDirectory}/jacoco-aggregate</jacoco.reportDirectory.aggregate>
+        <sonar.coverage.jacoco.xmlReportPaths>
+            ../cps-ri/target/site/jacoco-ut/jacoco.xml,
+            ../cps-ri/target/site/jacoco-aggregate/jacoco.xml,
+            ../cps-service/target/site/jacoco-ut/jacoco.xml,
+            ../cps-service/target/site/jacoco-aggregate/jacoco.xml,
+            ../cps-rest/target/site/jacoco-ut/jacoco.xml,
+            ../cps-rest/target/site/jacoco-aggregate/jacoco.xml,
+            ../cps-ncmp-service/target/site/jacoco-ut/jacoco.xml,
+            ../cps-ncmp-service/target/site/jacoco-aggregate/jacoco.xml,
+            ../cps-ncmp-rest/target/site/jacoco-ut/jacoco.xml,
+            ../cps-ncmp-rest/target/site/jacoco-aggregate/jacoco.xml,
+            ../cps-path-parser/target/site/jacoco-ut/jacoco.xml,
+            ../cps-path-parser/target/site/jacoco-aggregate/jacoco.xml,
+            ../cps-application/target/site/jacoco-ut/jacoco.xml,
+            ../cps-application/target/site/jacoco-aggregate/jacoco.xml
+        </sonar.coverage.jacoco.xmlReportPaths>
     </properties>
 
     <dependencyManagement>
                 <plugin>
                     <groupId>org.springframework.boot</groupId>
                     <artifactId>spring-boot-maven-plugin</artifactId>
-                    <version>${spring-boot-maven-plugin.version}</version>
+                    <version>2.3.3.RELEASE</version>
                     <executions>
                         <execution>
                             <goals>
                 <plugin>
                     <groupId>io.swagger.codegen.v3</groupId>
                     <artifactId>swagger-codegen-maven-plugin</artifactId>
-                    <version>${swagger-codegen-maven-plugin.version}</version>
+                    <version>3.0.18</version>
+                </plugin>
+                <plugin>
+                    <groupId>com.github.spotbugs</groupId>
+                    <artifactId>spotbugs-maven-plugin</artifactId>
+                    <version>4.1.3</version>
+                    <dependencies>
+                        <dependency>
+                            <groupId>com.github.spotbugs</groupId>
+                            <artifactId>spotbugs</artifactId>
+                            <version>4.2.0</version>
+                        </dependency>
+                        <dependency>
+                            <groupId>${project.groupId}</groupId>
+                            <artifactId>spotbugs</artifactId>
+                            <version>${project.version}</version>
+                        </dependency>
+                        <dependency>
+                            <!-- The SpotBugs Maven plugin uses SLF4J 1.8 beta 2 -->
+                            <groupId>org.slf4j</groupId>
+                            <artifactId>slf4j-simple</artifactId>
+                            <version>1.8.0-beta4</version>
+                        </dependency>
+                    </dependencies>
+                    <configuration>
+                        <plugins>
+                            <plugin>
+                                <groupId>jp.skypencil.findbugs.slf4j</groupId>
+                                <artifactId>bug-pattern</artifactId>
+                                <version>1.5.0</version>
+                            </plugin>
+                        </plugins>
+                        <!--
+                          Enables analysis which takes more memory but finds more bugs.
+                          If you run out of memory, changes the value of the effort element
+                          to 'Low'.
+                        -->
+                        <addSourceDirs>true</addSourceDirs>
+                        <effort>Max</effort>
+                        <!-- Reports all bugs (other values are medium and max) -->
+                        <threshold>Low</threshold>
+                        <!-- Build doesn't fail if problems are found -->
+                        <failOnError>true</failOnError>
+                        <!-- References the excluded rules -->
+                        <excludeFilterFile>spotbugs-exclude.xml</excludeFilterFile>
+                        <!-- Produces XML report -->
+                        <xmlOutput>true</xmlOutput>
+                        <!-- Configures the directory in which the XML report is created -->
+                        <xmlOutputDirectory>${project.build.directory}/spotbugs</xmlOutputDirectory>
+                    </configuration>
+                    <executions>
+                        <!--
+                          Ensures that SpotBugs inspects source code when project is compiled.
+                        -->
+                        <execution>
+                            <id>analyze-compile</id>
+                            <phase>compile</phase>
+                            <goals>
+                                <goal>check</goal>
+                            </goals>
+                        </execution>
+                    </executions>
+                </plugin>
+                <plugin>
+                    <groupId>org.jsonschema2pojo</groupId>
+                    <artifactId>jsonschema2pojo-maven-plugin</artifactId>
+                    <version>1.1.1</version>
+                    <configuration>
+                        <targetVersion>${java.version}</targetVersion>
+                    </configuration>
                     <executions>
                         <execution>
                             <goals>
                                 <goal>generate</goal>
                             </goals>
-                            <configuration>
-                                <inputSpec>${project.basedir}/docs/api/swagger/openapi.yml</inputSpec>
-                                <invokerPackage>org.onap.cps.rest.controller</invokerPackage>
-                                <modelPackage>org.onap.cps.rest.model</modelPackage>
-                                <apiPackage>org.onap.cps.rest.api</apiPackage>
-                                <language>spring</language>
-                                <generateSupportingFiles>false</generateSupportingFiles>
-                                <configOptions>
-                                    <sourceFolder>src/gen/java</sourceFolder>
-                                    <dateLibrary>java11</dateLibrary>
-                                    <interfaceOnly>true</interfaceOnly>
-                                    <useTags>true</useTags>
-                                </configOptions>
-                            </configuration>
                         </execution>
                     </executions>
                 </plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-checkstyle-plugin</artifactId>
                 <executions>
+                    <execution>
+                        <id>onap-license</id>
+                        <goals>
+                            <goal>check</goal>
+                        </goals>
+                        <phase>process-sources</phase>
+                        <configuration>
+                            <configLocation>onap-checkstyle/check-license.xml</configLocation>
+                            <includeResources>false</includeResources>
+                            <includeTestSourceDirectory>true</includeTestSourceDirectory>
+                            <includeTestResources>false</includeTestResources>
+                            <sourceDirectories>
+                                <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
+                            </sourceDirectories>
+                            <consoleOutput>false</consoleOutput>
+                            <violationSeverity>warning</violationSeverity>
+                            <failOnViolation>true</failOnViolation>
+                        </configuration>
+                    </execution>
                     <execution>
                         <id>onap-java-style</id>
                         <goals>
                         <phase>process-sources</phase>
                         <configuration>
                             <configLocation>onap-checkstyle/onap-java-style.xml</configLocation>
-                            <sourceDirectories>${project.build.sourceDirectory}</sourceDirectories>
+                            <sourceDirectories>
+                                <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
+                            </sourceDirectories>
                             <includeResources>true</includeResources>
                             <includeTestSourceDirectory>true</includeTestSourceDirectory>
                             <includeTestResources>true</includeTestResources>
                             <failOnViolation>true</failOnViolation>
                         </configuration>
                     </execution>
+                    <execution>
+                        <id>cps-java-style</id>
+                        <goals>
+                            <goal>check</goal>
+                        </goals>
+                        <phase>process-sources</phase>
+                        <configuration>
+                            <configLocation>cps-java-style.xml</configLocation>
+                            <sourceDirectories>
+                                <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
+                            </sourceDirectories>
+                            <includeResources>true</includeResources>
+                            <includeTestSourceDirectory>true</includeTestSourceDirectory>
+                            <includeTestResources>true</includeTestResources>
+                            <consoleOutput>true</consoleOutput>
+                            <violationSeverity>warning</violationSeverity>
+                            <failOnViolation>true</failOnViolation>
+                        </configuration>
+                    </execution>
                 </executions>
                 <dependencies>
                     <dependency>
                         <groupId>org.onap.oparent</groupId>
                         <artifactId>checkstyle</artifactId>
-                        <version>${oparent.version}</version>
+                        <version>3.1.0</version>
+                    </dependency>
+                    <dependency>
+                        <groupId>${project.groupId}</groupId>
+                        <artifactId>checkstyle</artifactId>
+                        <version>${project.version}</version>
                     </dependency>
                 </dependencies>
             </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-plugin</artifactId>
-                <version>3.0.0-M5</version>
                 <configuration>
+                    <!--suppress UnresolvedMavenProperty -->
+                    <argLine>${surefireArgLine}</argLine>
                     <useFile>false</useFile>
                     <includes>
                         <include>**/*Spec.java</include>
                         <include>**/*Test.java</include> <!-- Just in case of having also "normal" JUnit tests -->
                     </includes>
+                    <excludes>
+                        <exclude>**/IT*.java</exclude>
+                    </excludes>
+                    <environmentVariables>
+                        <!--
+                            disable privileged container usage to cleanup the test containers;
+                            these will be removed automatically on jvm termination;
+                            see https://www.testcontainers.org/features/configuration/#disabling-ryuk
+                         -->
+                        <TESTCONTAINERS_RYUK_DISABLED>true</TESTCONTAINERS_RYUK_DISABLED>
+                        <TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX>${docker.pull.registry}/</TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX>
+                    </environmentVariables>
                 </configuration>
             </plugin>
             <plugin>
-                <groupId>com.google.cloud.tools</groupId>
-                <artifactId>jib-maven-plugin</artifactId>
-                <version>${jib-maven-plugin.version}</version>
+                <groupId>org.jacoco</groupId>
+                <artifactId>jacoco-maven-plugin</artifactId>
                 <configuration>
-                    <container>
-                        <mainClass>${app}</mainClass>
-                        <creationTime>USE_CURRENT_TIMESTAMP</creationTime>
-                    </container>
-                    <from>
-                        <image>${base.image}</image>
-                    </from>
-                    <to>
-                        <image>${repository.name}</image>
-                        <tags>
-                            <tag>${tag.version}</tag>
-                        </tags>
-                    </to>
+                    <excludes>
+                        <exclude>org/onap/cps/rest/model/*</exclude>
+                        <exclude>org/onap/cps/cpspath/parser/antlr4/*</exclude>
+                        <exclude>org/onap/cps/ncmp/rest/model/*</exclude>
+                    </excludes>
                 </configuration>
                 <executions>
                     <execution>
-                        <phase>package</phase>
-                        <id>build</id>
+                        <id>default-prepare-agent</id>
                         <goals>
-                            <goal>dockerBuild</goal>
+                            <goal>prepare-agent</goal>
                         </goals>
                     </execution>
                     <execution>
-                        <phase>deploy</phase>
-                        <id>buildAndPush</id>
+                        <id>coverage-check</id>
                         <goals>
-                            <goal>build</goal>
+                            <goal>check</goal>
                         </goals>
+                        <configuration>
+                            <dataFile>${project.build.directory}/code-coverage/jacoco-ut.exec</dataFile>
+                            <rules>
+                                <rule>
+                                    <element>BUNDLE</element>
+                                    <limits>
+                                        <limit>
+                                            <counter>INSTRUCTION</counter>
+                                            <value>COVEREDRATIO</value>
+                                            <minimum>${minimum-coverage}</minimum>
+                                        </limit>
+                                    </limits>
+                                </rule>
+                            </rules>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>report</id>
+                        <goals>
+                            <goal>report-aggregate</goal>
+                        </goals>
+                        <phase>verify</phase>
+                        <configuration>
+                            <dataFileIncludes>
+                                <fileInclude>**/code-coverage/jacoco-ut.exec</fileInclude>
+                            </dataFileIncludes>
+                        </configuration>
                     </execution>
                 </executions>
             </plugin>
+            <plugin>
+                <groupId>com.github.spotbugs</groupId>
+                <artifactId>spotbugs-maven-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.sonarsource.scanner.maven</groupId>
+                <artifactId>sonar-maven-plugin</artifactId>
+            </plugin>
         </plugins>
     </build>
-</project>
\ No newline at end of file
+</project>