<?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.25.4</version>
  </parent>

  <artifactId>camel-braintree</artifactId>
  <packaging>jar</packaging>
  <name>Camel :: Braintree</name>
  <description>Camel Braintree support</description>

  <properties>
    <schemeName>braintree</schemeName>
    <componentName>Braintree</componentName>
    <componentPackage>org.apache.camel.component.braintree</componentPackage>
    <outPackage>org.apache.camel.component.braintree.internal</outPackage>

    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

    <camel.osgi.export.pkg>${componentPackage}</camel.osgi.export.pkg>
    <camel.osgi.private.pkg>${outPackage}</camel.osgi.private.pkg>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-core</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>com.braintreepayments.gateway</groupId>
      <artifactId>braintree-java</artifactId>
      <version>${braintree-gateway-version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.json</groupId>
          <artifactId>json</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <!-- Component API javadoc in provided scope to read API signatures -->
    <dependency>
      <groupId>com.braintreepayments.gateway</groupId>
      <artifactId>braintree-java</artifactId>
      <version>${braintree-gateway-version}</version>
      <type>javadoc</type>
      <scope>provided</scope>
      <optional>true</optional>
      <exclusions>
        <exclusion>
          <groupId>org.json</groupId>
          <artifactId>json</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

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

    <!-- testing - logging -->    
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-api</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-slf4j-impl</artifactId>
      <scope>test</scope>
    </dependency>

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

  <build>
    <defaultGoal>install</defaultGoal>

    <plugins>
      <!-- generate Component source and test source -->
      <plugin>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-api-component-maven-plugin</artifactId>
        <version>${project.version}</version>
        <executions>
          <execution>
            <id>generate-test-component-classes</id>
            <goals>
              <goal>fromApis</goal>
            </goals>
            <configuration>
              <apis>
                <api>
                  <apiName>addOn</apiName>
                  <proxyClass>com.braintreegateway.AddOnGateway</proxyClass>
                  <fromJavadoc />
                </api>
                <api>
                  <apiName>address</apiName>
                  <proxyClass>com.braintreegateway.AddressGateway</proxyClass>
                  <fromJavadoc />
                </api>
                <api>
                  <apiName>clientToken</apiName>
                  <proxyClass>com.braintreegateway.ClientTokenGateway</proxyClass>
                  <fromJavadoc />
                </api>
                <api>
                  <apiName>creditCardVerification</apiName>
                  <proxyClass>com.braintreegateway.CreditCardVerificationGateway</proxyClass>
                  <fromJavadoc />
                </api>
                <api>
                  <apiName>customer</apiName>
                  <proxyClass>com.braintreegateway.CustomerGateway</proxyClass>
                  <fromJavadoc>
                    <excludeMethods>.*ransparent.*</excludeMethods>
                  </fromJavadoc>
                </api>
                <api>
                  <apiName>discount</apiName>
                  <proxyClass>com.braintreegateway.DiscountGateway</proxyClass>
                  <fromJavadoc />
                </api>
                <api>
                  <apiName>dispute</apiName>
                  <proxyClass>com.braintreegateway.DisputeGateway</proxyClass>
                  <fromJavadoc />
                </api>
                <api>
                  <apiName>documentUpload</apiName>
                  <proxyClass>com.braintreegateway.DocumentUploadGateway</proxyClass>
                  <fromJavadoc />
                </api>
                <api>
                  <apiName>merchantAccount</apiName>
                  <proxyClass>com.braintreegateway.MerchantAccountGateway</proxyClass>
                  <fromJavadoc />
                  <substitutions>
                    <substitution>
                      <method>^.+$</method>
                      <argName>^.+$</argName>
                      <argType>com.braintreegateway.MerchantAccountRequest</argType>
                      <replacement>request</replacement>
                      <replaceWithType>false</replaceWithType>
                    </substitution>
                    <substitution>
                      <method>^.+$</method>
                      <argName>^.+$</argName>
                      <argType>com.braintreegateway.MerchantAccountCreateForCurrencyRequest</argType>
                      <replacement>currencyRequest</replacement>
                      <replaceWithType>false</replaceWithType>
                    </substitution>
                  </substitutions>
                </api>
                <api>
                  <apiName>paymentMethod</apiName>
                  <proxyClass>com.braintreegateway.PaymentMethodGateway</proxyClass>
                  <fromJavadoc>
                    <excludeMethods>.*parse.*</excludeMethods>
                  </fromJavadoc>
                  <substitutions>
                    <substitution>
                      <method>^.+$</method>
                      <argName>^.+$</argName>
                      <argType>com.braintreegateway.PaymentMethodRequest</argType>
                      <replacement>request</replacement>
                      <replaceWithType>false</replaceWithType>
                    </substitution>
                    <substitution>
                      <method>^.+$</method>
                      <argName>^.+$</argName>
                      <argType>com.braintreegateway.PaymentMethodDeleteRequest</argType>
                      <replacement>deleteRequest</replacement>
                      <replaceWithType>false</replaceWithType>
                    </substitution>
                  </substitutions>
                </api>
                <api>
                  <apiName>paymentMethodNonce</apiName>
                  <proxyClass>com.braintreegateway.PaymentMethodNonceGateway</proxyClass>
                  <fromJavadoc>
                    <excludeMethods>.*parse.*</excludeMethods>
                  </fromJavadoc>
                </api>
                <api>
                  <apiName>plan</apiName>
                  <proxyClass>com.braintreegateway.PlanGateway</proxyClass>
                  <fromJavadoc />
                </api>
                <api>
                  <apiName>report</apiName>
                  <proxyClass>com.braintreegateway.ReportGateway</proxyClass>
                  <fromJavadoc />
                </api>
                <api>
                  <apiName>settlementBatchSummary</apiName>
                  <proxyClass>com.braintreegateway.SettlementBatchSummaryGateway</proxyClass>
                  <fromJavadoc />
                </api>
                <api>
                  <apiName>subscription</apiName>
                  <proxyClass>com.braintreegateway.SubscriptionGateway</proxyClass>
                  <fromJavadoc />
                </api>
                <api>
                  <apiName>transaction</apiName>
                  <proxyClass>com.braintreegateway.TransactionGateway</proxyClass>
                  <fromJavadoc>
                    <excludeMethods>.*TrData.*|.*ransparent.*</excludeMethods>
                  </fromJavadoc>
                  <substitutions>
                    <substitution>
                      <method>^.+$</method>
                      <argName>^.+$</argName>
                      <argType>com.braintreegateway.TransactionRequest</argType>
                      <replacement>request</replacement>
                      <replaceWithType>false</replaceWithType>
                    </substitution>
                    <substitution>
                      <method>^.+$</method>
                      <argName>^.+$</argName>
                      <argType>com.braintreegateway.TransactionRefundRequest</argType>
                      <replacement>refundRequest</replacement>
                      <replaceWithType>false</replaceWithType>
                    </substitution>
                    <substitution>
                      <method>^.+$</method>
                      <argName>^.+$</argName>
                      <argType>com.braintreegateway.TransactionCloneRequest</argType>
                      <replacement>cloneRequest</replacement>
                      <replaceWithType>false</replaceWithType>
                    </substitution>
                  </substitutions>
                </api>
                <api>
                  <apiName>webhookNotification</apiName>
                  <proxyClass>com.braintreegateway.WebhookNotificationGateway</proxyClass>
                  <fromJavadoc />
                </api>
              </apis>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!-- add generated source and test source to build -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <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>
          <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>
        <configuration>
          <scheme>${schemeName}</scheme>
          <componentName>${componentName}</componentName>
          <componentPackage>${componentPackage}</componentPackage>
          <outPackage>${outPackage}</outPackage>
        </configuration>
      </plugin>
    </plugins>
  </reporting>

  <profiles>
    <profile>
      <id>braintree-test</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <systemPropertyVariables>
                <braintreeAuthenticationType>PUBLIC_PRIVATE_KEYS</braintreeAuthenticationType>
              </systemPropertyVariables>
              <childDelegation>false</childDelegation>
              <useFile>true</useFile>
              <forkCount>1</forkCount>
              <reuseForks>true</reuseForks>
              <forkedProcessTimeoutInSeconds>300</forkedProcessTimeoutInSeconds>
              <includes>
                <include>**/*Test.java</include>
              </includes>
              <excludes>
                <exclude>**/*XXXTest.java</exclude>
              </excludes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>braintree-access-token-test</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <systemPropertyVariables>
                <braintreeAuthenticationType>ACCESS_TOKEN</braintreeAuthenticationType>
              </systemPropertyVariables>
              <childDelegation>false</childDelegation>
              <useFile>true</useFile>
              <forkCount>1</forkCount>
              <reuseForks>true</reuseForks>
              <forkedProcessTimeoutInSeconds>300</forkedProcessTimeoutInSeconds>
              <includes>
                <include>**/*Test.java</include>
              </includes>
              <excludes>
                <exclude>**/*XXXTest.java</exclude>
              </excludes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
