<?xml version="1.0" encoding="UTF-8"?>
<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.flowable</groupId>
        <artifactId>flowable-root</artifactId>
        <version>7.0.0</version>
        <relativePath>../..</relativePath>
    </parent>

    <name>Flowable - Event Registry</name>
    <artifactId>flowable-event-registry</artifactId>

    <dependencies>
        <dependency>
            <groupId>org.flowable</groupId>
            <artifactId>flowable-event-registry-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.flowable</groupId>
            <artifactId>flowable-event-registry-model</artifactId>
        </dependency>
        <dependency>
            <groupId>org.flowable</groupId>
            <artifactId>flowable-event-registry-json-converter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.flowable</groupId>
            <artifactId>flowable-engine-common</artifactId>
        </dependency>
        <dependency>
            <groupId>org.flowable</groupId>
            <artifactId>flowable-eventsubscription-service-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
        </dependency>
        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.uuid</groupId>
            <artifactId>java-uuid-generator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- DATABASE -->
        <dependency>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-core</artifactId>
        </dependency>

        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>test</scope>
        </dependency>
        
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.vintage</groupId>
            <artifactId>junit-vintage-engine</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>net.javacrumbs.json-unit</groupId>
            <artifactId>json-unit-assertj</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.zaxxer</groupId>
            <artifactId>HikariCP</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    
    <properties>
        <flowable.artifact>
            org.flowable.eventregistry.impl
        </flowable.artifact>
        <flowable.osgi.export.additional>
            org.flowable.eventregistry.db.liquibase,
            org.flowable.eventregistry.db.mapping.entity,
        </flowable.osgi.export.additional>
        <flowable.osgi.import.additional>
            junit*;resolution:=optional,
            org.junit*;resolution:=optional,
            org.junit.jupiter*;resolution:=optional,
            com.sun*;resolution:=optional,
            liquibase*;resolution:=optional,
            jakarta.activation*;resolution:=optional,
            jakarta.persistence*;resolution:=optional,
            jakarta.mail*;resolution:=optional,
            org.apache.xerces*;resolution:=optional,
            org.springframework*;resolution:=optional,
            com.fasterxml*;resolution:=optional,
            jakarta.transaction;resolution:=optional,
            jakarta.enterprise.concurrent;resolution:=optional,
        </flowable.osgi.import.additional>
    </properties>
    
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>cleanVersions</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>bundle-manifest</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>manifest</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <!--This plugin's configuration is used to store Eclipse m2e settings 
                    only. It has no influence on the Maven build itself. -->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.apache.felix</groupId>
                                        <artifactId>
                                            maven-bundle-plugin
                                        </artifactId>
                                        <versionRange>
                                            [2.1.0,)
                                        </versionRange>
                                        <goals>
                                            <goal>cleanVersions</goal>
                                            <goal>manifest</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore></ignore>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
    
    <profiles>
        <!-- database qa profile -->
        <profile>
            <id>databaseevent</id>
            <activation>
                <property>
                    <name>databaseevent</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <!-- only worked with this version, there might be a bug with antrun 
                            see http://jira.codehaus.org/browse/MANTRUN-109 -->
                        <version>1.4</version>
                        <executions>
                            <execution>
                                <id>database-test-create-schema</id>
                                <phase>process-test-classes</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <tasks>
                                        <echo message="updating flowable event configuration to db ${databaseevent}" />
                                        <copy file="${basedir}/../../qa/db/flowable.eventregistry.cfg.xml"
                                            todir="target/test-classes" overwrite="true">
                                            <filterset
                                                filtersfile="${user.home}/.flowable/jdbc/build.flowable6.${databaseevent}.properties" />
                                        </copy>
                                    </tasks>
                                </configuration>
                            </execution>
                            <execution>
                                <id>database-test-drop-schema</id>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <tasks>
                                        <echo message="dropping schema in ${databaseevent}" />
                                        <java classname="org.flowable.eventregistry.impl.db.DbSchemaDrop"
                                            classpathref="maven.test.classpath" />
                                    </tasks>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        
        <profile>
            <id>databasemssqlevent</id>
            <activation>
                <property>
                    <name>databasemssqlevent</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <!-- only worked with this version, there might be a bug with antrun 
                            see http://jira.codehaus.org/browse/MANTRUN-109 -->
                        <version>1.4</version>
                        <executions>
                            <execution>
                                <id>database-test-create-schema</id>
                                <phase>process-test-classes</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <tasks>
                                        <echo message="updating flowable event configuration to db ${databasemssqlevent}" />
                                        <copy file="${basedir}/../../qa/db/flowable.mssql.eventregistry.cfg.xml"
                                            tofile="target/test-classes/flowable.eventregistry.cfg.xml" overwrite="true">
                                            <filterset
                                                filtersfile="${user.home}/.flowable/jdbc/build.flowable6.${databasemssqlevent}.properties" />
                                        </copy>
                                    </tasks>
                                </configuration>
                            </execution>
                            <execution>
                                <id>database-test-drop-schema</id>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <tasks>
                                        <echo message="dropping schema in ${databasemssqlevent}" />
                                        <java classname="org.flowable.eventregistry.impl.db.DbSchemaDrop"
                                            classpathref="maven.test.classpath" />
                                    </tasks>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>databasewithschemaevent</id>
            <activation>
                <property>
                    <name>databasewithschemaevent</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <!-- only worked with this version, there might be a bug with antrun 
                            see http://jira.codehaus.org/browse/MANTRUN-109 -->
                        <version>1.4</version>
                        <executions>
                            <execution>
                                <id>database-test-create-schema</id>
                                <phase>process-test-classes</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <tasks>
                                        <echo message="updating flowable event configuration to db ${databasewithschemaevent}" />
                                        <copy file="${basedir}/../../qa/db/schema/flowable.eventregistry.cfg.xml"
                                            todir="target/test-classes" overwrite="true">
                                            <filterset
                                                filtersfile="${user.home}/.flowable/jdbc/build.flowable6.${databasewithschemaevent}.properties" />
                                        </copy>
                                    </tasks>
                                </configuration>
                            </execution>
                            <execution>
                                <id>database-test-drop-schema</id>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <tasks>
                                        <echo message="dropping schema in ${databasewithschemaevent}" />
                                        <java classname="org.flowable.eventregistry.impl.db.DbSchemaDrop"
                                            classpathref="maven.test.classpath" />
                                    </tasks>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>cleanDb</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>drop-idm-schema</id>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>java</goal>
                                </goals>
                                <configuration>
                                    <mainClass>org.flowable.eventregistry.impl.db.DbSchemaDrop</mainClass>
                                    <classpathScope>test</classpathScope>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>oracle</id>
            <activation>
                <property>
                    <name>databaseevent</name>
                    <value>oracle</value>
                </property>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>com.oracle.database.jdbc</groupId>
                    <artifactId>${oracle.jdbc.artifact}</artifactId>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>

        <profile>
            <id>oraclewithschemaevent</id>
            <activation>
                <property>
                    <name>databasewithschemaevent</name>
                    <value>oracle</value>
                </property>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>com.oracle.database.jdbc</groupId>
                    <artifactId>${oracle.jdbc.artifact}</artifactId>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>

        <profile>
            <id>db2</id>
            <activation>
                <property>
                    <name>databaseevent</name>
                    <value>db2</value>
                </property>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>com.ibm.db2</groupId>
                    <artifactId>jcc</artifactId>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>

        <profile>
            <id>mssql</id>
            <activation>
                <property>
                    <name>databasemssqlevent</name>
                    <value>mssql</value>
                </property>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>net.sourceforge.jtds</groupId>
                    <artifactId>jtds</artifactId>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>

        <profile>
            <id>mysql</id>
            <activation>
                <property>
                    <name>databaseevent</name>
                    <value>mysql</value>
                </property>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>com.mysql</groupId>
                    <artifactId>mysql-connector-j</artifactId>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>
    </profiles>

</project>