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 ad996d86af730af8d52daaea409df4beff16d78f Author: Andrea Cosentino <[email protected]> AuthorDate: Mon Mar 8 07:17:35 2021 +0100 CAMEL-16293 - Camel-AWS2-Components: Autocreation of entities should be false by default - camel-aws2-sqs - removed integration tests, since they are exactly the same as the localstack one and are based on localstack too --- .../integration/SqsComponentIntegrationTest.java | 126 --------------------- .../SqsConsumerMessageIntegrationTest.java | 99 ---------------- .../SqsProducerBatchSendFifoIntegrationTest.java | 105 ----------------- .../SqsProducerBatchSendIntegrationTest.java | 103 ----------------- .../SqsProducerDeleteMessageIntegrationTest.java | 98 ---------------- .../aws2/sqs/integration/TestSqsConfiguration.java | 44 ------- 6 files changed, 575 deletions(-) diff --git a/components/camel-aws2-sqs/src/test/java/org/apache/camel/component/aws2/sqs/integration/SqsComponentIntegrationTest.java b/components/camel-aws2-sqs/src/test/java/org/apache/camel/component/aws2/sqs/integration/SqsComponentIntegrationTest.java deleted file mode 100644 index 6465550..0000000 --- a/components/camel-aws2-sqs/src/test/java/org/apache/camel/component/aws2/sqs/integration/SqsComponentIntegrationTest.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * 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.sqs.integration; - -import org.apache.camel.EndpointInject; -import org.apache.camel.Exchange; -import org.apache.camel.ExchangePattern; -import org.apache.camel.Processor; -import org.apache.camel.ProducerTemplate; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.aws2.sqs.Sqs2Constants; -import org.apache.camel.component.mock.MockEndpoint; -import org.apache.camel.test.infra.aws.common.services.AWSService; -import org.apache.camel.test.infra.aws2.common.SystemPropertiesAWSCredentialsProvider; -import org.apache.camel.test.infra.aws2.common.TestAWSCredentialsProvider; -import org.apache.camel.test.infra.aws2.services.AWSServiceFactory; -import org.apache.camel.test.infra.common.SharedNameGenerator; -import org.apache.camel.test.infra.common.TestEntityNameGenerator; -import org.apache.camel.test.junit5.CamelTestSupport; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; -import software.amazon.awssdk.auth.credentials.AwsCredentials; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -public class SqsComponentIntegrationTest extends CamelTestSupport { - - @RegisterExtension - public static AWSService service = AWSServiceFactory.createSQSService(); - - @RegisterExtension - public static SharedNameGenerator sharedNameGenerator = new TestEntityNameGenerator(); - - @EndpointInject("direct:start") - private ProducerTemplate template; - - @EndpointInject("mock:result") - private MockEndpoint result; - - @Test - public void sendInOnly() throws Exception { - result.expectedMessageCount(1); - - Exchange exchange = template.send("direct:start", ExchangePattern.InOnly, new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getIn().setBody("This is my message text."); - } - }); - - assertMockEndpointsSatisfied(); - - Exchange resultExchange = result.getExchanges().get(0); - assertEquals("This is my message text.", resultExchange.getIn().getBody()); - assertNotNull(resultExchange.getIn().getHeader(Sqs2Constants.MESSAGE_ID)); - assertNotNull(resultExchange.getIn().getHeader(Sqs2Constants.RECEIPT_HANDLE)); - assertEquals("6a1559560f67c5e7a7d5d838bf0272ee", resultExchange.getIn().getHeader(Sqs2Constants.MD5_OF_BODY)); - assertNotNull(resultExchange.getIn().getHeader(Sqs2Constants.ATTRIBUTES)); - assertNotNull(resultExchange.getIn().getHeader(Sqs2Constants.MESSAGE_ATTRIBUTES)); - - assertNotNull(exchange.getIn().getHeader(Sqs2Constants.MESSAGE_ID)); - assertEquals("6a1559560f67c5e7a7d5d838bf0272ee", exchange.getIn().getHeader(Sqs2Constants.MD5_OF_BODY)); - } - - @Test - public void sendInOut() throws Exception { - result.expectedMessageCount(1); - - Exchange exchange = template.send("direct:start", ExchangePattern.InOut, new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getIn().setBody("This is my message text."); - } - }); - - assertMockEndpointsSatisfied(); - - Exchange resultExchange = result.getExchanges().get(0); - assertEquals("This is my message text.", resultExchange.getIn().getBody()); - assertNotNull(resultExchange.getIn().getHeader(Sqs2Constants.RECEIPT_HANDLE)); - assertNotNull(resultExchange.getIn().getHeader(Sqs2Constants.MESSAGE_ID)); - assertEquals("6a1559560f67c5e7a7d5d838bf0272ee", resultExchange.getIn().getHeader(Sqs2Constants.MD5_OF_BODY)); - assertNotNull(resultExchange.getIn().getHeader(Sqs2Constants.ATTRIBUTES)); - assertNotNull(resultExchange.getIn().getHeader(Sqs2Constants.MESSAGE_ATTRIBUTES)); - - assertNotNull(exchange.getMessage().getHeader(Sqs2Constants.MESSAGE_ID)); - assertEquals("6a1559560f67c5e7a7d5d838bf0272ee", exchange.getMessage().getHeader(Sqs2Constants.MD5_OF_BODY)); - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - TestAWSCredentialsProvider credentialsProvider = new SystemPropertiesAWSCredentialsProvider(); - AwsCredentials credentials = credentialsProvider.resolveCredentials(); - - final String sqsEndpointUri = String - .format("aws2-sqs://%s?accessKey=%s&secretKey=%s&messageRetentionPeriod=%s&maximumMessageSize=%s&visibilityTimeout=%s&policy=%s&configuration=%s&autoCreateQueue=true", - sharedNameGenerator.getName(), - credentials.accessKeyId(), - credentials.secretAccessKey(), - "1209600", "65536", "60", - "file:src/test/resources/org/apache/camel/component/aws2/sqs/policy.txt", - "#class:" + TestSqsConfiguration.class.getName()); - - return new RouteBuilder() { - @Override - public void configure() throws Exception { - from("direct:start").to(sqsEndpointUri); - - from(sqsEndpointUri).to("mock:result"); - } - }; - } -} diff --git a/components/camel-aws2-sqs/src/test/java/org/apache/camel/component/aws2/sqs/integration/SqsConsumerMessageIntegrationTest.java b/components/camel-aws2-sqs/src/test/java/org/apache/camel/component/aws2/sqs/integration/SqsConsumerMessageIntegrationTest.java deleted file mode 100644 index 856e76c..0000000 --- a/components/camel-aws2-sqs/src/test/java/org/apache/camel/component/aws2/sqs/integration/SqsConsumerMessageIntegrationTest.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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.sqs.integration; - -import org.apache.camel.EndpointInject; -import org.apache.camel.Exchange; -import org.apache.camel.ExchangePattern; -import org.apache.camel.Processor; -import org.apache.camel.ProducerTemplate; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.mock.MockEndpoint; -import org.apache.camel.test.infra.aws.common.services.AWSService; -import org.apache.camel.test.infra.aws2.common.SystemPropertiesAWSCredentialsProvider; -import org.apache.camel.test.infra.aws2.common.TestAWSCredentialsProvider; -import org.apache.camel.test.infra.aws2.services.AWSServiceFactory; -import org.apache.camel.test.infra.common.SharedNameGenerator; -import org.apache.camel.test.infra.common.TestEntityNameGenerator; -import org.apache.camel.test.junit5.CamelTestSupport; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; -import software.amazon.awssdk.auth.credentials.AwsCredentials; - -public class SqsConsumerMessageIntegrationTest extends CamelTestSupport { - - @RegisterExtension - public static AWSService service = AWSServiceFactory.createSQSService(); - - @RegisterExtension - public static SharedNameGenerator sharedNameGenerator = new TestEntityNameGenerator(); - - @EndpointInject("direct:start") - private ProducerTemplate template; - - @EndpointInject("mock:result") - private MockEndpoint result; - - @Test - public void sendInOnly() throws Exception { - result.expectedMessageCount(1); - - Exchange exchange = template.send("direct:start", ExchangePattern.InOnly, new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getIn().setBody("ignore"); - } - }); - - exchange = template.send("direct:start", ExchangePattern.InOnly, new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getIn().setBody("test1"); - } - }); - - assertMockEndpointsSatisfied(); - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - TestAWSCredentialsProvider credentialsProvider = new SystemPropertiesAWSCredentialsProvider(); - AwsCredentials credentials = credentialsProvider.resolveCredentials(); - - final String sqsEndpointUri - = String.format( - "aws2-sqs://%s?accessKey=RAW(%s)&secretKey=RAW(%s)®ion=eu-west-1&configuration=%s&autoCreateQueue=true", - sharedNameGenerator.getName(), - credentials.accessKeyId(), - credentials.secretAccessKey(), - "#class:" + TestSqsConfiguration.class.getName()); - - return new RouteBuilder() { - @Override - public void configure() throws Exception { - from("direct:start").startupOrder(2).to(sqsEndpointUri); - - fromF("aws2-sqs://%s?accessKey=RAW(%s)&secretKey=RAW(%s)®ion=eu-west-1&deleteAfterRead=false&deleteIfFiltered=true&configuration=%s&autoCreateQueue=true", - sharedNameGenerator.getName(), - credentials.accessKeyId(), - credentials.secretAccessKey(), - "#class:" + TestSqsConfiguration.class.getName()) - .startupOrder(1) - .filter(simple("${body} != 'ignore'")).log("${body}").log("${header.CamelAwsSqsReceiptHandle}") - .to("mock:result"); - } - }; - } -} diff --git a/components/camel-aws2-sqs/src/test/java/org/apache/camel/component/aws2/sqs/integration/SqsProducerBatchSendFifoIntegrationTest.java b/components/camel-aws2-sqs/src/test/java/org/apache/camel/component/aws2/sqs/integration/SqsProducerBatchSendFifoIntegrationTest.java deleted file mode 100644 index 3454006..0000000 --- a/components/camel-aws2-sqs/src/test/java/org/apache/camel/component/aws2/sqs/integration/SqsProducerBatchSendFifoIntegrationTest.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * 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.sqs.integration; - -import java.util.ArrayList; -import java.util.Collection; - -import org.apache.camel.EndpointInject; -import org.apache.camel.Exchange; -import org.apache.camel.ExchangePattern; -import org.apache.camel.Processor; -import org.apache.camel.ProducerTemplate; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.aws2.sqs.Sqs2Constants; -import org.apache.camel.component.mock.MockEndpoint; -import org.apache.camel.test.infra.aws.common.services.AWSService; -import org.apache.camel.test.infra.aws2.common.SystemPropertiesAWSCredentialsProvider; -import org.apache.camel.test.infra.aws2.common.TestAWSCredentialsProvider; -import org.apache.camel.test.infra.aws2.services.AWSServiceFactory; -import org.apache.camel.test.infra.common.SharedNameGenerator; -import org.apache.camel.test.infra.common.TestEntityNameGenerator; -import org.apache.camel.test.junit5.CamelTestSupport; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; -import software.amazon.awssdk.auth.credentials.AwsCredentials; - -public class SqsProducerBatchSendFifoIntegrationTest extends CamelTestSupport { - - @RegisterExtension - public static AWSService service = AWSServiceFactory.createSQSService(); - - @RegisterExtension - public static SharedNameGenerator sharedNameGenerator = new TestEntityNameGenerator(); - - @EndpointInject("direct:start") - private ProducerTemplate template; - - @EndpointInject("mock:result") - private MockEndpoint result; - - @Test - public void sendInOnly() throws Exception { - result.expectedMessageCount(5); - - Exchange exchange = template.send("direct:start", ExchangePattern.InOnly, new Processor() { - public void process(Exchange exchange) throws Exception { - Collection c = new ArrayList<Integer>(); - c.add("2"); - c.add("1"); - c.add("3"); - c.add("4"); - c.add("5"); - exchange.getIn().setBody(c); - } - }); - - assertMockEndpointsSatisfied(); - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - TestAWSCredentialsProvider credentialsProvider = new SystemPropertiesAWSCredentialsProvider(); - AwsCredentials credentials = credentialsProvider.resolveCredentials(); - - final String sqsEndpointUri = String.format( - "aws2-sqs://%s.fifo?accessKey=RAW(%s)&secretKey=RAW(%s)®ion=eu-west-1&messageGroupIdStrategy=useExchangeId" - + "&messageDeduplicationIdStrategy=useContentBasedDeduplication" - + "&configuration=%s&autoCreateQueue=true", - sharedNameGenerator.getName(), - credentials.accessKeyId(), - credentials.secretAccessKey(), - "#class:" + TestSqsConfiguration.class.getName()); - - return new RouteBuilder() { - @Override - public void configure() throws Exception { - from("direct:start").startupOrder(2).setHeader(Sqs2Constants.SQS_OPERATION, constant("sendBatchMessage")) - .to(sqsEndpointUri); - - fromF("aws2-sqs://%s.fifo?accessKey=RAW(%s)&secretKey=RAW(%s)®ion=eu-west-1&deleteAfterRead=false&configuration=%s&autoCreateQueue=true", - sharedNameGenerator.getName(), - credentials.accessKeyId(), - credentials.secretAccessKey(), - "#class:" + TestSqsConfiguration.class.getName()) - .startupOrder(1) - .log("${body}") - .to("mock:result"); - } - }; - } -} diff --git a/components/camel-aws2-sqs/src/test/java/org/apache/camel/component/aws2/sqs/integration/SqsProducerBatchSendIntegrationTest.java b/components/camel-aws2-sqs/src/test/java/org/apache/camel/component/aws2/sqs/integration/SqsProducerBatchSendIntegrationTest.java deleted file mode 100644 index 273f7ed..0000000 --- a/components/camel-aws2-sqs/src/test/java/org/apache/camel/component/aws2/sqs/integration/SqsProducerBatchSendIntegrationTest.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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.sqs.integration; - -import java.util.ArrayList; -import java.util.Collection; - -import org.apache.camel.EndpointInject; -import org.apache.camel.Exchange; -import org.apache.camel.ExchangePattern; -import org.apache.camel.Processor; -import org.apache.camel.ProducerTemplate; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.aws2.sqs.Sqs2Constants; -import org.apache.camel.component.mock.MockEndpoint; -import org.apache.camel.test.infra.aws.common.services.AWSService; -import org.apache.camel.test.infra.aws2.common.SystemPropertiesAWSCredentialsProvider; -import org.apache.camel.test.infra.aws2.common.TestAWSCredentialsProvider; -import org.apache.camel.test.infra.aws2.services.AWSServiceFactory; -import org.apache.camel.test.infra.common.SharedNameGenerator; -import org.apache.camel.test.infra.common.TestEntityNameGenerator; -import org.apache.camel.test.junit5.CamelTestSupport; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; -import software.amazon.awssdk.auth.credentials.AwsCredentials; - -public class SqsProducerBatchSendIntegrationTest extends CamelTestSupport { - - @RegisterExtension - public static AWSService service = AWSServiceFactory.createSQSService(); - - @RegisterExtension - public static SharedNameGenerator sharedNameGenerator = new TestEntityNameGenerator(); - - @EndpointInject("direct:start") - private ProducerTemplate template; - - @EndpointInject("mock:result") - private MockEndpoint result; - - @Test - public void sendInOnly() throws Exception { - result.expectedMessageCount(5); - - Exchange exchange = template.send("direct:start", ExchangePattern.InOnly, new Processor() { - public void process(Exchange exchange) throws Exception { - Collection c = new ArrayList<Integer>(); - c.add("1"); - c.add("2"); - c.add("3"); - c.add("4"); - c.add("5"); - exchange.getIn().setBody(c); - } - }); - - assertMockEndpointsSatisfied(); - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - TestAWSCredentialsProvider credentialsProvider = new SystemPropertiesAWSCredentialsProvider(); - AwsCredentials credentials = credentialsProvider.resolveCredentials(); - - final String sqsEndpointUri - = String.format("aws2-sqs://%s?accessKey=RAW(%s)&secretKey=RAW(%s)®ion=eu-west-1&configuration=%s&autoCreateQueue=true", - sharedNameGenerator.getName(), - credentials.accessKeyId(), - credentials.secretAccessKey(), - "#class:" + TestSqsConfiguration.class.getName()); - - return new RouteBuilder() { - @Override - public void configure() throws Exception { - from("direct:start").startupOrder(2).setHeader(Sqs2Constants.SQS_OPERATION, constant("sendBatchMessage")) - .to(sqsEndpointUri); - - fromF("aws2-sqs://%s?accessKey=RAW(%s)&secretKey=RAW(%s)®ion=eu-west-1&deleteAfterRead=true&configuration=%s&autoCreateQueue=true", - sharedNameGenerator.getName(), - credentials.accessKeyId(), - credentials.secretAccessKey(), - "#class:" + TestSqsConfiguration.class.getName()) - .startupOrder(1) - .log("${body}") - .to("mock:result"); - } - }; - } -} diff --git a/components/camel-aws2-sqs/src/test/java/org/apache/camel/component/aws2/sqs/integration/SqsProducerDeleteMessageIntegrationTest.java b/components/camel-aws2-sqs/src/test/java/org/apache/camel/component/aws2/sqs/integration/SqsProducerDeleteMessageIntegrationTest.java deleted file mode 100644 index 4d14acc..0000000 --- a/components/camel-aws2-sqs/src/test/java/org/apache/camel/component/aws2/sqs/integration/SqsProducerDeleteMessageIntegrationTest.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * 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.sqs.integration; - -import org.apache.camel.EndpointInject; -import org.apache.camel.Exchange; -import org.apache.camel.ExchangePattern; -import org.apache.camel.Processor; -import org.apache.camel.ProducerTemplate; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.mock.MockEndpoint; -import org.apache.camel.test.infra.aws.common.services.AWSService; -import org.apache.camel.test.infra.aws2.common.SystemPropertiesAWSCredentialsProvider; -import org.apache.camel.test.infra.aws2.common.TestAWSCredentialsProvider; -import org.apache.camel.test.infra.aws2.services.AWSServiceFactory; -import org.apache.camel.test.infra.common.SharedNameGenerator; -import org.apache.camel.test.infra.common.TestEntityNameGenerator; -import org.apache.camel.test.junit5.CamelTestSupport; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; -import software.amazon.awssdk.auth.credentials.AwsCredentials; - -public class SqsProducerDeleteMessageIntegrationTest extends CamelTestSupport { - - @RegisterExtension - public static AWSService service = AWSServiceFactory.createSQSService(); - - @RegisterExtension - public static SharedNameGenerator sharedNameGenerator = new TestEntityNameGenerator(); - - @EndpointInject("direct:start") - private ProducerTemplate template; - - @EndpointInject("mock:result") - private MockEndpoint result; - - @Test - public void sendInOnly() throws Exception { - result.expectedMessageCount(1); - - Exchange exchange = template.send("direct:start", ExchangePattern.InOnly, new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getIn().setBody("Test sqs"); - } - }); - - assertMockEndpointsSatisfied(); - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - TestAWSCredentialsProvider credentialsProvider = new SystemPropertiesAWSCredentialsProvider(); - AwsCredentials credentials = credentialsProvider.resolveCredentials(); - - final String sqsEndpointUri - = String.format("aws2-sqs://%s?accessKey=RAW(%s)&secretKey=RAW(%s)®ion=eu-west-1&configuration=%s&autoCreateQueue=true", - sharedNameGenerator.getName(), - credentials.accessKeyId(), - credentials.secretAccessKey(), - "#class:" + TestSqsConfiguration.class.getName()); - - return new RouteBuilder() { - @Override - public void configure() throws Exception { - from("direct:start").startupOrder(2).to(sqsEndpointUri); - - fromF("aws2-sqs://%s?accessKey=RAW(%s)&secretKey=RAW(%s)®ion=eu-west-1&deleteAfterRead=false&configuration=%s&autoCreateQueue=true", - sharedNameGenerator.getName(), - credentials.accessKeyId(), - credentials.secretAccessKey(), - "#class:" + TestSqsConfiguration.class.getName()) - .startupOrder(1) - .log("${body}") - .toF("aws2-sqs://%s?accessKey=RAW(%s)&secretKey=RAW(%s)®ion=eu-west-1&operation=deleteMessage&configuration=%s&autoCreateQueue=true", - sharedNameGenerator.getName(), - credentials.accessKeyId(), - credentials.secretAccessKey(), - "#class:" + TestSqsConfiguration.class.getName()) - .log("${body}") - .log("${header.CamelAwsSqsReceiptHandle}").to("mock:result"); - } - }; - } -} diff --git a/components/camel-aws2-sqs/src/test/java/org/apache/camel/component/aws2/sqs/integration/TestSqsConfiguration.java b/components/camel-aws2-sqs/src/test/java/org/apache/camel/component/aws2/sqs/integration/TestSqsConfiguration.java deleted file mode 100644 index 9f70bc5..0000000 --- a/components/camel-aws2-sqs/src/test/java/org/apache/camel/component/aws2/sqs/integration/TestSqsConfiguration.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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.sqs.integration; - -import org.apache.camel.component.aws2.sqs.Sqs2Configuration; -import org.apache.camel.test.infra.aws2.clients.AWSSDKClientUtils; -import org.apache.camel.test.infra.common.SharedNameGenerator; -import org.apache.camel.test.infra.common.SharedNameRegistry; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import software.amazon.awssdk.services.sqs.SqsClient; - -public class TestSqsConfiguration extends Sqs2Configuration { - private static final Logger LOG = LoggerFactory.getLogger(TestSqsConfiguration.class); - private final SqsClient sqsClient = AWSSDKClientUtils.newSQSClient(); - - public TestSqsConfiguration() { - SharedNameGenerator sharedNameGenerator = SharedNameRegistry.getInstance().getSharedNameGenerator(); - - String name = sharedNameGenerator.getName(); - LOG.debug("Using the following shared resource name for the test: {}", name); - setQueueName(name); - } - - @Override - public SqsClient getAmazonSQSClient() { - return sqsClient; - } -}
