<?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.camel</groupId>
    <artifactId>components</artifactId>
    <version>2.17.6</version>
  </parent>

  <artifactId>camel-box</artifactId>
  <packaging>bundle</packaging>
  <name>Camel :: Box.com</name>
  <description>Camel Component for Box.com</description>

  <properties>
    <schemeName>box</schemeName>
    <componentName>Box</componentName>
    <componentPackage>org.apache.camel.component.box</componentPackage>
    <outPackage>org.apache.camel.component.box.internal</outPackage>

    <camel.osgi.export.pkg>${componentPackage}</camel.osgi.export.pkg>
    <camel.osgi.private.pkg>${outPackage}</camel.osgi.private.pkg>
    <camel.osgi.export.service>org.apache.camel.spi.ComponentResolver;component=box</camel.osgi.export.service>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.httpcomponents</groupId>
      <artifactId>httpclient</artifactId>
      <version>${httpclient4-version}</version>
    </dependency>
    <dependency>
      <groupId>net.box</groupId>
      <artifactId>boxjavalibv2</artifactId>
      <version>${boxjavalibv2.version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.apache.httpcomponents</groupId>
          <artifactId>httpclient</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.httpcomponents</groupId>
          <artifactId>httpclient-cache</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.fasterxml.jackson.core</groupId>
          <artifactId>jackson-annotations</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.fasterxml.jackson.core</groupId>
          <artifactId>jackson-core</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.fasterxml.jackson.core</groupId>
          <artifactId>jackson-databind</artifactId>
        </exclusion>
        <exclusion>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.easymock</groupId>
          <artifactId>easymock</artifactId>
        </exclusion>
        <exclusion>
          <groupId>commons-io</groupId>
          <artifactId>commons-io</artifactId>
        </exclusion>
        <exclusion>
          <groupId>commons-lang</groupId>
          <artifactId>commons-lang</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>net.sourceforge.htmlunit</groupId>
      <artifactId>htmlunit</artifactId>
      <version>${htmlunit.version}</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
    </dependency>
<!--
    <dependency>
      <groupId>httpunit</groupId>
      <artifactId>httpunit</artifactId>
      <version>${httpunit.version}</version>
    </dependency>
-->
    <dependency>
      <groupId>org.apache.httpcomponents</groupId>
      <artifactId>httpcore</artifactId>
      <version>${httpcore4-version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.httpcomponents</groupId>
      <artifactId>httpmime</artifactId>
      <version>${httpclient4-version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.httpcomponents</groupId>
      <artifactId>httpclient-cache</artifactId>
      <version>${httpclient4-version}</version>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <version>${commons-io-version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <version>${commons-lang3-version}</version>
    </dependency>
    <dependency>
      <groupId>commons-lang</groupId>
      <artifactId>commons-lang</artifactId>
      <version>${commons-lang-version}</version>
    </dependency>

    <!-- Camel annotations in provided scope to avoid compile errors in IDEs -->
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>spi-annotations</artifactId>
      <version>${project.version}</version>
      <scope>provided</scope>
    </dependency>

    <!-- Component API javadoc in provided scope to read API signatures -->
    <dependency>
      <groupId>net.box</groupId>
      <artifactId>boxjavalibv2</artifactId>
      <version>${boxjavalibv2.version}</version>
      <classifier>javadoc</classifier>
      <scope>provided</scope>
    </dependency>

    <!-- logging -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
      <scope>test</scope>
    </dependency>

    <!-- testing -->
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-test</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>

      <!-- compile LongPollingEventsManager before generate-sources -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <executions>
          <execution>
            <id>compile-long-polling-events-mnager</id>
            <goals>
              <goal>compile</goal>
            </goals>
            <phase>generate-sources</phase>
            <configuration>
              <includes>
                <include>**/LongPollingEventsManager.java</include>
              </includes>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!-- generate Component source and test source -->
      <plugin>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-api-component-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>generate-test-component-classes</id>
            <goals>
              <goal>fromApis</goal>
            </goals>
            <configuration>
              <apis>
                <api>
                  <apiName>collaborations</apiName>
                  <proxyClass>com.box.boxjavalibv2.resourcemanagers.IBoxCollaborationsManager</proxyClass>
                  <fromJavadoc />
                </api>
                <api>
                  <apiName>comments</apiName>
                  <proxyClass>com.box.boxjavalibv2.resourcemanagers.IBoxCommentsManager</proxyClass>
                  <fromJavadoc />
                </api>
                <api>
                  <apiName>events</apiName>
                  <proxyClass>com.box.boxjavalibv2.resourcemanagers.IBoxEventsManager</proxyClass>
                  <fromJavadoc />
                </api>
                <api>
                  <apiName>files</apiName>
                  <proxyClass>com.box.boxjavalibv2.resourcemanagers.IBoxFilesManager</proxyClass>
                  <substitutions>
                    <substitution>
                      <method>^.+$</method>
                      <argName>^.+$</argName>
                      <argType>^\S+\.Box(.+)RequestObject</argType>
                      <replacement>$1Request</replacement>
                      <replaceWithType>true</replaceWithType>
                    </substitution>
                    <substitution>
                      <method>^.+$</method>
                      <argName>type</argName>
                      <argType>com.box.boxjavalibv2.dao.BoxResourceType</argType>
                      <replacement>resourceType</replacement>
                    </substitution>
                    <substitution>
                      <method>^.+$</method>
                      <argName>^id$</argName>
                      <replacement>fileId</replacement>
                    </substitution>
                  </substitutions>
                  <fromJavadoc />
                  <aliases>
                    <alias>
                      <methodPattern>[gs]et(.+)</methodPattern>
                      <methodAlias>$1</methodAlias>
                    </alias>
                    <alias>
                      <methodPattern>(create|update|upload|download)\\w+</methodPattern>
                      <methodAlias>$1</methodAlias>
                    </alias>
                  </aliases>
                </api>
                <api>
                  <apiName>folders</apiName>
                  <proxyClass>com.box.boxjavalibv2.resourcemanagers.IBoxFoldersManager</proxyClass>
                  <substitutions>
                    <substitution>
                      <method>^.+$</method>
                      <argName>^.+$</argName>
                      <argType>^\S+\.Box(.+)RequestObject</argType>
                      <replacement>$1Request</replacement>
                      <replaceWithType>true</replaceWithType>
                    </substitution>
                    <substitution>
                      <method>^.+$</method>
                      <argName>type</argName>
                      <argType>com.box.boxjavalibv2.dao.BoxResourceType</argType>
                      <replacement>resourceType</replacement>
                    </substitution>
                    <substitution>
                      <method>^.+$</method>
                      <argName>^id$</argName>
                      <replacement>folderId</replacement>
                    </substitution>
                  </substitutions>
                  <fromJavadoc />
                </api>
                <api>
                  <apiName>groups</apiName>
                  <proxyClass>com.box.boxjavalibv2.resourcemanagers.IBoxGroupsManager</proxyClass>
                  <substitutions>
                    <substitution>
                      <method>^.+$</method>
                      <argName>^.+$</argName>
                      <argType>^\S+\.Box(.+)RequestObject</argType>
                      <replacement>$1Request</replacement>
                      <replaceWithType>true</replaceWithType>
                    </substitution>
                    <substitution>
                      <method>^.+$</method>
                      <argName>type</argName>
                      <argType>com.box.boxjavalibv2.dao.BoxResourceType</argType>
                      <replacement>resourceType</replacement>
                    </substitution>
                    <substitution>
                      <method>^.+$</method>
                      <argName>^id$</argName>
                      <replacement>groupId</replacement>
                    </substitution>
                  </substitutions>
                  <fromJavadoc />
                  <aliases>
                    <alias>
                      <methodPattern>[gs]et(.+)</methodPattern>
                      <methodAlias>$1</methodAlias>
                    </alias>
                    <alias>
                      <methodPattern>(delete|update)\\w+</methodPattern>
                      <methodAlias>$1</methodAlias>
                    </alias>
                  </aliases>
                </api>
                <api>
                  <apiName>poll-events</apiName>
                  <proxyClass>org.apache.camel.component.box.internal.LongPollingEventsManager</proxyClass>
                  <fromSignatureFile>${project.basedir}/src/signatures/long-polling-events-manager.txt</fromSignatureFile>
                  <excludeConfigNames>callback</excludeConfigNames>
                  <nullableOptions />
                </api>
                <api>
                  <apiName>search</apiName>
                  <proxyClass>com.box.boxjavalibv2.resourcemanagers.IBoxSearchManager</proxyClass>
                  <fromJavadoc />
                </api>
                <api>
                  <apiName>shared-comments</apiName>
                  <proxyClass>com.box.boxjavalibv2.resourcemanagers.IBoxCommentsManager</proxyClass>
                </api>
                <api>
                  <apiName>shared-files</apiName>
                  <proxyClass>com.box.boxjavalibv2.resourcemanagers.IBoxFilesManager</proxyClass>
                  <aliases>
                    <alias>
                      <methodPattern>[gs]et(.+)</methodPattern>
                      <methodAlias>$1</methodAlias>
                    </alias>
                    <alias>
                      <methodPattern>(create|update|upload|download)\\w+</methodPattern>
                      <methodAlias>$1</methodAlias>
                    </alias>
                  </aliases>
                </api>
                <api>
                  <apiName>shared-folders</apiName>
                  <proxyClass>com.box.boxjavalibv2.resourcemanagers.IBoxFoldersManager</proxyClass>
                </api>
                <api>
                  <apiName>shared-items</apiName>
                  <proxyClass>com.box.boxjavalibv2.resourcemanagers.IBoxSharedItemsManager</proxyClass>
                  <fromJavadoc />
                </api>
                <api>
                  <apiName>users</apiName>
                  <proxyClass>com.box.boxjavalibv2.resourcemanagers.IBoxUsersManager</proxyClass>
                  <aliases>
                    <alias>
                      <methodPattern>[gs]et(.+)</methodPattern>
                      <methodAlias>$1</methodAlias>
                    </alias>
                    <alias>
                      <methodPattern>(create|update|upload|download)\\w+</methodPattern>
                      <methodAlias>$1</methodAlias>
                    </alias>
                  </aliases>
                  <fromJavadoc />
                </api>
              </apis>
              <!-- common substitutions -->
              <substitutions>
                <substitution>
                  <method>^.+$</method>
                  <argName>^.+$</argName>
                  <argType>^\S+\.Box(.+)RequestObject</argType>
                  <replacement>$1Request</replacement>
                  <replaceWithType>true</replaceWithType>
                </substitution>
                <substitution>
                  <method>^.+$</method>
                  <argName>type</argName>
                  <argType>com.box.boxjavalibv2.dao.BoxResourceType</argType>
                  <replacement>resourceType</replacement>
                </substitution>
<!--
                <substitution>
                  <method>^.+$</method>
                  <argName>.*(i|I)d</argName>
                  <replacement>id</replacement>
                </substitution>
-->
              </substitutions>
              <fromJavadoc>
                <excludeClasses>BoxResourceManager|BoxItemsManager</excludeClasses>
              </fromJavadoc>
              <nullableOptions>
                <nullableOption>defaultRequest</nullableOption>
              </nullableOptions>
              <aliases>
                <alias>
                  <methodPattern>[gs]et(.+)</methodPattern>
                  <methodAlias>$1</methodAlias>
                </alias>
                <alias>
                  <methodPattern>(create|delete|update)\\w+</methodPattern>
                  <methodAlias>$1</methodAlias>
                </alias>
              </aliases>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!-- add generated source and test source to build -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.8</version>
        <executions>
          <execution>
            <id>add-generated-sources</id>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>${project.build.directory}/generated-sources/camel-component</source>
              </sources>
            </configuration>
          </execution>
          <execution>
            <id>add-generated-test-sources</id>
            <goals>
              <goal>add-test-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>${project.build.directory}/generated-test-sources/camel-component</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>

    </plugins>

    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.camel</groupId>
          <artifactId>camel-api-component-maven-plugin</artifactId>
          <version>${project.version}</version>
          <configuration>
            <scheme>${schemeName}</scheme>
            <componentName>${componentName}</componentName>
            <componentPackage>${componentPackage}</componentPackage>
            <outPackage>${outPackage}</outPackage>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>

  </build>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-api-component-maven-plugin</artifactId>
        <version>${project.version}</version>
        <configuration>
          <scheme>${schemeName}</scheme>
          <componentName>${componentName}</componentName>
          <componentPackage>${componentPackage}</componentPackage>
          <outPackage>${outPackage}</outPackage>
        </configuration>
      </plugin>
    </plugins>
  </reporting>

  <profiles>
    <profile>
      <id>box-test</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <childDelegation>false</childDelegation>
              <useFile>true</useFile>
              <forkCount>1</forkCount>
	      <reuseForks>true</reuseForks>
              <forkedProcessTimeoutInSeconds>300</forkedProcessTimeoutInSeconds>
              <excludes>
                  <exclude>**/*XXXTest.java</exclude>
              </excludes>
              <includes>
                <include>**/*Test.java</include>
              </includes>
              <systemPropertyVariables>
                <camel.box.userName>${camel.box.userName}</camel.box.userName>
                <camel.box.userPassword>${camel.box.userPassword}</camel.box.userPassword>
                <camel.box.clientId>${camel.box.clientId}</camel.box.clientId>
                <camel.box.clientSecret>${camel.box.clientSecret}</camel.box.clientSecret>
              </systemPropertyVariables>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
