<!--
  ~ Copyright 2005-2007 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.wsas</groupId>
        <artifactId>org.wso2.wsas</artifactId>
        <version>2.2-RC2</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>wso2wsas-integration</artifactId>
    <packaging>jar</packaging>
    <name>Integration</name>
    <description>This module contains the integration test suite for WSO2 WSAS</description>

    <dependencies>

        <!-- WSAS Dependencies -->
        <dependency>
            <groupId>org.wso2.wsas</groupId>
            <artifactId>wso2wsas-core</artifactId>
            <version>${pom.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.wso2.wsas</groupId>
            <artifactId>wso2wsas-admin</artifactId>
            <version>${pom.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.wso2.wsas</groupId>
            <artifactId>wso2wsas-samples-chad</artifactId>
            <version>${pom.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.wso2.wsas</groupId>
            <artifactId>wso2wsas-samples-commodityquote</artifactId>
            <version>${pom.version}</version>
            <scope>test</scope>
        </dependency>

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

        <dependency>
            <groupId>org.wso2.wsas</groupId>
            <artifactId>wso2wsas-samples-tinyurl</artifactId>
            <version>${pom.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.wso2.wsas</groupId>
            <artifactId>wso2wsas-samples-trader</artifactId>
            <version>${pom.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.wso2.wsas</groupId>
            <artifactId>wso2wsas-core</artifactId>
            <version>${pom.version}</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>

        <!-- System dependency -->
        <dependency>
            <groupId>sun.jdk</groupId>
            <artifactId>tools</artifactId>
            <version>${java.version}</version>
            <scope>system</scope>
            <!--<systemPath>${java.home}/../lib/tools.jar</systemPath>-->
            <systemPath>${toolsjar}</systemPath>
        </dependency>

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

    </dependencies>

    <build>
        <sourceDirectory>src</sourceDirectory>
        <testSourceDirectory>test</testSourceDirectory>

        <testResources>
            <testResource>
                <directory>../core/test-resources</directory>
                <includes>
                    <include>**/*.cfg.xml</include>
                </includes>
            </testResource>
            <testResource>
                <directory>../core/conf/hibernate</directory>
                <includes>
                    <include>**/*.hbm.xml</include>
                </includes>
            </testResource>
            <testResource>
                <directory>../core/conf</directory>
                <includes>
                    <include>**/*.properties</include>
                </includes>
            </testResource>
        </testResources>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.4</source>
                    <target>1.4</target>
                </configuration>
            </plugin>


            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <inherited>false</inherited>
                <configuration>
                    <systemProperties>
                        <property>
                            <name>log4j.configuration</name>
                            <value>file:../core/conf/log4j.properties</value>
                        </property>
                        <property>
                            <name>maven.test.haltafterfailure</name>
                            <value>false</value>
                        </property>
                        <property>
                            <name>wsas.test.timeout</name>
                            <value>1200000</value>
                        </property>
                    </systemProperties>
                    <forkMode>pertest</forkMode>
                    <argLine>-enableassertions</argLine>
                    <testFailureIgnore>false</testFailureIgnore>
                    <skip>false</skip>
                    <forkMode>pertest</forkMode>
                    <argLine>-enableassertions</argLine>
                    <excludes>
                        <exclude>**/TraderServiceIntegrationTest.java</exclude>
                        <exclude>**/WSDLInfoServiceTest.java</exclude>
                        <exclude>**/RestSupportTest.java</exclude>
                        <exclude>**/CommodityQuoteServiceIntegrationTest.java</exclude>
                        <exclude>**/TraderServiceIntegrationTest.java</exclude>
                        <exclude>**/LoadTest.java</exclude>
                    </excludes>
                    <includes>
                        <include>**/*IntegrationTestSuite.java</include>
                    </includes>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>

                    <execution>
                        <id>create_repo</id>
                        <phase>generate-test-resources</phase>
                        <configuration>
                            <tasks>

                                <mkdir dir="target/test-classes"/>
                                <mkdir dir="target/tmp/service"/>

                                <copy file="test-resources/META-INF/integration-services.xml"
                                      tofile="target/tmp/service/META-INF/services.xml"/>
                                <jar jarfile="target/wso2wsas-test-integration.aar"
                                     basedir="target/tmp/service">
                                    <include name="**"/>
                                </jar>

                                <delete dir="target/tmp"/>

                                <copy todir="target/tomcat_test">
                                    <fileset dir="../core/target/tomcat_test"/>
                                </copy>

                                <mkdir dir="target/tomcat_test/lib/tomcat/conf"/>
                                <copy todir="target/tomcat_test/lib/tomcat/conf">
                                     <fileset dir="../core/lib/appservers/tomcat/embedded"/>
                                </copy>

                                <!-- Start setting directories for documentation -->
                                
                                <mkdir dir="target/tomcat_test/lib/tomcat/webapps/ROOT/test_docs"/>
                                <copy todir="target/tomcat_test/lib/tomcat/webapps/ROOT/test_docs">
                                    <fileset dir="../documentation/target/site"/>
                                </copy>
                                <copy todir="target/tomcat_test/lib/tomcat/webapps/ROOT/test_docs">
                                    <fileset dir="../samples">
                                         <include name="**/wsdl/**.wsdl"/>
                                    </fileset>
                                </copy>
                                <!-- Finish setting directories for documentation -->

                                <copy todir="target/tomcat_test/repository/modules"
                                      file="../admin/target/wso2wsas-admin-${wso2.admin.module.version}.mar"/>
                                <copy file="target/wso2wsas-test-integration.aar"
                                      tofile="target/tomcat_test/repository/services/wso2wsas-test-integration.aar"/>

                                <copy file="../core/target/version.aar"
                                      tofile="target/tomcat_test/repository/services/version.aar"/>

                                <!-- Commodityquote integration test -->
                                <property name="test_service_repo"
                                          value="target/tomcat_test/repository/services"/>
                                <property name="CQ.dir"
                                          value="${test_service_repo}/CommodityQuote"/>
                                <mkdir dir="${CQ.dir}"/>

                                <mkdir dir="${CQ.dir}/META-INF"/>
                                <copy file="../samples/CommodityQuote/conf/services.xml"
                                      tofile="${CQ.dir}/META-INF/services.xml"/>
                                <copy file="../samples/CommodityQuote/wsdl/CommodityQuote.wsdl"
                                      tofile="${CQ.dir}/META-INF/service.wsdl"/>
                                <copy toDir="${CQ.dir}">
                                    <fileset dir="../samples/CommodityQuote/target/classes">
                                        <include name="**/services/**/*.class"/>
                                    </fileset>
                                </copy>

                                <!-- Trader service integration test -->

                                <property name="TC.dir" value="${test_service_repo}/TraderClient"/>
                                <mkdir dir="${TC.dir}"/>

                                <mkdir dir="${TC.dir}/META-INF"/>
                                <copy file="../samples/Trader/conf/Trader_Client_services.xml"
                                      tofile="${TC.dir}/META-INF/services.xml"/>
                                <copy file="../samples/Trader/wsdl/Trader_Client.wsdl"
                                      tofile="${TC.dir}/META-INF/service.wsdl"/>


                                <property name="TE.dir"
                                          value="${test_service_repo}/TraderExchange"/>
                                <mkdir dir="${TE.dir}"/>

                                <mkdir dir="${TE.dir}/META-INF"/>
                                <copy file="../samples/Trader/conf/Trader_Exchange_services.xml"
                                      tofile="${TE.dir}/META-INF/services.xml"/>
                                <copy file="../samples/Trader/wsdl/Trader_Exchange.wsdl"
                                      tofile="${TE.dir}/META-INF/service.wsdl"/>


                                <property name="BE.dir"
                                          value="${test_service_repo}/ExchangeClient"/>
                                <mkdir dir="${BE.dir}"/>

                                <mkdir dir="${BE.dir}/META-INF"/>
                                <copy file="../samples/Trader/conf/Exchange_Client_services.xml"
                                      tofile="${BE.dir}/META-INF/services.xml"/>
                                <copy file="../samples/Trader/wsdl/Exchange_Client.wsdl"
                                      tofile="${BE.dir}/META-INF/service.wsdl"/>

                                <property name="ET.dir"
                                          value="${test_service_repo}/ExchangeTrader"/>
                                <mkdir dir="${ET.dir}"/>

                                <mkdir dir="${ET.dir}/META-INF"/>
                                <copy file="../samples/Trader/conf/Exchange_Trader_services.xml"
                                      tofile="${ET.dir}/META-INF/services.xml"/>
                                <copy file="../samples/Trader/wsdl/Exchange_Trader.wsdl"
                                      tofile="${ET.dir}/META-INF/service.wsdl"/>


                            </tasks>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <configuration>
                    <enableRulesSummary>false</enableRulesSummary>
                </configuration>
            </plugin>
            <!--<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clover-plugin</artifactId>
                <configuration>
                    <licenseLocation>${clover.license.file}</licenseLocation>
                    <targetPercentage>60%</targetPercentage>
                    <generateHtml>true</generateHtml>
                    <generatePdf>false</generatePdf>
                    <generateXml>false</generateXml>
                    <excludes>
                        <exclude>**/*TestSuite.java</exclude>
                        <exclude>**/*Test.java</exclude>
                    </excludes>
                </configuration>
                <executions>
                    <execution>
                        <phase>verify</phase>
                        <goals>
                            <goal>aggregate</goal>
                            <goal>instrument</goal>
                            <goal>clover</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>-->
        </plugins>
    </build>
    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-report-plugin</artifactId>
                <configuration>
                    <outputDirectory>../../target/site/${artifactId}</outputDirectory>
                    <reportsDirectory>target/surefire-reports</reportsDirectory>
                    <outputName>${artifactId}-test-report</outputName>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jxr-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <configuration>
                    <outputDirectory>../../target/site/${artifactId}</outputDirectory>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>findbugs-maven-plugin</artifactId>
                <version>1.1.1</version>
                <configuration>
                    <!--<xmlOutput>true|false</xmlOutput>
                    <xmlOutputDirectory>
                    directory location of xml findbugs report
                    </xmlOutputDirectory>
                    <threshold>Normal</threshold>
                    <effort>Default</effort>
                    <excludeFilterFile>findbugs-exclude.xml</excludeFilterFile>
                    <includeFilterFile>findbugs-include.xml</includeFilterFile>
                    <visitors>FindDeadLocalStores,UnreadFields</visitors>
                    <omitVisitors>FindDeadLocalStores,UnreadFields</omitVisitors>
                    <onlyAnalyze>org.codehaus.mojo.findbugs.*</onlyAnalyze>
                    <pluginList>/libs/fb-contrib/fb-contrib-2.8.0.jar</pluginList>
                    <debug>true|false</debug>
                    <relaxed>true|false</relaxed>-->
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
            </plugin>
           <!-- <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clover-plugin</artifactId>
            </plugin>-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-pmd-plugin</artifactId>
            </plugin>
        </plugins>
    </reporting>
</project>
