<!--
  ~ JBoss, Home of Professional Open Source.
  ~ Copyright 2011, Red Hat and individual contributors
  ~ as indicated by the @author tags. See the copyright.txt file in the
  ~ distribution for a full listing of individual contributors.
  ~
  ~ This is free software; you can redistribute it and/or modify it
  ~ under the terms of the GNU Lesser General Public License as
  ~ published by the Free Software Foundation; either version 2.1 of
  ~ the License, or (at your option) any later version.
  ~
  ~ This software is distributed in the hope that it will be useful,
  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  ~ Lesser General Public License for more details.
  ~
  ~ You should have received a copy of the GNU Lesser General Public
  ~ License along with this software; if not, write to the Free
  ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  -->
<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>byteman-bmunit</artifactId>
    <packaging>jar</packaging>
    <description>
        The Byteman bmunit jar provides integration of Byteman into TestNG and JUnit tests.
    </description>
    <name>byteman-bmunit</name>
    <parent>
        <groupId>org.jboss.byteman</groupId>
        <artifactId>byteman-root</artifactId>
        <version>4.0.13</version>
        <relativePath>../../pom.xml</relativePath>
    </parent>
    <build>
        <sourceDirectory>src</sourceDirectory>
        <testSourceDirectory>test/src</testSourceDirectory>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifestEntries>
                            <Implementation-Version>${project.version}</Implementation-Version>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <!-- test combination of no BMUnit, BMNGListener and BMNGRunner integration -->
                    <!-- also NGUnitConfigTest sets the BMUnitConfig used as the default -->
                    <includes>
                        <include>test/ATest.class</include>
                        <include>test/NGUnitConfigTest.class</include>
                        <include>test/YTest.class</include>
                    </includes>
                    <useSystemClassLoader>true</useSystemClassLoader>
                    <useManifestOnlyJar>true</useManifestOnlyJar>
                    <forkCount>1</forkCount>
                    <reuseForks>false</reuseForks>
                    <systemProperties>
                        <property>
                            <name>org.jboss.byteman.home</name>
                            <value></value>
                        </property>
                    </systemProperties>
                    <argLine>-Djdk.attach.allowAttachSelf</argLine>
                    <environmentVariables>
                        <BYTEMAN_HOME></BYTEMAN_HOME>
                    </environmentVariables>
                </configuration>
                <executions>
                    <execution>
                        <id>testng.runner</id>
                        <phase>test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <!-- test second combination of no BMNGListener and BMNGRunner integration -->
                            <!-- BMUnitConfig default is not defined by any of these classes -->
                            <includes>
                                <include>test/NGUnitTest.class</include>
                                <include>test/ZTest.class</include>
                            </includes>
                        </configuration>
                    </execution>
                    <execution>
                        <id>junit</id>
                        <phase>test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <!-- test JUnit integration - this requires switching off the TestNG
                            processing mode enabled by the presence of TestNG tests in other
                            executions by overriding the testNGArtifactName -->
                            <!-- BMUnitConfig default is not defined by UnitTest-->
                            <testNGArtifactName>none:none</testNGArtifactName>
                            <includes>
                                <include>test/UnitTest.class</include>
                            </includes>
                        </configuration>
                    </execution>
                    <execution>
                        <id>junitconfig</id>
                        <phase>test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <!-- test JUnit integration - this requires switching off the TestNG
                            processing mode enabled by the presence of TestNG tests in other
                            executions by overriding the testNGArtifactName -->
                            <!-- BMUnitConfig default is defined by UnitConfigTest-->
                            <testNGArtifactName>none:none</testNGArtifactName>
                            <includes>
                                <include>test/UnitConfigTest.class</include>
                            </includes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <scope>compile</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>compile</scope>
            <optional>true</optional>
        </dependency>
        <!-- the bmunit code depends on the submit, install and agent jars
        -->
        <dependency>
          <groupId>org.jboss.byteman</groupId>
          <artifactId>byteman</artifactId>
        </dependency>
        <dependency>
          <groupId>org.jboss.byteman</groupId>
          <artifactId>byteman-submit</artifactId>
        </dependency>
        <dependency>
          <groupId>org.jboss.byteman</groupId>
          <artifactId>byteman-install</artifactId>
        </dependency>
    </dependencies>
    <profiles>
        <!-- the bmunit code uses the VM_Attach API which is available in the JDK tools jar
             in JDK6/7/8. In JDK9 it is always available via the system loader.
        -->
        <profile>
          <id>use-toolsjar-profile</id>
          <activation>
            <jdk>[1.6,1.8]</jdk>
          </activation>
          <dependencies>
            <dependency>
              <groupId>com.sun</groupId>
              <artifactId>tools</artifactId>
              <version>1.6</version>
              <scope>system</scope>
              <systemPath>${tools.jar}</systemPath>
            </dependency>
          </dependencies>
        </profile>
    </profiles>
</project>
