<?xml version="1.0"?>
<!--

    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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <artifactId>drill-contrib-parent</artifactId>
    <groupId>org.apache.drill.contrib</groupId>
    <version>1.15.0.7-mapr</version>
  </parent>

  <artifactId>drill-format-mapr</artifactId>
  <name>contrib/mapr-format-plugin</name>

  <properties>
    <mapr-format-plugin.hbase.version>1.1.1-mapr-1602-m7-5.2.0</mapr-format-plugin.hbase.version>
    <mapr.TestSuite>**/MaprDBTestsSuite.class</mapr.TestSuite>
    <mapr.skip.tests>true</mapr.skip.tests>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.apache.hbase</groupId>
        <artifactId>hbase-client</artifactId>
        <version>${mapr-format-plugin.hbase.version}</version>
        <exclusions>
          <exclusion>
              <groupId>io.netty</groupId>
              <artifactId>netty</artifactId>
          </exclusion>
          <exclusion>
              <groupId>io.netty</groupId>
              <artifactId>netty-all</artifactId>
          </exclusion>
          <exclusion>
              <groupId>log4j</groupId>
              <artifactId>log4j</artifactId>
          </exclusion>
          <exclusion>
              <groupId>commons-logging</groupId>
              <artifactId>commons-logging</artifactId>
          </exclusion>

        </exclusions>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <skipTests>${mapr.skip.tests}</skipTests>
          <includes>
            <include>${mapr.TestSuite}</include>
          </includes>
          <systemProperties>
            <property>
              <name>logback.log.dir</name>
              <value>${project.build.directory}/surefire-reports</value>
            </property>
          </systemProperties>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <excludes>
            <!-- do not package test configurations in the jar files as it can override
                 the installed one -->
            <exclude>**/core-site.xml</exclude>
            <exclude>**/logback.xml</exclude>
          </excludes>
        </configuration>
      </plugin>

      <!-- we need the source plugin for the UDFs -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.9.1</version>
        <executions>
          <execution>
            <id>add-sources-as-resources</id>
            <phase>process-sources</phase>
            <goals>
              <goal>add-resource</goal>
            </goals>
            <configuration>
              <resources>
                <resource>
                  <directory>src/main/java</directory>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <dependencies>

    <dependency>
      <groupId>com.mapr.hadoop</groupId>
      <artifactId>maprfs</artifactId>
      <exclusions>
        <exclusion>
          <groupId>commons-codec</groupId>
          <artifactId>commons-codec</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>com.mapr.fs</groupId>
      <artifactId>mapr-hbase</artifactId>
      <exclusions>
        <exclusion>
          <groupId>commons-codec</groupId>
          <artifactId>commons-codec</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>com.mapr.db</groupId>
      <artifactId>maprdb</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.drill.exec</groupId>
      <artifactId>drill-java-exec</artifactId>
      <version>${project.version}</version>
      <exclusions>
        <exclusion>
          <artifactId>log4j-over-slf4j</artifactId>
          <groupId>org.slf4j</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.apache.drill.contrib</groupId>
      <artifactId>drill-storage-hbase</artifactId>
      <version>${project.version}</version>
      <exclusions>
        <exclusion>
          <artifactId>log4j-over-slf4j</artifactId>
          <groupId>org.slf4j</groupId>
        </exclusion>
        <exclusion>
            <groupId>io.netty</groupId>
            <artifactId>netty</artifactId>
        </exclusion>
        <exclusion>
            <groupId>io.netty</groupId>
            <artifactId>netty-all</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>com.tdunning</groupId>
      <artifactId>json</artifactId>
    </dependency>
    <!-- Test dependencies -->
    <dependency>
      <groupId>com.mapr.db</groupId>
      <artifactId>maprdb</artifactId>
      <version>${mapr.release.version}</version>
      <classifier>tests</classifier>
    </dependency>
    <dependency>
      <groupId>com.mapr.hadoop</groupId>
      <artifactId>maprfs</artifactId>
      <version>${mapr.release.version}</version>
      <classifier>tests</classifier>
    </dependency>
    <dependency>
      <groupId>com.jcraft</groupId>
      <artifactId>jsch</artifactId>
      <version>0.1.54</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.mapr</groupId>
      <artifactId>mapr-java-utils</artifactId>
      <version>${mapr.release.version}</version>
      <scope>test</scope>
      <classifier>tests</classifier>
    </dependency>
    <dependency>
      <groupId>com.mapr</groupId>
      <artifactId>mapr-test-annotations</artifactId>
      <version>${mapr.release.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.drill.exec</groupId>
      <artifactId>drill-java-exec</artifactId>
      <version>${project.version}</version>
      <classifier>tests</classifier>
      <scope>test</scope>
      <exclusions>
        <exclusion>
            <groupId>io.netty</groupId>
            <artifactId>netty</artifactId>
        </exclusion>
        <exclusion>
            <groupId>io.netty</groupId>
            <artifactId>netty-all</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.apache.drill</groupId>
      <artifactId>drill-common</artifactId>
      <version>${project.version}</version>
      <classifier>tests</classifier>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <artifactId>log4j-over-slf4j</artifactId>
          <groupId>org.slf4j</groupId>
        </exclusion>
        <exclusion>
            <groupId>io.netty</groupId>
            <artifactId>netty</artifactId>
        </exclusion>
        <exclusion>
            <groupId>io.netty</groupId>
            <artifactId>netty-all</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.apache.drill.contrib</groupId>
      <artifactId>drill-storage-hbase</artifactId>
      <version>${project.version}</version>
      <classifier>tests</classifier>
      <scope>test</scope>
      <exclusions>
        <exclusion>
            <groupId>io.netty</groupId>
            <artifactId>netty</artifactId>
        </exclusion>
        <exclusion>
            <groupId>io.netty</groupId>
            <artifactId>netty-all</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

  </dependencies>

  <profiles>
    <profile>
      <id>mapr</id>
      <properties>
        <mapr.skip.tests>false</mapr.skip.tests>
      </properties>
    </profile>

    <!-- #### BEGIN ##### TEST PROFILES -->
    <profile>
      <!-- this is the default test mode -->
      <id>simple-tests-default</id>
      <activation>
        <property><name>!tests</name></property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <excludedGroups>com.mapr.tests.annotations.ClusterTest</excludedGroups>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>simple-tests</id>
      <activation>
        <property><name>tests</name><value>simple</value></property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <excludedGroups>com.mapr.tests.annotations.ClusterTest</excludedGroups>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>cluster-tests</id>
      <activation>
        <property><name>tests</name><value>cluster</value></property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <excludedGroups>com.mapr.tests.annotations.StressTest</excludedGroups>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>stress-tests</id>
      <activation>
        <property><name>tests</name><value>stress</value></property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <excludedGroups>com.mapr.tests.annotations.IntegrationTest</excludedGroups>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>all-tests</id>
      <activation>
        <property><name>tests</name><value>all</value></property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>selected-tests</id>
      <activation>
        <!-- if a specific test has been requested, set an unused category as
             excludedGroups, so that the requested test can be looked up in all categories.
             This must be the last profile to override the surefire configuration. -->
        <property><name>test</name></property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <excludedGroups>com.mapr.tests.annotations.AlwaysExclude</excludedGroups>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <!-- #### END ##### TEST PROFILES -->

  </profiles>

</project>
