<?xml version="1.0" encoding="UTF-8"?>
<!--
 Copyright 2021 Goldman Sachs

 Licensed 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">
    <parent>
        <groupId>org.finos.legend.engine</groupId>
        <artifactId>legend-engine-xt-relationalStore-execution</artifactId>
        <version>4.103.2</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>legend-engine-xt-relationalStore-executionPlan-connection-tests</artifactId>
    <packaging>jar</packaging>
    <name>Legend Engine - XT - Relational Store - Execution Plan - Connection - Tests</name>

    <build>
        <plugins>
            <!-- Block running the _server tests (They should only execute in TeamCity). Run only H2 tests-->
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.surefire</groupId>
                        <artifactId>surefire-junit47</artifactId>
                        <version>2.22.0</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <useSystemClassLoader>false</useSystemClassLoader>
                    <argLine>${argLine} ${surefire.vm.params}</argLine>
                    <excludes>
                        <exclude>**/ExternalIntegration*.java</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <!-- Block running the _server tests (They should only execute in TeamCity). Run only H2 tests-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>run-databricks-integration</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <dependencies>
                            <dependency>
                                <groupId>org.apache.maven.surefire</groupId>
                                <artifactId>surefire-junit47</artifactId>
                                <version>2.22.0</version></dependency>
                        </dependencies>
                        <!-- Without override, surefire configuration would have skipped our integration tests -->
                        <configuration combine.self="override">
                            <useSystemClassLoader>false</useSystemClassLoader>
                            <argLine>${argLine} ${surefire.vm.params}</argLine>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>run-redshift-integration</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <dependencies>
                            <dependency>
                                <groupId>org.apache.maven.surefire</groupId>
                                <artifactId>surefire-junit47</artifactId>
                                <version>2.22.0</version>
                            </dependency>
                        </dependencies>
                        <!-- Without override, surefire configuration would have skipped our integration tests -->
                        <configuration combine.self="override">
                            <useSystemClassLoader>false</useSystemClassLoader>
                            <argLine>${argLine} ${surefire.vm.params}</argLine>
                            <!--
                            <environmentVariables>
                                <REDSHIFT_LEGEND_INTEG_USERNAME></REDSHIFT_LEGEND_INTEG_USERNAME>
                                <REDSHIFT_LEGEND_INTEG_PASSWORD></REDSHIFT_LEGEND_INTEG_PASSWORD>
                            </environmentVariables>
                            -->
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>run_tests_in_teamcity</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <dependencies>
                            <dependency>
                                <groupId>org.apache.maven.surefire</groupId>
                                <artifactId>surefire-junit47</artifactId>
                                <version>2.22.0</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <dependencies>

        <!-- ENGINE -->
        <dependency>
            <groupId>org.finos.legend.engine</groupId>
            <artifactId>legend-engine-shared-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.finos.legend.engine</groupId>
            <artifactId>legend-engine-identity-core</artifactId>
        </dependency>


        <dependency>
            <groupId>org.finos.legend.engine</groupId>
            <artifactId>legend-engine-xt-relationalStore-protocol</artifactId>
        </dependency>

        <dependency>
            <groupId>org.finos.legend.engine</groupId>
            <artifactId>legend-engine-executionPlan-dependencies</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.finos.legend.engine</groupId>
            <artifactId>legend-engine-xt-relationalStore-executionPlan</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.finos.legend.pure</groupId>
                    <artifactId>legend-pure-m4</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.annotation</groupId>
                    <artifactId>javax.annotation-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.finos.legend.engine</groupId>
            <artifactId>legend-engine-xt-relationalStore-executionPlan-connection</artifactId>
        </dependency>

        <dependency>
            <groupId>org.finos.legend.engine</groupId>
            <artifactId>legend-engine-xt-relationalStore-executionPlan-connection-authentication</artifactId>
        </dependency>
        <dependency>
            <groupId>org.finos.legend.engine</groupId>
            <artifactId>legend-engine-xt-relationalStore-executionPlan-connection-authentication-default</artifactId>
        </dependency>
        <!-- ENGINE -->

        <!-- ECLIPSE COLLECTIONS -->
        <dependency>
            <groupId>org.eclipse.collections</groupId>
            <artifactId>eclipse-collections-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.collections</groupId>
            <artifactId>eclipse-collections</artifactId>
        </dependency>
        <!-- ECLIPSE COLLECTIONS -->

        <!-- POOLING -->
        <dependency>
            <groupId>com.zaxxer</groupId>
            <artifactId>HikariCP</artifactId>
        </dependency>
        <!-- POOLING -->

        <!-- DRIVERS -->
        <dependency>
            <groupId>org.finos.legend.engine</groupId>
            <artifactId>legend-engine-xt-relationalStore-h2-execution-2.1.214</artifactId>
        </dependency>

        <!-- Test -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>net.bytebuddy</groupId>
            <artifactId>byte-buddy</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>net.bytebuddy</groupId>
            <artifactId>byte-buddy-agent</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>testcontainers</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>postgresql</artifactId>
            <scope>test</scope>
        </dependency>

        <!--
        <dependency>
            <groupId>org.finos.legend.engine</groupId>
            <artifactId>legend-engine-executionPlan-dependencies</artifactId>
            <scope>runtime</scope>
        </dependency>
        -->
        <!-- Test -->
    </dependencies>
</project>
