<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2017 WSO2, Inc. (http://wso2.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.
  -->
<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">
    <parent>
        <groupId>org.wso2.msf4j</groupId>
        <artifactId>msf4j-tests</artifactId>
        <version>2.8.4</version>
        <relativePath>../pom.xml</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <packaging>pom</packaging>

    <artifactId>wso2-msf4j-tests</artifactId>
    <name>WSO2 MSF4j - Test - Distribution</name>

    <dependencies>
        <dependency>
            <groupId>org.wso2.msf4j</groupId>
            <artifactId>org.wso2.msf4j.feature</artifactId>
            <type>zip</type>
        </dependency>
        <dependency>
            <groupId>org.wso2.msf4j</groupId>
            <artifactId>org.wso2.msf4j.deployer.feature</artifactId>
            <type>zip</type>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.server.feature</artifactId>
            <type>zip</type>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.osgi.feature</artifactId>
            <type>zip</type>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.runtime.feature</artifactId>
            <type>zip</type>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.pax.exam.feature</artifactId>
            <type>zip</type>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.transport</groupId>
            <artifactId>org.wso2.carbon.connector.framework.feature</artifactId>
            <version>${org.wso2.carbon.transport.http.netty.version}</version>
            <type>zip</type>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.metrics</groupId>
            <artifactId>org.wso2.carbon.metrics.core.feature</artifactId>
            <version>${carbon.metrics.version}</version>
            <type>zip</type>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.metrics</groupId>
            <artifactId>org.wso2.carbon.metrics.jdbc.core.feature</artifactId>
            <version>${carbon.metrics.version}</version>
            <type>zip</type>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.metrics</groupId>
            <artifactId>org.wso2.carbon.metrics.das.core.feature</artifactId>
            <version>${carbon.metrics.version}</version>
            <type>zip</type>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.deployment</groupId>
            <artifactId>org.wso2.carbon.deployment.engine.feature</artifactId>
            <version>${carbon.deployment.version}</version>
            <type>zip</type>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.jndi</groupId>
            <artifactId>org.wso2.carbon.jndi.feature</artifactId>
            <version>${carbon.jndi.version}</version>
            <type>zip</type>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.datasources</groupId>
            <artifactId>org.wso2.carbon.datasource.core.feature</artifactId>
            <version>${carbon.datasources.version}</version>
            <type>zip</type>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.config</groupId>
            <artifactId>org.wso2.carbon.config.feature</artifactId>
            <version>${carbon.config.version}</version>
            <type>zip</type>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.secvault</groupId>
            <artifactId>org.wso2.carbon.secvault.feature</artifactId>
            <version>${carbon.secvault.version}</version>
            <type>zip</type>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.utils</groupId>
            <artifactId>org.wso2.carbon.utils.feature</artifactId>
            <version>${carbon.utils.version}</version>
            <type>zip</type>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.touchpoint</groupId>
            <artifactId>org.wso2.carbon.touchpoint.feature</artifactId>
            <version>${carbon.touchpoint.version}</version>
            <type>zip</type>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <inherited>false</inherited>
                <executions>
                    <execution>
                        <id>unpack-equinox-executable</id>
                        <phase>test</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.eclipse.equinox</groupId>
                                    <artifactId>org.eclipse.equinox.executable</artifactId>
                                    <version>3.5.0.v20110530-7P7NFUFFLWUl76mart</version>
                                    <type>zip</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>target</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.wso2.carbon.maven</groupId>
                <artifactId>carbon-feature-plugin</artifactId>
                <version>3.1.3</version>
                <executions>
                    <execution>
                        <id>p2-repo-generation</id>
                        <phase>package</phase>
                        <goals>
                            <goal>generate-repo</goal>
                        </goals>
                        <configuration>
                            <targetRepository>file:${basedir}/target/p2-repo</targetRepository>
                            <features>
                                <feature>
                                    <id>org.wso2.carbon.server.feature</id>
                                    <version>${carbon.kernel.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.osgi.feature</id>
                                    <version>${carbon.kernel.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.runtime.feature</id>
                                    <version>${carbon.kernel.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.config.feature</id>
                                    <version>${carbon.config.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.secvault.feature</id>
                                    <version>${carbon.secvault.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.utils.feature</id>
                                    <version>${carbon.utils.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.touchpoint.feature</id>
                                    <version>${carbon.touchpoint.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.msf4j.feature</id>
                                    <version>${msf4j.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.msf4j.deployer.feature</id>
                                    <version>${msf4j.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.pax.exam.feature</id>
                                    <version>${carbon.kernel.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.deployment.engine.feature</id>
                                    <version>${carbon.deployment.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.connector.framework.feature</id>
                                    <version>${org.wso2.carbon.transport.http.netty.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.metrics.core.feature</id>
                                    <version>${carbon.metrics.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.metrics.jdbc.core.feature</id>
                                    <version>${carbon.metrics.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.metrics.das.core.feature</id>
                                    <version>${carbon.metrics.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.jndi.feature</id>
                                    <version>${carbon.jndi.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.datasource.core.feature</id>
                                    <version>${carbon.datasources.version}</version>
                                </feature>
                            </features>
                        </configuration>
                    </execution>
                    <execution>
                        <id>publishing products</id>
                        <phase>package</phase>
                        <goals>
                            <goal>publish-product</goal>
                        </goals>
                        <configuration>
                            <executable>
                                ${basedir}/target/org.eclipse.equinox.executable_3.5.0.v20110530-7P7NFUFFLWUl76mart
                            </executable>
                            <repositoryURL>file:${basedir}/target/p2-repo</repositoryURL>
                        </configuration>
                    </execution>
                    <execution>
                        <id>materialize-product</id>
                        <phase>package</phase>
                        <goals>
                            <goal>generate-runtime</goal>
                        </goals>
                        <configuration>
                            <repositoryURL>file:${basedir}/target/p2-repo</repositoryURL>
                            <targetPath>file:${basedir}/target/wso2-msf4j-${msf4j.version}/wso2
                            </targetPath>
                            <runtime>default</runtime>
                        </configuration>
                    </execution>
                    <execution>
                        <id>feature-installation</id>
                        <phase>package</phase>
                        <goals>
                            <goal>install</goal>
                        </goals>
                        <configuration>
                            <runtime>default</runtime>
                            <repositoryURL>file:${basedir}/target/p2-repo</repositoryURL>
                            <destination>
                                ${basedir}/target/wso2-msf4j-${msf4j.version}/wso2
                            </destination>
                            <deleteOldRuntimeFiles>true</deleteOldRuntimeFiles>
                            <features>
                                <feature>
                                    <id>org.wso2.carbon.config.feature</id>
                                    <version>${carbon.config.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.secvault.feature</id>
                                    <version>${carbon.secvault.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.utils.feature</id>
                                    <version>${carbon.utils.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.server.feature.group</id>
                                    <version>${carbon.kernel.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.osgi.feature</id>
                                    <version>${carbon.kernel.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.deployment.engine.feature</id>
                                    <version>${carbon.deployment.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.msf4j.feature</id>
                                    <version>${msf4j.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.msf4j.deployer.feature</id>
                                    <version>${msf4j.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.pax.exam.feature</id>
                                    <version>${carbon.kernel.version}</version>
                                </feature>
                            </features>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <configuration>
                            <tasks>
                                <replace dir="target/wso2-msf4j-${msf4j.version}/wso2" token="false" value="true">
                                    <include name="**/bundles.info" />
                                </replace>
                            </tasks>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>clean_target</id>
                        <phase>install</phase>
                        <configuration>
                            <target>
                                <delete dir="target/archive-tmp" />
                                <delete dir="target/dependency-maven-plugin-markers" />
                                <delete dir="target/org.eclipse.equinox.executable-3.5.0.v20110530-7P7NFUFFLWUl76mart" />
                                <delete dir="target/p2-repo" />
                                <delete file="target/tmp" />
                                <delete dir="target/wso2-msf4j-${msf4j.version}" />
                                <delete dir="target/antrun" />
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptors>
                        <descriptor>${basedir}/src/assembly/bin.xml</descriptor>
                    </descriptors>
                    <finalName>wso2-msf4j-${msf4j.version}</finalName>
                    <appendAssemblyId>false</appendAssemblyId>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
