<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~  Licensed to the Apache Software Foundation (ASF) under one
  ~  or more contributor license agreements.  See the NOTICE file
  ~  distributed with this work for additional information
  ~  regarding copyright ownership.  The ASF licenses this file
  ~  to you 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">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.apache.synapse</groupId>
        <artifactId>Apache-Synapse</artifactId>
        <version>4.0.0-wso2v16</version>
        <relativePath>../../pom.xml</relativePath>
    </parent>

    <groupId>org.apache.synapse</groupId>
    <artifactId>synapse-integration</artifactId>

    <name>Apache Synapse - Integration</name>
    <description>Apache Synapse - Sample Automation Framework</description>

    <scm>
        <connection>scm:svn:http://svn.apache.org/repos/asf/synapse/trunk/java/modules/integration</connection>
        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/synapse/trunk/java/modules/integration</developerConnection>
        <url>http://svn.apache.org/viewvc/synapse/trunk/java/modules/integration</url>
      <tag>v4.0.0-wso2v16</tag>
  </scm>

    <build>
        <plugins>
            <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>
                                <echo message="*** Creating testing repositories for synapse samples" />
                                <mkdir dir="target/test_repos" />
                                <mkdir dir="target/test_repos/axis2Server" />
                                <mkdir dir="target/test_repos/axis2Client" />
                                <mkdir dir="target/test_repos/synapse" />
                                <mkdir dir="target/test_repos/synapse" />
                                <mkdir dir="target/test_repos/synapse/modules" />
                                <mkdir dir="target/test_repos/synapse/conf" />
                                <mkdir dir="target/test_repos/axis2Server/services" />
                                <mkdir dir="target/test_repos/axis2Server/modules" />
                                <mkdir dir="target/test_repos/axis2Server/conf" />
                                <mkdir dir="target/test_repos/axis2Client/modules" />
                                <mkdir dir="target/test_repos/axis2Client/conf" />

                                <copy todir="target/test_repos/axis2Server/conf/">
                                    <fileset dir="src/test/resources/axis2Xml/axis2Server">
                                        <include name="*.xml" />
                                    </fileset>
                                </copy>
                                <copy todir="target/test_repos/synapse/conf/">
                                    <fileset dir="src/test/resources/axis2Xml/synapse">
                                        <include name="*.xml" />
                                    </fileset>
                                </copy>
                                <copy todir="target/test_repos/axis2Client/conf/">
                                    <fileset dir="src/test/resources/axis2Xml/axis2Client">
                                        <include name="*.xml" />
                                    </fileset>
                                </copy>

                                <!--<copy file="src/test/resources/trust.jks"-->
                                <!--tofile="target/test_repos/synapse/conf/trust.jks" />-->
                                <!--<copy file="src/test/resources/identity.jks"-->
                                <!--tofile="target/test_repos/synapse/conf/identity.jks" />-->
                                <!--<copy file="../core/src/test/resources/keystore.jks"-->
                                <!--tofile="target/test_repos/synapse/conf/keystore.jks" />-->

                                <property name="temp.dir" value="target/temp" />
                                <property name="classes" value="${temp.dir}/classes" />
                                <property name="services" value="target/test_repos/axis2Server/services" />

                                <property name="src" value="../samples/services/SimpleStockQuoteService/src" />

                                <mkdir dir="${temp.dir}" />
                                <mkdir dir="${classes}" />

                                <javac source="${java.version}" target="${java.version}" debug="on" destdir="${classes}" fork="true" includeantruntime="false">
                                    <src path="${src}" />
                                    <classpath refid="maven.compile.classpath" />
                                </javac>

                                <property name="SSQ.dir" value="${temp.dir}/SimpleStockQuote" />
                                <mkdir dir="${SSQ.dir}" />

                                <mkdir dir="${SSQ.dir}/META-INF" />
                                <copy file="${src}/../conf/services.xml" tofile="${SSQ.dir}/META-INF/services.xml" />
                                <!--<copy file="${src}/../wsdl/SimpleStockQuoteService.wsdl"-->
                                <!--tofile="${SSQ.dir}/META-INF/service.wsdl" />-->
                                <copy toDir="${SSQ.dir}">
                                    <fileset dir="${classes}">
                                        <include name="**/*.class" />
                                    </fileset>
                                </copy>

                                <jar destfile="${services}/SimpleStockQuoteService.aar">
                                    <fileset dir="${SSQ.dir}" />
                                </jar>

                                <property name="src2" value="../samples/services/SecureStockQuoteService/src" />
                                <delete dir="${temp.dir}" />
                                <mkdir dir="${temp.dir}" />
                                <mkdir dir="${classes}" />
                                <javac source="${java.version}" target="${java.version}" debug="on" destdir="${classes}" fork="true" includeantruntime="false">
                                    <src path="${src2}" />
                                    <classpath refid="maven.compile.classpath" />
                                </javac>
                                <property name="SSQ2.dir" value="${temp.dir}/SecureStockQuoteService" />
                                <mkdir dir="${SSQ2.dir}" />
                                <mkdir dir="${SSQ2.dir}/META-INF" />
                                <copy file="${src2}/../conf/services.xml" tofile="${SSQ2.dir}/META-INF/services.xml" />
                                <!--<copy file="${src2}/../wsdl/SimpleStockQuoteService.wsdl"-->
                                <!--tofile="${SSQ2.dir}/META-INF/service.wsdl" />-->
                                <copy file="${src2}/../store.jks" tofile="${SSQ2.dir}/store.jks" />
                                <copy toDir="${SSQ2.dir}">
                                    <fileset dir="${classes}">
                                        <include name="**/*.class" />
                                    </fileset>
                                </copy>
                                <jar destfile="${services}/SecureStockQuoteService.aar">
                                    <fileset dir="${SSQ2.dir}" />
                                </jar>

                                <property name="src3" value="../samples/services/MTOMSwASampleService/src" />
                                <delete dir="${temp.dir}" />
                                <mkdir dir="${temp.dir}" />
                                <mkdir dir="${classes}" />
                                <javac source="${java.version}" target="${java.version}" debug="on" destdir="${classes}" fork="true" includeantruntime="false">
                                    <src path="${src3}" />
                                    <classpath refid="maven.compile.classpath" />
                                </javac>
                                <property name="SSQ3.dir" value="${temp.dir}/MTOMSwASampleService" />
                                <mkdir dir="${SSQ3.dir}" />
                                <mkdir dir="${SSQ3.dir}/META-INF" />
                                <copy file="${src3}/../conf/services.xml" tofile="${SSQ3.dir}/META-INF/services.xml" />
                                <copy toDir="${SSQ3.dir}">
                                    <fileset dir="${classes}">
                                        <include name="**/*.class" />
                                    </fileset>
                                </copy>
                                <jar destfile="${services}/MTOMSwASampleService.aar">
                                    <fileset dir="${SSQ3.dir}" />
                                </jar>

                                <property name="src5" value="../samples/services/LoadbalanceFailoverService/src" />
                                <delete dir="${temp.dir}" />
                                <mkdir dir="${temp.dir}" />
                                <mkdir dir="${classes}" />
                                <javac source="${java.version}" target="${java.version}" debug="on" destdir="${classes}" fork="true" includeantruntime="false">
                                    <src path="${src5}" />
                                    <classpath refid="maven.compile.classpath" />
                                </javac>

                                <property name="LBFA1.dir" value="${temp.dir}/LBService1" />
                                <mkdir dir="${LBFA1.dir}" />

                                <mkdir dir="${LBFA1.dir}/META-INF" />
                                <copy file="${src5}/../conf/service1/services.xml" tofile="${LBFA1.dir}/META-INF/services.xml" />
                                <copy toDir="${LBFA1.dir}">
                                    <fileset dir="${classes}">
                                        <include name="**/LBService1.class" />
                                    </fileset>
                                </copy>

                                <jar destfile="${services}/LBService1.aar">
                                    <fileset dir="${LBFA1.dir}" />
                                </jar>

                                <property name="LBFA2.dir" value="${temp.dir}/LBService2" />
                                <mkdir dir="${LBFA2.dir}" />

                                <mkdir dir="${LBFA2.dir}/META-INF" />
                                <copy file="${src5}/../conf/service2/services.xml" tofile="${LBFA2.dir}/META-INF/services.xml" />
                                <copy toDir="${LBFA2.dir}">
                                    <fileset dir="${classes}">
                                        <include name="**/LBService2.class" />
                                    </fileset>
                                </copy>

                                <jar destfile="${services}/LBService2.aar">
                                    <fileset dir="${LBFA2.dir}" />
                                </jar>

                            </tasks>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>


            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy</id>
                        <phase>generate-test-resources</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.apache.axis2</groupId>
                                    <artifactId>addressing</artifactId>
                                    <version>${addressing.version}</version>
                                    <type>mar</type>
                                    <outputDirectory>target/test_repos/axis2Server/modules
                                    </outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>org.apache.rampart</groupId>
                                    <artifactId>rampart</artifactId>
                                    <version>${rampart.version}</version>
                                    <type>mar</type>
                                    <outputDirectory>target/test_repos/axis2Server/modules
                                    </outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>org.apache.axis2</groupId>
                                    <artifactId>addressing</artifactId>
                                    <version>${addressing.version}</version>
                                    <type>mar</type>
                                    <outputDirectory>target/test_repos/axis2Client/modules
                                    </outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>org.apache.rampart</groupId>
                                    <artifactId>rampart</artifactId>
                                    <version>${rampart.version}</version>
                                    <type>mar</type>
                                    <outputDirectory>target/test_repos/axis2Client/modules
                                    </outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>org.apache.axis2</groupId>
                                    <artifactId>addressing</artifactId>
                                    <version>${addressing.version}</version>
                                    <type>mar</type>
                                    <outputDirectory>target/test_repos/synapse/modules
                                    </outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>org.apache.rampart</groupId>
                                    <artifactId>rampart</artifactId>
                                    <version>${rampart.version}</version>
                                    <type>mar</type>
                                    <outputDirectory>target/test_repos/synapse/modules
                                    </outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.11</version>
                <configuration>
                    <systemPropertyVariables>
                        <property>
                            <name>suite</name>
                            <value>${suite}</value>
                            <name>tests</name>
                            <value>${tests}</value>
                        </property>
                        <timeStamp>${maven.build.timestamp}</timeStamp>
                    </systemPropertyVariables>
                    <argLine>-Xms128m -Xmx384m -XX:MaxPermSize=128m</argLine>
                    <!-- The working directory must be set to the root directory of the Synapse project because the
                         test cases use the configuration files in the repository directory (repository/conf/sample/*.xml)
                         and some of these configuration files contain URLs that are relative to the current working
                         directory (file:repository/...). -->
                    <workingDirectory>../..</workingDirectory>
                    <!--redirectTestOutputToFile>true</redirectTestOutputToFile-->
                    <forkMode>pertest</forkMode>
                </configuration>
            </plugin>

        </plugins>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-report-plugin</artifactId>
                <version>2.11</version>
                <configuration>
                    <outputName>sample_automation</outputName>
                </configuration>
            </plugin>
        </plugins>
    </reporting>

    <dependencies>
        <dependency>
            <groupId>xml-apis</groupId>
            <artifactId>xml-apis</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.synapse</groupId>
            <artifactId>synapse-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.synapse</groupId>
            <artifactId>synapse-commons</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.synapse</groupId>
            <artifactId>synapse-extensions</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.synapse</groupId>
            <artifactId>synapse-samples</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-adb</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>javax.ws.rs</groupId>
                    <artifactId>jsr311-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.rampart</groupId>
            <artifactId>rampart-core</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>log4j-over-slf4j</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>jcl-over-slf4j</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-transport-base</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2.transport</groupId>
            <artifactId>axis2-transport-jms</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jruby</groupId>
            <artifactId>jruby-complete</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.derby</groupId>
            <artifactId>derbyclient</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.derby</groupId>
            <artifactId>derbynet</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.derby</groupId>
            <artifactId>derby</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>activemq-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mozilla</groupId>
            <artifactId>rhino</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>tomcat-dbcp</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
             <groupId>net.sf.saxon</groupId>
             <artifactId>saxon</artifactId>
             <scope>test</scope>
        </dependency>
        <dependency>
             <groupId>net.sf.saxon</groupId>
             <artifactId>saxon-xqj</artifactId>
             <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.wso2.caching</groupId>
            <artifactId>wso2caching-core</artifactId>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>javax.ws.rs-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.containers</groupId>
            <artifactId>jersey-container-grizzly2-servlet</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.core</groupId>
            <artifactId>jersey-client</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.inject</groupId>
            <artifactId>jersey-hk2</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

</project>
