<!--

    Copyright 2015-2016 Red Hat, Inc. and/or its affiliates
    and other contributors as indicated by the @author tags.

    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">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.hawkular.commons</groupId>
    <artifactId>hawkular-nest-parent</artifactId>
    <version>0.3.4.Final</version>
  </parent>
  <artifactId>hawkular-nest-itest</artifactId>
  <name>Hawkular Nest Intagration Tests</name>

  <properties>
    <hawkular.nest.deployments.dir>${project.build.directory}/${project.artifactId}-${project.version}/modules/org/hawkular/nest/main/deployments</hawkular.nest.deployments.dir>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.jboss.arquillian</groupId>
        <artifactId>arquillian-bom</artifactId>
        <version>${version.org.jboss.arquillian}</version>
        <scope>import</scope>
        <type>pom</type>
      </dependency>

      <dependency>
        <groupId>org.hawkular.commons</groupId>
        <artifactId>hawkular-rest-status</artifactId>
        <version>${project.version}</version>
        <scope>test</scope>
      </dependency>

    </dependencies>
  </dependencyManagement>

  <dependencies>

    <dependency>
      <groupId>org.hawkular.commons</groupId>
      <artifactId>hawkular-nest-feature-pack</artifactId>
      <version>${project.version}</version>
      <type>pom</type>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.hawkular.commons</groupId>
      <artifactId>hawkular-nest-feature-pack</artifactId>
      <version>${project.version}</version>
      <type>zip</type>
      <exclusions>
        <exclusion>
          <groupId>*</groupId>
          <artifactId>*</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.hawkular.commons</groupId>
      <artifactId>hawkular-rest-status</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.jboss.resteasy</groupId>
      <artifactId>resteasy-jaxrs</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>javax.inject</groupId>
      <artifactId>javax.inject</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>javax.enterprise</groupId>
      <artifactId>cdi-api</artifactId>
      <scope>provided</scope>
    </dependency>


    <dependency>
      <groupId>org.hawkular.commons</groupId>
      <artifactId>hawkular-rest-status</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.jboss.resteasy</groupId>
      <artifactId>resteasy-jaxrs</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>javax.inject</groupId>
      <artifactId>javax.inject</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>javax.enterprise</groupId>
      <artifactId>cdi-api</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>com.squareup.okhttp</groupId>
      <artifactId>okhttp</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.jboss.arquillian.junit</groupId>
      <artifactId>arquillian-junit-container</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.wildfly</groupId>
      <artifactId>wildfly-arquillian-container-managed</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.jboss.shrinkwrap.resolver</groupId>
      <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
      <scope>test</scope>
    </dependency>

  </dependencies>


  <build>
    <plugins>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <systemPropertyVariables>
            <jboss.home>${project.build.directory}/${project.artifactId}-${project.version}</jboss.home>
            <shrinkwrap.maven.settings>${project.build.directory}/shrinkwrap-maven-settings.xml</shrinkwrap.maven.settings>
          </systemPropertyVariables>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.wildfly.build</groupId>
        <artifactId>wildfly-server-provisioning-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>server-provisioning</id>
            <goals>
              <goal>build</goal>
            </goals>
            <phase>compile</phase>
            <configuration>
              <config-file>server-provisioning.xml</config-file>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.codehaus.gmavenplus</groupId>
        <artifactId>gmavenplus-plugin</artifactId>
        <executions>
          <execution>
            <phase>compile</phase>
            <goals>
              <goal>execute</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <properties>
            <property>
              <name>someProp</name>
              <value>${someProp}</value>
            </property>
          </properties>
          <scripts>
            <script><![CDATA[
              import org.apache.maven.settings.io.xpp3.SettingsXpp3Writer
              import org.apache.maven.settings.SettingsUtils
              import org.apache.maven.settings.Settings

              Settings settings = SettingsUtils.copySettings(session.settings)
              settings.setServers(null)
              String outputPath = "${project.build.directory}/shrinkwrap-maven-settings.xml"
              Writer out = null
              try {
                out = new OutputStreamWriter(new FileOutputStream(new File(outputPath)), "utf-8")
                new SettingsXpp3Writer().write(out, settings)
              } finally {
                if (out != null) {
                  out.close()
                }
              }
            ]]></script>
          </scripts>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-all</artifactId>
            <version>${version.org.codehaus.groovy}</version>
            <scope>runtime</scope>
          </dependency>
        </dependencies>
      </plugin>

    </plugins>
  </build>

</project>