<?xml version="1.0" encoding="UTF-8"?>
<!--
  Copyright (C) 2006-2025 Talend Inc. - www.talend.com
   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="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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.talend.sdk.component</groupId>
    <artifactId>component-runtime-testing</artifactId>
    <version>1.80.1</version>
  </parent>

  <artifactId>component-runtime-http-junit</artifactId>

  <name>Component Runtime :: Testing :: HTTP</name>
  <description>JUnit integration to simplify the HTTP API testing/mocking.</description>

  <properties>
    <netty.version>4.1.119.Final</netty.version>
    <talend.build.name>${talend.build.name.base}.junit.http</talend.build.name>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.geronimo.specs</groupId>
      <artifactId>geronimo-jsonb_1.0_spec</artifactId>
      <version>${geronimo-jsonb.version}</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.apache.geronimo.specs</groupId>
      <artifactId>geronimo-json_1.1_spec</artifactId>
      <version>${geronimo-json.version}</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.apache.johnzon</groupId>
      <artifactId>johnzon-jsonb</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>io.netty</groupId>
      <artifactId>netty-codec-http</artifactId>
      <version>${netty.version}</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>io.netty</groupId>
      <artifactId>netty-handler</artifactId>
      <version>${netty.version}</version>
      <optional>true</optional>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${junit.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-api</artifactId>
      <version>${junit5.version}</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.talend.sdk.component</groupId>
      <artifactId>component-runtime-junit-base</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-params</artifactId>
      <version>${junit5.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-slf4j-impl</artifactId>
      <version>${log4j2.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-api</artifactId>
      <version>${log4j2.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-core</artifactId>
      <version>${log4j2.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.tomee</groupId>
      <artifactId>ziplock</artifactId>
      <version>${ziplock.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-clean-plugin</artifactId>
        <executions>
          <execution>
            <id>forced-clean</id>
            <goals>
              <goal>clean</goal>
            </goals>
            <phase>prepare-package</phase>
            <configuration>
              <!-- ensure shade works even if already done and "clean" is not called -->
              <excludeDefaultDirectories>true</excludeDefaultDirectories>
              <filesets>
                <fileset>
                  <directory>${project.build.directory}</directory>
                  <includes>
                    <include>${project.build.finalName}.${project.packaging}</include>
                  </includes>
                </fileset>
              </filesets>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>${javadoc-plugin.version}</version>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>shade</goal>
            </goals>
            <phase>package</phase>
            <configuration>
              <createDependencyReducedPom>false</createDependencyReducedPom>
              <transformers>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
              </transformers>
              <artifactSet>
                <includes>
                  <include>io.netty:*</include>
                  <include>org.apache.geronimo.specs:*</include>
                  <include>org.apache.johnzon:*</include>
                </includes>
              </artifactSet>
              <relocations>
                <relocation>
                  <pattern>io.netty</pattern>
                  <shadedPattern>org.talend.__shade__.io.netty</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>org.apache.johnzon</pattern>
                  <shadedPattern>org.talend.__shade__.org.apache.johnzon</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>javax.json</pattern>
                  <shadedPattern>org.talend.__shade__.javax.json</shadedPattern>
                </relocation>
              </relocations>
              <filters>
                <filter>
                  <artifact>org.apache.johnzon:johnzon-jsonb</artifact>
                  <excludes>
                    <!-- no need -->
                    <exclude>org/apache/johnzon/jsonb/cdi</exclude>
                    <exclude>META-INF/services/javax.enterprise.inject.spi.Extension</exclude>
                  </excludes>
                </filter>
                <filter>
                  <artifact>*:*</artifact>
                  <excludes>
                    <exclude>META-INF/maven/**</exclude>
                    <exclude>META-INF/*.SF</exclude>
                    <exclude>META-INF/*.DSA</exclude>
                    <exclude>META-INF/*.RSA</exclude>
                  </excludes>
                </filter>
              </filters>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>clirr-maven-plugin</artifactId>
        <version>${clirr-plugin.version}</version>
        <executions>
          <execution>
            <id>check compatibility</id>
            <goals>
              <goal>check</goal>
            </goals>
            <configuration>
              <excludes>
                <exclude>org/talend/__shade__/**</exclude>
                <exclude>**/base/**</exclude>
                <exclude>**/internal/**</exclude>
                <!-- clirr is not java 8 friendly -->
                <exclude>**/api/Request</exclude>
              </excludes>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
