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

    Copyright (c) 2012, 2021 Oracle and/or its affiliates. All rights reserved.

    This program and the accompanying materials are made available under the
    terms of the Eclipse Distribution License v. 1.0, which is available at
    http://www.eclipse.org/org/documents/edl-v10.php.

    SPDX-License-Identifier: BSD-3-Clause

-->

<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.6</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>jaxws-unit</artifactId>
    <packaging>pom</packaging>
    <version>2.3.6</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>-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=6000</ws.jvmOpts>-->
        <ws.all-args>-cp:jaxws ${project.basedir}/../.. ${ws.args}</ws.all-args>
        <extensions.dir>${project.build.directory}/harness-extensions</extensions.dir>
    </properties>

    <dependencies>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>jaxwsTestUtil</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>*</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <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-extensions</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${extensions.dir}</outputDirectory>
                            <includeArtifactIds>jaxwsTestUtil</includeArtifactIds>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.glassfish.metro</groupId>
                <artifactId>harness-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>jaxws-unit</id>
                        <phase>package</phase>
                        <goals>
                            <goal>ws-test</goal>
                        </goals>
                        <configuration>
                            <extDir>${extensions.dir}</extDir>
                            <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</id>
            <activation>
                <property>
                    <name>!dev</name>
                </property>
            </activation>

            <dependencies>
                <dependency>
                    <groupId>${project.groupId}</groupId>
                    <artifactId>jaxws-ri</artifactId>
                    <version>${project.version}</version>
                    <!--classifier>${jaxwsri.dep.classifier}</classifier-->
                    <type>zip</type>
                </dependency>
                <dependency>
                    <groupId>com.sun.xml.ws</groupId>
                    <artifactId>jaxws-local-transport</artifactId>
                    <version>${project.version}</version>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>prepare-image</id>
                                <phase>validate</phase>
                                <goals>
                                    <goal>copy-dependencies</goal>
                                </goals>
                                <configuration>
                                    <stripVersion>true</stripVersion>
                                    <outputDirectory>${project.build.directory}/image</outputDirectory>
                                    <includeArtifactIds>metro-standalone</includeArtifactIds>
                                </configuration>
                            </execution>
                            <execution>
                                <id>unzip-image</id>
                                <phase>validate</phase>
                                <goals>
                                    <goal>unpack-dependencies</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${project.build.directory}/image</outputDirectory>
                                    <includeArtifactIds>jaxws-ri</includeArtifactIds>
                                </configuration>
                            </execution>
                            <execution>
                                <id>prepare-transport-lib</id>
                                <phase>validate</phase>
                                <goals>
                                    <goal>copy-dependencies</goal>
                                </goals>
                                <configuration>
                                    <stripVersion>true</stripVersion>
                                    <outputDirectory>${project.build.directory}/test-lib</outputDirectory>
                                    <includeArtifactIds>jaxws-local-transport</includeArtifactIds>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.glassfish.metro</groupId>
                        <artifactId>harness-maven-plugin</artifactId>
                        <configuration>
                            <localImage>${project.build.directory}/image</localImage>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

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

            <dependencies>
                <dependency>
                    <groupId>com.sun.activation</groupId>
                    <artifactId>jakarta.activation</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>jakarta.servlet</groupId>
                    <artifactId>jakarta.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.external</groupId>
                    <artifactId>management-api</artifactId>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>org.glassfish.gmbal</groupId>
                    <artifactId>gmbal</artifactId>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>org.glassfish.pfl</groupId>
                    <artifactId>pfl-tf</artifactId>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>org.glassfish.pfl</groupId>
                    <artifactId>pfl-basic</artifactId>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>com.sun.xml.fastinfoset</groupId>
                    <artifactId>FastInfoset</artifactId>
                    <scope>provided</scope>
                </dependency>

                <!-- Parsers -->
                <dependency>
                    <groupId>com.fasterxml.woodstox</groupId>
                    <artifactId>woodstox-core</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>
                -->

                <!-- To be removed after end of support for JDK 8 -->
<!--                <dependency>
                    <groupId>com.sun.org.apache.xml.internal</groupId>
                    <artifactId>resolver</artifactId>
                </dependency>-->

                <!-- Plugin dependencies -->
                <dependency>
                    <groupId>com.sun.mail</groupId>
                    <artifactId>jakarta.mail</artifactId>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>org.eclipse.persistence</groupId>
                    <artifactId>org.eclipse.persistence.moxy</artifactId>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>org.eclipse.persistence</groupId>
                    <artifactId>org.eclipse.persistence.sdo</artifactId>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>org.eclipse.persistence</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>jakarta.xml.bind-api,jakarta.annotation-api,jakarta.jws-api,jakarta.xml.soap-api,jakarta.xml.ws-api</excludeArtifactIds>-->
                                    <excludeArtifactIds>jaxwsTestUtil,org.eclipse.persistence.sdo,jakarta.activation-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>jacoco-build</name>
                </property>
            </activation>
            <properties>
                <ws.jvmOpts>-Djacoco-agent.destfile=${basedir}/target/jacoco.exec</ws.jvmOpts>
            </properties>
            <build>
                <plugins>
                    <!--plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>copy-exec-file</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <target>
                                        <copy todir="target/jacoco" file="${basedir}/target/jacoco.exec"
                                              verbose="true" failonerror="true"/>
                                    </target>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin-->
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>default-prepare-agent</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>default-report</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>report</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
