<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>com.carrotsearch.randomizedtesting</groupId>
    <artifactId>randomizedtesting-parent</artifactId>
    <version>2.8.2</version>
    <relativePath>../../pom.xml</relativePath>
  </parent>

  <artifactId>randomizedtesting-examples</artifactId>
  <name>RandomizedTesting Examples</name>

  <description>
  Simple use-case examples meant to be included in some
  end-user documentation if it's ever going to be written...
  </description>

  <properties>
    <maven.deploy.skip>true</maven.deploy.skip>
  </properties>

  <dependencies>
    <dependency>
      <groupId>com.carrotsearch.randomizedtesting</groupId>
      <artifactId>randomizedtesting-runner</artifactId>
      <version>${project.version}</version>
      <scope>compile</scope>
    </dependency>

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

  <build>
    <plugins>
      <!-- We don't want to use surefire to run our tests so we skip it. -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <executions>
          <execution>
            <id>default-test</id>
            <phase>none</phase>
          </execution>
        </executions>
      </plugin>

      <!-- 
       !!! LOOK HERE !!!
       Run tests with JUnit4 instead. A simple configuration here. 
       -->
      <plugin>
        <groupId>com.carrotsearch.randomizedtesting</groupId>
        <artifactId>junit4-maven-plugin</artifactId>
        <version>${project.version}</version>
        <executions>
          <execution>
            <id>junit4-tests</id>
            <goals>
              <goal>junit4</goal>
            </goals>
            <phase>test</phase>
            <configuration>
              <!-- Some of these examples have intentional failures, so don't fail on errors. -->
              <haltOnFailure>false</haltOnFailure>
              
              <!-- Our tests are in primary classes folder. -->
              <testClassesDirectory>${project.build.outputDirectory}</testClassesDirectory>

              <!-- Attach a simple listener. -->
              <listeners>
                <report-text
                    showThrowable="false" 
                    showStackTraces="false" 
                    showOutput="never" 

                    showStatusOk="true"
                    showStatusError="true"
                    showStatusFailure="true"
                    showStatusIgnored="true"

                    showSuiteSummary="false"
                />

                <!-- JSON report with HTML scaffolding. -->
                <report-json file="${dir.ant.tests}/result-json/results.html" />
              </listeners>

              <assertions>
                <enable package="com.carrotsearch"/>
              </assertions>
            </configuration>
          </execution>
        </executions>
      </plugin>      
    </plugins>
  </build>
</project>
