<?xml version="1.0" encoding="UTF-8"?>
<!--
  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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.apache.nifi</groupId>
        <artifactId>nifi-elasticsearch-bundle</artifactId>
        <version>1.11.2</version>
    </parent>

    <artifactId>nifi-elasticsearch-client-service</artifactId>
    <packaging>jar</packaging>

    <properties>
        <es.int.version>5.6.15</es.int.version>
        <script.name>setup-5.script</script.name>
        <type.name>faketype</type.name>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-lookup-service-api</artifactId>
            <scope>provided</scope>
            <version>1.11.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-api</artifactId>
            <scope>provided</scope>
            <version>1.11.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-utils</artifactId>
            <version>1.11.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-distributed-cache-client-service-api</artifactId>
            <version>1.11.2</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-record</artifactId>
            <version>1.11.2</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson-databind.version}</version>
        </dependency>

        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.6</version>
        </dependency>

        <dependency>
            <groupId>com.github.stephenc.findbugs</groupId>
            <artifactId>findbugs-annotations</artifactId>
            <version>1.3.9-1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.9</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>log4j-over-slf4j</artifactId>
            <version>${org.slf4j.version}</version>
        </dependency>


        <!-- test dependencies -->
        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-mock</artifactId>
            <version>1.11.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-ssl-context-service-api</artifactId>
            <version>1.11.2</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-elasticsearch-client-service-api</artifactId>
            <version>1.11.2</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>elasticsearch</artifactId>
            <version>5.6.16</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-high-level-client</artifactId>
            <version>5.6.16</version>
            <scope>compile</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.vividsolutions</groupId>
                    <artifactId>jts</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-avro-record-utils</artifactId>
            <version>1.11.2</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-schema-registry-service-api</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.jayway.jsonpath</groupId>
            <artifactId>json-path</artifactId>
            <version>2.4.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.5.10</version>
        </dependency>
        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-record-path</artifactId>
            <version>1.11.2</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-ssl-context-service</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-json</artifactId>
            <version>${nifi.groovy.version}</version>
            <scope>test</scope>
	</dependency>
	<dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-client</artifactId>
            <version>5.6.16</version>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>integration-6</id>
            <properties>
                <es.int.version>6.7.1</es.int.version>
                <type.name>_doc</type.name>
                <script.name>setup-6.script</script.name>
            </properties>
        </profile>
        <profile>
            <id>integration-7</id>
            <properties>
                <es.int.version>7.0.0</es.int.version>
                <script.name>setup-7.script</script.name>
                <type.name>_doc</type.name>
            </properties>
        </profile>
        <profile>
            <id>integration-tests</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <version>3.0.0-M3</version>
                        <configuration>
                            <systemPropertyVariables>
                                <type_name>${type.name}</type_name>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>com.github.alexcojocaru</groupId>
                        <artifactId>elasticsearch-maven-plugin</artifactId>
                        <version>6.13</version>
                        <configuration>
                            <clusterName>testCluster</clusterName>
                            <transportPort>9500</transportPort>
                            <httpPort>9400</httpPort>
                            <version>${es.int.version}</version>
                            <timeout>90</timeout>
                            <logLevel>ERROR</logLevel>
                            <pathInitScript>${project.basedir}/src/test/resources/${script.name}</pathInitScript>
                        </configuration>
                        <executions>
                            <execution>
                                <id>start-elasticsearch</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>runforked</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>stop-elasticsearch</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>stop</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
