<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>wso2.sampleUnitTestTutorial</groupId>
  <artifactId>UnitTestTutorial</artifactId>
  <version>1.0.0</version>
  <packaging>pom</packaging>
  <name>UnitTestTutorial</name>
  <description>UnitTestTutorial</description>
  <repositories>
    <repository>
      <id>wso2-nexus</id>
      <name>WSO2 internal Repository</name>
      <url>https://maven.wso2.org/nexus/content/groups/wso2-public/</url>
      <releases>
        <enabled>true</enabled>
        <updatePolicy>daily</updatePolicy>
        <checksumPolicy>ignore</checksumPolicy>
      </releases>
    </repository>
    <repository>
      <id>wso2.releases</id>
      <name>WSO2 internal Repository</name>
      <url>https://maven.wso2.org/nexus/content/repositories/releases/</url>
      <releases>
        <enabled>true</enabled>
        <updatePolicy>daily</updatePolicy>
        <checksumPolicy>ignore</checksumPolicy>
      </releases>
    </repository>
    <repository>
      <id>wso2.snapshots</id>
      <name>Apache Snapshot Repository</name>
      <url>https://maven.wso2.org/nexus/content/repositories/snapshots/</url>
      <snapshots>
        <enabled>true</enabled>
        <updatePolicy>daily</updatePolicy>
      </snapshots>
      <releases>
        <enabled>false</enabled>
      </releases>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <id>wso2.snapshots</id>
      <name>Apache Snapshot Repository</name>
      <url>https://maven.wso2.org/nexus/content/repositories/snapshots/</url>
      <snapshots>
        <enabled>true</enabled>
        <updatePolicy>daily</updatePolicy>
      </snapshots>
      <releases>
        <enabled>false</enabled>
      </releases>
    </pluginRepository>
    <pluginRepository>
      <releases>
        <enabled>true</enabled>
        <updatePolicy>daily</updatePolicy>
        <checksumPolicy>ignore</checksumPolicy>
      </releases>
      <id>wso2-nexus</id>
      <url>https://maven.wso2.org/nexus/content/groups/wso2-public/</url>
    </pluginRepository>
  </pluginRepositories>
  <profiles>
    <profile>
      <id>default</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <build>
        <plugins>
          <!-- Download dependency jars to the deployment/libs folder -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>3.5.0</version>
            <executions>
              <execution>
                <phase>process-resources</phase>
                <goals>
                  <goal>copy-dependencies</goal>
                </goals>
                <configuration>
                  <outputDirectory>${basedir}/deployment/libs</outputDirectory>
                  <excludeTransitive>true</excludeTransitive>
                  <!-- exclude dependencies which already available in MI -->
                  <excludeGroupIds>org.apache.synapse,org.apache.axis2</excludeGroupIds>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
              <source>1.8</source>
              <target>1.8</target>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.wso2.maven</groupId>
            <artifactId>vscode-car-plugin</artifactId>
            <version>5.2.60</version>
            <extensions>true</extensions>
            <executions>
              <execution>
                <goals>
                  <goal>car</goal>
                </goals>
                <configuration/>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-install-plugin</artifactId>
            <version>2.5.2</version>
            <executions>
              <execution>
                <id>install-car</id>
                <phase>install</phase>
                <goals>
                  <goal>install-file</goal>
                </goals>
                <configuration>
                  <packaging>car</packaging>
                  <artifactId>${project.artifactId}</artifactId>
                  <groupId>${project.groupId}</groupId>
                  <version>${project.version}</version>
                  <file>${project.build.directory}/${project.artifactId}_${project.version}.car</file>
                  <!-- Use the following configuration when archiveLocation is configured -->
                  <!-- <file>${archiveLocation}/${project.artifactId}_${project.version}.car</file> -->
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>test</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.wso2.maven</groupId>
            <artifactId>synapse-unit-test-maven-plugin</artifactId>
            <version>5.2.60</version>
            <executions>
              <execution>
                <id>synapse-unit-test</id>
                <phase>test</phase>
                <goals>
                  <goal>synapse-unit-test</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <server>
                <testServerType>${testServerType}</testServerType>
                <testServerHost>${testServerHost}</testServerHost>
                <testServerPort>${testServerPort}</testServerPort>
                <testServerPath>${testServerPath}</testServerPath>
              </server>
              <testCasesFilePath>${project.basedir}/src/test/wso2mi/${testFile}</testCasesFilePath>
              <mavenTestSkip>${maven.test.skip}</mavenTestSkip>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>docker</id>
      <build>
        <plugins>
          <!-- Compile and build the class mediator jars -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <executions>
              <execution>
                <id>default-compile</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>compile</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <source>1.8</source>
              <target>1.8</target>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <executions>
              <execution>
                <id>default-jar</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <!-- Build the Carbon Application -->
          <plugin>
            <groupId>org.wso2.maven</groupId>
            <artifactId>vscode-car-plugin</artifactId>
            <version>5.2.60</version>
            <extensions>true</extensions>
            <executions>
              <execution>
                <phase>generate-sources</phase>
                <goals>
                  <goal>car</goal>
                </goals>
                <configuration></configuration>
              </execution>
            </executions>
          </plugin>
          <!-- Download dependency jars to the deployment/libs folder -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>3.5.0</version>
            <executions>
              <execution>
                <phase>process-resources</phase>
                <goals>
                  <goal>copy-dependencies</goal>
                </goals>
                <configuration>
                  <outputDirectory>${basedir}/deployment/libs</outputDirectory>
                  <excludeTransitive>true</excludeTransitive>
                  <!-- exclude dependencies which already available in MI -->
                  <excludeGroupIds>org.apache.synapse,org.apache.axis2</excludeGroupIds>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <!-- Run config mapper to transform configuration files -->
          <plugin>
            <groupId>org.wso2.maven</groupId>
            <artifactId>mi-container-config-mapper</artifactId>
            <version>5.2.60</version>
            <extensions>true</extensions>
            <executions>
              <execution>
                <id>config-mapper-parser</id>
                <phase>generate-resources</phase>
                <goals>
                  <goal>config-mapper-parser</goal>
                </goals>
                <configuration>
                  <miVersion>4.2.0</miVersion>
                  <executeCipherTool>${ciphertool.enable}</executeCipherTool>
                  <keystoreName>${keystore.name}</keystoreName>
                  <keystoreAlias>${keystore.alias}</keystoreAlias>
                  <keystoreType>${keystore.type}</keystoreType>
                  <keystorePassword>${keystore.password}</keystorePassword>
                  <projectLocation>${project.basedir}</projectLocation>
                </configuration>
              </execution>
            </executions>
            <configuration/>
          </plugin>
          <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>3.0.0</version>
            <extensions>true</extensions>
            <executions>
              <execution>
                <id>antrun-edit</id>
                <phase>process-resources</phase>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <target>
                    <copy todir="${basedir}/target/tmp_docker/CompositeApps">
                      <fileset dir="${basedir}/target">
                        <include name="*.car"/>
                      </fileset>
                    </copy>
                    <move todir="${basedir}/target/tmp_docker/CarbonHome/metadata">
                      <fileset dir="${basedir}/target/tmp_docker/CarbonHome/.metadata"/>
                    </move>
                    <replace file="${basedir}/target/tmp_docker/Dockerfile">
                      <replacefilter token="CarbonHome/.metadata/metadata_config.properties" value="CarbonHome/metadata/metadata_config.properties"/>
                      <replacefilter token="CarbonHome/.metadata/references.properties" value="CarbonHome/metadata/references.properties"/>
                    </replace>
                  </target>
                </configuration>
              </execution>
            </executions>
            <configuration/>
          </plugin>
          <!-- Build docker image -->
          <plugin>
            <groupId>io.fabric8</groupId>
            <artifactId>docker-maven-plugin</artifactId>
            <version>0.43.4</version>
            <extensions>true</extensions>
            <executions>
              <execution>
                <id>docker-build</id>
                <phase>package</phase>
                <goals>
                  <goal>build</goal>
                </goals>
                <configuration>
                  <images>
                    <image>
                      <name>unittesttutorial:${project.version}</name>
                      <build>
                        <from>${dockerfile.base.image}</from>
                        <dockerFile>${basedir}/target/tmp_docker/Dockerfile</dockerFile>
                        <args>
                          <BASE_IMAGE>${dockerfile.base.image}</BASE_IMAGE>
                        </args>
                      </build>
                    </image>
                  </images>
                  <authConfig>
                    <username>${dockerfile.pull.username}</username>
                    <password>${dockerfile.pull.password}</password>
                  </authConfig>
                  <verbose>true</verbose>
                </configuration>
              </execution>
            </executions>
            <configuration/>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
  <properties>
    <projectType>integration-project</projectType>
    <uuid>9e1a7663-a801-48ba-b93f-26aab3ad6abb</uuid>
    <!-- <archiveLocation>configure a custom target directory for CAPP</archiveLocation> -->
    <keystore.type>JKS</keystore.type>
    <keystore.name>wso2carbon.jks</keystore.name>
    <keystore.password>wso2carbon</keystore.password>
    <keystore.alias>wso2carbon</keystore.alias>
    <ciphertool.enable>true</ciphertool.enable>
    <dockerfile.base.image>wso2/wso2mi:4.2.0</dockerfile.base.image>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
  </properties>
</project>