<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <artifactId>kylin-it</artifactId>
    <packaging>jar</packaging>
    <name>Apache Kylin - Integration Test</name>
    <description>Apache Kylin - Integration Test</description>

    <parent>
        <artifactId>kylin</artifactId>
        <groupId>org.apache.kylin</groupId>
        <version>2.3.2</version>
    </parent>

    <properties>
        <hdp.version />
        <fastBuildMode />
        <buildCubeUsingProvidedData />
        <engineType />
    </properties>

    <!-- Dependencies. -->
    <dependencies>
        <dependency>
            <groupId>org.apache.kylin</groupId>
            <artifactId>atopcalcite</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>avatica-core</artifactId>
                    <groupId>org.apache.calcite.avatica</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.kylin</groupId>
            <artifactId>kylin-server</artifactId>
            <classifier>classes</classifier>
            <version>${project.parent.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.kylin</groupId>
            <artifactId>kylin-core-storage</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.kylin</groupId>
            <artifactId>kylin-source-hive</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.kylin</groupId>
            <artifactId>kylin-jdbc</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.kylin</groupId>
            <artifactId>kylin-tool</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.kylin</groupId>
            <artifactId>kylin-storage-hbase</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.kylin</groupId>
            <artifactId>kylin-query</artifactId>
        </dependency>

        <!-- Env & Test -->

        <dependency>
            <groupId>org.apache.kylin</groupId>
            <artifactId>kylin-core-common</artifactId>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.kylin</groupId>
            <artifactId>kylin-core-cube</artifactId>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.kylin</groupId>
            <artifactId>kylin-core-storage</artifactId>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.kylin</groupId>
            <artifactId>kylin-core-job</artifactId>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.kylin</groupId>
            <artifactId>kylin-storage-hbase</artifactId>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.hive.hcatalog</groupId>
            <artifactId>hive-hcatalog-core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.kylin</groupId>
            <artifactId>kylin-assembly</artifactId>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-model</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>xerces</groupId>
            <artifactId>xercesImpl</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>xalan</groupId>
            <artifactId>xalan</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.dbunit</groupId>
            <artifactId>dbunit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-annotations</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-mapreduce-client-core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-hdfs</artifactId>
            <scope>provided</scope>
            <!-- protobuf version conflict with hbase -->
            <exclusions>
                <exclusion>
                    <groupId>com.google.protobuf</groupId>
                    <artifactId>protobuf-java</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-yarn-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-yarn-server-resourcemanager</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.hbase</groupId>
            <artifactId>hbase-common</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.hbase</groupId>
            <artifactId>hbase-hadoop2-compat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.hbase</groupId>
            <artifactId>hbase-client</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.hbase</groupId>
            <artifactId>hbase-server</artifactId>
            <scope>provided</scope>
            <!-- version conflict with hadoop2.2 -->
            <exclusions>
                <exclusion>
                    <groupId>org.apache.hadoop</groupId>
                    <artifactId>hadoop-mapreduce-client-jobclient</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>tomcat</groupId>
                    <artifactId>jasper-compiler</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>tomcat</groupId>
                    <artifactId>jasper-runtime</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-mapreduce-client-jobclient</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.hbase</groupId>
            <artifactId>hbase-testing-util</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>javax.servlet</groupId>
                    <artifactId>servlet-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.servlet.jsp</groupId>
                    <artifactId>jsp-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>tomcat</groupId>
                    <artifactId>jasper-compiler</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>tomcat</groupId>
                    <artifactId>jasper-runtime</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.kafka</groupId>
            <artifactId>kafka_2.11</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- log dependency -->
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <scope>test</scope>
        </dependency>


        <!-- Spark dependency -->
        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-core_2.11</artifactId>
            <version>${spark.version}</version>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.thrift</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-sql_2.11</artifactId>
            <version>${spark.version}</version>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.thrift</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-hive_2.11</artifactId>
            <version>${spark.version}</version>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.thrift</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>


    <profiles>
        <profile>
            <id>sandbox</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>integration-tests</id>
                                <goals>
                                    <goal>integration-test</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>verify</id>
                                <goals>
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <excludes>
                                <exclude>**/*$*</exclude>
                            </excludes>
                            <systemProperties>
                                <property>
                                    <name>log4j.configuration</name>
                                    <value>
                                        file:${project.basedir}/..//build/conf/kylin-tools-log4j.properties
                                    </value>
                                </property>
                            </systemProperties>
                            <argLine>-Xms1G -Xmx2G -XX:PermSize=128M -XX:MaxPermSize=512M
                                -Dkylin.server.cluster-servers=localhost:7070
                            </argLine>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>build_cube_with_engine</id>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <phase>pre-integration-test</phase>
                                <configuration>
                                    <skip>${skipTests}</skip>
                                    <classpathScope>test</classpathScope>
                                    <executable>java</executable>
                                    <arguments>
                                        <argument>-Dhdp.version=${hdp.version}</argument>
                                        <argument>-DfastBuildMode=${fastBuildMode}</argument>
                                        <argument>
                                            -DbuildCubeUsingProvidedData=${buildCubeUsingProvidedData}
                                        </argument>
                                        <argument>-DengineType=${engineType}</argument>
                                        <argument>
                                            -Dlog4j.configuration=file:${project.basedir}/..//build/conf/kylin-tools-log4j.properties
                                        </argument>
                                        <argument>-classpath</argument>
                                        <classpath />
                                        <argument>org.apache.kylin.provision.BuildCubeWithEngine
                                        </argument>
                                    </arguments>
                                    <workingDirectory>${project.basedir}</workingDirectory>
                                </configuration>
                            </execution>
                            <execution>
                                <id>build_cube_with_stream</id>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <phase>pre-integration-test</phase>
                                <configuration>
                                    <skip>${skipTests}</skip>
                                    <classpathScope>test</classpathScope>
                                    <executable>java</executable>
                                    <arguments>
                                        <argument>-Dhdp.version=${hdp.version}</argument>
                                        <argument>-DfastBuildMode=${fastBuildMode}</argument>
                                        <argument>
                                            -DbuildCubeUsingProvidedData=${buildCubeUsingProvidedData}
                                        </argument>
                                        <argument>
                                            -Dlog4j.configuration=file:${project.basedir}/..//build/conf/kylin-tools-log4j.properties
                                        </argument>
                                        <argument>-classpath</argument>
                                        <classpath />
                                        <argument>org.apache.kylin.provision.BuildCubeWithStream
                                        </argument>
                                    </arguments>
                                    <workingDirectory>${project.basedir}</workingDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                </plugins>
            </build>
        </profile>
    </profiles>

</project>
