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

  <parent>
    <groupId>org.apache.qpid</groupId>
    <artifactId>qpid-java-build</artifactId>
    <version>6.1.0-SNAPSHOT</version>
  </parent>

  <artifactId>qpid-perftests</artifactId>
  <name>Apache Qpid Performance Tests</name>
  <description>Performance testing configuration, code and tests</description>

  <properties>
    <dependency-change-verification>true</dependency-change-verification>

    <!-- Overrides for system properties understood by Qpid JMS 0-8..0-10 client -->
    <qpid.amqp.version>0-9</qpid.amqp.version>
    <qpid.dest_syntax>BURL</qpid.dest_syntax>
    <qpid.close_timeout>90000</qpid.close_timeout>

    <!-- Overrides for system properties understood by disttest itself -->
    <qpid.disttest.loglevel>info</qpid.disttest.loglevel>
    <qpid.disttest.duration>5000</qpid.disttest.duration>
    <qpid.disttest.distributed>false</qpid.disttest.distributed>

    <!-- The following provide values for the disttest command line -->
    <qpid.disttest.test_config>${basedir}/etc/testdefs</qpid.disttest.test_config>
    <qpid.disttest.hillclimb>false</qpid.disttest.hillclimb>
    <qpid.disttest.hillclimb.max_runs>3</qpid.disttest.hillclimb.max_runs>
    <qpid.disttest.hillclimb.start_target_rate>1025.0</qpid.disttest.hillclimb.start_target_rate>
    <qpid.disttest.hillclimb.production_to_target_ratio_success_threshold>0.95</qpid.disttest.hillclimb.production_to_target_ratio_success_threshold>
    <qpid.disttest.hillclimb.consumption_to_production_ratio_success_threshold>0.95</qpid.disttest.hillclimb.consumption_to_production_ratio_success_threshold>
    <qpid.disttest.hillclimb.minimum_delta>1.0</qpid.disttest.hillclimb.minimum_delta>
    <qpid.disttest.hillclimb.bias>0.25</qpid.disttest.hillclimb.bias>
  </properties>

  <dependencies>
    <!-- client deps -->
    <dependency>
      <groupId>org.apache.qpid</groupId>
      <artifactId>qpid-client</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.apache.geronimo.specs</groupId>
      <artifactId>geronimo-jms_1.1_spec</artifactId>
      <version>${geronimo-jms-1-1-version}</version>
      <scope>provided</scope>
    </dependency>

    <!-- other deps -->
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <version>${logback-version}</version>
    </dependency>

    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-core</artifactId>
      <version>${fasterxml-jackson-version}</version>
    </dependency>

    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>${fasterxml-jackson-version}</version>
    </dependency>

    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>${guava-version}</version>
    </dependency>

    <dependency>
      <groupId>org.apache.derby</groupId>
      <artifactId>derby</artifactId>
      <version>${derby-version}</version>
      <scope>provided</scope>
    </dependency>

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

    <!-- test deps -->
    <dependency>
      <groupId>org.apache.qpid</groupId>
      <artifactId>qpid-test-utils</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>

    <resources>
      <resource>
        <directory>src/main/resources</directory>
      </resource>
      <resource>
        <directory>src/main/java</directory>
        <excludes>
          <exclude>**/*.java/</exclude>
        </excludes>
      </resource>
    </resources>

    <testResources>
      <testResource>
        <directory>src/test/java</directory>
        <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
      </testResource>
      <testResource>
        <directory>src/test/resources</directory>
      </testResource>
    </testResources>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
          <descriptors>
            <descriptor>src/main/assembly/qpid-perftests-bin.xml</descriptor>
          </descriptors>
        </configuration>
        <executions>
          <execution>
            <id>make-assembly</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-deploy-plugin</artifactId>
        <configuration>
          <skip>true</skip>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>${exec-maven-plugin-version}</version>
        <executions>
          <execution>
            <goals>
              <goal>java</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <mainClass>org.apache.qpid.disttest.ControllerRunner</mainClass>
          <arguments>
            <argument>jndi-config=${basedir}/etc/perftests-jndi.properties</argument>
            <argument>test-config=${qpid.disttest.test_config}</argument>
            <argument>distributed=${qpid.disttest.distributed}</argument>
            <argument>writeToDb=false</argument>
            <argument>hill-climb=${qpid.disttest.hillclimb}</argument>
            <argument>hill-climber.max-runs=${qpid.disttest.hillclimb.max_runs}</argument>
            <argument>hill-climber.start-target-rate=${qpid.disttest.hillclimb.start_target_rate}</argument>
            <argument>hill-climber.production-to-target-ratio-success-threshold=${qpid.disttest.hillclimb.production_to_target_ratio_success_threshold}</argument>
            <argument>hill-climber.consumption-to-production-ratio-success-threshold=${qpid.disttest.hillclimb.consumption_to_production_ratio_success_threshold}</argument>
            <argument>hill-climber.minimum-delta=${qpid.disttest.hillclimb.minimum_delta}</argument>
            <argument>hill-climber.bias=${qpid.disttest.hillclimb.bias}</argument>
          </arguments>
          <classpathScope>compile</classpathScope>
          <systemProperties>
            <systemProperty>
              <key>qpid.disttest.loglevel</key>
              <value>${qpid.disttest.loglevel}</value>
            </systemProperty>
            <systemProperty>
              <key>qpid.disttest.duration</key>
              <value>${qpid.disttest.duration}</value>
            </systemProperty>
            <systemProperty>
              <key>qpid.amqp.version</key>
              <value>${qpid.amqp.version}</value>
            </systemProperty>
            <systemProperty>
              <key>qpid.dest_syntax</key>
              <value>${qpid.dest_syntax}</value>
            </systemProperty>
            <systemProperty>
              <key>qpid.close_timeout</key>
              <value>${qpid.close_timeout}</value>
            </systemProperty>
            <systemProperty>
               <key>java.naming.factory.initial</key>
               <value>org.apache.qpid.jndi.PropertiesFileInitialContextFactory</value>
            </systemProperty>
          </systemProperties>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.rat</groupId>
        <artifactId>apache-rat-plugin</artifactId>
        <configuration>
          <excludes>
            <exclude>src/main/java/json2.js</exclude>
            <exclude>src/test/java/org/apache/qpid/disttest/controller/config/sampleConfig.json</exclude>
            <exclude>src/test/java/org/apache/qpid/disttest/results/formatting/expectedOutput.csv</exclude>
            <exclude>visualisation-jfc/**</exclude>
          </excludes>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>qpid-jms-client</id>
      <activation>
        <property>
          <name>client</name>
          <value>qpid-jms-client</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>${exec-maven-plugin-version}</version>
            <executions>
              <execution>
                <goals>
                  <goal>java</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <mainClass>org.apache.qpid.disttest.ControllerRunner</mainClass>
              <arguments>
                <argument>jndi-config=${basedir}/etc/perftests-jndi-qpid-jms-client.properties</argument>
                <argument>test-config=${qpid.disttest.test_config}</argument>
                <argument>distributed=false</argument>
                <argument>writeToDb=false</argument>
                <argument>hill-climb=${qpid.disttest.hillclimb}</argument>
                <argument>hill-climber.max-runs=${qpid.disttest.hillclimb.max_runs}</argument>
                <argument>hill-climber.start-target-rate=${qpid.disttest.hillclimb.start_target_rate}</argument>
                <argument>hill-climber.production-to-target-ratio-success-threshold=${qpid.disttest.hillclimb.production_to_target_ratio_success_threshold}</argument>
                <argument>hill-climber.consumption-to-production-ratio-success-threshold=${qpid.disttest.hillclimb.consumption_to_production_ratio_success_threshold}</argument>
                <argument>hill-climber.minimum-delta=${qpid.disttest.hillclimb.minimum_delta}</argument>
                <argument>hill-climber.bias=${qpid.disttest.hillclimb.bias}</argument>
              </arguments>
              <classpathScope>compile</classpathScope>
              <systemProperties>
                <systemProperty>
                  <key>qpid.disttest.loglevel</key>
                  <value>${qpid.disttest.loglevel}</value>
                </systemProperty>
                <systemProperty>
                  <key>qpid.disttest.duration</key>
                  <value>${qpid.disttest.duration}</value>
                </systemProperty>
                <systemProperty>
                  <key>java.naming.factory.initial</key>
                  <value>org.apache.qpid.jms.jndi.JmsInitialContextFactory</value>
                </systemProperty>
                <systemProperty>
                  <key>qpid.disttest.queue.creator.class</key>
                  <value>org.apache.qpid.disttest.jms.QpidRestAPIQueueCreator</value>
                </systemProperty>
              </systemProperties>
            </configuration>
          </plugin>
        </plugins>
      </build>
      <dependencies>
        <dependency>
          <groupId>org.apache.qpid</groupId>
          <artifactId>qpid-jms-client</artifactId>
          <version>${qpid-jms-client-version}</version>
        </dependency>
      </dependencies>
    </profile>
  </profiles>

</project>
