<?xml version="1.0" encoding="UTF-8"?>
<!--
    Licensed to the Apache Software Foundation (ASF) under one or
    more contributor license agreements. See the NOTICE file
    distributed with this work for additional information regarding
    copyright ownership. The ASF licenses this file to you 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
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
    xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.apache.sling.ide</groupId>
        <artifactId>sling-ide-tooling</artifactId>
        <version>1.1.1-SNAPSHOT</version>
    </parent>
    <artifactId>org.apache.sling.ide.eclipse-test</artifactId>
    <packaging>eclipse-test-plugin</packaging>
    <name>Apache Sling IDE Tools Eclipse Tests</name>

    <scm>
        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/tooling/ide/eclipse-test</connection>
        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/tooling/ide/eclipse-test</developerConnection>
        <url>http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test</url>
    </scm>

    <build>
        <plugins>
            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>target-platform-configuration</artifactId>
                <configuration>
                    <dependency-resolution>
                        <extraRequirements>
                            <requirement>
                                <type>eclipse-plugin</type>
                                <id>org.eclipse.equinox.event</id>
                                <versionRange>0.0.0</versionRange>
                            </requirement>
                            <requirement>
                                <type>eclipse-plugin</type>
                                <id>org.eclipse.equinox.ds</id>
                                <versionRange>0.0.0</versionRange>
                            </requirement>
                            <requirement>
                                <type>eclipse-feature</type>
                                <id>org.apache.sling.ide.feature</id>
                                <versionRange>0.0.0</versionRange>
                            </requirement>
                            <requirement>
                                <type>eclipse-feature</type>
                                <id>org.apache.sling.ide.sightly-feature</id>
                                <versionRange>0.0.0</versionRange>
                            </requirement>
                        </extraRequirements>
                    </dependency-resolution>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>tycho-surefire-plugin</artifactId>
                <version>${tycho.version}</version>
                <configuration>
                    <useUIHarness>true</useUIHarness>
                    <useUIThread>false</useUIThread>
                    <argLine>-XX:MaxPermSize=512m ${ui.test.args}</argLine>
                    <systemProperties>
                        <launchpad.http.port>${http.port}</launchpad.http.port>
                    </systemProperties>
                    <environmentVariables>
                        <SWT_GTK3>0</SWT_GTK3>
                    </environmentVariables>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>1.7</version>
                <executions>
                    <execution>
                        <id>reserve-network-port</id>
                        <goals>
                            <goal>reserve-network-port</goal>
                        </goals>
                        <phase>pre-integration-test</phase>
                        <configuration>
                            <portNames>
                                <portName>http.port</portName>
                                <portName>jetty.stop.port</portName>
                            </portNames>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>prepare-launchpad</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <artifactItems>
                        <artifactItem>
                            <groupId>org.apache.sling</groupId>
                            <artifactId>org.apache.sling.launchpad</artifactId>
                            <version>7</version>
                            <type>war</type>
                            <overWrite>false</overWrite>
                            <outputDirectory>${project.build.directory}</outputDirectory>
                            <destFileName>sling.war</destFileName>
                        </artifactItem>
                    </artifactItems>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>7.6.15.v20140411</version>
                <configuration>
                    <war>${project.build.directory}/sling.war</war>
                    <connectors>
                        <connector
                            implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
                            <port>${http.port}</port>
                        </connector>
                    </connectors>
                    <stopKey>SLING_IT_STOP_KEY</stopKey>
                    <stopPort>${jetty.stop.port}</stopPort>
                    <contextPath>/</contextPath>
                    <daemon>true</daemon>
                    <systemProperties>
                        <force>true</force>
                        <systemProperty>
                            <name>user.dir</name>
                            <value>${project.build.directory}</value>
                        </systemProperty>
                    </systemProperties>
                </configuration>
                <executions>
                    <execution>
                        <id>jetty-run</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>run-war</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>jetty-stop</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <properties>
        <ui.test.args></ui.test.args>
    </properties>

    <profiles>
        <profile>
            <id>macosx</id>
            <activation>
                <os>
                    <family>mac</family>
                    <name>mac os x</name>
                </os>
            </activation>
            <properties>
                <ui.test.args>-XstartOnFirstThread</ui.test.args>
            </properties>
        </profile>
    </profiles>
</project>
