<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright © 2019 CMCC Corporation and others. All rights reserved. This 
    program and the accompanying materials are made available under the terms 
    of the Eclipse Public License v1.0 which accompanies this distribution, and 
    is available at http://www.eclipse.org/legal/epl-v10.html -->
<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">

    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.opendaylight.controller</groupId>
        <artifactId>mdsal-it-parent</artifactId>
        <version>1.7.4</version>
        <relativePath />
    </parent>

    <groupId>com.cmcc.cmhi</groupId>
    <artifactId>driver-layer-it</artifactId>
    <version>0.1.0</version>
    <!-- <name> formatting is used by autorelease to parse and notify projects 
        on build failure. Please do not modify this unless you have a good reason. -->
    <name>ODL :: com.cmcc.cmhi :: ${project.artifactId}</name>
    <packaging>bundle</packaging>

    <properties>
        <!-- 修改这里,跳过集成测试 -->
        <skipITs>false</skipITs>
        <karaf.distro.groupId>org.opendaylight.odlparent</karaf.distro.groupId>
        <karaf.distro.artifactId>opendaylight-karaf-empty</karaf.distro.artifactId>
        <karaf.distro.version>3.1.4</karaf.distro.version>
        <karaf.distro.type>zip</karaf.distro.type>
    </properties>

    <dependencies>
        <!-- 被测试的功能模块 -->
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>features-driver-all</artifactId>
            <version>${project.version}</version>
            <classifier>features</classifier>
            <type>xml</type>
        </dependency>

        <!-- Dependencies for pax exam karaf container -->
        <dependency>
            <groupId>org.ops4j.pax.exam</groupId>
            <artifactId>pax-exam-container-karaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.ops4j.pax.exam</groupId>
            <artifactId>pax-exam-junit4</artifactId>
        </dependency>
        <dependency>
            <groupId>org.ops4j.pax.exam</groupId>
            <artifactId>pax-exam</artifactId>
        </dependency>
        <dependency>
            <groupId>org.ops4j.pax.exam</groupId>
            <artifactId>pax-exam-features</artifactId>
            <type>xml</type>

            <!-- FIXME: remove version declaration and scope once odlparent has this -->
            <!-- <version>${exam.version}</version> -->
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.ops4j.pax.exam</groupId>
            <artifactId>pax-exam-extender-service</artifactId>

            <!-- FIXME: remove version declaration and scope once odlparent has this -->
            <!-- <version>${exam.version}</version> -->
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.ops4j.pax.exam</groupId>
            <artifactId>pax-exam-inject</artifactId>

            <!-- FIXME: remove version declaration and scope once odlparent has this -->
            <!-- <version>${exam.version}</version> -->
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.ops4j.pax.exam</groupId>
            <artifactId>pax-exam-invoker-junit</artifactId>

            <!-- FIXME: remove version declaration and scope once odlparent has this -->
            <!-- <version>${exam.version}</version> -->
            <scope>test</scope>
        </dependency>


        <dependency>
            <groupId>org.ops4j.pax.url</groupId>
            <artifactId>pax-url-aether</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <!-- <version>1</version> -->
        </dependency>
        <dependency>
            <groupId>org.apache.karaf.features</groupId>
            <artifactId>org.apache.karaf.features.core</artifactId>
            <version>${karaf.version}</version>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.core</artifactId>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>

        <!-- Testing Dependencies -->
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <!-- <version>${maven.surefire.version}</version> -->
                <configuration>
                    <systemPropertyVariables>
                        <!-- CONTROLLER-1799: Use the same repository for Pax Exam as is used 
                            for Maven -->
                        <org.ops4j.pax.url.mvn.localRepository>${settings.localRepository}</org.ops4j.pax.url.mvn.localRepository>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                        <configuration>
                            <systemProperties>
                                <property>
                                    <name>karaf.distro.groupId</name>
                                    <value>${karaf.distro.groupId}</value>
                                </property>
                                <property>
                                    <name>karaf.distro.artifactId</name>
                                    <value>${karaf.distro.artifactId}</value>
                                </property>
                                <property>
                                    <name>karaf.distro.version</name>
                                    <value>${karaf.distro.version}</value>
                                </property>
                                <property>
                                    <name>karaf.distro.type</name>
                                    <value>${karaf.distro.type}</value>
                                </property>
                                <property>
                                    <name>karaf.keep.unpack</name>
                                    <value>${karaf.keep.unpack}</value>
                                </property>
                            </systemProperties>
                            <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- Needed if you use versionAsInProject() -->
            <plugin>
                <groupId>org.apache.servicemix.tooling</groupId>
                <artifactId>depends-maven-plugin</artifactId>
                <configuration>
                    <!-- 这个配置是use versionAsInProject()关键 -->
                    <outputFile>${project.build.directory}/test-classes/META-INF/maven/dependencies.properties</outputFile>
                </configuration>
                <executions>
                    <execution>
                        <id>generate-depends-file</id>
                        <goals>
                            <goal>generate-depends-file</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>