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

    Copyright (C) 2015 Red Hat, Inc.

    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>
        <artifactId>karaf</artifactId>
        <groupId>io.fabric8.kubernetes</groupId>
        <version>4.1.0</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <groupId>io.fabric8.kubernetes</groupId>
    <artifactId>kubernetes-karaf-itests</artifactId>
    <name>Fabric8 :: Kubernetes :: Platforms :: Karaf :: Tests</name>

    <dependencies>

        <dependency>
            <groupId>io.fabric8</groupId>
            <artifactId>openshift-client</artifactId>
            <version>${project.version}</version>
            <classifier>bundle</classifier>
        </dependency>
        <dependency>
            <groupId>io.fabric8</groupId>
            <artifactId>kubernetes-client</artifactId>
            <version>${project.version}</version>
            <classifier>bundle</classifier>
        </dependency>

        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.core</artifactId>
            <version>${osgi.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.karaf.itests</groupId>
            <artifactId>itests</artifactId>
            <version>${karaf.version}</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.karaf</groupId>
            <artifactId>apache-karaf-minimal</artifactId>
            <version>${karaf.version}</version>
            <scope>test</scope>
            <type>tar.gz</type>
            <exclusions>
                <exclusion>
                    <artifactId>org.apache.karaf.client</artifactId>
                    <groupId>org.apache.karaf</groupId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.ops4j.pax.exam</groupId>
            <artifactId>pax-exam-container-karaf</artifactId>
            <version>${pax.exam.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.ops4j.pax.exam</groupId>
            <artifactId>pax-exam-junit4</artifactId>
            <version>${pax.exam.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-atinject_1.0_spec</artifactId>
            <version>1.0</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.servicemix.tooling</groupId>
                <artifactId>depends-maven-plugin</artifactId>
                <version>1.3</version>
                <executions>
                    <execution>
                        <id>generate-depends-file</id>
                        <goals>
                            <goal>generate-depends-file</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-features-xml</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>io.fabric8.kubernetes</groupId>
                                    <artifactId>kubernetes-karaf</artifactId>
                                    <version>${project.version}</version>
                                    <classifier>features</classifier>
                                    <type>xml</type>
                                    <outputDirectory>${project.build.directory}/</outputDirectory>
                                    <destFileName>features.xml</destFileName>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.karaf.tooling</groupId>
                <artifactId>karaf-maven-plugin</artifactId>
                <version>${karaf.version}</version>
                <executions>
                    <execution>
                        <id>add-features-to-repo</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>features-add-to-repository</goal>
                        </goals>
                        <configuration>
                            <features>
                                <feature>kubernetes-client</feature>
                                <feature>openshift-client</feature>
                            </features>
                            <descriptors>
                                <descriptor>file:${project.build.directory}/features.xml</descriptor>
                            </descriptors>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <skip>${karaf.itest.skip}</skip>
                    <systemPropertyVariables>
                        <features.xml>${project.build.directory}/features.xml</features.xml>
                        <features.repo>${project.build.directory}/features-repo</features.repo>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>
