This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit 45ebf8ef27a0cd716c88a7499746c1f29495cc78 Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Tue Jan 16 08:02:10 2018 +0100 CAMEL-12137 - Fixed CS --- .../component/braintree/AuthenticationType.java | 16 ++++++++ .../BraintreeComponentVerifierExtension.java | 20 +++++++++- .../braintree/AbstractBraintreeTestSupport.java | 43 +++++++++++----------- .../TransactionGatewayIntegrationTest.java | 10 +++-- 4 files changed, 63 insertions(+), 26 deletions(-) diff --git a/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/AuthenticationType.java b/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/AuthenticationType.java index 19edd08..f03df96 100644 --- a/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/AuthenticationType.java +++ b/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/AuthenticationType.java @@ -1,3 +1,19 @@ +/** + * 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. + */ package org.apache.camel.component.braintree; public enum AuthenticationType { diff --git a/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeComponentVerifierExtension.java b/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeComponentVerifierExtension.java index 37ca6bf..0e4a858 100644 --- a/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeComponentVerifierExtension.java +++ b/components/camel-braintree/src/main/java/org/apache/camel/component/braintree/BraintreeComponentVerifierExtension.java @@ -1,12 +1,28 @@ +/** + * 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. + */ package org.apache.camel.component.braintree; +import java.util.Map; + import org.apache.camel.component.extension.verifier.DefaultComponentVerifierExtension; import org.apache.camel.component.extension.verifier.OptionsGroup; import org.apache.camel.component.extension.verifier.ResultBuilder; import org.apache.camel.component.extension.verifier.ResultErrorHelper; -import java.util.Map; - public class BraintreeComponentVerifierExtension extends DefaultComponentVerifierExtension { BraintreeComponentVerifierExtension() { diff --git a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/AbstractBraintreeTestSupport.java b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/AbstractBraintreeTestSupport.java index c1b7cb9..837919f 100644 --- a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/AbstractBraintreeTestSupport.java +++ b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/AbstractBraintreeTestSupport.java @@ -23,6 +23,7 @@ import java.util.Map; import java.util.Properties; import com.braintreegateway.BraintreeGateway; + import org.apache.camel.CamelContext; import org.apache.camel.CamelExecutionException; import org.apache.camel.component.braintree.internal.BraintreeApiCollection; @@ -91,21 +92,23 @@ public class AbstractBraintreeTestSupport extends CamelTestSupport { AuthenticationType configurationType = getAuthenticationType(); LOG.info(String.format("Test using %s configuration profile", configurationType)); switch (configurationType) { - case PUBLIC_PRIVATE_KEYS: - addOptionIfMissing(options, "environment", "CAMEL_BRAINTREE_ENVIRONMENT"); - addOptionIfMissing(options, "merchantId", "CAMEL_BRAINTREE_MERCHANT_ID"); - addOptionIfMissing(options, "publicKey", "CAMEL_BRAINTREE_PUBLIC_KEY"); - addOptionIfMissing(options, "privateKey", "CAMEL_BRAINTREE_PRIVATE_KEY"); - options.remove("accessToken"); - options.remove("clientId"); - break; - case ACCESS_TOKEN: - addOptionIfMissing(options, "accessToken", "CAMEL_BRAINTREE_ACCESS_TOKEN"); - options.remove("environment"); - options.remove("merchantId"); - options.remove("publicKey"); - options.remove("privateKey"); - break; + case PUBLIC_PRIVATE_KEYS: + addOptionIfMissing(options, "environment", "CAMEL_BRAINTREE_ENVIRONMENT"); + addOptionIfMissing(options, "merchantId", "CAMEL_BRAINTREE_MERCHANT_ID"); + addOptionIfMissing(options, "publicKey", "CAMEL_BRAINTREE_PUBLIC_KEY"); + addOptionIfMissing(options, "privateKey", "CAMEL_BRAINTREE_PRIVATE_KEY"); + options.remove("accessToken"); + options.remove("clientId"); + break; + case ACCESS_TOKEN: + addOptionIfMissing(options, "accessToken", "CAMEL_BRAINTREE_ACCESS_TOKEN"); + options.remove("environment"); + options.remove("merchantId"); + options.remove("publicKey"); + options.remove("privateKey"); + break; + default: + throw new IllegalArgumentException("Unsupported configuration type"); } final BraintreeConfiguration configuration = new BraintreeConfiguration(); @@ -146,19 +149,17 @@ public class AbstractBraintreeTestSupport extends CamelTestSupport { } @SuppressWarnings("unchecked") - protected <T> T requestBodyAndHeaders(String endpointUri, Object body, Map<String, Object> headers) - throws CamelExecutionException { - return (T) template().requestBodyAndHeaders(endpointUri, body, headers); + protected <T> T requestBodyAndHeaders(String endpointUri, Object body, Map<String, Object> headers) throws CamelExecutionException { + return (T)template().requestBodyAndHeaders(endpointUri, body, headers); } - protected <T> T requestBodyAndHeaders(String endpointUri, Object body, Map<String, Object> headers, Class<T> type) - throws CamelExecutionException { + protected <T> T requestBodyAndHeaders(String endpointUri, Object body, Map<String, Object> headers, Class<T> type) throws CamelExecutionException { return template().requestBodyAndHeaders(endpointUri, body, headers, type); } @SuppressWarnings("unchecked") protected <T> T requestBody(String endpoint, Object body) throws CamelExecutionException { - return (T) template().requestBody(endpoint, body); + return (T)template().requestBody(endpoint, body); } protected <T> T requestBody(String endpoint, Object body, Class<T> type) throws CamelExecutionException { diff --git a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/TransactionGatewayIntegrationTest.java b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/TransactionGatewayIntegrationTest.java index 8fec666..01f5fbb 100644 --- a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/TransactionGatewayIntegrationTest.java +++ b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/TransactionGatewayIntegrationTest.java @@ -22,12 +22,16 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; -import com.braintreegateway.*; +import com.braintreegateway.BraintreeGateway; +import com.braintreegateway.Result; +import com.braintreegateway.Transaction; +import com.braintreegateway.TransactionCloneRequest; +import com.braintreegateway.TransactionRefundRequest; +import com.braintreegateway.TransactionRequest; + import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.braintree.internal.BraintreeApiCollection; import org.apache.camel.component.braintree.internal.TransactionGatewayApiMethod; -import org.junit.After; -import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import org.slf4j.Logger; -- To stop receiving notification emails like this one, please contact "commits@camel.apache.org" <commits@camel.apache.org>.