<?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.4.2.Final</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>org.apache.felix</groupId>
            <artifactId>org.apache.felix.configadmin</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.apache.felix.log</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.apache.felix.metatype</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.apache.felix.scr</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.apache.felix.webconsole</artifactId>
            <scope>provided</scope>
            <classifier>all</classifier>
        </dependency>
        <dependency>
            <groupId>org.apache.aries.blueprint</groupId>
            <artifactId>org.apache.aries.blueprint</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.aries.jmx</groupId>
            <artifactId>org.apache.aries.jmx</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.aries.jndi</groupId>
            <artifactId>org.apache.aries.jndi</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.aries.proxy</groupId>
            <artifactId>org.apache.aries.proxy</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.aries</groupId>
            <artifactId>org.apache.aries.util</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.jboss.spec</groupId>
            <artifactId>jboss-javaee-7.0</artifactId>
            <type>pom</type>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>provided</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>embedded</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>@{jacocoArgLine} @{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>wildfly-testing</id>
            <activation>
                <property>
                    <name>!embedded</name>
                </property>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>org.wildfly.core</groupId>
                    <artifactId>wildfly-controller-client</artifactId>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <argLine>@{jacocoArgLine} @{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>
