<!--
   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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <artifactId>slider-funtest</artifactId>
  <name>Slider Functional Tests</name>
  <packaging>jar</packaging>
  <description>
    Functional testing for slider: testing is always fun
  </description>
  <parent>
    <groupId>org.apache.slider</groupId>
    <artifactId>slider</artifactId>
    <version>0.92.0.0-mapr-636</version>
  </parent>
  <properties>
    <work.dir>package-tmp</work.dir>
  </properties>

  <build>

    <!-- resources are filtered for dynamic updates. This gets build info in-->
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
      </resource>
    </resources>

    <plugins>

      <!--read in a build.properties file if defined-->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>properties-maven-plugin</artifactId>
        <version>${maven.properties.version}</version>
        <executions>
          <execution>
            <phase>initialize</phase>
            <goals>
              <goal>read-project-properties</goal>
            </goals>
            <configuration>
              <quiet>true</quiet>
              <files>
                <file>build.properties</file>
                <file>../build.properties</file>
              </files>
            </configuration>
          </execution>
        </executions>
      </plugin>
      
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${maven-compiler-plugin.version}</version>
        <dependencies>
          <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-eclipse-compiler</artifactId>
            <version>${groovy-eclipse-compiler.version}</version>
          </dependency>
          <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-eclipse-batch</artifactId>
            <version>${groovy-eclipse-batch.version}</version>
          </dependency>
        </dependencies>
      </plugin>


      <!-- test -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>${maven-failsafe-plugin.version}</version>
        <executions>
          <execution>
            <id>run-integration-tests</id>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <!--mvn process fork options-->
          <reuseForks>${test.reuseForks}</reuseForks>
          <forkMode>${test.forkMode}</forkMode>
          <forkCount>1</forkCount>
          <forkedProcessTimeoutInSeconds>${test.forkedProcessTimeoutInSeconds}
          </forkedProcessTimeoutInSeconds>
          <threadCount>1</threadCount>
          <argLine>${test.argLine}</argLine>
          <failIfNoTests>${test.funtests.failIfNoTests}</failIfNoTests>

          <trimStackTrace>false</trimStackTrace>
          <redirectTestOutputToFile>${build.redirect.test.output.to.file}</redirectTestOutputToFile>
          <systemPropertyVariables>
            <java.net.preferIPv4Stack>true</java.net.preferIPv4Stack>
            <java.awt.headless>true</java.awt.headless>
            <java.security.krb5.realm>${slider.test.java.security.krb5.realm}</java.security.krb5.realm>
            <java.security.krb5.kdc>${slider.test.java.security.krb5.kdc}</java.security.krb5.kdc>
            <!-- this property must be supplied-->
            <slider.conf.dir>${slider.conf.dir}</slider.conf.dir>
            <slider.bin.dir>../slider-assembly/target/slider-${project.version}-all/slider-${project.version}</slider.bin.dir>
            <test.app.pkg.dir>../app-packages/command-logger/slider-pkg/target</test.app.pkg.dir>
            <test.app.pkg.file>command-logger-slider-package.zip</test.app.pkg.file>
            <test.app.pkg.name>CMD_LOGGER</test.app.pkg.name>
            <test.app.resource>../slider-core/src/test/app_packages/test_command_log/resources.json</test.app.resource>
            <test.app.template>../slider-core/src/test/app_packages/test_command_log/appConfig.json</test.app.template>
            <vagrant.current.working.dir />
          </systemPropertyVariables>
        </configuration>
      </plugin>
  
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>${maven-dependency-plugin.version}</version>
        <executions>
          <execution>
            <id>copy-dependencies</id>
            <phase>process-resources</phase>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
            <configuration>
              <includeArtifactIds>apache-slider-command-logger</includeArtifactIds>
              <includeTypes>zip</includeTypes>
              <outputDirectory>${project.build.directory}/${work.dir}</outputDirectory>
            </configuration>
          </execution>
          <execution>
            <id>copy</id>
            <phase>test</phase>
            <goals>
              <goal>copy</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>org.apache.slider</groupId>
                  <artifactId>command-logger-slider-package</artifactId>
                  <type>zip</type>
                  <overWrite>false</overWrite>
                  <outputDirectory>${project.build.directory}/${work.dir}</outputDirectory>
                  <destFileName>command-logger-slider-package.zip</destFileName>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>
 
    </plugins>
  </build>

  <reporting>
    <plugins>
 
    </plugins>
  </reporting>

  <dependencies>

    <dependency>
      <groupId>org.apache.slider</groupId>
      <artifactId>slider-core</artifactId>
        <exclusions>
          <exclusion>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-client</artifactId>
          </exclusion>
        </exclusions>
    </dependency>

    <dependency>
      <groupId>org.apache.slider</groupId>
      <artifactId>slider-core</artifactId>
      <type>test-jar</type>
    </dependency>

    <dependency>
      <groupId>org.apache.slider</groupId>
      <artifactId>slider-assembly</artifactId>
      <classifier>all</classifier>
      <type>tar.gz</type>
      <scope>test</scope>
    </dependency>

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

    <dependency>
       <groupId>org.apache.hbase</groupId>
       <artifactId>hbase-client</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-minicluster</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.slider</groupId>
      <artifactId>command-logger-slider-package</artifactId>
      <version>${project.version}</version>
      <type>zip</type>
    </dependency>

    <dependency>
      <groupId>org.apache.bigtop.itest</groupId>
      <artifactId>itest-common</artifactId>
    </dependency>
    
    <dependency>
      <groupId>org.apache.slider</groupId>
      <artifactId>slider-agent</artifactId>
      <scope>test</scope>
      <type>tar.gz</type>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
    </dependency>

    <dependency>
      <groupId>org.codehaus.groovy</groupId>
      <artifactId>groovy-all</artifactId>
    </dependency>

    <dependency>
      <groupId>com.jcraft</groupId>
      <artifactId>jsch</artifactId>
    </dependency>

  </dependencies>

  <profiles>
    <profile>
      <id>tests-on-from-CLI</id>
      <activation>
        <property>
          <name>slider.conf.dir</name>
        </property>
      </activation>
      <properties>
        <maven.test.skip>false</maven.test.skip>
      </properties>
    </profile>
    <profile>
      <id>tests-on-from-build.properties</id>
      <activation>
        <file>
          <exists>../build.properties</exists>
        </file>
      </activation>
      <properties>
        <maven.test.skip>false</maven.test.skip>
      </properties>
    </profile>
    <profile>
      <id>tests-off</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <properties>
        <maven.test.skip>true</maven.test.skip>
      </properties>
    </profile>
      <profile>
        <id>rat</id>
        <build>
          <plugins>
            <plugin>
              <groupId>org.apache.rat</groupId>
              <artifactId>apache-rat-plugin</artifactId>
              <version>${apache-rat-plugin.version}</version>
              <executions>
                <execution>
                  <id>check-licenses</id>
                  <goals>
                    <goal>check</goal>
                  </goals>
                </execution>
              </executions>
              <configuration>
                <excludes>
                  <exclude>**/*.json</exclude>
                  <exclude>**/httpfs-signature.secret</exclude>
                  <exclude>**/regionservers</exclude>
                  <exclude>**/THIRD-PARTY.properties</exclude>
                </excludes>
              </configuration>
            </plugin>

          </plugins>
        </build>
      </profile>
  </profiles>

</project>
