<?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>
    <parent>
        <groupId>org.apache.tuscany.sca.services.databinding</groupId>
        <artifactId>parent</artifactId>
        <version>1.0-incubator-M2-SNAPSHOT</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>databinding-test</artifactId>
    <packaging>jar</packaging>
    <name>Apache Tuscany Data Binding Integration Test</name>
    <description>Apache Tuscany Data Binding Integration Test</description>

    <repositories>
        <repository>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <id>java.net</id>
            <name>java.net Maven 1.x Repository</name>
            <url>https://maven-repository.dev.java.net/nonav/repository</url>
            <layout>legacy</layout>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.apache.tuscany.sca.kernel</groupId>
            <artifactId>tuscany-spi</artifactId>
            <version>${pom.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.tuscany.sca.services.databinding</groupId>
            <artifactId>databinding-jaxb</artifactId>
            <version>${pom.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.tuscany.sca.services.databinding</groupId>
            <artifactId>databinding-xmlbeans</artifactId>
            <version>${pom.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.tuscany.sca.services.databinding</groupId>
            <artifactId>databinding-axiom</artifactId>
            <version>${pom.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.tuscany.sca.services.databinding</groupId>
            <artifactId>databinding-sdo</artifactId>
            <version>${pom.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.tuscany.sca.services.idl</groupId>
            <artifactId>wsdl</artifactId>
            <version>${pom.version}</version>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>
        <dependency>
            <groupId>org.easymock</groupId>
            <artifactId>easymock</artifactId>
        </dependency>

        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>2.0.2</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.tuscany.sca</groupId>
            <artifactId>test</artifactId>
            <version>${sca.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>1.0</version>
                <executions>
                    <execution>
                        <id>add-test-source</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-test-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>target/jaxb-source</source>
                                <source>target/sdo-source</source>
                                <source>target/xmlbeans-source</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.tuscany.sdo</groupId>
                <artifactId>tuscany-sdo-plugin</artifactId>
                <executions>
                    <execution>
                        <id>generate-sdo</id>
                        <phase>generate-sources</phase>
                        <configuration>
                            <schemaFile>${basedir}/src/test/resources/ipo.xsd</schemaFile>
                            <javaPackage>com.example.ipo.sdo</javaPackage>
                            <noNotification>true</noNotification>
                            <noContainer>true</noContainer>
                            <noUnsettable>true</noUnsettable>
                        </configuration>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>com.sun.tools.xjc.maven2</groupId>
                <artifactId>maven-jaxb-plugin</artifactId>
                <version>1.0</version>
                <executions>
                    <execution>
                        <id>generate-jaxb</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <generatePackage>com.example.ipo.jaxb</generatePackage>
                    <generateDirectory>${project.build.directory}/jaxb-source</generateDirectory>
                    <schemaDirectory>${basedir}/src/test/resources</schemaDirectory>
                    <includeSchemas>
                        <includeSchema>ipo.xsd</includeSchema>
                    </includeSchemas>
                </configuration>
            </plugin>

            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <dependencies>
                    <dependency>
                        <groupId>xmlbeans</groupId>
                        <artifactId>xbean</artifactId>
                        <version>2.1.0</version>
                    </dependency>
                    <dependency>
                        <groupId>stax</groupId>
                        <artifactId>stax-api</artifactId>
                        <version>1.0.1</version>
                    </dependency>

                </dependencies>

                <executions>
                    <execution>
                        <id>generate-xmlbeans</id>
                        <phase>generate-sources</phase>
                        <configuration>
                            <tasks>
                                <taskdef name="xmlbean" classname="org.apache.xmlbeans.impl.tool.XMLBean"
                                    classpathref="maven.compile.classpath" />
                                <xmlbean schema="${basedir}/src/test/resources" classpathref="maven.compile.classpath"
                                    destfile="${project.build.directory}/ipo-xmlbeans.jar"
                                    srcgendir="${project.build.directory}/xmlbeans-source" javasource="1.5"
                                    classgendir="${project.build.directory}/test-classes" />
                            </tasks>
                            <!-- 
                                <sourceRoot>${project.build.directory}/xmlbeans-source</sourceRoot>
                                <testSourceRoot>${project.build.directory}/xmlbeans-source</testSourceRoot>
                            -->
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>
