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

<!-- ====================================================================== -->
<!--                                                                        -->
<!-- JBoss, the OpenSource J2EE webOS                                       -->
<!--                                                                        -->
<!-- Distributable under LGPL license.                                      -->
<!-- See terms of license at http://www.gnu.org.                            -->
<!--                                                                        -->
<!-- ====================================================================== -->

<!-- 

  Set these VM properties in your IDE debugger 

  -Djava.util.logging.manager=org.jboss.logmanager.LogManager
  -Dtest.archive.directory=${workspace_loc:jbosgi-testsuite-example/target}/test-libs 
-->

<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.jboss.osgi.testsuite</groupId>
        <artifactId>jbosgi-testsuite</artifactId>
        <version>2.1.0</version>
    </parent>

    <name>JBossOSGi Testsuite Examples</name>

    <artifactId>jbosgi-testsuite-example</artifactId>
    <packaging>jar</packaging>

    <!-- Properties -->
    <properties>
        <project.root.dir>${basedir}/../..</project.root.dir>
    </properties>
    
    <!-- Dependencies -->
    <dependencies>
        <!-- Provided -->
        <dependency>
            <groupId>javax.enterprise</groupId>
            <artifactId>cdi-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.apache.felix.log</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.osgi.framework</groupId>
            <artifactId>jbosgi-framework-core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.osgi.logging</groupId>
            <artifactId>jboss-osgi-logging</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.hibernate.javax.persistence</groupId>
            <artifactId>hibernate-jpa-2.0-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.spec.javax.annotation</groupId>
            <artifactId>jboss-annotations-api_1.1_spec</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.spec.javax.ejb</groupId>
            <artifactId>jboss-ejb-api_3.1_spec</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.spec.javax.servlet</groupId>
            <artifactId>jboss-servlet-api_3.0_spec</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.spec.javax.transaction</groupId>
            <artifactId>jboss-transaction-api_1.2_spec</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.spec.javax.ws.rs</groupId>
            <artifactId>jboss-jaxrs-api_1.1_spec</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>provided</scope>
        </dependency>
        <!-- Test -->
        <dependency>
            <groupId>org.jboss.osgi.testing</groupId>
            <artifactId>jbosgi-testing</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <!-- Build -->
    <build>
        <resources>
            <resource>
                <directory>src/test/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <id>bundles</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>directory-single</goal>
                        </goals>
                        <configuration>
                            <finalName>test-libs</finalName>
                            <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
                            <appendAssemblyId>false</appendAssemblyId>
                            <descriptors>
                                <descriptor>scripts/assembly-bundles.xml</descriptor>
                            </descriptors>
                        </configuration>
                    </execution>
                    <execution>
                        <id>examples</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <appendAssemblyId>false</appendAssemblyId>
                            <descriptors>
                                <descriptor>scripts/assembly-examples-zip.xml</descriptor>
                            </descriptors>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-artifacts</id>
                        <phase>package</phase>
                        <goals>
                            <goal>attach-artifact</goal>
                        </goals>
                        <configuration>
                            <artifacts>
                                <artifact>
                                    <file>target/${project.artifactId}-${project.version}.zip</file>
                                    <type>zip</type>
                                </artifact>
                            </artifacts>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <!-- Profiles -->
    <profiles>
        <profile>
            <id>embedded-testing</id>
            <activation>
                <property>
                    <name>!target.container</name>
                </property>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>org.wildfly</groupId>
                    <artifactId>wildfly-controller-client</artifactId>
                    <version>${version.jboss.wildfly.stable}</version>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <argLine>${surefire.system.args} ${surefire.security.args}</argLine>
                            <excludes>
                                <exclude>**/cdi/*TestCase.java</exclude>
                                <exclude>**/ear/*TestCase.java</exclude>
                                <exclude>**/ejb3/*TestCase.java</exclude>
                                <exclude>**/http/*TestCase.java</exclude>
                                <exclude>**/interceptor/*TestCase.java</exclude>
                                <exclude>**/jaxb/*TestCase.java</exclude>
                                <exclude>**/jaxp/*TestCase.java</exclude>
                                <exclude>**/jaxrs/*TestCase.java</exclude>
                                <exclude>**/jaxws/*TestCase.java</exclude>
                                <exclude>**/jpa/*TestCase.java</exclude>
                                <exclude>**/jta/*TestCase.java</exclude>
                                <exclude>**/resource/*TestCase.java</exclude>
                                <exclude>**/webapp/*TestCase.java</exclude>
                                <exclude>**/*IntegrationTestCase.java</exclude>
                            </excludes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        
        <profile>
            <id>wildfly800-testing</id>
            <activation>
                <property>
                    <name>target.container</name>
                    <value>wildfly800</value>
                </property>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>org.wildfly</groupId>
                    <artifactId>wildfly-controller-client</artifactId>
                    <version>${version.jboss.wildfly}</version>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <argLine>${surefire.system.args} ${surefire.security.args}</argLine>
                            <excludes>
                                <exclude>**/*StandaloneTestCase.java</exclude>
                            </excludes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <!-- Repositories -->
    <repositories>
        <!-- Define the JBoss Repository here because the examples are distributed standalone -->
        <repository>
            <id>jboss-public-repository-group</id>
            <name>JBoss Public Maven Repository Group</name>
            <url>https://repository.jboss.org/nexus/content/groups/public/</url>
        </repository>
    </repositories>

</project>
