<?xml version="1.0" encoding="UTF-8"?>

<!--
  ~ /*
   ~  *  Copyright 2014 Orient Technologies LTD (info(at)orientechnologies.com)
   ~  *
   ~  *  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.
   ~  *
   ~  * For more information: http://www.orientechnologies.com
   ~  */
   -->

<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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.orientechnologies</groupId>
        <artifactId>orientdb-parent</artifactId>
        <version>3.2.10</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>orientdb-distributed</artifactId>

    <name>OrientDB Distributed Server</name>

    <properties>
        <hz.version>3.12.8</hz.version>
        <javac.src.version>1.6</javac.src.version>
        <javac.target.version>1.6</javac.target.version>
        <jar.manifest.mainclass>com.orientechnologies.orient.server.OServerMain</jar.manifest.mainclass>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <exclude.test.distributed>NONE</exclude.test.distributed>
        <project.rootdir>${project.basedir}/../</project.rootdir>
    </properties>

    <profiles>
        <profile>
            <id>java8</id>
            <activation>
                <jdk>1.8</jdk>
            </activation>
            <properties>
                <argLine>-ea
                    -Xmx${heapSize}
                    -Dstorage.diskCache.bufferSize=4096
                    -Dindex.flushAfterCreate=false
                    -Dstorage.makeFullCheckpointAfterCreate=false
                    -Dmemory.directMemory.trackMode=true
                    -Dstorage.makeFullCheckpointAfterOpen=false
                    -Dstorage.makeFullCheckpointAfterClusterCreate=false
                    -Dstorage.wal.syncOnPageFlush=false
                    -Dserver.backwardCompatibility=false
                    -Dstorage.configuration.syncOnUpdate=false
                    -Ddb.makeFullCheckpointOnIndexChange=false
                    -Ddb.makeFullCheckpointOnSchemaChange=false
                    -Dhazelcast.wait.seconds.before.join=3
                    -Djava.util.logging.manager=com.orientechnologies.common.log.ShutdownLogManager
                    -Dstorage.diskCache.checksumMode=storeAndThrow
                    -Dindex.allowManualIndexes=false
                    -Dsecurity.warningDefaultUsers=false
                    -Dsecurity.createDefaultUsers=false
                    -Dmemory.directMemory.preallocate=false
                </argLine>
            </properties>
        </profile>
        <profile>
            <id>java11</id>
            <activation>
                <jdk>[11,)</jdk>
            </activation>
            <properties>
                <argLine>-ea
                    -Xmx${heapSize}
                    -Dstorage.diskCache.bufferSize=4096
                    -Dindex.flushAfterCreate=false
                    -Dstorage.makeFullCheckpointAfterCreate=false
                    -Dmemory.directMemory.trackMode=true
                    -Dstorage.makeFullCheckpointAfterOpen=false
                    -Dstorage.makeFullCheckpointAfterClusterCreate=false
                    -Dstorage.wal.syncOnPageFlush=false
                    -Dserver.backwardCompatibility=false
                    -Dstorage.configuration.syncOnUpdate=false
                    -Ddb.makeFullCheckpointOnIndexChange=false
                    -Ddb.makeFullCheckpointOnSchemaChange=false
                    -Dhazelcast.wait.seconds.before.join=3
                    -Djava.util.logging.manager=com.orientechnologies.common.log.ShutdownLogManager
                    -Dstorage.diskCache.checksumMode=storeAndThrow
                    -Dindex.allowManualIndexes=false
                    -Dsecurity.warningDefaultUsers=false
                    -Dsecurity.createDefaultUsers=false
                    --add-opens jdk.unsupported/sun.misc=ALL-UNNAMED
                    --add-opens java.base/sun.security.x509=ALL-UNNAMED
                    -Dmemory.directMemory.preallocate=false
                </argLine>
            </properties>
        </profile>
        <profile>
            <id>crash-tests</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <version>${surefire.version}</version>
                        <configuration>
                            <skipTests>true</skipTests>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>secondary-tests</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>${surefire.version}</version>
                        <configuration>
                            <includes>
                                <include>**/*ST.java</include>
                            </includes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>it-k8s</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <configuration>
                            <includes>
                                <include>**/BasicSyncIT.java</include>
                                <include>**/SimpleQueryDistributedIT.java</include>
                                <include>**/ReverseStartSyncIT.java</include>
                                <include>**/ConcurrentIndexDefinitionIT.java</include>
                                <include>**/SimpleMultiNodeConnectIT.java</include>
                                <include>**/SimpleLiveQueryDistributedIT.java</include>
                                <include>**/SimpleIndexDistributedIT.java</include>
                                <include>**/UniqueCompositeIndexDistributedIT.java</include>
                            </includes>
                            <systemPropertyVariables>
                                <kubeConfig />
                                <orientdbLabel>orientdb</orientdbLabel>
                                <orientdbHttpPort>2480</orientdbHttpPort>
                                <orientdbBinaryPort>2424</orientdbBinaryPort>
                                <orientdbHazelcastPort>2434</orientdbHazelcastPort>
                                <orientdbDockerImage />
                                <orientdbVolumeSize>2</orientdbVolumeSize>
                                <databaseVolumeStorageClass />
                                <configVolumeStorageClass />
                                <kubernetesNamespace>orientdb</kubernetesNamespace>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <dependencies>

        <dependency>
            <groupId>com.orientechnologies</groupId>
            <artifactId>orientdb-test-commons</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.orientechnologies</groupId>
            <artifactId>orientdb-core</artifactId>
            <version>${project.version}</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.orientechnologies</groupId>
            <artifactId>orientdb-server</artifactId>
            <version>${project.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.orientechnologies</groupId>
            <artifactId>orientdb-tools</artifactId>
            <version>${project.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.hazelcast</groupId>
            <artifactId>hazelcast</artifactId>
            <version>${hz.version}</version>
        </dependency>
        <dependency>
            <groupId>com.hazelcast</groupId>
            <artifactId>hazelcast-kubernetes</artifactId>
            <version>1.5.3</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>io.kubernetes</groupId>
            <artifactId>client-java</artifactId>
            <version>10.0.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-text</artifactId>
            <version>1.8</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>29.0-jre</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>3.6.0</version>
            <scope>test</scope>
        </dependency>
        <!-- Required by the Kubernetes java client -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.6.2</version>
            <scope>test</scope>
        </dependency>


    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>${jar.manifest.mainclass}</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <systemPropertyVariables>
                        <buildDirectory>${project.build.directory}</buildDirectory>
                    </systemPropertyVariables>
                    <excludes>
                        <exclude>${exclude.test.distributed}</exclude>
                    </excludes>
                    <reuseForks>false</reuseForks>
                    <forkCount>1</forkCount>
                </configuration>

                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.surefire</groupId>
                        <artifactId>surefire-junit47</artifactId>
                        <version>${surefire.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>${surefire.version}</version>
                <configuration>
                    <reuseForks>false</reuseForks>
                    <forkCount>1</forkCount>
                    <useModulePath>false</useModulePath>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>
