<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one
  ~ or more contributor license agreements.  See the NOTICE file
  ~ distributed with this work for additional information
  ~ regarding copyright ownership.  The ASF licenses this file
  ~ to you 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="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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <artifactId>apache-atlas</artifactId>
        <groupId>org.apache.atlas</groupId>
        <version>3.0.0-SNAPSHOT</version>
        <relativePath>../../</relativePath>
    </parent>
    <artifactId>hbase-bridge</artifactId>
    <description>Apache Atlas Hbase Bridge Module</description>
    <name>Apache Atlas Hbase Bridge</name>
    <packaging>jar</packaging>

    <properties>
        <hadoop.version>3.0.3</hadoop.version>
        <jetty.version>9.3.14.v20161028</jetty.version>
    </properties>

    <dependencies>
        <!-- Logging -->
        <dependency>
            <groupId>org.apache.hbase</groupId>
            <artifactId>hbase-server</artifactId>
            <version>${hbase.version}</version>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>javax.servlet</groupId>
                    <artifactId>servlet-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.mortbay.jetty</groupId>
                    <artifactId>servlet-api-2.5</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.ws.rs</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.apache.atlas</groupId>
            <artifactId>atlas-notification</artifactId>
        </dependency>

        <!-- to bring up atlas server for integration tests -->
        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-bundle</artifactId>
            <version>1.19</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.atlas</groupId>
            <artifactId>atlas-webapp</artifactId>
            <type>war</type>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-client</artifactId>
            <version>${hadoop.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-hdfs</artifactId>
            <version>${hadoop.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>javax.servlet</groupId>
                    <artifactId>servlet-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-hdfs-client</artifactId>
            <version>${hadoop.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-annotations</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-minicluster</artifactId>
            <version>${hadoop.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>javax.servlet</groupId>
                    <artifactId>servlet-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpcore</artifactId>
            <version>${httpcomponents-httpcore.version}</version>
        </dependency>

        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-webapp</artifactId>
            <version>${jetty.version}</version>
            <scope>compile</scope>
        </dependency>

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

        <dependency>
            <groupId>org.apache.hbase</groupId>
            <artifactId>hbase-server</artifactId>
            <version>${hbase.version}</version>
            <type>test-jar</type>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.mortbay.jetty</groupId>
                    <artifactId>servlet-api-2.5</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.eclipse.jetty</groupId>
                    <artifactId>jetty-server</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
            <version>4.12</version>
        </dependency>

        <dependency>
            <groupId>org.apache.hbase</groupId>
            <artifactId>hbase-client</artifactId>
            <version>${hbase.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.hbase</groupId>
            <artifactId>hbase-common</artifactId>
            <version>${hbase.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>com.github.stephenc.findbugs</groupId>
                    <artifactId>findbugs-annotations</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.hbase</groupId>
            <artifactId>hbase-hadoop2-compat</artifactId>
            <version>${hbase.version}</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.hbase</groupId>
            <artifactId>hbase-hadoop-compat</artifactId>
            <version>${hbase.version}</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-common</artifactId>
            <version>${hadoop.version}</version>
            <scope>compile</scope>
            <exclusions>
                <exclusion>
                    <groupId>javax.servlet</groupId>
                    <artifactId>servlet-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-auth</artifactId>
            <version>${hadoop.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.atlas</groupId>
            <artifactId>atlas-client-v2</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.hbase</groupId>
            <artifactId>hbase-zookeeper</artifactId>
            <type>test-jar</type>
            <scope>test</scope>
            <version>${hbase.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.hbase</groupId>
            <artifactId>hbase-common</artifactId>
            <type>test-jar</type>
            <version>${hbase.version}</version>
            <scope>test</scope>
        </dependency>

        <!-- Intra-project dependencies -->
        <dependency>
            <groupId>org.apache.hbase</groupId>
            <artifactId>hbase-testing-util</artifactId>
            <version>${hbase.version}</version>
        </dependency>

    </dependencies>

    <profiles>
        <profile>
            <id>dist</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>copy-hook</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>copy</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${project.build.directory}/dependency/hook/hbase/atlas-hbase-plugin-impl</outputDirectory>
                                    <overWriteReleases>false</overWriteReleases>
                                    <overWriteSnapshots>false</overWriteSnapshots>
                                    <overWriteIfNewer>true</overWriteIfNewer>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>${project.groupId}</groupId>
                                            <artifactId>${project.artifactId}</artifactId>
                                            <version>${project.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>${project.groupId}</groupId>
                                            <artifactId>atlas-client-common</artifactId>
                                            <version>${project.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>${project.groupId}</groupId>
                                            <artifactId>atlas-client-v2</artifactId>
                                            <version>${project.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>${project.groupId}</groupId>
                                            <artifactId>atlas-intg</artifactId>
                                            <version>${project.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>${project.groupId}</groupId>
                                            <artifactId>atlas-notification</artifactId>
                                            <version>${project.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>${project.groupId}</groupId>
                                            <artifactId>atlas-common</artifactId>
                                            <version>${project.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>org.apache.kafka</groupId>
                                            <artifactId>kafka_${kafka.scala.binary.version}</artifactId>
                                            <version>${kafka.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>org.apache.kafka</groupId>
                                            <artifactId>kafka-clients</artifactId>
                                            <version>${kafka.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>com.sun.jersey.contribs</groupId>
                                            <artifactId>jersey-multipart</artifactId>
                                            <version>${jersey.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>com.fasterxml.jackson.core</groupId>
                                            <artifactId>jackson-databind</artifactId>
                                            <version>${jackson.databind.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>com.fasterxml.jackson.core</groupId>
                                            <artifactId>jackson-core</artifactId>
                                            <version>${jackson.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>com.fasterxml.jackson.core</groupId>
                                            <artifactId>jackson-annotations</artifactId>
                                            <version>${jackson.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>commons-configuration</groupId>
                                            <artifactId>commons-configuration</artifactId>
                                            <version>${commons-conf.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>com.sun.jersey</groupId>
                                            <artifactId>jersey-json</artifactId>
                                            <version>${jersey.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>javax.ws.rs</groupId>
                                            <artifactId>jsr311-api</artifactId>
                                            <version>${jsr.version}</version>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                            <execution>
                                <id>copy-hook-shim</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>copy</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${project.build.directory}/dependency/hook/hbase</outputDirectory>
                                    <overWriteReleases>false</overWriteReleases>
                                    <overWriteSnapshots>false</overWriteSnapshots>
                                    <overWriteIfNewer>true</overWriteIfNewer>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>${project.groupId}</groupId>
                                            <artifactId>hbase-bridge-shim</artifactId>
                                            <version>${project.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>${project.groupId}</groupId>
                                            <artifactId>atlas-plugin-classloader</artifactId>
                                            <version>${project.version}</version>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
    <build>
        <plugins>
            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>${jetty.version}</version>
                <configuration>
                    <skip>${skipTests}</skip>
                    <!--only skip int tests -->
                    <httpConnector>
                        <port>31000</port>
                        <idleTimeout>60000</idleTimeout>
                    </httpConnector>
                    <war>../../webapp/target/atlas-webapp-${project.version}.war</war>
                    <daemon>true</daemon>
                    <webAppSourceDirectory>../../webapp/src/main/webapp</webAppSourceDirectory>
                    <webApp>
                        <contextPath>/</contextPath>
                        <descriptor>${project.basedir}/../../webapp/src/main/webapp/WEB-INF/web.xml</descriptor>
                    </webApp>
                    <useTestScope>true</useTestScope>
                    <systemProperties>
                        <force>true</force>
                        <systemProperty>
                            <name>atlas.home</name>
                            <value>${project.build.directory}</value>
                        </systemProperty>
                        <systemProperty>
                            <key>atlas.conf</key>
                            <value>${project.build.directory}/test-classes</value>
                        </systemProperty>
                        <systemProperty>
                            <name>atlas.data</name>
                            <value>${project.build.directory}/data</value>
                        </systemProperty>
                        <systemProperty>
                            <name>atlas.log.dir</name>
                            <value>${project.build.directory}/logs</value>
                        </systemProperty>
                        <systemProperty>
                            <name>atlas.log.file</name>
                            <value>application.log</value>
                        </systemProperty>
                        <systemProperty>
                            <name>log4j.configuration</name>
                            <value>file:///${project.build.directory}/test-classes/atlas-log4j.xml</value>
                        </systemProperty>
                        <systemProperty>
                            <name>atlas.graphdb.backend</name>
                            <value>${graphdb.backend.impl}</value>
                        </systemProperty>
                        <systemProperty>
                            <key>embedded.solr.directory</key>
                            <value>${project.build.directory}</value>
                        </systemProperty>
                        <systemProperty>
                            <name>solr.log.dir</name>
                            <value>${project.build.directory}/logs</value>
                        </systemProperty>
                        <systemProperty>
                            <name>org.eclipse.jetty.annotations.maxWait</name>
                            <value>5000</value>
                        </systemProperty>
                    </systemProperties>
                    <stopKey>atlas-stop</stopKey>
                    <stopPort>31001</stopPort>
                    <stopWait>${jetty-maven-plugin.stopWait}</stopWait>
                    <supportedPackagings>jar</supportedPackagings>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.curator</groupId>
                        <artifactId>curator-client</artifactId>
                        <version>${curator.version}</version>
                    </dependency>

                    <dependency>
                        <groupId>org.apache.zookeeper</groupId>
                        <artifactId>zookeeper</artifactId>
                        <version>${zookeeper.version}</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>start-jetty</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>deploy-war</goal>
                        </goals>
                        <configuration>
                            <daemon>true</daemon>
                        </configuration>
                    </execution>
                    <execution>
                        <id>stop-jetty</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.doxia</groupId>
                        <artifactId>doxia-module-twiki</artifactId>
                        <version>${doxia.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.apache.maven.doxia</groupId>
                        <artifactId>doxia-core</artifactId>
                        <version>${doxia.version}</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <goals>
                            <goal>site</goal>
                        </goals>
                        <phase>prepare-package</phase>
                    </execution>
                </executions>
                <configuration>
                    <generateProjectInfo>false</generateProjectInfo>
                    <generateReports>false</generateReports>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <inherited>false</inherited>
                <executions>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-resources</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/target/models</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${basedir}/../models</directory>
                                    <includes>
                                        <include>0000-Area0/**</include>
                                        <include>1000-Hadoop/**</include>
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-solr-resources</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/solr</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${basedir}/../../test-tools/src/main/resources/solr</directory>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>
    </build>
</project>