<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2015 Red Hat, Inc.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~   http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.wildfly.arquillian</groupId>
        <artifactId>wildfly-arquillian-parent</artifactId>
        <version>2.1.1.Final</version>
        <relativePath>../pom.xml</relativePath>
    </parent>
    <artifactId>wildfly-arquillian-container-domain-managed</artifactId>

    <name>WildFly: Arquillian Managed Domain Container</name>

    <packaging>jar</packaging>

    <properties>
        <maven.test.skip>false</maven.test.skip>
        <skipTests>${maven.test.skip}</skipTests>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.wildfly.arquillian</groupId>
            <artifactId>wildfly-arquillian-common-domain</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wildfly.core</groupId>
            <artifactId>wildfly-launcher</artifactId>
        </dependency>

        <!-- Test Scope -->
        <dependency>
            <groupId>org.jboss.arquillian.junit</groupId>
            <artifactId>arquillian-junit-container</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.spec.javax.servlet</groupId>
            <artifactId>jboss-servlet-api_3.1_spec</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
             <plugin>
                <groupId>org.wildfly.build</groupId>
                <artifactId>wildfly-server-provisioning-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
                <executions>
                    <execution>
                        <id>default</id>
                        <phase>test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <skip>false</skip>
                            <excludedGroups>org.jboss.as.arquillian.container.domain.managed.test.ManualMode</excludedGroups>
                            <systemPropertyVariables>
                                <jboss.home>${jboss.home}</jboss.home>
                            </systemPropertyVariables>
                        </configuration>
                    </execution>
                    <execution>
                        <id>manual</id>
                        <phase>test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <skip>false</skip>
                            <groups>org.jboss.as.arquillian.container.domain.managed.test.ManualMode</groups>
                            <systemPropertyVariables>
                                <arquillian.xml>manual-arquillian.xml</arquillian.xml>
                                <jboss.home>${jboss.home}</jboss.home>
                            </systemPropertyVariables>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- Workaround for WFLY-6201 to allow tests to run with the servlet container only -->
            <plugin>
                <groupId>org.wildfly.plugins</groupId>
                <artifactId>wildfly-maven-plugin</artifactId>
                <configuration>
                    <!-- Don't execute if we're skipping tests -->
                    <skip>${skipTests}</skip>
                </configuration>
                <executions>
                    <execution>
                        <id>fix-servlet</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>execute-commands</goal>
                        </goals>
                        <configuration>
                            <offline>true</offline>
                            <jboss-home>${jboss.home}</jboss-home>
                            <execute-commands>
                                <fail-on-error>false</fail-on-error>
                                <commands>
                                    <command>embed-host-controller</command>
                                    <command>/server-group=other-server-group:add(socket-binding-group=standard-sockets, profile=default)</command>
                                    <command>stop-embedded-host-controller</command>
                                </commands>
                            </execute-commands>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
