<!--
	~ Copyright (c) 2006, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
	~
	~ 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.mashup</groupId>
        <artifactId>org.wso2.mashup</artifactId>
        <version>1.0beta</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>wso2mashup-integration</artifactId>
    <packaging>jar</packaging>
    <version>1.0beta</version>
    <name>WSO2 Mashup Server - Integration Tests</name>

    <dependencies>
        <dependency>
            <groupId>org.wso2.mashup</groupId>
            <artifactId>wso2mashup-hostobjects</artifactId>
            <version>${pom.version}</version>
        </dependency>

        <dependency>
            <groupId>org.wso2.mashup</groupId>
            <artifactId>wso2mashup-javascriptdeployer</artifactId>
            <version>${pom.version}</version>
        </dependency>

        <dependency>
            <groupId>org.wso2.mashup</groupId>
            <artifactId>wso2mashup-core</artifactId>
            <version>${pom.version}</version>
        </dependency>

        <dependency>
            <groupId>httpunit</groupId>
            <artifactId>httpunit</artifactId>
            <version>${httpunit.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>rhino</groupId>
                    <artifactId>js</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>tidy</groupId>
            <artifactId>tidy</artifactId>
            <version>${tidy.version}</version>
        </dependency>
    </dependencies>

    <build>
        <sourceDirectory>src</sourceDirectory>
        <testSourceDirectory>test</testSourceDirectory>
        <resources>
            <resource>
                <directory>src</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.0-alpha-4</version>
                <executions>
                    <execution>
                        <id>download-addressing</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.wso2.wsas</groupId>
                                    <artifactId>wso2wsas</artifactId>
                                    <version>${wso2wsas.version}</version>
                                    <type>zip</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>target/zips</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>org.wso2.dynamiccodegen</groupId>
                                    <artifactId>wso2dynamic-codegen</artifactId>
                                    <version>${dynamicCodegen.version}</version>
                                    <type>zip</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>target/zips</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>yui</groupId>
                                    <artifactId>yui</artifactId>
                                    <version>${yui.version}</version>
                                    <type>zip</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>target/zips</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>yui-ext</groupId>
                                    <artifactId>yui-ext</artifactId>
                                    <version>${yui.ext.version}</version>
                                    <type>zip</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>target/zips</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>org.wso2.wsf.javascript.native</groupId>
                                    <artifactId>wsrequest</artifactId>
                                    <version>${wsrequest.version}</version>
                                    <type>zip</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>target/zips</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>codepress</groupId>
                                    <artifactId>codepress</artifactId>
                                    <version>${codepress.version}</version>
                                    <type>zip</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>target/zips</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>net.sf.xmljs</groupId>
                                    <artifactId>xml-for-script</artifactId>
                                    <version>${xml-for-script.version}</version>
                                    <type>zip</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>target/zips</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>org.wso2.dynamicresponse</groupId>
                                    <artifactId>wso2dynamic-response</artifactId>
                                    <version>${dynamicresponse.version}</version>
                                    <type>mar</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>target/dist-lib</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>org.apache.axis2</groupId>
                                    <artifactId>axis2</artifactId>
                                    <version>${axis2.version}</version>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>target/dist-lib</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.1</version>
                <executions>
                    <execution>
                        <id>create-test-resources</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <property name="wso2mashup.version" value="${wso2mashup.version}"/>
                                <property name="wso2mashup.version.number" value="${wso2mashup.version.number}"/>
                                <property name="httpPort" value="${httpPort}"/>
                                <property name="httpsPort" value="${httpsPort}"/>
                                <property name="commandPort" value="${commandPort}"/>
                                <property name="bcprov.jdk13.version" value="${bcprov.jdk13.version}"/>
                                <property name="bcprov.jdk15.version" value="${bcprov.jdk15.version}"/>
                                <property name="wso2wsas.version" value="${wso2wsas.version}"/>
                                <property name="dist.dir" value="${dist.dir}"/>
                                <property name="dynamicresponse.version" value="${dynamicresponse.version}"/>
                                <property name="dynamicCodegen.version" value="${dynamicCodegen.version}"/>
                                <property name="yui.version" value="${yui.version}"/>
                                <property name="yui.ext.version" value="${yui.ext.version}"/>
                                <property name="codepress.version" value="${codepress.version}"/>
                                <property name="xml-for-script.version" value="${xml-for-script.version}"/>
                                <property name="wsrequest.version" value="${wsrequest.version}"/>
                                <property name="derby.version" value="${derby.version}"/>

                                <property name="registry.driverClass" value="${registry.driverClass}"/>
                                <property name="registry.userid" value="${registry.userid}"/>
                                <property name="registry.password" value="${registry.password}"/>
                                <property name="registry.dbURL"
                                        value="jdbc:derby:${basedir}/${dist.dir}/database/WSO2REGISTRY_DB;create=true"/>

                                <property name="usermanager.driverClass" value="${usermanager.driverClass}"/>
                                <property name="usermanager.userid" value="${usermanager.userid}"/>
                                <property name="usermanager.password" value="${usermanager.password}"/>
                                <property name="usermanager.dbURL"
                                        value="jdbc:derby:${basedir}/${dist.dir}/database/WSO2USERMANAGER_DB;create=true"/>
                                
                                <ant antfile="../distribution/create-distro-build.xml" inheritall="true" inheritrefs="true"
                                         dir="." target="build-distro"/>

                                <copy todir="${dist.dir}/scripts/system">
                                    <fileset dir="test-resources/scripts"/>
                                </copy>
                                
                                <!--Copying in the RESTSample as its used to test HTTPBinding properties-->
                                <copy todir="${dist.dir}/scripts/system">
                                    <fileset dir="../samples/RESTSample"/>
                                </copy>

                                <move file="${dist.dir}/conf/log4j.properties" todir="target/test-classes" />
								<move file="${dist.dir}/conf/ui-extensions-config.xml" todir="target/test-classes" />
								<move file="${dist.dir}/conf/wso2wsas.hibernate.cfg.xml" todir="target/test-classes" />
								<move file="${dist.dir}/conf/wso2wsas.hbm.xml" todir="target/test-classes" />
								<move file="${dist.dir}/conf/wso2wsas.properties" todir="target/test-classes" />

                            </tasks>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <inherited>false</inherited>
                <configuration>
                    <!--<forkMode>pertest</forkMode>-->
                    <argLine>-enableassertions</argLine>
                    <testFailureIgnore>false</testFailureIgnore>
                    <skip>false</skip>
                    <includes>
                        <include>**/*IntegrationTestSuite.java</include>
                    </includes>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <properties>
        <testResources.dir>target</testResources.dir>
        <httpPort>11001</httpPort>
        <httpsPort>11002</httpsPort>
        <commandPort>11003</commandPort>
        <dist.dir>target/wso2-mashup</dist.dir>
    </properties>
</project>
