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

    Copyright (c) 2018, 2023 Oracle and/or its affiliates.

    Licensed 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:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>io.helidon.microprofile</groupId>
        <artifactId>helidon-microprofile-project</artifactId>
        <version>3.2.2</version>
    </parent>
    <groupId>io.helidon.microprofile.metrics</groupId>
    <artifactId>helidon-microprofile-metrics</artifactId>
    <name>Helidon Microprofile Metrics</name>

    <description>
        Helidon Microprofile Metrics 2.0
    </description>

    <dependencies>
        <dependency>
            <groupId>jakarta.enterprise</groupId>
            <artifactId>jakarta.enterprise.cdi-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.activation</groupId>
            <artifactId>jakarta.activation-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>io.helidon.common</groupId>
            <artifactId>helidon-common</artifactId>
        </dependency>
        <dependency>
            <groupId>io.helidon.service-common</groupId>
            <artifactId>helidon-service-common-rest-cdi</artifactId>
        </dependency>
        <dependency>
            <groupId>io.helidon.microprofile.server</groupId>
            <artifactId>helidon-microprofile-server</artifactId>
        </dependency>
        <dependency>
            <groupId>io.helidon.microprofile.config</groupId>
            <artifactId>helidon-microprofile-config</artifactId>
        </dependency>
        <dependency>
            <groupId>io.helidon.metrics</groupId>
            <artifactId>helidon-metrics-api</artifactId>
        </dependency>
        <dependency>
            <groupId>io.helidon.metrics</groupId>
            <artifactId>helidon-metrics-service-api</artifactId>
        </dependency>
        <dependency>
            <groupId>io.helidon.common</groupId>
            <artifactId>helidon-common-service-loader</artifactId>
        </dependency>
        <dependency>
            <groupId>io.helidon.metrics</groupId>
            <artifactId>helidon-metrics</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.microprofile.metrics</groupId>
            <artifactId>microprofile-metrics-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.helidon.microprofile.tests</groupId>
            <artifactId>helidon-microprofile-tests-junit5</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.helidon.config</groupId>
            <artifactId>helidon-config-testing</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-test</id>
                        <configuration>
                            <excludes>
                                <exclude>**/HelloWorldAsyncResponseTest.java</exclude>
                                <exclude>**/TestExtendedKPIMetrics.java</exclude>
                                <exclude>**/TestMetricsOnOwnSocket.java</exclude>
                                <exclude>**/TestDisabledMetrics.java</exclude>
                                <exclude>**/TestConfigProcessing.java</exclude>
                                <exclude>**/MetricLookupTest.java</exclude>
                            </excludes>
                        </configuration>
                    </execution>
                    <execution>
                        <!-- Run in separate invocation to enable extended KPI metrics (checked in the test) -->
                        <id>key-performance-indicator-metrics-enabled</id>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <includes>
                                <include>**/HelloWorldAsyncResponseTest.java</include>
                                <include>**/TestExtendedKPIMetrics.java</include>
                                <include>**/TestMetricsOnOwnSocket.java</include>
                                <include>**/MetricLookupTest.java</include>
                            </includes>
                        </configuration>
                    </execution>
                    <execution>
                        <!-- Run in separate invocation to disable all metrics -->
                        <id>test-with-metrics-disabled</id>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <includes>
                                <include>**/TestDisabledMetrics.java</include>
                            </includes>
                            <excludes>
                                <exclude>**/HelloWorldTest.java</exclude>
                                <exclude>**/HelloWorldAsyncResponseWithRestRequestTest.java</exclude>
                                <exclude>**/MetricLookupTest.java</exclude>
                            </excludes>
                        </configuration>
                    </execution>
                    <execution>
                        <id>test-config-with-top-level-tags</id>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <includes>
                                <include>**/TestConfigProcessing.java</include>
                            </includes>
                            <excludes>
                                <exclude>**/MetricLookupTest.java</exclude>
                            </excludes>
                            <environmentVariables>
                                <TAGS>topLevel</TAGS>
                            </environmentVariables>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>pipeline</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <systemPropertyVariables>
                                <helidon.microprofile.metrics.perfTest.enabled>false</helidon.microprofile.metrics.perfTest.enabled>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
