<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.atlassian.vcache</groupId>
    <artifactId>atlassian-vcache</artifactId>
    <version>2.0.0</version>
  </parent>

  <artifactId>atlassian-vcache-internal-redis</artifactId>
  <name>Atlassian VCache - Redis Impl</name>

  <dependencies>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>atlassian-vcache-internal-core</artifactId>
    </dependency>

    <!-- Implementation dependencies -->
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
    </dependency>
    <dependency>
      <groupId>redis.clients</groupId>
      <artifactId>jedis</artifactId>
    </dependency>
    <dependency>
      <groupId>io.atlassian.util.concurrent</groupId>
      <artifactId>atlassian-util-concurrent</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.atlassian.fugue</groupId>
      <artifactId>fugue</artifactId>
      <scope>provided</scope>
      <optional>true</optional>
    </dependency>

    <!-- Test dependencies -->
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>atlassian-vcache-internal-test</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-library</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-all</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <configuration>
          <systemProperties>
            <redis.svr>
              redis://${redis.host}:${redis.port}
            </redis.svr>
          </systemProperties>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>disable-docker</id>
      <activation>
        <property>
          <name>!enableDocker</name>
        </property>
      </activation>
      <properties>
        <redis.host>localhost</redis.host>
        <redis.port>6379</redis.port>
      </properties>
    </profile>

    <profile>
      <id>docker-start</id>
      <activation>
        <property>
          <name>enableDocker</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>io.fabric8</groupId>
            <artifactId>docker-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>start</id>
                <goals>
                  <goal>start</goal>
                </goals>
                <configuration>
                  <images>
                    <image>
                      <alias>redis</alias>
                      <name>redis:3.0.4</name>
                      <run>
                        <ports>
                          <port>${redis.host}:${redis.port}:6379</port>
                        </ports>
                        <wait>
                          <tcp>
                            <mode>mapped</mode>
                            <ports>
                              <port>6379</port>
                            </ports>
                          </tcp>
                          <time>5000</time>
                        </wait>
                      </run>
                    </image>
                  </images>
                </configuration>
              </execution>
              <execution>
                <id>stop</id>
                <goals>
                  <goal>stop</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
      <properties>
        <redis.host>localhost</redis.host>
        <redis.port>6380</redis.port>
      </properties>
    </profile>
  </profiles>

</project>
