<?xml version="1.0" encoding="UTF-8"?>
<!--

    DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.

    Copyright (c) 2012-2017 Oracle and/or its affiliates. All rights reserved.

    The contents of this file are subject to the terms of either the GNU
    General Public License Version 2 only ("GPL") or the Common Development
    and Distribution License("CDDL") (collectively, the "License").  You
    may not use this file except in compliance with the License.  You can
    obtain a copy of the License at
    https://oss.oracle.com/licenses/CDDL+GPL-1.1
    or LICENSE.txt.  See the License for the specific
    language governing permissions and limitations under the License.

    When distributing the software, include this License Header Notice in each
    file and include the License file at LICENSE.txt.

    GPL Classpath Exception:
    Oracle designates this particular file as subject to the "Classpath"
    exception as provided by Oracle in the GPL Version 2 section of the License
    file that accompanied this code.

    Modifications:
    If applicable, add the following below the License Header, with the fields
    enclosed by brackets [] replaced by your own identifying information:
    "Portions Copyright [year] [name of copyright owner]"

    Contributor(s):
    If you wish your version of this file to be governed by only the CDDL or
    only the GPL Version 2, indicate your decision by adding "[Contributor]
    elects to include this software in this distribution under the [CDDL or GPL
    Version 2] license."  If you don't indicate a single choice of license, a
    recipient has the option to distribute your version of this file under
    either the CDDL, the GPL Version 2 or to extend the choice of license to
    its licensees as provided above.  However, if you add GPL Version 2 code
    and therefore, elected the GPL Version 2 license, then the option applies
    only if the new code is made subject to such option by the copyright
    holder.

-->

