<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
    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 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.apache.sling</groupId>
        <artifactId>sling</artifactId>
        <version>22</version>
        <relativePath />
    </parent>

    <artifactId>org.apache.sling.scripting.sightly.testing</artifactId>
    <packaging>jar</packaging>
    <version>1.0.2</version>

    <name>Apache Sling Scripting Sightly Integration Tests</name>
    <description>This project runs the integration tests for validating the Apache Sling Scripting Sightly implementation
        against the Adobe Sightly TCK.</description>

    <scm>
        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.scripting.sightly.testing-1.0.2</connection>
        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.scripting.sightly.testing-1.0.2</developerConnection>
        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.scripting.sightly.testing-1.0.2</url>
    </scm>

    <properties>
        <!-- HTTP port to use when running mvn launchpad:run -->
        <run.http.port>8888</run.http.port>

        <!-- Timeout when checking for Sling readyness before starting tests -->
        <HttpTestBase.readyTimeoutSeconds>62</HttpTestBase.readyTimeoutSeconds>

        <!-- path suffix for HTTP access to Sling -->
        <http.base.path />

        <!-- path suffix for WebDAV access to the repository -->
        <webdav.workspace.path />

        <!-- hostname for integration tests -->
        <test.host>localhost</test.host>

        <!-- optionally exclude some integration tests  -->
        <failsafe.exclude />

        <!--
            Set this to true to stop mvn once the integration test Jetty instance is
            started. Useful to manually test the integration testing webapp.
        -->
        <integration.test.wait>false</integration.test.wait>

        <slf4j.version>1.5.11</slf4j.version>
        <logback.version>0.9.20</logback.version>
    </properties>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>${basedir}</directory>
                            <includes>
                                <include>derby.log</include>
                            </includes>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>reserve-network-port</id>
                        <goals>
                            <goal>reserve-network-port</goal>
                        </goals>
                        <phase>process-resources</phase>
                        <configuration>
                            <portNames>
                                <portName>http.port</portName>
                                <portName>sling.control.port</portName>
                            </portNames>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-failsafe-plugin</artifactId>
                <!-- Version newer than the one declared in the parent pom -->
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <includes>
                        <include>%regex[.*LaunchpadReadyIT.*]</include>
                        <include>%regex[.*SlingSpecificsSightlyIT.*]</include>
                        <include>%regex[.*TestsRunner.*]</include>
                        <include>%regex[.*PerformanceIT.*]</include>
                    </includes>
                    <dependenciesToScan>
                        <dependency>io.sightly:io.sightly.tck</dependency>
                    </dependenciesToScan>
                    <excludes>
                        <exclude>${failsafe.exclude}</exclude>
                    </excludes>
                    <systemPropertyVariables>
                        <io.sightly.tck.serverURL>http://${test.host}:${http.port}</io.sightly.tck.serverURL>
                        <launchpad.http.server.url>http://${test.host}:${http.port}/</launchpad.http.server.url>
                        <launchpad.webdav.server.url>http://${test.host}:${http.port}/${webdav.workspace.path}</launchpad.webdav.server.url>
                        <HttpTestBase.readyTimeoutSeconds>${HttpTestBase.readyTimeoutSeconds}</HttpTestBase.readyTimeoutSeconds>

                        <!-- Additional readyness checks, SLING-3235 -->
                        <launchpad.ready.1>GET:/index.html:200:.*Welcome to the Sling Launchpad.*</launchpad.ready.1>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.sling</groupId>
                <artifactId>maven-launchpad-plugin</artifactId>
                <version>2.3.0</version>
                <extensions>true</extensions>
                <executions>
                    <execution>
                        <id>prepare-test-webapp</id>
                        <goals>
                            <goal>prepare-test-webapp</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>start-container</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>start</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>stop-container</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <slingHome>${project.build.directory}/sling</slingHome>
                    <httpPort>${http.port}</httpPort>
                    <controlHost>${test.host}</controlHost>
                    <controlPort>${sling.control.port}</controlPort>
                    <defaultBundleList>
                        <version>7</version>
                    </defaultBundleList>
                    <jarWebSupport>
                        <bundles>
                          <bundle>
                                <groupId>org.apache.felix</groupId>
                                <artifactId>org.apache.felix.http.api</artifactId>
                                <version>2.3.2</version>
                                <startLevel>5</startLevel>
                            </bundle>
                            <bundle>
                                <groupId>org.apache.felix</groupId>
                                <artifactId>org.apache.felix.http.servlet-api</artifactId>
                                <version>1.0.1</version>
                                <startLevel>5</startLevel>
                            </bundle>
                            <bundle>
                                <groupId>org.apache.felix</groupId>
                                <artifactId>org.apache.felix.http.jetty</artifactId>
                                <version>2.3.2</version>
                                <startLevel>5</startLevel>
                            </bundle>
                        </bundles>
                    </jarWebSupport>
                    <additionalBundles>
                        <bundle>
                            <groupId>org.apache.sling</groupId>
                            <artifactId>org.apache.sling.launchpad.installer</artifactId>
                            <version>1.2.2</version>
                        </bundle>
                        <bundle>
                            <groupId>org.apache.sling</groupId>
                            <artifactId>org.apache.sling.jcr.compiler</artifactId>
                            <version>2.1.0</version>
                            <startLevel>20</startLevel>
                        </bundle>
                        <bundle>
                            <groupId>javax.mail</groupId>
                            <artifactId>mail</artifactId>
                            <version>1.4.7</version>
                            <startLevel>20</startLevel>
                        </bundle>
                        <bundle>
                            <groupId>org.apache.sling</groupId>
                            <artifactId>org.apache.sling.i18n</artifactId>
                            <version>2.2.10</version>
                            <startLevel>20</startLevel>
                        </bundle>
                        <bundle>
                            <groupId>org.apache.sling</groupId>
                            <artifactId>org.apache.sling.xss</artifactId>
                            <version>1.0.2</version>
                            <startLevel>20</startLevel>
                        </bundle>
                        <bundle>
                            <groupId>org.apache.sling</groupId>
                            <artifactId>org.apache.sling.scripting.sightly</artifactId>
                            <version>1.0.2</version>
                            <startLevel>20</startLevel>
                        </bundle>
                        <bundle>
                            <groupId>org.apache.sling</groupId>
                            <artifactId>org.apache.sling.scripting.sightly.js.provider</artifactId>
                            <version>1.0.0</version>
                            <startLevel>20</startLevel>
                        </bundle>
                        <bundle>
                            <groupId>org.apache.sling</groupId>
                            <artifactId>org.apache.sling.scripting.sightly.testing-content</artifactId>
                            <version>1.0.2</version>
                            <startLevel>20</startLevel>
                        </bundle>
                        <bundle>
                            <groupId>org.apache.sling</groupId>
                            <artifactId>org.apache.sling.scripting.sightly.repl</artifactId>
                            <version>1.0.0</version>
                            <startLevel>20</startLevel>
                        </bundle>
                    </additionalBundles>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.sling</groupId>
                        <artifactId>org.apache.sling.launchpad.base</artifactId>
                        <version>4.6.1-2.5.8</version>
                    </dependency>
                    <dependency>
                        <groupId>org.apache.sling</groupId>
                        <artifactId>org.apache.sling.launchpad.base</artifactId>
                        <version>4.6.1-2.5.8</version>
                        <classifier>app</classifier>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <!--
                Run the integration tests.
            -->
            <id>integrationTesting</id>
            <activation>
                <property>
                    <name>!maven.test.skip</name>
                </property>
            </activation>
            <build>
                <plugins>

                </plugins>
            </build>
        </profile>
    </profiles>

    <dependencies>

      <!-- The integration tests -->
        <dependency>
            <groupId>io.sightly</groupId>
            <artifactId>io.sightly.tck</artifactId>
            <version>1.1.2</version>
            <scope>test</scope>
        </dependency>

      <!--  The basic Sling WebApp -->
        <dependency>
            <groupId>org.apache.sling</groupId>
            <artifactId>org.apache.sling.launchpad.base</artifactId>
            <version>4.6.1-2.5.8</version>
            <classifier>app</classifier>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.sling</groupId>
            <artifactId>org.apache.sling.commons.testing</artifactId>
            <version>2.0.16</version>
            <exclusions>
                <exclusion>
                    <groupId>junit</groupId>
                    <artifactId>junit-dep</artifactId>
                </exclusion>
            </exclusions>
            <scope>test</scope>
        </dependency>

        <!-- Dependencies for the Test Build and Run -->
        <dependency>
            <groupId>javax.jcr</groupId>
            <artifactId>jcr</artifactId>
            <version>2.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>log4j-over-slf4j</artifactId>
            <version>${slf4j.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${logback.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>4.11</version>
          <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.compendium</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- Dependency for running Sling performance tests -->
        <dependency>
            <groupId>org.apache.sling</groupId>
            <artifactId>org.apache.sling.performance.base</artifactId>
            <version>1.0.2</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>
