<?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 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.apache.roller</groupId>
        <artifactId>roller-project</artifactId>
        <version>6.0.2</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <name>Roller Selenium tests</name>
    <artifactId>roller-selenium-tests</artifactId>
    <packaging>war</packaging>

    <!-- Process to run Selenium tests (actually no tests right now, just a skeleton)
         1. Tests presently require Firefox browser, Chrome on the to-do list.

         2. Run mvn clean install from the roller trunk or app folder, that will install Roller in your
         local Maven Repository.

         3. Navigate to this directory and run mvn integration-test or clean install.  Test results will
            be in target/failsafe-reports.

         4. Feel free to add more Selenium tests!
    -->
    <dependencies>

        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>3.4.0</version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.commons</groupId>
                    <artifactId>commons-lang3</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-firefox-driver</artifactId>
            <version>3.4.0</version>
        </dependency>

        <!-- Will bring in once we configure a Chrome option -->
        <!--dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-chrome-driver</artifactId>
            <version>${selenium.version}</version>
        </dependency-->

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>

        <!--
             Type "war" listed below makes this a WAR overlay (i.e., incorporating
             another WAR into this project in making a new WAR, with any additional
             WAR configuration provided (here, none) going into the new WAR.
        -->
        <dependency>
            <groupId>org.apache.roller</groupId>
            <artifactId>roller-webapp</artifactId>
            <version>${project.version}</version>
            <type>war</type>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>

    </dependencies>

    <build>
        <plugins>

            <!-- Activates integration tests (by default, classes under tests that end with "IT")
            -->
            <plugin>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.20</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Activates the Derby database during the integration test phase -->
            <plugin>
                <groupId>com.btmatthews.maven.plugins.inmemdb</groupId>
                <artifactId>inmemdb-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>run</id>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <daemon>true</daemon>
                            <type>derby</type>
                            <database>rollerdb</database>
                            <username>APP</username>
                            <password>APP</password>
                            <port>4224</port>
                            <sources>
                                <script>
                                    <sourceFile>target/roller-selenium-tests-${project.version}/WEB-INF/classes/dbscripts/derby/createdb.sql</sourceFile>
                                </script>
                            </sources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>stop</id>
                        <!-- Moving later to verify phase from post-integration-test.  Reason: Jetty shutdown wants
                             to close database or will raise error messages. -->
                        <phase>verify</phase>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Activates the Roller application during the integration test phase -->
            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <configuration>
                    <stopKey>selenium</stopKey>
                    <stopPort>9999</stopPort>
                    <webApp>
                        <contextPath>/roller</contextPath>
                    </webApp>
                    <webAppSourceDirectory>target/roller-selenium-tests-${project.version}</webAppSourceDirectory>
                    <jettyXml>../app/src/test/resources/jetty.xml</jettyXml>
                    <systemProperties>
                        <systemProperty>
                            <name>roller.custom.config</name>
                            <value>src/test/resources/roller-jettyrun.properties</value>
                        </systemProperty>
                    </systemProperties>
                </configuration>
                <executions>
                    <execution>
                        <id>start-jetty</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>start</goal>
                        </goals>
                        <configuration>
                            <scanIntervalSeconds>0</scanIntervalSeconds>
                            <!-- <daemon>true</daemon> -->
                        </configuration>
                    </execution>
                    <execution>
                        <id>stop-jetty</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>

                    <dependency>
                        <groupId>org.apache.derby</groupId>
                        <artifactId>derby</artifactId>
                        <version>${derby.version}</version>
                    </dependency>

                    <dependency>
                        <groupId>org.apache.derby</groupId>
                        <artifactId>derbyclient</artifactId>
                        <version>${derby.version}</version>
                    </dependency>

                    <dependency>
                        <groupId>javax.mail</groupId>
                        <artifactId>mail</artifactId>
                        <version>1.4.7</version>
                    </dependency>

                </dependencies>
            </plugin>
        </plugins>
    </build>

</project>
