<?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">
  <parent>
    <artifactId>dashbuilder-backend</artifactId>
    <groupId>org.dashbuilder</groupId>
    <version>0.3.2.Final</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>

  <artifactId>dashbuilder-dataset-elasticsearch</artifactId>
  <name>Dashbuilder Dataset ElasticSearch Provider</name>

  <build>
    
    <resources>
      <resource>
        <directory>src/main/resources</directory>
      </resource>
    </resources>
    
  </build>

  <profiles>

    <!-- By default, do not run elastic search using Java < 7.X. -->
    <profile>
      <id>default-no-tests-unitl-java7</id>
      <properties>
        <maven.test.skip>true</maven.test.skip>
      </properties>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
    </profile>
    
    <!-- Run the tests using a local ELS instance running in same thread.
        @See org.dashbuilder.dataprovider.backend.elasticsearch.suite.ElasticSearchTestSuite
    -->
    <profile>
      <id>fullProfile</id>
      <activation>
        <property>
          <name>full</name>
        </property>
      </activation>
     <build>
       <plugins>
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-surefire-plugin</artifactId>
           <configuration combine.self="override">
             <!-- NOTE: Java 1.7.0_40 suffers from critical bug that produces the Elastic Search server fail on startup.
                        Using this JVM argument you can skip the error and force running the ELS instance. -->
             <argLine>-XX:-UseSuperWord</argLine>

             <!-- Run the integration Test Suite. Skip the local for development.-->
             <includes>
               <include>**/*TestSuite.java</include>
             </includes>
             <excludes>
               <exclude>**/LocalTestSuite.java</exclude>
             </excludes>
           </configuration>
         </plugin>
       </plugins>
     </build>
    </profile>
    
    
    <!-- Test - Development profile. ELS instance running and populated with default data on localhost at port tcp 9200.
        @See org.dashbuilder.dataprovider.backend.elasticsearch.suite.LocalTestSuite
        mvn clean test -Ddev
    -->
    <profile>
      <id>test-development</id>
      <activation>
        <activeByDefault>false</activeByDefault>
        <property>
          <name>dev</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration combine.self="override">
              <!-- NOTE: Java 1.7.0_40 suffers from critical bug that produces the Elastic Search server fail on startup.
                         Using this JVM argument you can skip the error and force running the ELS instance. -->
              <argLine>-XX:-UseSuperWord</argLine>

              <!-- Run the integration Test Suite. Skip the local for development.-->
              <includes>
                <include>**/LocalTestSuite.java</include>
              </includes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    
  </profiles>

  
  <dependencies>

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

    <dependency>
      <groupId>javax.enterprise</groupId>
      <artifactId>cdi-api</artifactId>
    </dependency>

    <dependency>
      <groupId>org.dashbuilder</groupId>
      <artifactId>dashbuilder-dataset-api</artifactId>
    </dependency>

    <dependency>
      <groupId>org.dashbuilder</groupId>
      <artifactId>dashbuilder-dataset-core</artifactId>
    </dependency>

    <dependency>
      <groupId>org.dashbuilder</groupId>
      <artifactId>dashbuilder-common</artifactId>
    </dependency>

    <dependency>
      <groupId>com.googlecode.json-simple</groupId>
      <artifactId>json-simple</artifactId>
      <type>jar</type>
    </dependency>

    <dependency>
      <groupId>com.google.code.gson</groupId>
      <artifactId>gson</artifactId>
    </dependency>

    <!-- Jest ES client. -->
    <dependency>
      <groupId>io.searchbox</groupId>
      <artifactId>jest</artifactId>
    </dependency>

    <dependency>
      <groupId>io.searchbox</groupId>
      <artifactId>jest-common</artifactId>
    </dependency>

    <dependency>
      <groupId>joda-time</groupId>
      <artifactId>joda-time</artifactId>
    </dependency>

    <dependency>
      <groupId>org.elasticsearch</groupId>
      <artifactId>elasticsearch</artifactId>
      <!-- BY default, the client used for ELS provider is the GSON one, instead of the native one.
          If you want to use the native client, Inherit it in your project. -->
      <optional>true</optional>
    </dependency>

    <!-- Testing scope -->
    <dependency>
      <groupId>org.apache.lucene</groupId>
      <artifactId>lucene-core</artifactId>
      <scope>test</scope>
    </dependency>
    
    <dependency>
      <groupId>org.apache.lucene</groupId>
      <artifactId>lucene-queryparser</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.codehaus.groovy</groupId>
      <artifactId>groovy-all</artifactId>
      <type>jar</type>
      <scope>test</scope>
    </dependency>
    
    <dependency>
      <groupId>org.dashbuilder</groupId>
      <artifactId>dashbuilder-common</artifactId>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.dashbuilder</groupId>
      <artifactId>dashbuilder-dataset-core</artifactId>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.httpcomponents</groupId>
      <artifactId>httpclient</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-all</artifactId>
      <scope>test</scope>
    </dependency>
    
  </dependencies>
  
</project>
