<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">
    <parent>
        <groupId>org.red5</groupId>
        <artifactId>red5-parent</artifactId>
        <version>2.0.40</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>red5-tests</artifactId>
    <packaging>jar</packaging>
    <name>Red5 :: Tests</name>
    <description>The Red5 tests</description>
    <properties>
        <maven.deploy.skip>true</maven.deploy.skip>
        <red5.it.image>mondain/red5:latest</red5.it.image>
        <red5.it.autoPull>off</red5.it.autoPull>
    </properties>
    <build>
        <defaultGoal>test</defaultGoal>
        <plugins>
            <plugin>
                <artifactId>maven-enforcer-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>net.revelc.code.formatter</groupId>
                <artifactId>formatter-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-source-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>org.red5</groupId>
            <artifactId>red5-io</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.red5</groupId>
            <artifactId>red5-server-common</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.red5</groupId>
            <artifactId>red5-server</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.red5</groupId>
            <artifactId>red5-client</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.red5</groupId>
            <artifactId>red5-service</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-core</artifactId>
            <version>${tomcat.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>tomcat-websocket</artifactId>
            <version>${tomcat.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>tomcat-servlet-api</artifactId>
            <version>${tomcat.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <profiles>
        <profile>
            <id>docker-integration</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <version>3.4.1</version>
                        <executions>
                            <execution>
                                <id>docker-rtmp-ffmpeg-probe-test</id>
                                <phase>integration-test</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <executable>bash</executable>
                                    <arguments>
                                        <argument>${project.basedir}/src/test/resources/scripts/rtmp_docker_ffmpeg_probe_test.sh</argument>
                                    </arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>io.fabric8</groupId>
                        <artifactId>docker-maven-plugin</artifactId>
                        <version>0.45.1</version>
                        <configuration>
                            <autoPull>${red5.it.autoPull}</autoPull>
                            <images>
                                <image>
                                    <name>${red5.it.image}</name>
                                    <alias>red5-server</alias>
                                    <run>
                                        <ports>
                                            <port>1935:1935</port>
                                            <port>5080:5080</port>
                                            <port>8443:8443</port>
                                        </ports>
                                        <wait>
                                            <tcp>
                                                <ports>
                                                    <port>1935</port>
                                                </ports>
                                            </tcp>
                                            <time>30000</time>
                                        </wait>
                                    </run>
                                </image>
                            </images>
                        </configuration>
                        <executions>
                            <execution>
                                <id>start-red5</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>start</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>stop-red5</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>stop</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <version>3.0.0</version>
                        <configuration>
                            <groups>org.red5.test.IntegrationTest</groups>
                            <excludes>
                                <exclude>**/FBLiveConnectTest.java</exclude>
                                <exclude>**/TwitchConnectTest.java</exclude>
                                <exclude>**/YouTubeConnectTest.java</exclude>
                                <exclude>**/Red5ConnectTest.java</exclude>
                                <exclude>**/PublisherConnectLoadTest.java</exclude>
                            </excludes>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>integration-test</goal>
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
