<?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.
-->

<!-- $Rev$ $Date$ -->

<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>
        <artifactId>monitoring</artifactId>
        <groupId>org.apache.geronimo.plugins.monitoring</groupId>
        <version>4.0.0-SNAPSHOT</version>
    </parent>

    <artifactId>mconsole-jetty-server</artifactId>
    <packaging>server-assembly</packaging>
    <name>Simple Monitoring Console Server on Jetty</name>

    <properties>
        <!--
        NOTE: The default assembly is jetty, so exclude any tomcat tests by
              default. Profiles below will set this based on the assemblyId.
        -->
        <shittyTestExcludes>**/*tomcat*/pom.xml</shittyTestExcludes>

        <!--
        NOTE: Override the following on the cmdline to only run specific
              testsuite buckets.  To only run console-testsuite/advanced -
                mvn -DshittyTestIncludes=console-testsuite/advanced/pom.xml
              or
                mvn install -Dtests=console-testsuite/advanced
        -->
        <shittyTestIncludes>*/pom.xml</shittyTestIncludes>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.apache.geronimo.framework.plugingroups</groupId>
            <artifactId>framework</artifactId>
            <version>${project.version}</version>
            <type>car</type>
        </dependency>
        <dependency>
            <groupId>org.apache.geronimo.plugins.monitoring</groupId>
            <artifactId>mconsole-jetty</artifactId>
            <version>${project.version}</version>
            <type>car</type>
        </dependency>
        <dependency>
            <groupId>org.apache.geronimo.plugins.monitoring</groupId>
            <artifactId>agent-car-ejb</artifactId>
            <version>${project.version}</version>
            <type>car</type>
        </dependency>
        <dependency>
            <groupId>org.apache.geronimo.plugins.monitoring</groupId>
            <artifactId>agent-car-jmx</artifactId>
            <version>${project.version}</version>
            <type>car</type>
        </dependency>

        <!-- Hack, due to new AMQ 5.3 + Spring integration -->
        <dependency>
            <groupId>org.apache.geronimo.configs</groupId>
            <artifactId>activemq-ra</artifactId>
            <version>${project.version}</version>
            <type>car</type>
        </dependency>

        <!--<dependency>-->
            <!--<groupId>org.apache.geronimo.plugins</groupId>-->
            <!--<artifactId>sysdb-console-jetty</artifactId>-->
            <!--<version>${project.version}</version>-->
            <!--<type>car</type>-->
        <!--</dependency>-->
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <!--<plugin>-->
                    <!--<groupId>org.apache.geronimo.buildsupport</groupId>-->
                    <!--<artifactId>car-maven-plugin</artifactId>-->
                    <!--<extensions>true</extensions>-->
                <!--</plugin>-->
                <!--
                NOTE: This horrible looking configuration sets up the surefire plugin to
                      not run tests durring the 'test' phase, but instead during the
                      'integration-test' phase.
                -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <configuration>
                        <skip>true</skip>
                    </configuration>
                    <executions>
                        <execution>
                            <id>test</id>
                            <phase>test</phase>
                            <goals>
                                <goal>test</goal>
                            </goals>
                            <configuration>
                                <skip>true</skip>
                            </configuration>
                        </execution>
                        <execution>
                            <id>integration</id>
                            <phase>integration-test</phase>
                            <goals>
                                <goal>test</goal>
                            </goals>
                            <configuration>
                                <skip>false</skip>
                                <suiteXmlFiles>
                                    <suiteXmlFile>${project.build.testOutputDirectory}/testng.xml</suiteXmlFile>
                                </suiteXmlFiles>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.geronimo.buildsupport</groupId>
                    <artifactId>geronimo-maven-plugin</artifactId>
                    <configuration>
                        <reporters>
                            <reporter implementation="org.apache.geronimo.mavenplugins.geronimo.reporting.SurefireReporter">
                                <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
                            </reporter>
                        </reporters>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.geronimo.buildsupport</groupId>
                <artifactId>car-maven-plugin</artifactId>
                <configuration>
                    <servers>
                        <serverInstance>
                            <name>default</name>
                            <configFile>var/config/config.xml</configFile>
                            <configSubstitutionsFile>var/config/config-substitutions.properties</configSubstitutionsFile>
                            <configSubstitutionsPrefix>org.apache.geronimo.config.substitution.</configSubstitutionsPrefix>
                            <artifactAliasesFile>var/config/artifact_aliases.properties</artifactAliasesFile>
                        </serverInstance>
                        <serverInstance>
                            <name>client</name>
                            <attributeManagerFrom>default</attributeManagerFrom>
                            <artifactAliasesFile>var/config/client_artifact_aliases.properties</artifactAliasesFile>
                        </serverInstance>
                        <serverInstance>
                            <name>offline</name>
                            <configFile>var/config/offline-deployer-config.xml</configFile>
                            <configSubstitutionsFile>var/config/config-substitutions.properties</configSubstitutionsFile>
                            <configSubstitutionsPrefix>org.apache.geronimo.config.substitution.</configSubstitutionsPrefix>
                            <artifactAliasesFile>var/config/artifact_aliases.properties</artifactAliasesFile>
                        </serverInstance>
                        <serverInstance>
                            <name>jsr88</name>
                            <configFile>var/config/jsr88-configurer-config.xml</configFile>
                            <configSubstitutionsFile>var/config/config-substitutions.properties</configSubstitutionsFile>
                            <configSubstitutionsPrefix>org.apache.geronimo.config.substitution.</configSubstitutionsPrefix>
                            <artifactAliasesFile>var/config/artifact_aliases.properties</artifactAliasesFile>
                        </serverInstance>
                    </servers>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>it</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>selenium-maven-plugin</artifactId>
                        <inherited>false</inherited>
                        <executions>
                            <execution>
                                <id>start</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>start-server</goal>
                                </goals>
                                <configuration>
                                    <logOutput>true</logOutput>
                                    <background>true</background>
                                    <systemProperties>
                                        <property>
                                            <name>browser</name>
                                            <value>${browser}</value>
                                        </property>
                                    </systemProperties>
                                </configuration>
                            </execution>
                            <execution>
                                <id>stop</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>stop-server</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.geronimo.buildsupport</groupId>
                        <artifactId>geronimo-maven-plugin</artifactId>
                        <inherited>false</inherited>
                        <configuration>
                           <assemblyArchive>${project.build.directory}/${project.artifactId}-${project.version}-bin.zip</assemblyArchive>
                            <optionSets>
                                <optionSet>
                                    <id>morememory</id>
                                    <options>
                                        <option>-Xmx512m</option>
                                        <option>-XX:MaxPermSize=128m</option>
                                    </options>
                                </optionSet>

                                <optionSet>
                                    <id>debug</id>
                                    <options>
                                        <option>-Xdebug</option>
                                        <option>-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n</option>
                                    </options>
                                </optionSet>
                            </optionSets>
                        </configuration>
                        <executions>
                            <execution>
                                <id>start</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>start-server</goal>
                                </goals>
                                <configuration>
                                    <logOutput>true</logOutput>
                                    <background>true</background>
                                    <verifyTimeout>300</verifyTimeout>
                                    <refresh>true</refresh>
                                    <optionSets>
                                        <optionSet>
                                            <id>default</id>
                                            <options>
                                               <option>-XX:MaxPermSize=128m</option>
                                            </options>
                                        </optionSet>
                                    </optionSets>
                                </configuration>
                            </execution>
                            <execution>
                                <id>stop</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>stop-server</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>shitty-maven-plugin</artifactId>
                        <inherited>false</inherited>
                        <configuration>
                            <projects>
                                <fileset>
                                    <directory>${project.basedir}</directory>
                                    <includes>
                                        <include>${shittyTestIncludes}</include>
                                    </includes>
                                    <excludes>
                                        <exclude>${shittyTestExcludes}</exclude>
                                    </excludes>
                                </fileset>
                            </projects>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>clean</goal>
                                    <goal>install</goal>
                                    <goal>test</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.geronimo.buildsupport</groupId>
                        <artifactId>testsuite-maven-plugin</artifactId>
                        <inherited>false</inherited>
                        <executions>
                            <execution>
                                <id>summarize</id>
                                <phase>post-site</phase>
                                <goals>
                                    <goal>summarize</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