<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>com.sun.xml.ws</groupId>
        <artifactId>jaxws-ri-tests</artifactId>
        <version>2.3.0.2</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>jaxws-unit</artifactId>
    <version>2.3.0.2</version>

    <name>JAX-WS RI Unit Tests</name>
    <description>JAX-WS RI Unit Tests</description>

    <properties>
        <!-- override in commandline to pass additional arguments to harness -->
        <ws.args></ws.args>
        <!-- DEFAULT = JAXB, TOPLINK = MOXy -->
        <ws.databinding>DEFAULT</ws.databinding>
        <!-- IN_VM, LWHS, TOMCAT/TOMCAT_LOCAL (requires tomcat.home to be set) -->
        <ws.transport>IN_VM</ws.transport>
        <ws.test>${project.basedir}/testcases</ws.test>
        <!-- extra JVM options for JVM forked by test harness, ie proxy, tests' debugging-->
        <ws.jvmOpts></ws.jvmOpts>
        <!--<ws.jvmOpts>-Dhttp.proxyHost=www-proxy.us.oracle.com -Dhttp.proxyPort=80 -Dhttps.proxyHost=www-proxy.us.oracle.com -Dhttps.proxyPort=80</ws.jvmOpts>-->
        <ws.all-args>-cp:jaxws ${project.basedir}/../.. ${ws.args}</ws.all-args>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-clean</id>
                        <goals>
                            <goal>clean</goal>
                        </goals>
                        <configuration>
                            <filesets>
                                <fileset>
                                    <directory>${project.build.directory}</directory>
                                </fileset>
                                <fileset>
                                    <directory>testcases</directory>
                                    <includes>
                                        <include>**/work/**</include>
                                    </includes>
                                    <followSymlinks>false</followSymlinks>
                                </fileset>
                            </filesets>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>enforce-property</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <phase>validate</phase>
                        <configuration>
                            <rules>
                                <requireProperty>
                                    <property>jaxb-api.version</property>
                                    <message>Property jaxb-api.version not imported or set!</message>
                                </requireProperty>
                                <requireProperty>
                                    <property>saaj-api.version</property>
                                    <message>Property saaj-api.version not imported or set!</message>
                                </requireProperty>
                                <requireProperty>
                                    <property>jaxws-api.version</property>
                                    <message>Property jaxws-api.version not imported or set!</message>
                                </requireProperty>
                                <requireProperty>
                                    <property>javax.annotation-api.version</property>
                                    <message>Property javax.annotation-api.version not imported or set!</message>
                                </requireProperty>
                            </rules>
                            <fail>true</fail>
                        </configuration>
                    </execution>
                </executions>
            </plugin>        
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>prepare-endorsed</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${endorsed.dir}</outputDirectory>
                            <silent>false</silent>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>javax.xml.bind</groupId>
                                    <artifactId>jaxb-api</artifactId>
                                    <version>${jaxb-api.version}</version>
                                    <type>jar</type>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>javax.xml.soap</groupId>
                                    <artifactId>javax.xml.soap-api</artifactId>
                                    <version>${saaj-api.version}</version>
                                    <type>jar</type>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>javax.xml.ws</groupId>
                                    <artifactId>jaxws-api</artifactId>
                                    <version>${jaxws-api.version}</version>
                                    <type>jar</type>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>javax.annotation</groupId>
                                    <artifactId>javax.annotation-api</artifactId>
                                    <version>${javax.annotation-api.version}</version>
                                    <type>jar</type>
                                </artifactItem>
                            </artifactItems>                        
                        </configuration>
                    </execution>
                </executions>
                <!-- TODO JDK9 add to upgrade module path instead after modularization -->
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.glassfish.metro</groupId>
                <artifactId>harness-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>jaxws-unit</id>
                        <goals>
                            <goal>ws-test</goal>
                        </goals>
                        <configuration>
                            <endorsedDir>${endorsed.dir}</endorsedDir>
                            <args>
                                <arg>${ws.all-args}</arg>
                            </args>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>hudson</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.glassfish.metro</groupId>
                        <artifactId>harness-maven-plugin</artifactId>
                        <configuration>
                            <imageUrl>${jaxwsri.hudson.url}</imageUrl>
                            <transportUrl>
                                ${hudson.build.id}/artifact/jaxws-ri/transports/local/target/jaxws-local-transport.jar
                            </transportUrl>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>jaxwsInJDK6</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <properties>
                <ws.all-args>-jaxwsInJDK -version 2.1.6 -lwhs ${ws.args}</ws.all-args>
                <maven.endorsed.skip>true</maven.endorsed.skip>
            </properties>
        </profile>

        <profile>
            <id>jaxwsInJDK7</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <properties>
                <ws.all-args>-jaxwsInJDK -version 2.2.4 -lwhs ${ws.args}</ws.all-args>
                <maven.endorsed.skip>true</maven.endorsed.skip>
            </properties>
        </profile>

        <profile>
            <id>jaxwsInJDK8</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <properties>
                <ws.all-args>-jaxwsInJDK -version 2.2.8 -lwhs ${ws.args}</ws.all-args>
                <maven.endorsed.skip>true</maven.endorsed.skip>
                <ws.permGenJvmOpts></ws.permGenJvmOpts>
            </properties>
        </profile>

        <profile>
            <id>jaxwsInJDK9</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <properties>
                <ws.all-args>-jaxwsInJDK -version 2.3.0 -lwhs ${ws.args}</ws.all-args>
                <maven.endorsed.skip>true</maven.endorsed.skip>
                <ws.permGenJvmOpts></ws.permGenJvmOpts>
            </properties>
        </profile>

        <profile>
            <id>dev-impl</id>
            <activation>
                <property>
                    <name>dev</name>
                </property>
            </activation>

            <dependencies>
                <dependency>
                    <groupId>com.sun.xml.bind</groupId>
                    <artifactId>jaxb-core</artifactId>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>com.sun.xml.bind</groupId>
                    <artifactId>jaxb-impl</artifactId>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>com.sun.xml.bind</groupId>
                    <artifactId>jaxb-xjc</artifactId>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>com.sun.xml.bind</groupId>
                    <artifactId>jaxb-jxc</artifactId>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>com.sun.xml.messaging.saaj</groupId>
                    <artifactId>saaj-impl</artifactId>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>com.sun.xml.stream.buffer</groupId>
                    <artifactId>streambuffer</artifactId>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>org.jvnet.mimepull</groupId>
                    <artifactId>mimepull</artifactId>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>${project.groupId}</groupId>
                    <artifactId>policy</artifactId>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>org.jvnet.staxex</groupId>
                    <artifactId>stax-ex</artifactId>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>javax.servlet</groupId>
                    <artifactId>javax.servlet-api</artifactId>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>org.glassfish.ha</groupId>
                    <artifactId>ha-api</artifactId>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>org.glassfish.gmbal</groupId>
                    <artifactId>gmbal-api-only</artifactId>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>org.glassfish.external</groupId>
                    <artifactId>management-api</artifactId>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>com.sun.xml.fastinfoset</groupId>
                    <artifactId>FastInfoset</artifactId>
                    <scope>provided</scope>
                </dependency>

                <!-- Parsers -->
                <dependency>
                    <groupId>org.codehaus.woodstox</groupId>
                    <artifactId>woodstox-core-asl</artifactId>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>org.codehaus.woodstox</groupId>
                    <artifactId>stax2-api</artifactId>
                    <scope>provided</scope>
                </dependency>
                <!--
                If you want to use SJSXP StAX parser, uncomment this
                and comment woodstox one -->
                <!--
                <dependency>
                    <groupId>com.sun.xml.stream</groupId>
                    <artifactId>sjsxp</artifactId>
                    <version>1.0.1</version>
                    <scope>provided</scope>
                    <exclusions>
                        <exclusion>
                            <artifactId>stax-api</artifactId>
                            <groupId>javax.xml.stream</groupId>
                        </exclusion>
                    </exclusions>
                </dependency>
                -->

                <dependency>
                    <groupId>com.sun.org.apache.xml.internal</groupId>
                    <artifactId>resolver</artifactId>
                </dependency>

                <dependency>
                    <groupId>javax.mail</groupId>
                    <artifactId>mail</artifactId>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>org.eclipse.persistence</groupId>
                    <artifactId>eclipselink</artifactId>
                    <scope>provided</scope>
                </dependency>

                <dependency>
                    <groupId>commonj.sdo</groupId>
                    <artifactId>commonj.sdo</artifactId>
                    <scope>provided</scope>
                </dependency>
            </dependencies>

            <properties>
                <libraries.dir>target/dependencies</libraries.dir>
            </properties>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>prepare-dependencies</id>
                                <phase>validate</phase>
                                <goals>
                                    <goal>copy-dependencies</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${libraries.dir}</outputDirectory>
                                    <excludeArtifactIds>jaxb-api,javax.annotation-api,jsr181-api,javax.xml.soap-api,jaxws-api</excludeArtifactIds>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.glassfish.metro</groupId>
                        <artifactId>harness-maven-plugin</artifactId>
                        <configuration>
                            <vmArgs>
                                <vmArg>-Dlibraries.dir=${libraries.dir}</vmArg>
                            </vmArgs>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>coverage</id>
            <activation>
                <property>
                    <name>cobertura-build</name>
                </property>
            </activation>
            <properties>
                <ws.jvmOpts>-Dnet.sourceforge.cobertura.datafile=${basedir}/target/cobertura.ser</ws.jvmOpts>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>copy-ser-file</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <target>
                                        <copy todir="target/cobertura" file="${basedir}/target/cobertura.ser"
                                              verbose="true" failonerror="true"/>
                                    </target>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>cobertura-maven-plugin</artifactId>
                        <configuration>
                            <forceMojoExecution>true</forceMojoExecution>
                        </configuration>
                        <executions>
                            <execution>
                                <id>instrument-code</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>instrument</goal>
                                </goals>
                                <configuration>
                                    <attach>true</attach>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
