<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (c) 2018 Orange 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. -->
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns="http://maven.apache.org/POM/4.0.0"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>org.onap.externalapi-nbi</groupId>
  <artifactId>nbi-rest-services</artifactId>
  <version>4.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>externalapi-nbi</name>

  <parent>
    <groupId>org.onap.oparent</groupId>
    <artifactId>oparent</artifactId>
    <version>2.0.0</version>
  </parent>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <maven.compiler.target>1.8</maven.compiler.target>
    <maven.compiler.source>1.8</maven.compiler.source>
    <start-class>org.onap.nbi.Application</start-class>
    <onap.nexus.url>https://nexus.onap.org</onap.nexus.url>
    <nexusproxy>https://nexus.onap.org</nexusproxy>
    <snapshotNexusPath>content/repositories/snapshots/</snapshotNexusPath>
    <releaseNexusPath>content/repositories/releases/</releaseNexusPath>
    <stagingNexusPath>content/repositories/staging/</stagingNexusPath>
    <java.version>1.8</java.version>
    <docker.pull.registry>nexus3.onap.org:10001</docker.pull.registry>
    <docker.push.registry>nexus3.onap.org:10003</docker.push.registry>
    <timestamp>${maven.build.timestamp}</timestamp>
    <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
    <!--docker -->
    <docker.tag>${project.version}-${timestamp}</docker.tag>
    <docker.latest.tag>${project.version}-latest</docker.latest.tag>
    <!--sonar -->
    <sonar.language>java</sonar.language>
    <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
    <sonar.surefire.reportsPath>${project.build.directory}/surefire-reports
    </sonar.surefire.reportsPath>
    <sonar.jacoco.reportPath>${project.build.directory}/coverage-reports/jacoco.exec
    </sonar.jacoco.reportPath>
    <sonar.jacoco.itReportPath>${project.build.directory}/coverage-reports/jacoco-it.exec
    </sonar.jacoco.itReportPath>
    <sonar.jacoco.reportMissing.force.zero>true</sonar.jacoco.reportMissing.force.zero>
    <sonar.projectVersion>${project.version}</sonar.projectVersion>
    <sonar.coverage.exclusions>**/model/**/*</sonar.coverage.exclusions>
  </properties>

  <!--<repositories>-->
  <!--<repository>-->
  <!--<id>maven2-repository.java.net</id>-->
  <!--<name>Java.net Repository for Maven</name>-->
  <!--<url>http://download.java.net/maven/2/</url>-->
  <!--<layout>default</layout>-->
  <!--</repository>-->
  <!--<repository>-->
  <!--<id>ecomp-release</id>-->
  <!--<name>Snapshot Repository</name>-->
  <!--<url>https://nexus.onap.org/content/repositories/releases/</url>-->
  <!--</repository>-->
  <!--<repository>-->
  <!--<id>ecomp-staging</id>-->
  <!--<name>Staging Repository</name>-->
  <!--<url>https://nexus.onap.org/content/repositories/staging/</url>-->
  <!--</repository>-->
  <!--<repository>-->
  <!--<id>ecomp-snapshots</id>-->
  <!--<name>Snapshot Repository</name>-->
  <!--<url>https://nexus.onap.org/content/repositories/snapshots/</url>-->
  <!--</repository>-->
  <!--</repositories>-->

  <distributionManagement>
    <repository>
      <id>ecomp-releases</id>
      <name>Release Repository</name>
      <url>${nexusproxy}/${releaseNexusPath}</url>
    </repository>
    <snapshotRepository>
      <id>ecomp-snapshots</id>
      <name>Snapshot Repository</name>
      <url>${nexusproxy}/${snapshotNexusPath}</url>
    </snapshotRepository>
  </distributionManagement>

  <licenses>
    <license>
      <name>Apache2</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
    </license>
  </licenses>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>2.1.4.RELEASE</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
      <exclusions>
        <exclusion>
          <groupId>org.apache.tomcat.embed</groupId>
          <artifactId>tomcat-embed-core</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.apache.tomcat.embed</groupId>
      <artifactId>tomcat-embed-core</artifactId>
      <version>9.0.19</version>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-aop</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-io</artifactId>
      <version>1.3.2</version>
    </dependency>

    <dependency>
      <groupId>commons-beanutils</groupId>
      <artifactId>commons-beanutils</artifactId>
      <version>1.9.3</version>
    </dependency>

    <dependency>
      <groupId>javax.validation</groupId>
      <artifactId>validation-api</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
    </dependency>

    <!-- mongo -->

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-data-mongodb</artifactId>
    </dependency>

    <!-- mysql -->

    <dependency>
      <groupId>org.mariadb.jdbc</groupId>
      <artifactId>mariadb-java-client</artifactId>
    </dependency>

    <!-- swagger -->

    <dependency>
      <groupId>io.swagger</groupId>
      <artifactId>swagger-annotations</artifactId>
      <version>1.5.18</version>
    </dependency>

    <!-- swagger core -->
    <dependency>
      <groupId>io.swagger</groupId>
      <artifactId>swagger-core</artifactId>
      <version>1.5.18</version>
    </dependency>

    <!-- jackson -->

    <dependency>
      <groupId>com.fasterxml.jackson.dataformat</groupId>
      <artifactId>jackson-dataformat-yaml</artifactId>
    </dependency>

    <!-- sdc tosca parser -->

    <dependency>
      <groupId>org.onap.sdc.sdc-tosca</groupId>
      <artifactId>sdc-tosca</artifactId>
      <version>1.4.6</version>
      <exclusions>
        <exclusion>
          <groupId>com.google.guava</groupId>
          <artifactId>guava</artifactId>
        </exclusion>
        <exclusion>
          <groupId>commons-codec</groupId>
          <artifactId>commons-codec</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>commons-codec</groupId>
      <artifactId>commons-codec</artifactId>
      <version>1.12</version>
    </dependency>

    <!-- jolt -->

    <dependency>
      <groupId>com.bazaarvoice.jolt</groupId>
      <artifactId>jolt-core</artifactId>
      <version>0.1.0</version>
      <exclusions>
        <exclusion>
          <groupId>com.fasterxml.jackson.core</groupId>
          <artifactId>jackson-databind</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>com.bazaarvoice.jolt</groupId>
      <artifactId>json-utils</artifactId>
      <version>0.1.0</version>
      <exclusions>
        <exclusion>
          <groupId>com.fasterxml.jackson.core</groupId>
          <artifactId>jackson-databind</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <!-- test -->

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
    </dependency>

    <!-- test h2 -->

    <dependency>
      <groupId>com.h2database</groupId>
      <artifactId>h2</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>de.flapdoodle.embed</groupId>
      <artifactId>de.flapdoodle.embed.mongo</artifactId>
      <scope>test</scope>
    </dependency>

    <!-- test wiremock -->

    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-contract-wiremock</artifactId>
      <version>1.2.6.RELEASE</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>com.fasterxml.jackson.core</groupId>
          <artifactId>jackson-databind</artifactId>
        </exclusion>
        <exclusion>
          <groupId>commons-codec</groupId>
          <artifactId>commons-codec</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-servlet</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-servlets</artifactId>
      <scope>test</scope>
    </dependency>

    <!-- runtime dev -->

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-devtools</artifactId>
      <scope>runtime</scope>
    </dependency>

    <!-- MSB SDK -->
    <dependency>
      <groupId>org.onap.msb.java-sdk</groupId>
      <artifactId>msb-java-sdk</artifactId>
      <version>1.1.1</version>
      <exclusions>
        <exclusion>
          <groupId>com.google.guava</groupId>
          <artifactId>guava</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.squareup.okhttp3</groupId>
          <artifactId>okhttp</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>com.squareup.okhttp3</groupId>
      <artifactId>okhttp</artifactId>
      <version>3.14.1</version>
    </dependency>

    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
    </dependency>

    <!-- karate -->

    <dependency>
      <groupId>com.intuit.karate</groupId>
      <artifactId>karate-junit4</artifactId>
      <version>0.9.0</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>com.intuit.karate</groupId>
      <artifactId>karate-apache</artifactId>
      <version>0.9.0</version>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <build>
    <testResources>
      <testResource>
        <directory>src/test/java</directory>
        <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
      </testResource>
      <testResource>
        <directory>src/test/resources</directory>
      </testResource>
    </testResources>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>repackage</goal>
            </goals>
            <configuration>
              <mainClass>org.onap.nbi.Application</mainClass>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <includes>
            <include>org/onap/nbi/test/KarateApiTest.java</include>
            <include>org/onap/nbi/test/ExecutionTaskTest.java</include>
            <include>org/onap/nbi/test/ServiceOrderRepositoryTest.java</include>
            <include>org/onap/nbi/apis/servicecatalog/ToscaInfosProcessorTest.java</include>
          </includes>
        </configuration>
      </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>
      <plugin>
        <groupId>com.mycila</groupId>
        <artifactId>license-maven-plugin</artifactId>
        <version>3.0</version>
        <configuration>
          <header>LICENSE.TXT</header>
          <includes>
            <include>restclient/**</include>
            <include>src/**</include>
            <include>./**/*.xml</include>
            <include>./**/*.xml</include>
            <include>./**/*.yml</include>
            <include>./**/*.yaml</include>
          </includes>
          <excludes>
            <!-- karate-config.js doesn't support comment, and is mandatory by
              karate -->
            <exclude>src/test/java/karate-config.js</exclude>
          </excludes>
          <skipExistingHeaders>true</skipExistingHeaders>
          <skip>false</skip>
          <mapping>
            <http>SCRIPT_STYLE</http>
          </mapping>
        </configuration>
        <executions>
          <execution>
            <goals>
              <!-- Set goal to "format" to auto update license headers -->
              <goal>check</goal>
            </goals>
            <phase>process-sources</phase>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>sonar-maven-plugin</artifactId>
        <version>3.2</version>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>0.8.1</version>
        <configuration>
          <dumpOnExit>true</dumpOnExit>
          <includes>
            <include>org.onap.nbi.*</include>
          </includes>
          <excludes>
            <exclude>**/model/**/*</exclude>
          </excludes>
        </configuration>
        <executions>
          <execution>
            <id>pre-unit-test</id>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
            <configuration>
              <destFile>${project.build.directory}/coverage-reports/jacoco.exec</destFile>
            </configuration>
          </execution>
          <execution>
            <id>pre-integration-test</id>
            <phase>pre-integration-test</phase>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
            <configuration>
              <destFile>${project.build.directory}/coverage-reports/jacoco-it.exec</destFile>
            </configuration>
          </execution>
          <execution>
            <goals>
              <goal>merge</goal>
            </goals>
            <phase>post-integration-test</phase>
            <configuration>
              <fileSets>
                <fileSet
                  implementation="org.apache.maven.shared.model.fileset.FileSet">
                  <directory>${project.build.directory}/coverage-reports</directory>
                  <includes>
                    <include>*.exec</include>
                  </includes>
                </fileSet>
              </fileSets>
              <destFile>${project.build.directory}/jacoco-dev.exec</destFile>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-source-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-sources</id>
            <phase>deploy</phase>
            <goals>
              <goal>jar-no-fork</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>docker</id>
      <build>
        <plugins>
          <plugin>
            <groupId>io.fabric8</groupId>
            <artifactId>docker-maven-plugin</artifactId>
            <version>0.28.0</version>
            <configuration>
              <verbose>true</verbose>
              <apiVersion>1.23</apiVersion>
              <pullRegistry>${docker.pull.registry}</pullRegistry>
              <pushRegistry>${docker.push.registry}</pushRegistry>
              <images>
                <image>
                  <name>onap/externalapi/nbi:${docker.tag}</name>
                  <build>
                    <cleanup>true</cleanup>
                    <tags>
                      <tag>latest</tag>
                      <tag>${docker.latest.tag}</tag>
                    </tags>
                    <dockerFileDir>${project.basedir}</dockerFileDir>
                    <args>
                      <PKG_FILENAME>${project.build.finalName}.${project.packaging}</PKG_FILENAME>
                    </args>
                  </build>
                </image>
              </images>
            </configuration>
            <executions>
              <execution>
                <id>clean-images</id>
                <phase>pre-clean</phase>
                <goals>
                  <goal>remove</goal>
                </goals>
                <configuration>
                  <removeMode>all</removeMode>
                </configuration>
              </execution>
              <execution>
                <id>generate-images</id>
                <phase>package</phase>
                <goals>
                  <goal>build</goal>
                </goals>
              </execution>
              <execution>
                <id>push-images</id>
                <phase>deploy</phase>
                <goals>
                  <goal>push</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>onap-settings</id>
      <properties>
        <onap.nexus.url>https://nexus.onap.org</onap.nexus.url>
        <onap.nexus.rawrepo.baseurl.upload>https://nexus.onap.org/content/sites/raw
        </onap.nexus.rawrepo.baseurl.upload>
        <onap.nexus.rawrepo.baseurl.download>
          https://nexus.onap.org/service/local/repositories/raw/content
        </onap.nexus.rawrepo.baseurl.download>
        <onap.nexus.rawrepo.serverid>ecomp-raw</onap.nexus.rawrepo.serverid>

        <!-- properties for Nexus Docker registry -->
        <onap.nexus.dockerregistry.daily>nexus3.onap.org:10003</onap.nexus.dockerregistry.daily>
        <onap.nexus.dockerregistry.release>nexus3.onap.org:10002</onap.nexus.dockerregistry.release>
        <docker.pull.registry>nexus3.onap.org:10001</docker.pull.registry>
        <docker.push.registry>nexus3.onap.org:10003</docker.push.registry>
      </properties>
    </profile>
    <profile>
      <id>onap-snapshots</id>
      <repositories>
        <repository>
          <id>onap-snapshots</id>
          <name>onap-snapshots</name>
          <url>https://nexus.onap.org/content/repositories/snapshots/</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>onap-snapshots</id>
          <name>onap-snapshots</name>
          <url>https://nexus.onap.org/content/repositories/snapshots/</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
    <profile>
      <id>onap-releases</id>
      <repositories>
        <repository>
          <id>onap-releases</id>
          <name>onap-releases</name>
          <url>https://nexus.onap.org/content/repositories/releases/</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>onap-releases</id>
          <name>onap-releases</name>
          <url>https://nexus.onap.org/content/repositories/releases/</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
    <profile>
      <id>onap-public</id>
      <repositories>
        <repository>
          <id>central</id>
          <url>http://repo1.maven.org/maven2/</url>
        </repository>
        <repository>
          <id>onap-public</id>
          <name>onap-public</name>
          <url>https://nexus.onap.org/content/repositories/public/</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <url>http://repo1.maven.org/maven2/</url>
        </pluginRepository>
        <pluginRepository>
          <id>onap-public</id>
          <name>onap-public</name>
          <url>https://nexus.onap.org/content/repositories/public/</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>

</project>