You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2020/10/19 11:41:24 UTC
[camel] branch master updated: Migrates the camel-aws-sqs
integration tests to the shared test infra (#4476)
This is an automated email from the ASF dual-hosted git repository.
orpiske pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new 5755e05 Migrates the camel-aws-sqs integration tests to the shared test infra (#4476)
5755e05 is described below
commit 5755e05cdfc3fb59ada93f24e7925abee2e25da5
Author: Otavio Rodolfo Piske <or...@users.noreply.github.com>
AuthorDate: Mon Oct 19 13:41:01 2020 +0200
Migrates the camel-aws-sqs integration tests to the shared test infra (#4476)
---
components/camel-aws-sqs/README.md | 35 ++++++++++++
components/camel-aws-sqs/pom.xml | 63 ++++++++++++++++++++++
.../integration/SqsComponentIntegrationTest.java | 31 ++++++++---
.../SqsConsumerMessageIntegrationTest.java | 37 ++++++++++---
.../SqsProducerBatchSendFifoIntegrationTest.java | 35 +++++++++---
.../SqsProducerBatchSendIntegrationTest.java | 34 ++++++++++--
.../SqsProducerDeleteMessageIntegrationTest.java | 44 ++++++++++++---
.../aws/sqs/integration/TestSqsConfiguration.java | 54 +++++++++++++++++++
.../camel/test/infra/aws/common/AWSConfigs.java | 4 +-
.../test/infra/aws/clients/AWSClientUtils.java | 11 ++--
.../SystemPropertiesAWSCredentialsProvider.java} | 12 ++---
.../test/infra/aws/common/TestAWSCredentials.java} | 30 ++++++++---
.../aws/common/TestAWSCredentialsProvider.java | 28 ----------
.../aws/services/AWSLocalContainerService.java | 17 +++---
.../test/infra/aws/services/AWSRemoteService.java | 4 +-
.../test/infra/common/SharedNameGenerator.java} | 15 +++---
.../test/infra/common/SharedNameRegistry.java} | 27 +++++++---
.../infra/common/TestEntityNameGenerator.java} | 29 +++++++---
18 files changed, 393 insertions(+), 117 deletions(-)
diff --git a/components/camel-aws-sqs/README.md b/components/camel-aws-sqs/README.md
new file mode 100644
index 0000000..88b7245
--- /dev/null
+++ b/components/camel-aws-sqs/README.md
@@ -0,0 +1,35 @@
+# AWS SQS component for SDK v1
+
+# Running the tests
+
+This component contains integration tests that can be executed against a LocalStack instance, or an actual AWS
+instance. The build determines the execution or not of the integration tests automatically by checking the `DOCKER_HOST`
+environment variable. If set, then the build will try to execute the integration test.
+
+*Note*: the `DOCKER_HOST` variable is usually the address of the local unix socket `unix:///var/run/docker.sock`.
+
+It is possible to run the tests on a remote docker server by overwriting the value of the DOCKER_HOST variable:
+
+
+```
+DOCKER_HOST=tcp://myhost:2375 mvn clean verify
+```
+
+# Force running the integration tests
+
+Should you need to force the execution of the integration tests, despite the value of the DOCKER_HOST variable, you can
+do so by enabling the `aws-tests-docker-env` profile:
+
+
+```
+mvn -Paws-tests-docker-env clean test verify
+```
+
+# Running the tests against AWS
+
+You can define the `aws-service.instance.type`, `aws.access.key` and `aws.secret.key` to switch the test execution from
+using LocalStack and, instead, using AWS:
+
+```
+mvn -Paws-tests-docker-env -Daws-service.instance.type=remote -Daws.access.key=you-access-key -Daws.secret.key=you-secret-key clean test verify
+```
\ No newline at end of file
diff --git a/components/camel-aws-sqs/pom.xml b/components/camel-aws-sqs/pom.xml
index 2995c38..e945e02 100644
--- a/components/camel-aws-sqs/pom.xml
+++ b/components/camel-aws-sqs/pom.xml
@@ -46,6 +46,31 @@
<version>${aws-java-sdk-version}</version>
</dependency>
+ <!-- test infra -->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-test-infra-common</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-test-infra-aws-common</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-test-infra-aws-v1</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
<!-- for testing -->
<dependency>
<groupId>org.junit.jupiter</groupId>
@@ -73,4 +98,42 @@
<scope>test</scope>
</dependency>
</dependencies>
+
+ <!-- activate test if the DOCKER_HOST env var is set -->
+ <profiles>
+ <profile>
+ <id>aws-tests-docker-env</id>
+ <activation>
+ <property>
+ <name>env.DOCKER_HOST</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <configuration>
+ <skipTests>${skipTests}</skipTests>
+ <reuseForks>true</reuseForks>
+ <systemPropertyVariables>
+ <visibleassertions.silence>true</visibleassertions.silence>
+ </systemPropertyVariables>
+ <includes>
+ <include>**/*IntegrationTest.java</include>
+ </includes>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
diff --git a/components/camel-aws-sqs/src/test/java/org/apache/camel/component/aws/sqs/integration/SqsComponentIntegrationTest.java b/components/camel-aws-sqs/src/test/java/org/apache/camel/component/aws/sqs/integration/SqsComponentIntegrationTest.java
index 3e6a1e8..5652762 100644
--- a/components/camel-aws-sqs/src/test/java/org/apache/camel/component/aws/sqs/integration/SqsComponentIntegrationTest.java
+++ b/components/camel-aws-sqs/src/test/java/org/apache/camel/component/aws/sqs/integration/SqsComponentIntegrationTest.java
@@ -16,6 +16,8 @@
*/
package org.apache.camel.component.aws.sqs.integration;
+import com.amazonaws.auth.AWSCredentials;
+import com.amazonaws.services.sqs.AmazonSQS;
import org.apache.camel.EndpointInject;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
@@ -24,18 +26,27 @@ import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.aws.sqs.SqsConstants;
import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.infra.aws.common.SystemPropertiesAWSCredentialsProvider;
+import org.apache.camel.test.infra.aws.common.TestAWSCredentialsProvider;
+import org.apache.camel.test.infra.aws.common.services.AWSService;
+import org.apache.camel.test.infra.aws.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.Disabled;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
-@Disabled("Must be manually tested. Provide your own accessKey and secretKey!")
public class SqsComponentIntegrationTest extends CamelTestSupport {
- private String accessKey = "xxx";
- private String secretKey = "yyy";
+ @SuppressWarnings("unused")
+ @RegisterExtension
+ public static AWSService<AmazonSQS> service = AWSServiceFactory.createSQSService();
+
+ @RegisterExtension
+ public static SharedNameGenerator sharedNameGenerator = new TestEntityNameGenerator();
@EndpointInject("direct:start")
private ProducerTemplate template;
@@ -93,13 +104,19 @@ public class SqsComponentIntegrationTest extends CamelTestSupport {
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
+ TestAWSCredentialsProvider awsCredentialsProvider = new SystemPropertiesAWSCredentialsProvider();
+ AWSCredentials awsCredentials = awsCredentialsProvider.getCredentials();
+
final String sqsEndpointUri = String
- .format("aws-sqs://MyNewCamelQueue?accessKey=%s&secretKey=%s&messageRetentionPeriod=%s&maximumMessageSize=%s&visibilityTimeout=%s&policy=%s",
- accessKey, secretKey,
+ .format("aws-sqs://%s?accessKey=%s&secretKey=%s&messageRetentionPeriod=%s&maximumMessageSize=%s&visibilityTimeout=%s&policy=%s®ion=US_EAST_1&configuration=%s",
+ sharedNameGenerator.getName(),
+ awsCredentials.getAWSAccessKeyId(),
+ awsCredentials.getAWSSecretKey(),
"1209600", "65536", "60",
"%7B%22Version%22%3A%222008-10-17%22%2C%22Id%22%3A%22%2F195004372649%2FMyNewCamelQueue%2FSQSDefaultPolicy%22%2C%22"
+ "Statement%22%3A%5B%7B%22Sid%22%3A%22Queue1ReceiveMessage%22%2C%22Effect%22%3A%22Allow%22%2C%22Principal%22%3A%7B%22AWS%22%3A%22*%22%7D%2C%22"
- + "Action%22%3A%22SQS%3AReceiveMessage%22%2C%22Resource%22%3A%22%2F195004372649%2FMyNewCamelQueue%22%7D%5D%7D");
+ + "Action%22%3A%22SQS%3AReceiveMessage%22%2C%22Resource%22%3A%22%2F195004372649%2FMyNewCamelQueue%22%7D%5D%7D",
+ "#class:" + TestSqsConfiguration.class.getName());
return new RouteBuilder() {
@Override
diff --git a/components/camel-aws-sqs/src/test/java/org/apache/camel/component/aws/sqs/integration/SqsConsumerMessageIntegrationTest.java b/components/camel-aws-sqs/src/test/java/org/apache/camel/component/aws/sqs/integration/SqsConsumerMessageIntegrationTest.java
index 8ce1abc..d0c0c4c 100644
--- a/components/camel-aws-sqs/src/test/java/org/apache/camel/component/aws/sqs/integration/SqsConsumerMessageIntegrationTest.java
+++ b/components/camel-aws-sqs/src/test/java/org/apache/camel/component/aws/sqs/integration/SqsConsumerMessageIntegrationTest.java
@@ -16,6 +16,7 @@
*/
package org.apache.camel.component.aws.sqs.integration;
+import com.amazonaws.services.sqs.AmazonSQS;
import org.apache.camel.EndpointInject;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
@@ -23,13 +24,25 @@ 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.SystemPropertiesAWSCredentialsProvider;
+import org.apache.camel.test.infra.aws.common.TestAWSCredentialsProvider;
+import org.apache.camel.test.infra.aws.common.services.AWSService;
+import org.apache.camel.test.infra.aws.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.Disabled;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
-@Disabled("Must be manually tested. Provide your own accessKey and secretKey!")
public class SqsConsumerMessageIntegrationTest extends CamelTestSupport {
+ @SuppressWarnings("unused")
+ @RegisterExtension
+ public static AWSService<AmazonSQS> service = AWSServiceFactory.createSQSService();
+
+ @RegisterExtension
+ public static SharedNameGenerator sharedNameGenerator = new TestEntityNameGenerator();
+
@EndpointInject("direct:start")
private ProducerTemplate template;
@@ -57,18 +70,28 @@ public class SqsConsumerMessageIntegrationTest extends CamelTestSupport {
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
+ TestAWSCredentialsProvider awsCredentialsProvider = new SystemPropertiesAWSCredentialsProvider();
+
final String sqsEndpointUri
- = String.format("aws-sqs://camel-1?accessKey=RAW(xxxx)&secretKey=RAW(xxxx)®ion=EU_WEST_1");
+ = String.format("aws-sqs://%s?accessKey=RAW(%s)&secretKey=RAW(%s)®ion=EU_WEST_1&configuration=#class:%s",
+ sharedNameGenerator.getName(),
+ awsCredentialsProvider.getCredentials().getAWSAccessKeyId(),
+ awsCredentialsProvider.getCredentials().getAWSSecretKey(),
+ TestSqsConfiguration.class.getName());
return new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").startupOrder(2).to(sqsEndpointUri);
- from("aws-sqs://camel-1?accessKey=RAW(xxxx)&secretKey=RAW(xxxx)®ion=EU_WEST_1&deleteAfterRead=false&deleteIfFiltered=true")
- .startupOrder(1)
- .filter(simple("${body} != 'ignore'")).log("${body}").log("${header.CamelAwsSqsReceiptHandle}")
- .to("mock:result");
+ fromF("aws-sqs://%s?accessKey=RAW(%s)&secretKey=RAW(%s)®ion=EU_WEST_1&deleteAfterRead=false&deleteIfFiltered=true&configuration=#class:%s",
+ sharedNameGenerator.getName(),
+ awsCredentialsProvider.getCredentials().getAWSAccessKeyId(),
+ awsCredentialsProvider.getCredentials().getAWSSecretKey(),
+ TestSqsConfiguration.class.getName())
+ .startupOrder(1)
+ .filter(simple("${body} != 'ignore'")).log("${body}").log("${header.CamelAwsSqsReceiptHandle}")
+ .to("mock:result");
}
};
}
diff --git a/components/camel-aws-sqs/src/test/java/org/apache/camel/component/aws/sqs/integration/SqsProducerBatchSendFifoIntegrationTest.java b/components/camel-aws-sqs/src/test/java/org/apache/camel/component/aws/sqs/integration/SqsProducerBatchSendFifoIntegrationTest.java
index ff9faf5..684d7a6 100644
--- a/components/camel-aws-sqs/src/test/java/org/apache/camel/component/aws/sqs/integration/SqsProducerBatchSendFifoIntegrationTest.java
+++ b/components/camel-aws-sqs/src/test/java/org/apache/camel/component/aws/sqs/integration/SqsProducerBatchSendFifoIntegrationTest.java
@@ -19,6 +19,7 @@ package org.apache.camel.component.aws.sqs.integration;
import java.util.ArrayList;
import java.util.Collection;
+import com.amazonaws.services.sqs.AmazonSQS;
import org.apache.camel.EndpointInject;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
@@ -27,13 +28,25 @@ import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.aws.sqs.SqsConstants;
import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.infra.aws.common.SystemPropertiesAWSCredentialsProvider;
+import org.apache.camel.test.infra.aws.common.TestAWSCredentialsProvider;
+import org.apache.camel.test.infra.aws.common.services.AWSService;
+import org.apache.camel.test.infra.aws.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.Disabled;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
-@Disabled("Must be manually tested. Provide your own accessKey and secretKey!")
public class SqsProducerBatchSendFifoIntegrationTest extends CamelTestSupport {
+ @SuppressWarnings("unused")
+ @RegisterExtension
+ public static AWSService<AmazonSQS> service = AWSServiceFactory.createSQSService();
+
+ @RegisterExtension
+ public static SharedNameGenerator sharedNameGenerator = new TestEntityNameGenerator();
+
@EndpointInject("direct:start")
private ProducerTemplate template;
@@ -61,9 +74,15 @@ public class SqsProducerBatchSendFifoIntegrationTest extends CamelTestSupport {
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
+ TestAWSCredentialsProvider awsCredentialsProvider = new SystemPropertiesAWSCredentialsProvider();
+
final String sqsEndpointUri = String.format(
- "aws-sqs://camel-1.fifo?accessKey=RAW(xxx)&secretKey=RAW(xxx)®ion=EU_WEST_1&messageGroupIdStrategy=useExchangeId"
- + "&messageDeduplicationIdStrategy=useContentBasedDeduplication");
+ "aws-sqs://%s?accessKey=RAW(%s)&secretKey=RAW(%s)®ion=EU_WEST_1&messageGroupIdStrategy=useExchangeId"
+ + "&messageDeduplicationIdStrategy=useContentBasedDeduplication&configuration=#class:%s",
+ sharedNameGenerator.getName(),
+ awsCredentialsProvider.getCredentials().getAWSAccessKeyId(),
+ awsCredentialsProvider.getCredentials().getAWSSecretKey(),
+ TestSqsConfiguration.class.getName());
return new RouteBuilder() {
@Override
@@ -71,8 +90,12 @@ public class SqsProducerBatchSendFifoIntegrationTest extends CamelTestSupport {
from("direct:start").startupOrder(2).setHeader(SqsConstants.SQS_OPERATION, constant("sendBatchMessage"))
.to(sqsEndpointUri);
- from("aws-sqs://camel-1.fifo?accessKey=RAW(xxx)&secretKey=RAW(xxxx)®ion=EU_WEST_1&deleteAfterRead=false")
- .startupOrder(1).log("${body}").to("mock:result");
+ fromF("aws-sqs://%s?accessKey=RAW(%s)&secretKey=RAW(%s)®ion=EU_WEST_1&deleteAfterRead=false&configuration=#class:%s",
+ sharedNameGenerator.getName(),
+ awsCredentialsProvider.getCredentials().getAWSAccessKeyId(),
+ awsCredentialsProvider.getCredentials().getAWSSecretKey(),
+ TestSqsConfiguration.class.getName())
+ .startupOrder(1).log("${body}").to("mock:result");
}
};
}
diff --git a/components/camel-aws-sqs/src/test/java/org/apache/camel/component/aws/sqs/integration/SqsProducerBatchSendIntegrationTest.java b/components/camel-aws-sqs/src/test/java/org/apache/camel/component/aws/sqs/integration/SqsProducerBatchSendIntegrationTest.java
index 7628850..4a2f735 100644
--- a/components/camel-aws-sqs/src/test/java/org/apache/camel/component/aws/sqs/integration/SqsProducerBatchSendIntegrationTest.java
+++ b/components/camel-aws-sqs/src/test/java/org/apache/camel/component/aws/sqs/integration/SqsProducerBatchSendIntegrationTest.java
@@ -19,6 +19,7 @@ package org.apache.camel.component.aws.sqs.integration;
import java.util.ArrayList;
import java.util.Collection;
+import com.amazonaws.services.sqs.AmazonSQS;
import org.apache.camel.EndpointInject;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
@@ -27,13 +28,25 @@ import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.aws.sqs.SqsConstants;
import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.infra.aws.common.SystemPropertiesAWSCredentialsProvider;
+import org.apache.camel.test.infra.aws.common.TestAWSCredentialsProvider;
+import org.apache.camel.test.infra.aws.common.services.AWSService;
+import org.apache.camel.test.infra.aws.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.Disabled;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
-@Disabled("Must be manually tested. Provide your own accessKey and secretKey!")
public class SqsProducerBatchSendIntegrationTest extends CamelTestSupport {
+ @SuppressWarnings("unused")
+ @RegisterExtension
+ public static AWSService<AmazonSQS> service = AWSServiceFactory.createSQSService();
+
+ @RegisterExtension
+ public static SharedNameGenerator sharedNameGenerator = new TestEntityNameGenerator();
+
@EndpointInject("direct:start")
private ProducerTemplate template;
@@ -61,7 +74,14 @@ public class SqsProducerBatchSendIntegrationTest extends CamelTestSupport {
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
- final String sqsEndpointUri = String.format("aws-sqs://camel-1?accessKey=RAW(xxx)&secretKey=RAW(xxx)®ion=EU_WEST_1");
+ TestAWSCredentialsProvider awsCredentialsProvider = new SystemPropertiesAWSCredentialsProvider();
+
+ final String sqsEndpointUri
+ = String.format("aws-sqs://%s?accessKey=RAW(%s)&secretKey=RAW(%s)®ion=EU_WEST_1&configuration=#class:%s",
+ sharedNameGenerator.getName(),
+ awsCredentialsProvider.getCredentials().getAWSAccessKeyId(),
+ awsCredentialsProvider.getCredentials().getAWSSecretKey(),
+ TestSqsConfiguration.class.getName());
return new RouteBuilder() {
@Override
@@ -69,8 +89,12 @@ public class SqsProducerBatchSendIntegrationTest extends CamelTestSupport {
from("direct:start").startupOrder(2).setHeader(SqsConstants.SQS_OPERATION, constant("sendBatchMessage"))
.to(sqsEndpointUri);
- from("aws-sqs://camel-1?accessKey=RAW(xxx)&secretKey=RAW(xxx)®ion=EU_WEST_1&deleteAfterRead=true")
- .startupOrder(1).log("${body}").to("mock:result");
+ fromF("aws-sqs://%s?accessKey=RAW(%s)&secretKey=RAW(%s)®ion=EU_WEST_1&deleteAfterRead=true&configuration=#class:%s",
+ sharedNameGenerator.getName(),
+ awsCredentialsProvider.getCredentials().getAWSAccessKeyId(),
+ awsCredentialsProvider.getCredentials().getAWSSecretKey(),
+ TestSqsConfiguration.class.getName())
+ .startupOrder(1).log("${body}").to("mock:result");
}
};
}
diff --git a/components/camel-aws-sqs/src/test/java/org/apache/camel/component/aws/sqs/integration/SqsProducerDeleteMessageIntegrationTest.java b/components/camel-aws-sqs/src/test/java/org/apache/camel/component/aws/sqs/integration/SqsProducerDeleteMessageIntegrationTest.java
index a457402..6f1af71 100644
--- a/components/camel-aws-sqs/src/test/java/org/apache/camel/component/aws/sqs/integration/SqsProducerDeleteMessageIntegrationTest.java
+++ b/components/camel-aws-sqs/src/test/java/org/apache/camel/component/aws/sqs/integration/SqsProducerDeleteMessageIntegrationTest.java
@@ -16,6 +16,7 @@
*/
package org.apache.camel.component.aws.sqs.integration;
+import com.amazonaws.services.sqs.AmazonSQS;
import org.apache.camel.EndpointInject;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
@@ -23,13 +24,25 @@ 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.SystemPropertiesAWSCredentialsProvider;
+import org.apache.camel.test.infra.aws.common.TestAWSCredentialsProvider;
+import org.apache.camel.test.infra.aws.common.services.AWSService;
+import org.apache.camel.test.infra.aws.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.Disabled;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
-@Disabled("Must be manually tested. Provide your own accessKey and secretKey!")
public class SqsProducerDeleteMessageIntegrationTest extends CamelTestSupport {
+ @SuppressWarnings("unused")
+ @RegisterExtension
+ public static AWSService<AmazonSQS> service = AWSServiceFactory.createSQSService();
+
+ @RegisterExtension
+ public static SharedNameGenerator sharedNameGenerator = new TestEntityNameGenerator();
+
@EndpointInject("direct:start")
private ProducerTemplate template;
@@ -51,18 +64,33 @@ public class SqsProducerDeleteMessageIntegrationTest extends CamelTestSupport {
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
- final String sqsEndpointUri = String.format("aws-sqs://camel-1?accessKey=RAW(xxx)&secretKey=RAW(xxx)®ion=EU_WEST_1");
+ TestAWSCredentialsProvider awsCredentialsProvider = new SystemPropertiesAWSCredentialsProvider();
+
+ final String sqsEndpointUri
+ = String.format("aws-sqs://%s?accessKey=RAW(%s)&secretKey=RAW(%s)®ion=EU_WEST_1&configuration=#class:%s",
+ sharedNameGenerator.getName(),
+ awsCredentialsProvider.getCredentials().getAWSAccessKeyId(),
+ awsCredentialsProvider.getCredentials().getAWSSecretKey(),
+ TestSqsConfiguration.class.getName());
return new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").startupOrder(2).to(sqsEndpointUri);
- from("aws-sqs://camel-1?accessKey=RAW(xxx)&secretKey=RAW(xxx)®ion=EU_WEST_1&deleteAfterRead=false")
- .startupOrder(1).log("${body}")
- .to("aws-sqs://camel-1?accessKey=RAW(xxx)&secretKey=RAW(xxx)®ion=EU_WEST_1&operation=deleteMessage")
- .log("${body}").log("${header.CamelAwsSqsReceiptHandle}")
- .to("mock:result");
+ fromF("aws-sqs://%s?accessKey=RAW(%s)&secretKey=RAW(%s)®ion=EU_WEST_1&deleteAfterRead=false&configuration=#class:%s",
+ sharedNameGenerator.getName(),
+ awsCredentialsProvider.getCredentials().getAWSAccessKeyId(),
+ awsCredentialsProvider.getCredentials().getAWSSecretKey(),
+ TestSqsConfiguration.class.getName())
+ .startupOrder(1).log("${body}")
+ .toF("aws-sqs://%s?accessKey=RAW(%s)&secretKey=RAW(%s)®ion=EU_WEST_1&operation=deleteMessage&configuration=#class:%s",
+ sharedNameGenerator.getName(),
+ awsCredentialsProvider.getCredentials().getAWSAccessKeyId(),
+ awsCredentialsProvider.getCredentials().getAWSSecretKey(),
+ TestSqsConfiguration.class.getName())
+ .log("${body}").log("${header.CamelAwsSqsReceiptHandle}")
+ .to("mock:result");
}
};
}
diff --git a/components/camel-aws-sqs/src/test/java/org/apache/camel/component/aws/sqs/integration/TestSqsConfiguration.java b/components/camel-aws-sqs/src/test/java/org/apache/camel/component/aws/sqs/integration/TestSqsConfiguration.java
new file mode 100644
index 0000000..7bae0b7
--- /dev/null
+++ b/components/camel-aws-sqs/src/test/java/org/apache/camel/component/aws/sqs/integration/TestSqsConfiguration.java
@@ -0,0 +1,54 @@
+/*
+ * 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.aws.sqs.integration;
+
+import com.amazonaws.services.sqs.AmazonSQS;
+import com.amazonaws.services.sqs.model.QueueDoesNotExistException;
+import org.apache.camel.component.aws.sqs.SqsConfiguration;
+import org.apache.camel.test.infra.aws.clients.AWSClientUtils;
+import org.apache.camel.test.infra.common.SharedNameGenerator;
+import org.apache.camel.test.infra.common.SharedNameRegistry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TestSqsConfiguration extends SqsConfiguration {
+ private static final Logger LOG = LoggerFactory.getLogger(TestSqsConfiguration.class);
+ private final AmazonSQS client = AWSClientUtils.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 String getQueueUrl() {
+ try {
+ return client.getQueueUrl(getQueueName()).getQueueUrl();
+ } catch (QueueDoesNotExistException e) {
+ return client.createQueue(getQueueName()).getQueueUrl();
+ }
+ }
+
+ @Override
+ public AmazonSQS getAmazonSQSClient() {
+ return client;
+ }
+}
diff --git a/test-infra/camel-test-infra-aws-common/src/test/java/org/apache/camel/test/infra/aws/common/AWSConfigs.java b/test-infra/camel-test-infra-aws-common/src/test/java/org/apache/camel/test/infra/aws/common/AWSConfigs.java
index c9503ea..5a17902 100644
--- a/test-infra/camel-test-infra-aws-common/src/test/java/org/apache/camel/test/infra/aws/common/AWSConfigs.java
+++ b/test-infra/camel-test-infra-aws-common/src/test/java/org/apache/camel/test/infra/aws/common/AWSConfigs.java
@@ -17,8 +17,8 @@
package org.apache.camel.test.infra.aws.common;
public final class AWSConfigs {
- public static final String ACCESS_KEY = "access.key";
- public static final String SECRET_KEY = "secret.key";
+ public static final String ACCESS_KEY = "aws.access.key";
+ public static final String SECRET_KEY = "aws.secret.key";
public static final String REGION = "aws.region";
public static final String AMAZON_AWS_HOST = "aws.host";
public static final String PROTOCOL = "aws.protocol";
diff --git a/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/clients/AWSClientUtils.java b/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/clients/AWSClientUtils.java
index 8b0094e..c80b5c6 100644
--- a/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/clients/AWSClientUtils.java
+++ b/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/clients/AWSClientUtils.java
@@ -30,6 +30,7 @@ import com.amazonaws.services.sns.AmazonSNSClientBuilder;
import com.amazonaws.services.sqs.AmazonSQS;
import com.amazonaws.services.sqs.AmazonSQSClientBuilder;
import org.apache.camel.test.infra.aws.common.AWSConfigs;
+import org.apache.camel.test.infra.aws.common.SystemPropertiesAWSCredentialsProvider;
import org.apache.camel.test.infra.aws.common.TestAWSCredentialsProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -74,7 +75,7 @@ public final class AWSClientUtils {
} else {
clientBuilder
.withRegion(region)
- .withCredentials(new TestAWSCredentialsProvider());
+ .withCredentials(new SystemPropertiesAWSCredentialsProvider());
}
return clientBuilder.build();
@@ -87,9 +88,11 @@ public final class AWSClientUtils {
String awsInstanceType = System.getProperty("aws-service.instance.type");
String region = getRegion();
+ LOG.debug("Using amazon region: {}", region);
if (awsInstanceType == null || awsInstanceType.equals("local-aws-container")) {
String amazonHost = System.getProperty(AWSConfigs.AMAZON_AWS_HOST);
+ LOG.debug("Using amazon host: {}", amazonHost);
ClientConfiguration clientConfiguration = new ClientConfiguration();
clientConfiguration.setProtocol(Protocol.HTTP);
@@ -101,7 +104,7 @@ public final class AWSClientUtils {
} else {
clientBuilder
.withRegion(region)
- .withCredentials(new TestAWSCredentialsProvider());
+ .withCredentials(new SystemPropertiesAWSCredentialsProvider());
}
return clientBuilder.build();
@@ -126,7 +129,7 @@ public final class AWSClientUtils {
} else {
clientBuilder
.withRegion(region)
- .withCredentials(new TestAWSCredentialsProvider());
+ .withCredentials(new SystemPropertiesAWSCredentialsProvider());
}
clientBuilder
@@ -157,7 +160,7 @@ public final class AWSClientUtils {
} else {
clientBuilder
.withRegion(region)
- .withCredentials(new TestAWSCredentialsProvider());
+ .withCredentials(new SystemPropertiesAWSCredentialsProvider());
}
return clientBuilder.build();
diff --git a/test-infra/camel-test-infra-aws-common/src/test/java/org/apache/camel/test/infra/aws/common/AWSConfigs.java b/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/common/SystemPropertiesAWSCredentialsProvider.java
similarity index 71%
copy from test-infra/camel-test-infra-aws-common/src/test/java/org/apache/camel/test/infra/aws/common/AWSConfigs.java
copy to test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/common/SystemPropertiesAWSCredentialsProvider.java
index c9503ea..88ab1f6 100644
--- a/test-infra/camel-test-infra-aws-common/src/test/java/org/apache/camel/test/infra/aws/common/AWSConfigs.java
+++ b/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/common/SystemPropertiesAWSCredentialsProvider.java
@@ -14,15 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.camel.test.infra.aws.common;
-public final class AWSConfigs {
- public static final String ACCESS_KEY = "access.key";
- public static final String SECRET_KEY = "secret.key";
- public static final String REGION = "aws.region";
- public static final String AMAZON_AWS_HOST = "aws.host";
- public static final String PROTOCOL = "aws.protocol";
+public class SystemPropertiesAWSCredentialsProvider extends TestAWSCredentialsProvider {
- private AWSConfigs() {
+ public SystemPropertiesAWSCredentialsProvider() {
+ super(System.getProperty(AWSConfigs.ACCESS_KEY), System.getProperty(AWSConfigs.SECRET_KEY));
}
+
}
diff --git a/test-infra/camel-test-infra-aws-common/src/test/java/org/apache/camel/test/infra/aws/common/AWSConfigs.java b/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/common/TestAWSCredentials.java
similarity index 60%
copy from test-infra/camel-test-infra-aws-common/src/test/java/org/apache/camel/test/infra/aws/common/AWSConfigs.java
copy to test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/common/TestAWSCredentials.java
index c9503ea..e5d77c1 100644
--- a/test-infra/camel-test-infra-aws-common/src/test/java/org/apache/camel/test/infra/aws/common/AWSConfigs.java
+++ b/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/common/TestAWSCredentials.java
@@ -14,15 +14,29 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.camel.test.infra.aws.common;
-public final class AWSConfigs {
- public static final String ACCESS_KEY = "access.key";
- public static final String SECRET_KEY = "secret.key";
- public static final String REGION = "aws.region";
- public static final String AMAZON_AWS_HOST = "aws.host";
- public static final String PROTOCOL = "aws.protocol";
+import java.util.Objects;
+
+import com.amazonaws.auth.AWSCredentials;
+
+public class TestAWSCredentials implements AWSCredentials {
+ private final String accessKey;
+ private final String secretKey;
+
+ public TestAWSCredentials(String accessKey, String secretKey) {
+ this.accessKey = Objects.requireNonNull(accessKey);
+ this.secretKey = Objects.requireNonNull(secretKey);
+ }
+
+ @Override
+ public String getAWSAccessKeyId() {
+ return accessKey;
+ }
- private AWSConfigs() {
+ @Override
+ public String getAWSSecretKey() {
+ return secretKey;
}
-}
+};
diff --git a/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/common/TestAWSCredentialsProvider.java b/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/common/TestAWSCredentialsProvider.java
index dcfba3d..d4c1d97 100644
--- a/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/common/TestAWSCredentialsProvider.java
+++ b/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/common/TestAWSCredentialsProvider.java
@@ -20,36 +20,8 @@ import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.AWSCredentialsProvider;
public class TestAWSCredentialsProvider implements AWSCredentialsProvider {
- private static class TestAWSCredentials implements AWSCredentials {
- private final String accessKey;
- private final String secretKey;
-
- public TestAWSCredentials() {
- this(System.getProperty(AWSConfigs.ACCESS_KEY), System.getProperty(AWSConfigs.SECRET_KEY));
- }
-
- public TestAWSCredentials(String accessKey, String secretKey) {
- this.accessKey = accessKey;
- this.secretKey = secretKey;
- }
-
- @Override
- public String getAWSAccessKeyId() {
- return accessKey;
- }
-
- @Override
- public String getAWSSecretKey() {
- return secretKey;
- }
- };
-
private AWSCredentials credentials;
- public TestAWSCredentialsProvider() {
- credentials = new TestAWSCredentials();
- }
-
public TestAWSCredentialsProvider(String accessKey, String secretKey) {
credentials = new TestAWSCredentials(accessKey, secretKey);
}
diff --git a/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/services/AWSLocalContainerService.java b/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/services/AWSLocalContainerService.java
index 16a08fe..6460921 100644
--- a/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/services/AWSLocalContainerService.java
+++ b/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/services/AWSLocalContainerService.java
@@ -43,6 +43,7 @@ abstract class AWSLocalContainerService<T> implements AWSService<T> {
@Override
public void initialize() {
+ getConnectionProperties();
LOG.info("AWS service running at address {}", getServiceEndpoint());
}
@@ -63,24 +64,24 @@ abstract class AWSLocalContainerService<T> implements AWSService<T> {
AWSCredentials credentials = getCredentials();
properties.put(AWSConfigs.ACCESS_KEY, credentials.getAWSAccessKeyId());
-
properties.put(AWSConfigs.SECRET_KEY, credentials.getAWSSecretKey());
-
properties.put(AWSConfigs.REGION, Regions.US_EAST_1.name());
-
properties.put(AWSConfigs.AMAZON_AWS_HOST, getAmazonHost());
+ properties.put(AWSConfigs.PROTOCOL, "http");
/**
* We need to set this one. For some sets, when they instantiate the clients within Camel, they need to know
- * what is the Amazon host being used (ie.: when creating them using the withEndpointConfiguration()). Because
- * this happens within Camel, there's no way to pass that information easily. Therefore, the host is set as a
- * property and read by whatever class/method creates the clients to pass to Camel.
+ * what is the Amazon details being used (ie.: when creating them using the withEndpointConfiguration()).
+ * Because this happens within Camel, there's no way to pass that information easily. Therefore, the information
+ * is set as a property and read by whatever class/method creates the clients to pass to Camel.
*
* Do not unset.
*/
+ System.setProperty(AWSConfigs.SECRET_KEY, credentials.getAWSSecretKey());
+ System.setProperty(AWSConfigs.ACCESS_KEY, credentials.getAWSAccessKeyId());
System.setProperty(AWSConfigs.AMAZON_AWS_HOST, getAmazonHost());
-
- properties.put(AWSConfigs.PROTOCOL, "http");
+ System.setProperty(AWSConfigs.REGION, Regions.US_EAST_1.name());
+ System.setProperty(AWSConfigs.PROTOCOL, "http");
return properties;
}
diff --git a/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/services/AWSRemoteService.java b/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/services/AWSRemoteService.java
index db499ec..a889d52 100644
--- a/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/services/AWSRemoteService.java
+++ b/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/services/AWSRemoteService.java
@@ -24,11 +24,11 @@ import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.AWSCredentialsProvider;
import com.amazonaws.regions.Regions;
import org.apache.camel.test.infra.aws.common.AWSConfigs;
-import org.apache.camel.test.infra.aws.common.TestAWSCredentialsProvider;
+import org.apache.camel.test.infra.aws.common.SystemPropertiesAWSCredentialsProvider;
import org.apache.camel.test.infra.aws.common.services.AWSService;
public class AWSRemoteService<T> implements AWSService<T> {
- private static final AWSCredentialsProvider CREDENTIALS_PROVIDER = new TestAWSCredentialsProvider();
+ private static final AWSCredentialsProvider CREDENTIALS_PROVIDER = new SystemPropertiesAWSCredentialsProvider();
private Supplier<T> remoteClientSupplier;
public AWSRemoteService(Supplier<T> remoteClientSupplier) {
diff --git a/test-infra/camel-test-infra-aws-common/src/test/java/org/apache/camel/test/infra/aws/common/AWSConfigs.java b/test-infra/camel-test-infra-common/src/test/java/org/apache/camel/test/infra/common/SharedNameGenerator.java
similarity index 66%
copy from test-infra/camel-test-infra-aws-common/src/test/java/org/apache/camel/test/infra/aws/common/AWSConfigs.java
copy to test-infra/camel-test-infra-common/src/test/java/org/apache/camel/test/infra/common/SharedNameGenerator.java
index c9503ea..5e7af4b 100644
--- a/test-infra/camel-test-infra-aws-common/src/test/java/org/apache/camel/test/infra/aws/common/AWSConfigs.java
+++ b/test-infra/camel-test-infra-common/src/test/java/org/apache/camel/test/infra/common/SharedNameGenerator.java
@@ -14,15 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.test.infra.aws.common;
-public final class AWSConfigs {
- public static final String ACCESS_KEY = "access.key";
- public static final String SECRET_KEY = "secret.key";
- public static final String REGION = "aws.region";
- public static final String AMAZON_AWS_HOST = "aws.host";
- public static final String PROTOCOL = "aws.protocol";
+package org.apache.camel.test.infra.common;
- private AWSConfigs() {
- }
+import org.junit.jupiter.api.extension.BeforeAllCallback;
+import org.junit.jupiter.api.extension.BeforeEachCallback;
+
+public interface SharedNameGenerator extends BeforeAllCallback, BeforeEachCallback {
+ String getName();
}
diff --git a/test-infra/camel-test-infra-aws-common/src/test/java/org/apache/camel/test/infra/aws/common/AWSConfigs.java b/test-infra/camel-test-infra-common/src/test/java/org/apache/camel/test/infra/common/SharedNameRegistry.java
similarity index 57%
copy from test-infra/camel-test-infra-aws-common/src/test/java/org/apache/camel/test/infra/aws/common/AWSConfigs.java
copy to test-infra/camel-test-infra-common/src/test/java/org/apache/camel/test/infra/common/SharedNameRegistry.java
index c9503ea..9113dc1 100644
--- a/test-infra/camel-test-infra-aws-common/src/test/java/org/apache/camel/test/infra/aws/common/AWSConfigs.java
+++ b/test-infra/camel-test-infra-common/src/test/java/org/apache/camel/test/infra/common/SharedNameRegistry.java
@@ -14,15 +14,26 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.test.infra.aws.common;
-public final class AWSConfigs {
- public static final String ACCESS_KEY = "access.key";
- public static final String SECRET_KEY = "secret.key";
- public static final String REGION = "aws.region";
- public static final String AMAZON_AWS_HOST = "aws.host";
- public static final String PROTOCOL = "aws.protocol";
+package org.apache.camel.test.infra.common;
- private AWSConfigs() {
+public class SharedNameRegistry {
+ private static SharedNameRegistry instance;
+ private SharedNameGenerator sharedNameGenerator;
+
+ public SharedNameGenerator getSharedNameGenerator() {
+ return sharedNameGenerator;
+ }
+
+ public void setSharedNameGenerator(SharedNameGenerator sharedNameGenerator) {
+ this.sharedNameGenerator = sharedNameGenerator;
+ }
+
+ public static synchronized SharedNameRegistry getInstance() {
+ if (instance == null) {
+ instance = new SharedNameRegistry();
+ }
+
+ return instance;
}
}
diff --git a/test-infra/camel-test-infra-aws-common/src/test/java/org/apache/camel/test/infra/aws/common/AWSConfigs.java b/test-infra/camel-test-infra-common/src/test/java/org/apache/camel/test/infra/common/TestEntityNameGenerator.java
similarity index 54%
copy from test-infra/camel-test-infra-aws-common/src/test/java/org/apache/camel/test/infra/aws/common/AWSConfigs.java
copy to test-infra/camel-test-infra-common/src/test/java/org/apache/camel/test/infra/common/TestEntityNameGenerator.java
index c9503ea..dca6388 100644
--- a/test-infra/camel-test-infra-aws-common/src/test/java/org/apache/camel/test/infra/aws/common/AWSConfigs.java
+++ b/test-infra/camel-test-infra-common/src/test/java/org/apache/camel/test/infra/common/TestEntityNameGenerator.java
@@ -14,15 +14,28 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.test.infra.aws.common;
-public final class AWSConfigs {
- public static final String ACCESS_KEY = "access.key";
- public static final String SECRET_KEY = "secret.key";
- public static final String REGION = "aws.region";
- public static final String AMAZON_AWS_HOST = "aws.host";
- public static final String PROTOCOL = "aws.protocol";
+package org.apache.camel.test.infra.common;
- private AWSConfigs() {
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class TestEntityNameGenerator implements SharedNameGenerator {
+ private String testClass;
+ private String testName;
+
+ @Override
+ public void beforeAll(ExtensionContext context) throws Exception {
+ testClass = context.getTestClass().get().getSimpleName();
+ }
+
+ @Override
+ public void beforeEach(ExtensionContext context) throws Exception {
+ testName = context.getTestMethod().get().getName();
+
+ SharedNameRegistry.getInstance().setSharedNameGenerator(this);
+ }
+
+ public String getName() {
+ return testClass + testName;
}
}