<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright 2015-2017 Red Hat, Inc. and/or its affiliates
    and other contributors as indicated by the @author tags.

    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="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>
    <groupId>org.hawkular.apm</groupId>
    <artifactId>hawkular-apm-tests-parent</artifactId>
    <version>0.14.3.Final</version>
    <relativePath>../pom.xml</relativePath>
  </parent>

  <artifactId>hawkular-apm-tests-instrumentation</artifactId>
  <packaging>jar</packaging>

  <name>Hawkular APM::Tests::Instrumentation</name>

  <properties>
    <hawkular-apm.lib>${project.build.directory}/lib</hawkular-apm.lib>
    <hawkular-apm.instrumentation>${project.basedir}/target/test-classes/instrumentation</hawkular-apm.instrumentation>
    <hawkular-apm.logging>${project.basedir}/src/test/configuratio/logging.propertiesn</hawkular-apm.logging>

    <hawkular.host>127.0.0.1</hawkular.host>
    <hawkular.port>8080</hawkular.port>
    <hawkular.uri>http://${hawkular.host}:${hawkular.port}</hawkular.uri>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.hawkular.apm</groupId>
      <artifactId>hawkular-apm-agent</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.hawkular.apm</groupId>
      <artifactId>hawkular-apm-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.hawkular.apm</groupId>
      <artifactId>hawkular-apm-trace-service-rest-client</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.hawkular.apm</groupId>
      <artifactId>hawkular-apm-tests-common</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-restlet</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-jms</artifactId>
    </dependency>

    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-core</artifactId>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-annotations</artifactId>
    </dependency>

    <!-- ActiveMQ dependencies -->
    <dependency>
      <groupId>org.apache.activemq</groupId>
      <artifactId>activemq-broker</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.activemq</groupId>
      <artifactId>activemq-client</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.activemq</groupId>
      <artifactId>activemq-camel</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.xbean</groupId>
      <artifactId>xbean-spring</artifactId>
      <version>3.18</version>
    </dependency>

    <dependency>
      <groupId>org.jboss.resteasy</groupId>
      <artifactId>resteasy-client</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
    </dependency>

    <!-- RX Netty HTTP dependencies -->
    <dependency>
      <groupId>io.reactivex</groupId>
      <artifactId>rxnetty-http</artifactId>
      <version>0.5.2-RC1</version>
    </dependency>

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

    <dependency>
      <groupId>io.opentracing</groupId>
      <artifactId>opentracing-api</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>


  <profiles>
    <profile>
      <id>itest</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <skip>true</skip>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <id>get-client-all</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>copy</goal>
                </goals>
                <configuration>
                  <artifactItems>
                    <artifactItem>
                      <groupId>org.hawkular.apm</groupId>
                      <artifactId>hawkular-apm-agent</artifactId>
                      <overWrite>true</overWrite>
                      <outputDirectory>${hawkular-apm.lib}</outputDirectory>
                      <destFileName>hawkular-apm-agent.jar</destFileName>
                    </artifactItem>
                  </artifactItems>
                </configuration>
              </execution>
              <execution>
                <id>unpack</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>unpack</goal>
                </goals>
                <configuration>
                  <artifactItems>
                    <artifactItem>
                      <groupId>org.hawkular.apm</groupId>
                      <artifactId>hawkular-apm-instrumentation-jvm</artifactId>
                    </artifactItem>
                  </artifactItems>
                  <outputDirectory>${hawkular-apm.instrumentation}</outputDirectory>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <configuration>
              <threadCount>1</threadCount>
              <threadCountClasses>1</threadCountClasses>
              <argLine>
                -javaagent:${hawkular-apm.lib}/hawkular-apm-agent.jar
                -DHAWKULAR_APM_CONFIG=${hawkular-apm.instrumentation}/apmconfig
                -DHAWKULAR_APM_URI=${hawkular.uri}
                -DHAWKULAR_APM_USERNAME=admin
                -DHAWKULAR_APM_PASSWORD=password
                -Djava.util.logging.config.file=${hawkular-apm.logging}
                -Dhawkular-apm.test.mode=true
                -DHAWKULAR_APM_LOG_LEVEL=INFO
              </argLine>
            </configuration>
            <executions>
              <execution>
                <id>run-integration-tests</id>
                <goals>
                  <goal>integration-test</goal>
                </goals>
                <configuration>
                  <includes>
                    <include>**/*ITest.java</include>
                  </includes>
                </configuration>
              </execution>
              <execution>
                <id>final-verify</id>
                <goals>
                  <goal>verify</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
