<?xml version="1.0"?>
<!--
============LICENSE_START===================================================
Copyright (c) 2018 Amdocs
============================================================================
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">
  <modelVersion>4.0.0</modelVersion>

  <groupId>org.onap.aai.validation</groupId>
  <artifactId>validation</artifactId>
  <name>aai-validation</name>
  <version>1.4.0-SNAPSHOT</version>
  <parent>
    <groupId>org.onap.oparent</groupId>
    <artifactId>oparent</artifactId>
    <version>1.2.1</version>
    <relativePath/>
  </parent>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>${spring-boot.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <properties>
    <spring-boot.version>1.5.18.RELEASE</spring-boot.version>
    <start-class>org.onap.aai.validation.ValidationServiceApplication</start-class>
    <serverPort>9500</serverPort>
    <sslport>9501</sslport>
    <version.org.onap.aai.logging-service>1.2.2</version.org.onap.aai.logging-service>
    <version.org.onap.aai-rest-client>1.2.1</version.org.onap.aai-rest-client>
    <version.org.onap.aai.event.client>1.2.2</version.org.onap.aai.event.client>
    <version.com.ecomp.aai.gap.data.client>1.0</version.com.ecomp.aai.gap.data.client>
    <version.com.google.code.gson>2.7</version.com.google.code.gson>
    <version.com.jayway.jsonpath>2.2.0</version.com.jayway.jsonpath>
    <version.commons-configuration>1.10</version.commons-configuration>
    <version.jaxen.jaxen>1.1.6</version.jaxen.jaxen>
    <version.org.apache.httpcomponents.httpclient>4.5.2</version.org.apache.httpcomponents.httpclient>
    <version.org.codehaus.groovy.groovy-eclipse-batch>2.4.3-01</version.org.codehaus.groovy.groovy-eclipse-batch>
    <version.org.codehaus.groovy.groovy-eclipse-compiler>2.9.2-01</version.org.codehaus.groovy.groovy-eclipse-compiler>
    <version.org.eclipse.persistence.moxy>2.6.2</version.org.eclipse.persistence.moxy>
    <version.org.hamcrest.hamcrest-library>1.3</version.org.hamcrest.hamcrest-library>
    <version.org.json.json>20160212</version.org.json.json>
    <version.org.onap.aai.aai-schema>1.2.4</version.org.onap.aai.aai-schema>
    <version.jacoco.maven.plugin>0.7.9</version.jacoco.maven.plugin>
    <version.org.glassfish.jersey.core.jersey-client>2.23</version.org.glassfish.jersey.core.jersey-client>
    <version.aai.aai-schema-ingest>1.2.4</version.aai.aai-schema-ingest>
    <docker.location>${basedir}/target</docker.location>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
      <exclusions>
        <exclusion>
          <artifactId>logback-classic</artifactId>
          <groupId>ch.qos.logback</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-webmvc</artifactId>
    </dependency>
    <dependency>
          <groupId>ch.qos.logback</groupId>
          <artifactId>logback-classic</artifactId>
          <version>1.2.3</version>
      </dependency>
    <dependency>
      <groupId>org.codehaus.groovy</groupId>
      <artifactId>groovy-all</artifactId>
    </dependency>
    <dependency>
      <groupId>javax.ws.rs</groupId>
      <artifactId>javax.ws.rs-api</artifactId>
      <version>2.0.1</version>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <version>2.4</version>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <version>3.7</version>
    </dependency>
    <dependency>
      <groupId>commons-collections</groupId>
      <artifactId>commons-collections</artifactId>
    </dependency>
    <dependency>
      <groupId>org.dom4j</groupId>
      <artifactId>dom4j</artifactId>
      <version>2.1.1</version>
    </dependency>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-security</artifactId>
            </dependency>

    <!-- 02: Logging -->

    <dependency>
      <groupId>org.onap.aai.logging-service</groupId>
      <artifactId>logging-api</artifactId>
      <version>${version.org.onap.aai.logging-service}</version>
    </dependency>

    <dependency>
      <groupId>org.onap.aai.logging-service</groupId>
      <artifactId>common-logging</artifactId>
      <version>${version.org.onap.aai.logging-service}</version>
    </dependency>

    <dependency>
      <groupId>org.onap.aai.logging-service</groupId>
      <artifactId>eelf-logging</artifactId>
      <version>${version.org.onap.aai.logging-service}</version>
    </dependency>

    <dependency>
      <groupId>com.att.eelf</groupId>
      <artifactId>eelf-core</artifactId>
      <version>1.0.1-oss</version>
    </dependency>

    <dependency>
      <groupId>org.onap.aai</groupId>
      <artifactId>rest-client</artifactId>
      <version>${version.org.onap.aai-rest-client}</version>
    </dependency>

    <dependency>
      <groupId>org.onap.aai.event-client</groupId>
      <artifactId>event-client-dmaap</artifactId>
      <version>${version.org.onap.aai.event.client}</version>
    </dependency>

    <dependency>
      <groupId>com.google.code.gson</groupId>
      <artifactId>gson</artifactId>
    </dependency>

    <dependency>
      <groupId>com.jayway.jsonpath</groupId>
      <artifactId>json-path</artifactId>
    </dependency>

    <dependency>
      <groupId>commons-configuration</groupId>
      <artifactId>commons-configuration</artifactId>
      <version>${version.commons-configuration}</version>
    </dependency>

    <dependency>
      <groupId>jaxen</groupId>
      <artifactId>jaxen</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.httpcomponents</groupId>
      <artifactId>httpclient</artifactId>
    </dependency>

    <dependency>
      <groupId>org.eclipse.persistence</groupId>
      <artifactId>org.eclipse.persistence.moxy</artifactId>
      <version>${version.org.eclipse.persistence.moxy}</version>
    </dependency>

    <dependency>
      <groupId>org.json</groupId>
      <artifactId>json</artifactId>
      <version>${version.org.json.json}</version><!--$NO-MVN-MAN-VER$ -->
    </dependency>

    <dependency>
      <groupId>org.glassfish.jersey.core</groupId>
      <artifactId>jersey-client</artifactId>
    </dependency>

    <dependency>
      <groupId>org.onap.aai.aai-common</groupId>
      <artifactId>aai-schema-ingest</artifactId>
      <version>${version.aai.aai-schema-ingest}</version>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-all</artifactId>
      <version>1.10.19</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-library</artifactId>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <build>
    <finalName>${project.artifactId}</finalName>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <version>${spring-boot.version}</version>
        <configuration>
          <executable>true</executable>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>repackage</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <compilerId>groovy-eclipse-compiler</compilerId>
          <verbose>true</verbose>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-eclipse-compiler</artifactId>
            <version>${version.org.codehaus.groovy.groovy-eclipse-compiler}</version>
          </dependency>
          <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-eclipse-batch</artifactId>
            <version>${version.org.codehaus.groovy.groovy-eclipse-batch}</version>
          </dependency>
        </dependencies>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>unpack</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>unpack</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>org.onap.aai.aai-common</groupId>
                  <artifactId>aai-schema</artifactId>
                  <version>${version.org.onap.aai.aai-schema}</version>
                  <type>jar</type>
                  <includes>oxm/</includes>
                  <outputDirectory>${project.build.directory}/bundleconfig/etc/</outputDirectory>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.19.1</version>
        <configuration>
          <!-- Skips unit tests if the value of skip.unit.tests property is true -->
          <skipTests>${skip.unit.tests}</skipTests>
          <!-- Excludes integration tests when unit tests are run -->
          <excludes>
            <exclude>**/IT*.java</exclude>
          </excludes>
          <environmentVariables>
            <APP_HOME>.</APP_HOME>
          </environmentVariables>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <version>3.0.2</version>
        <executions>
          <execution>
            <id>copy-docker-file</id>
            <phase>package</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.directory}</outputDirectory>
              <overwrite>true</overwrite>
              <resources>
                <resource>
                  <directory>${basedir}/src/main/docker</directory>
                  <filtering>true</filtering>
                  <includes>
                    <include>**/*</include>
                  </includes>
                </resource>
                <resource>
                  <directory>${basedir}/src/main/bin/</directory>
                  <filtering>true</filtering>
                  <includes>
                    <include>**/*</include>
                  </includes>
                </resource>
              </resources>
            </configuration>
          </execution>
          <execution>
            <id>copy-bundleconfig</id>
            <phase>package</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.directory}/bundleconfig</outputDirectory>
              <overwrite>false</overwrite>
              <resources>
                <resource>
                  <directory>${basedir}/bundleconfig/</directory>
                  <filtering>true</filtering>
                  <includes>
                    <include>etc/appprops/</include>
                    <include>etc/rules/</include>
                  </includes>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>com.spotify</groupId>
        <artifactId>docker-maven-plugin</artifactId>
        <version>0.4.11</version>
        <configuration>
          <verbose>true</verbose>
          <serverId>docker-hub</serverId>
          <imageName>${docker.push.registry}/onap/${project.artifactId}</imageName>
          <dockerDirectory>${docker.location}</dockerDirectory>
          <imageTags>
            <imageTag>latest</imageTag>
          </imageTags>
          <forceTags>true</forceTags>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${version.jacoco.maven.plugin}</version>
        <executions>
          <execution>
            <id>prepare-agent</id>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>report</id>
            <phase>package</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>dev</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <properties>
        <build.profile.id>dev</build.profile.id>
        <!-- Only unit tests are run when the development profile is active -->
        <skip.integration.tests>true</skip.integration.tests>
        <skip.unit.tests>false</skip.unit.tests>
      </properties>
    </profile>
  </profiles>
</project>