<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">
  <!--
    -  AOP Integration module.
    -  This modules includes 4 different test configurations: weave, no-weave, weave-secure, and no-weave-secure
    -  By default, none of the configurations will run.  A single test configuration can be called using the
    -  appropriate profile:
    -    mvn -Ptests-weave-secure install
    -  
    -  All four surefire test configurations can be run using the property aop.tests.all
    -    mvn -Daop.tests.all install
    -
    -  Individual tests can be run by activating the appropriate profiles, then specifying the tests to run
    -    mvn -Ptests-weave,tests-no-weave-secure -Dtest=TypeDefAopTestCase install
    -->
  <parent>
    <groupId>org.jboss.microcontainer</groupId>
    <artifactId>jboss-microcontainer</artifactId>
    <version>2.0.4.GA</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>
  <artifactId>jboss-aop-mc-int</artifactId>
  <packaging>jar</packaging>
  <name>JBoss Microcontainer AOP MC INT</name>
  <url>http://www.jboss.com/products/jbossmc</url>
  <description>JBoss Microcontainer</description>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
          <descriptors>
            <descriptor>src/assembly/impl.xml</descriptor>
            <descriptor>src/assembly/aspects.xml</descriptor>
          </descriptors>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <executions>
          <execution>
            <id>weave</id>
            <phase>test</phase>
            <goals>
              <goal>test</goal>
            </goals>
            <configuration>
              <skip>true</skip>
              <includes>
                <include>org/jboss/test/**/*TestCase.java</include>
              </includes>
             <useSystemClassLoader>true</useSystemClassLoader>
              <argLine>-Djava.system.class.loader=org.jboss.aop.standalone.SystemClassLoader</argLine>
              <reportsDirectory>${project.build.directory}/surefire-reports/weave</reportsDirectory>     
              <systemProperties>
                <property>
                  <name>jboss.aop.exclude</name>
                  <value>org.jboss.,org.apache.</value>
                </property>
                <property>
                  <name>jboss.aop.include</name>
                  <value>org.jboss.test.</value>
                </property>
                <property>
                  <name>jboss-junit-configuration</name>
                  <value>weave</value>
                </property>
                <property>
                  <name>build.testlog</name>
                  <value>target/log</value>
                </property>
                <property>
                  <name>jboss.aop.verbose</name>
                  <value>true</value>
                </property>
              </systemProperties>
            </configuration>
          </execution>
          <execution>
            <id>weave-secure</id>
            <phase>test</phase>
            <goals>
              <goal>test</goal>
            </goals>
            <configuration>
              <skip>true</skip>
              <reportsDirectory>${project.build.directory}/surefire-reports/weave-secure</reportsDirectory>     
              <includes>
                <include>org/jboss/test/**/*TestCase.java</include>
              </includes>
              <useSystemClassLoader>true</useSystemClassLoader>
              <argLine>-Djava.system.class.loader=org.jboss.aop.standalone.SystemClassLoader</argLine>
              <systemProperties>
                <property>
                  <name>jboss.aop.exclude</name>
                  <value>org.jboss.,org.apache.</value>
                </property>
                <property>
                  <name>jboss.aop.include</name>
                  <value>org.jboss.test.</value>
                </property>
                <property>
                  <name>jboss-junit-configuration</name>
                  <value>weave</value>
                </property>
                <property>
                  <name>build.testlog</name>
                  <value>target/log</value>
                </property>
                <property>
                  <name>jboss.mc.secure</name>
                  <value>true</value>
                </property>
              </systemProperties>
            </configuration>
          </execution>
          <execution>
            <id>no-weave</id>
            <goals>
              <goal>test</goal>
            </goals>
            <configuration>
              <skip>true</skip>
              <reportsDirectory>${project.build.directory}/surefire-reports/no-weave</reportsDirectory>     
              <includes>
                <include>org/jboss/test/microcontainer/test/**/*TestCase.java</include>
                <include>org/jboss/test/microcontainer/beans/test/**/*TestCase.java</include>
                <include>org/jboss/test/microcontainer/annotatedaop/test/**/*TestCase.java</include>
              </includes>
              <systemProperties>
                <property>
                  <name>jboss-junit-configuration</name>
                  <value>no_weave</value>
                </property>
                <property>
                  <name>build.testlog</name>
                  <value>target/log</value>
                </property>
              </systemProperties>
            </configuration>
          </execution>
          <execution>
            <id>no-weave-secure</id>
            <goals>
              <goal>test</goal>
            </goals>
            <configuration>
              <skip>true</skip>
              <reportsDirectory>${project.build.directory}/surefire-reports/no-weave-secure</reportsDirectory>     
              <includes>
                <include>org/jboss/test/microcontainer/test/**/*TestCase.java</include>
                <include>org/jboss/test/microcontainer/beans/test/**/*TestCase.java</include>
                <include>org/jboss/test/microcontainer/annotatedaop/test/**/*TestCase.java</include>
              </includes>
              <systemProperties>
                <property>
                  <name>jboss-junit-configuration</name>
                  <value>no_weave</value>
                </property>
                <property>
                  <name>build.testlog</name>
                  <value>target/log</value>
                </property>
                <property>
                  <name>jboss.mc.secure</name>
                  <value>true</value>
                </property>
              </systemProperties>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <testFailureIgnore>true</testFailureIgnore>
          <forkMode>always</forkMode>
          <redirectTestOutputToFile>true</redirectTestOutputToFile>          
          <skip>true</skip>
          <trimStackTrace>false</trimStackTrace>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.jboss</groupId>
        <artifactId>jboss-test</artifactId>
        <version>${version.org.jboss.test}</version>
        <scope>compile</scope>
      </dependency>
      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>${version.junit}</version>
        <scope>compile</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  
  <!-- Do not add version information here, use ../pom.xml instead -->
  <dependencies>
    <!-- Global dependencies -->
    <dependency>
      <groupId>org.jboss.aop</groupId>
      <artifactId>jboss-aop</artifactId>
      <exclusions>
        <exclusion>
          <groupId>ant</groupId>
          <artifactId>ant</artifactId>
        </exclusion>
        <exclusion>
          <groupId>apache-xerces</groupId>
          <artifactId>xml-apis</artifactId>
        </exclusion>
        <exclusion>
          <groupId>javassist</groupId>
          <artifactId>javassist</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.jboss</groupId>
          <artifactId>jboss-common-core</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.jboss.logging</groupId>
          <artifactId>jboss-logging-spi</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.jboss.logging</groupId>
          <artifactId>jboss-logging-log4j</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.jboss.microcontainer</groupId>
          <artifactId>jboss-container</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.jboss.microcontainer</groupId>
          <artifactId>jboss-dependency</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.jboss.microcontainer</groupId>
      <artifactId>jboss-kernel</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jboss.man</groupId>
      <artifactId>jboss-managed</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>javassist</groupId>
      <artifactId>javassist</artifactId>
    </dependency>
    <!-- Test dependencies -->
    <dependency>
      <groupId>org.jboss.logging</groupId>
      <artifactId>jboss-logging-log4j</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.test</groupId>
      <artifactId>jboss-test</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.microcontainer</groupId>
      <artifactId>jboss-kernel</artifactId>
      <type>test-jar</type>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.jboss.microcontainer</groupId>
          <artifactId>jboss-dependency</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.jboss</groupId>
          <artifactId>jbossxb</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
  </dependencies>
  
  <profiles>
    <profile>
      <id>tests-weave</id>
      <activation>
        <property>
          <name>aop.tests.all</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <executions>
              <execution>
                <id>weave</id>
                <configuration>
                  <skip>false</skip>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-surefire-report-plugin</artifactId>
            <configuration>
              <reportsDirectory>${project.build.directory}/surefire-reports/weave</reportsDirectory>
              <outputName>surefire-report-weave</outputName>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>tests-weave-secure</id>
      <activation>
        <property>
          <name>aop.tests.all</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <executions>
              <execution>
                <id>weave-secure</id>
                <configuration>
                  <skip>false</skip>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-surefire-report-plugin</artifactId>
            <configuration>
              <reportsDirectory>${project.build.directory}/surefire-reports/weave-secure</reportsDirectory>
              <outputName>surefire-report-weave-secure</outputName>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>tests-no-weave</id>
      <activation>
        <property>
          <name>aop.tests.all</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <executions>
              <execution>
                <id>no-weave</id>
                <configuration>
                  <skip>false</skip>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-surefire-report-plugin</artifactId>
            <configuration>
              <reportsDirectory>${project.build.directory}/surefire-reports/no-weave</reportsDirectory>
              <outputName>surefire-report-no-weave</outputName>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>tests-no-weave-secure</id>
      <activation>
        <property>
          <name>aop.tests.all</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <executions>
              <execution>
                <id>no-weave-secure</id>
                <configuration>
                  <skip>false</skip>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-surefire-report-plugin</artifactId>
            <configuration>
              <reportsDirectory>${project.build.directory}/surefire-reports/no-weave-secure</reportsDirectory>
              <outputName>surefire-report-no-weave-secure</outputName>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>ant-tests-weave</id>
      <activation>
        <property>
          <name>ant-tests-weave</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
			      <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
			      <version>1.1</version>
            <executions>
              <execution>
                <id>ant-tests-weave</id>
                <phase>test</phase>
                <configuration>
                  <tasks>
                    <property name="plugin_classpath" refid="maven.plugin.classpath" />
					          <echo message="plugin classpath: ${plugin_classpath}" />
                    <mkdir dir="${project.build.directory}/surefire-reports/ant-weave" />
                    <property name="build.testlog" value="${project.build.directory}/log" />
                    <mkdir dir="${build.testlog}" />
                    <!-- Remove the test.log so each run has a fresh log -->
                    <delete file="${build.testlog}/test.log" />
                    <junit dir="${project.build.directory}" printsummary="yes" haltonerror="false" haltonfailure="false" fork="true">
              
                       <sysproperty key="jboss.aop.exclude" value="org.jboss.,org.apache." />
                       <sysproperty key="jboss.aop.include" value="org.jboss.test." />
                       <sysproperty key="jboss-junit-configuration" value="weave" />
                       <sysproperty key="build.testlog" value="${build.testlog}" />
                       <sysproperty key="java.system.class.loader" value="org.jboss.aop.standalone.SystemClassLoader" />
              
                       <classpath>
                          <path refid="maven.test.classpath" />
                       </classpath>
              
                       <formatter type="plain" usefile="true" extension=".txt" />
                       <formatter classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter" usefile="true" extension=".xml" />
              
                       <batchtest todir="${project.build.directory}/surefire-reports/ant-weave" haltonerror="false" haltonfailure="false" fork="true">
              
                          <fileset dir="${project.build.directory}/test-classes">
                             <include name="org/jboss/test/**/*TestCase.class" />
                          </fileset>
                       </batchtest>
                    </junit>
                  </tasks>
                </configuration>
                <goals>
                  <goal>run</goal>
                </goals>
              </execution>
            </executions> 
            <dependencies>
              <dependency>
                <groupId>ant</groupId>
                <artifactId>ant-junit</artifactId>
                <version>${version.ant.junit}</version>
              </dependency>
              <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>${version.junit}</version>
              </dependency>
            </dependencies>     
          </plugin>
          <plugin>
            <artifactId>maven-surefire-report-plugin</artifactId>
            <configuration>
              <reportsDirectory>${project.build.directory}/surefire-reports/ant-weave</reportsDirectory>
              <outputName>surefire-report-ant-weave</outputName>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>ant-one-test-weave</id>
      <activation>
        <property>
          <name>ant-one-test-weave</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
			      <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
			      <version>1.1</version>
            <executions>
              <execution>
                <id>ant-one-test-weave</id>
                <phase>test</phase>
                <configuration>
                  <tasks>
                    <property name="plugin_classpath" refid="maven.plugin.classpath" />
					          <echo message="plugin classpath: ${plugin_classpath}" />
                    <mkdir dir="${project.build.directory}/surefire-reports/ant-one-weave" />
                    <property name="build.testlog" value="${project.build.directory}/log" />
                    <mkdir dir="${build.testlog}" />
                    <!-- Remove the test.log so each run has a fresh log -->
                    <delete file="${build.testlog}/test.log" />
                    <junit dir="${project.build.directory}" printsummary="yes" haltonerror="false" haltonfailure="false" fork="true">
              
                       <sysproperty key="jboss.aop.exclude" value="org.jboss.,org.apache." />
                       <sysproperty key="jboss.aop.include" value="org.jboss.test." />
                       <sysproperty key="jboss-junit-configuration" value="weave" />
                       <sysproperty key="build.testlog" value="${build.testlog}" />
                       <sysproperty key="java.system.class.loader" value="org.jboss.aop.standalone.SystemClassLoader" />
              
                       <classpath>
                          <path refid="maven.test.classpath" />
                       </classpath>
              
                       <formatter type="plain" usefile="true" extension=".txt" />
                       <formatter classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter" usefile="true" extension=".xml" />
              
                       <test todir="${project.build.directory}/surefire-reports/ant-one-weave" name="${test}" haltonerror="false" haltonfailure="false" fork="true" />
                       
                    </junit>
                  </tasks>
                </configuration>
                <goals>
                  <goal>run</goal>
                </goals>
              </execution>
            </executions> 
            <dependencies>
              <dependency>
                <groupId>ant</groupId>
                <artifactId>ant-junit</artifactId>
                <version>${version.ant.junit}</version>
              </dependency>
              <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>${version.junit}</version>
              </dependency>
            </dependencies>     
          </plugin>
          <plugin>
            <artifactId>maven-surefire-report-plugin</artifactId>
            <configuration>
              <reportsDirectory>${project.build.directory}/surefire-reports/ant-weave</reportsDirectory>
              <outputName>surefire-report-ant-weave</outputName>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>ant-tests-weave-secure</id>
      <activation>
        <property>
          <name>ant-tests-weave-secure</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <id>ant-tests-weave-secure</id>
                <phase>test</phase>
                <configuration>
                  <tasks>
                    <mkdir dir="${project.build.directory}/surefire-reports/ant-weave-secure" />
                    <property name="build.testlog" value="${project.build.directory}/log" />
                    <mkdir dir="${build.testlog}" />
                    <!-- Remove the test.log so each run has a fresh log -->
                    <delete file="${build.testlog}/test.log" />
                    <junit dir="${project.build.directory}" printsummary="yes" haltonerror="false" haltonfailure="false" fork="true">
              
                       <sysproperty key="jboss.aop.exclude" value="org.jboss.,org.apache." />
                       <sysproperty key="jboss.aop.include" value="org.jboss.test." />
                       <sysproperty key="jboss-junit-configuration" value="weave-secure" />
                       <sysproperty key="build.testlog" value="${build.testlog}" />
                       <sysproperty key="java.system.class.loader" value="org.jboss.aop.standalone.SystemClassLoader" />
                       <sysproperty key="jboss.mc.secure" value="true" />
              
                       <classpath>
                          <path refid="maven.test.classpath" />
                       </classpath>
              
                       <formatter type="plain" usefile="true" extension=".txt" />
                       <formatter classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter" usefile="true" extension=".xml" />
              
                       <batchtest todir="${project.build.directory}/surefire-reports/ant-weave-secure" haltonerror="false" haltonfailure="false" fork="true">
              
                          <fileset dir="${project.build.directory}/test-classes">
                             <include name="org/jboss/test/**/*TestCase.class" />
                          </fileset>
                       </batchtest>
                    </junit>
                  </tasks>
                </configuration>
                <goals>
                  <goal>run</goal>
                </goals>
              </execution>
            </executions> 
            <dependencies>
              <dependency>
                <groupId>ant</groupId>
                <artifactId>ant-junit</artifactId>
                <version>${version.ant.junit}</version>
              </dependency>
              <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>${version.junit}</version>
              </dependency>
            </dependencies>     
          </plugin>
          <plugin>
            <artifactId>maven-surefire-report-plugin</artifactId>
            <configuration>
              <reportsDirectory>${project.build.directory}/surefire-reports/ant-weave-secure</reportsDirectory>
              <outputName>surefire-report-ant-weave-secure</outputName>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
