<?xml version='1.0'?>
<!--
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.
-->

<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>
      <groupId>org.apache.activemq.examples.broker</groupId>
      <artifactId>jms-examples</artifactId>
      <version>2.31.2</version>
   </parent>

   <artifactId>opentelemetry</artifactId>
   <packaging>jar</packaging>
   <name>ActiveMQ Artemis Broker Plugin Example</name>

   <properties>
      <activemq.basedir>${project.basedir}/../../../..</activemq.basedir>
   </properties>

   <dependencies>
      <dependency>
         <groupId>org.apache.activemq</groupId>
         <artifactId>artemis-jms-client-all</artifactId>
         <version>${project.version}</version>
      </dependency>
      <dependency>
         <groupId>org.apache.activemq</groupId>
         <artifactId>artemis-server</artifactId>
         <version>${project.version}</version>
      </dependency>
      <dependency>
         <groupId>org.apache.activemq</groupId>
         <artifactId>artemis-amqp-protocol</artifactId>
         <version>${project.version}</version>
      </dependency>
      <dependency>
         <groupId>org.apache.qpid</groupId>
         <artifactId>qpid-jms-client</artifactId>
      </dependency>
      <dependency>
         <groupId>io.opentelemetry</groupId>
         <artifactId>opentelemetry-api</artifactId>
         <version>1.10.0</version>
      </dependency>
      <dependency>
         <groupId>io.opentelemetry</groupId>
         <artifactId>opentelemetry-sdk</artifactId>
      </dependency>
      <dependency>
         <groupId>io.opentelemetry</groupId>
         <artifactId>opentelemetry-semconv</artifactId>
      </dependency>
      <dependency>
         <groupId>io.opentelemetry</groupId>
         <artifactId>opentelemetry-sdk-extension-autoconfigure</artifactId>
      </dependency>
      <dependency>
         <groupId>io.opentelemetry</groupId>
         <artifactId>opentelemetry-exporter-logging</artifactId>
      </dependency>
      <dependency>
         <groupId>io.opentelemetry</groupId>
         <artifactId>opentelemetry-exporter-otlp</artifactId>
      </dependency>
      <dependency>
         <groupId>io.opentelemetry</groupId>
         <artifactId>opentelemetry-exporter-jaeger</artifactId>
      </dependency>
      <dependency>
         <groupId>io.opentelemetry</groupId>
         <artifactId>opentelemetry-exporter-zipkin</artifactId>
      </dependency>
      <dependency>
         <groupId>io.opentelemetry</groupId>
         <artifactId>opentelemetry-sdk-testing</artifactId>
      </dependency>
      <dependency>
         <groupId>junit</groupId>
         <artifactId>junit</artifactId>
         <scope>test</scope>
      </dependency>
      <!-- https://mvnrepository.com/artifact/org.assertj/assertj-core -->
      <dependency>
         <groupId>org.assertj</groupId>
         <artifactId>assertj-core</artifactId>
         <version>3.22.0</version>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.mockito</groupId>
         <artifactId>mockito-core</artifactId>
         <scope>test</scope>
      </dependency>
   </dependencies>

   <build>
      <plugins>
         <plugin>
            <groupId>org.apache.activemq</groupId>
            <artifactId>artemis-maven-plugin</artifactId>
            <executions>
               <execution>
                  <id>create</id>
                  <phase>verify</phase>
                  <configuration>
                     <!-- The broker plugin will install this library on the server's classpath -->
                     <libList>
                        <arg>org.apache.activemq.examples.broker:opentelemetry:${project.version}</arg>
                     </libList>
                     <libListWithDeps>
                        <arg>io.opentelemetry:opentelemetry-api:${opentelemetry.version}</arg>
                        <arg>io.opentelemetry:opentelemetry-sdk:${opentelemetry.version}</arg>
                        <arg>io.opentelemetry:opentelemetry-semconv:${opentelemetry-alpha.version}</arg>
                        <arg>io.opentelemetry:opentelemetry-sdk-extension-autoconfigure:${opentelemetry-alpha.version}
                        </arg>
                        <arg>io.opentelemetry:opentelemetry-exporter-logging:${opentelemetry.version}</arg>
                        <arg>io.opentelemetry:opentelemetry-exporter-otlp:${opentelemetry.version}</arg>
                        <arg>io.opentelemetry:opentelemetry-exporter-jaeger:${opentelemetry.version}</arg>
                        <arg>io.opentelemetry:opentelemetry-exporter-zipkin:${opentelemetry.version}</arg>
                        <arg>io.opentelemetry:opentelemetry-sdk:${opentelemetry.version}</arg>
                        <arg>io.opentelemetry:opentelemetry-sdk-testing:${opentelemetry.version}</arg>
                        <arg>junit:junit:${junit.version}</arg>
                        <arg>org.assertj:assertj-core:3.22.0</arg>
                        <arg>org.mockito:mockito-core:${mockito.version}</arg>
                     </libListWithDeps>
                     <ignore>${noServer}</ignore>
                  </configuration>
                  <goals>
                     <goal>create</goal>
                  </goals>
               </execution>
               <execution>
                  <id>start</id>
                  <goals>
                     <goal>cli</goal>
                  </goals>
                  <configuration>
                     <spawn>true</spawn>
                     <ignore>${noServer}</ignore>
                     <testURI>tcp://localhost:61616</testURI>
                     <args>
                        <param>run</param>
                     </args>
                  </configuration>
               </execution>
               <execution>
                  <id>runClient</id>
                  <goals>
                     <goal>runClient</goal>
                  </goals>
                  <configuration>
                     <clientClass>org.apache.activemq.artemis.jms.example.OpenTelemetryPluginExample</clientClass>
                  </configuration>
               </execution>
               <execution>
                  <id>stop</id>
                  <goals>
                     <goal>cli</goal>
                  </goals>
                  <configuration>
                     <ignore>${noServer}</ignore>
                     <args>
                        <param>stop</param>
                     </args>
                  </configuration>
               </execution>
            </executions>
            <dependencies>
               <dependency>
                  <groupId>org.apache.activemq.examples.broker</groupId>
                  <artifactId>opentelemetry</artifactId>
                  <version>${project.version}</version>
               </dependency>
            </dependencies>
         </plugin>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-clean-plugin</artifactId>
         </plugin>
      </plugins>
   </build>
</project>
