This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit bfd16d8cd050333da409f95efdc3aedbe3999318 Author: Andrea Cosentino <[email protected]> AuthorDate: Thu May 27 14:51:52 2021 +0200 CAMEL-16465 - Camel-AWS: Add useDefaultCredentialProvider option to all the components - Translate Component --- .../translate/Translate2ClientFactoryTest.java | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/components/camel-aws/camel-aws2-translate/src/test/java/org/apache/camel/component/aws2/translate/Translate2ClientFactoryTest.java b/components/camel-aws/camel-aws2-translate/src/test/java/org/apache/camel/component/aws2/translate/Translate2ClientFactoryTest.java new file mode 100644 index 0000000..2b9bf09 --- /dev/null +++ b/components/camel-aws/camel-aws2-translate/src/test/java/org/apache/camel/component/aws2/translate/Translate2ClientFactoryTest.java @@ -0,0 +1,51 @@ +/* + * 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.aws2.translate; + +import org.apache.camel.component.aws2.translate.client.Translate2ClientFactory; +import org.apache.camel.component.aws2.translate.client.Translate2InternalClient; +import org.apache.camel.component.aws2.translate.client.impl.Translate2ClientIAMOptimized; +import org.apache.camel.component.aws2.translate.client.impl.Translate2ClientStandardImpl; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class Translate2ClientFactoryTest { + + @Test + public void getStandardTranslateClientDefault() { + Translate2Configuration translate2Configuration = new Translate2Configuration(); + Translate2InternalClient translateClient = Translate2ClientFactory.getTranslateClient(translate2Configuration); + assertTrue(translateClient instanceof Translate2ClientStandardImpl); + } + + @Test + public void getStandardTranslateClient() { + Translate2Configuration translate2Configuration = new Translate2Configuration(); + translate2Configuration.setUseDefaultCredentialsProvider(false); + Translate2InternalClient translateClient = Translate2ClientFactory.getTranslateClient(translate2Configuration); + assertTrue(translateClient instanceof Translate2ClientStandardImpl); + } + + @Test + public void getTranslateOptimizedIAMClient() { + Translate2Configuration translate2Configuration = new Translate2Configuration(); + translate2Configuration.setUseDefaultCredentialsProvider(true); + Translate2InternalClient translateClient = Translate2ClientFactory.getTranslateClient(translate2Configuration); + assertTrue(translateClient instanceof Translate2ClientIAMOptimized); + } +}
