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

    Copyright 2015 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.btm</groupId>
    <artifactId>hawkular-btm</artifactId>
    <version>0.3.0.Final</version>
    <relativePath>../../pom.xml</relativePath>
  </parent>

  <artifactId>hawkular-btm-tests-client</artifactId>
  <packaging>jar</packaging>

  <name>Hawkular BTM::Tests::Client</name>

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

    <hawkular.host>127.0.0.1</hawkular.host>
    <hawkular.port>8080</hawkular.port>
    <hawkular.base-uri>http://${hawkular.host}:${hawkular.port}</hawkular.base-uri>
    <hawkular-btm.path>/hawkular/btm</hawkular-btm.path>
    <hawkular-btm.base-uri>${hawkular.base-uri}${hawkular-btm.path}</hawkular-btm.base-uri>
    <hawkular-btm.testapp.host>127.0.0.1</hawkular-btm.testapp.host>
    <hawkular-btm.testapp.port>8180</hawkular-btm.testapp.port>
    <hawkular-btm.testapp.base-uri>http://${hawkular-btm.testapp.host}:${hawkular-btm.testapp.port}</hawkular-btm.testapp.base-uri>
  </properties>

  <dependencies>

    <dependency>
      <groupId>org.hawkular.btm</groupId>
      <artifactId>hawkular-btm-client-rest</artifactId>
      <scope>test</scope>
    </dependency>

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

    <dependency>
      <groupId>org.hawkular.btm</groupId>
      <artifactId>hawkular-btm-tests-common</artifactId>
    </dependency>
    <dependency>
      <groupId>org.hawkular.btm</groupId>
      <artifactId>hawkular-btm-test-server</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>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-annotations</artifactId>
      <scope>test</scope>
    </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>

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

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

  </dependencies>

  <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.btm</groupId>
                  <artifactId>hawkular-btm-client-rest</artifactId>
                  <overWrite>true</overWrite>
                  <outputDirectory>${hawkular-btm.lib}</outputDirectory>
                  <destFileName>hawkular-btm-client-rest.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.btm</groupId>
                  <artifactId>hawkular-btm-btxn-instrumentation</artifactId>
                </artifactItem>
              </artifactItems>
              <outputDirectory>${hawkular-btm.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>
              -Dorg.jboss.byteman.transform.all
              -javaagent:${hawkular-btm.lib}/hawkular-btm-client-rest.jar=manager:org.hawkular.btm.client.manager.ClientManager,boot:${hawkular-btm.lib}/hawkular-btm-client-rest.jar
              -Dorg.jboss.byteman.compileToBytecode
              -Dhawkular-btm.config=${hawkular-btm.instrumentation}
              -Dhawkular-btm.base-uri=http://localhost:8080/hawkular/btm
              -Dhawkular-btm.username=jdoe
              -Dhawkular-btm.password=password
              -Djava.util.logging.config.file=${hawkular-btm.logging}
              -Dhawkular-btm.log.level=INFO
          </argLine>
          <systemPropertyVariables>
            <hawkular-btm.base-uri>${hawkular-btm.base-uri}</hawkular-btm.base-uri>
            <hawkular-btm.testapp.base-uri>${hawkular-btm.testapp.base-uri}</hawkular-btm.testapp.base-uri>
          </systemPropertyVariables>
        </configuration>
        <executions>
          <execution>
            <id>exec-standalone-tests</id>
            <goals>
              <goal>integration-test</goal>
            </goals>
            <configuration>
              <includes>
                <include>**/*Test.java</include>
              </includes>
            </configuration>
          </execution>
          <execution>
            <id>final-verify</id>
            <goals>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

</project>
