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 33d5809 Removes test-infra based on AWS v1 services (rel: CAMEL-16115) (#5189) 33d5809 is described below commit 33d5809bfde87702353845eec7a1f13cd2c8e5a5 Author: Otavio Rodolfo Piske <orpi...@users.noreply.github.com> AuthorDate: Tue Mar 9 15:49:40 2021 +0100 Removes test-infra based on AWS v1 services (rel: CAMEL-16115) (#5189) --- test-infra/camel-test-infra-aws-v1/pom.xml | 101 ------------- .../src/main/resources/META-INF/MANIFEST.MF | 0 .../test/infra/aws/clients/AWSClientUtils.java | 168 --------------------- .../SystemPropertiesAWSCredentialsProvider.java | 26 ---- .../test/infra/aws/common/TestAWSCredentials.java | 42 ------ .../aws/common/TestAWSCredentialsProvider.java | 38 ----- .../services/AWSKinesisLocalContainerService.java | 32 ---- .../aws/services/AWSLocalContainerService.java | 114 -------------- .../test/infra/aws/services/AWSRemoteService.java | 63 -------- .../aws/services/AWSS3LocalContainerService.java | 32 ---- .../aws/services/AWSSNSLocalContainerService.java | 33 ---- .../aws/services/AWSSQSLocalContainerService.java | 32 ---- .../test/infra/aws/services/AWSServiceFactory.java | 102 ------------- test-infra/pom.xml | 1 - 14 files changed, 784 deletions(-) diff --git a/test-infra/camel-test-infra-aws-v1/pom.xml b/test-infra/camel-test-infra-aws-v1/pom.xml deleted file mode 100644 index 0d85160..0000000 --- a/test-infra/camel-test-infra-aws-v1/pom.xml +++ /dev/null @@ -1,101 +0,0 @@ -<?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/xsd/maven-4.0.0.xsd"> - <parent> - <artifactId>camel-test-infra-parent</artifactId> - <groupId>org.apache.camel</groupId> - <relativePath>../camel-test-infra-parent/pom.xml</relativePath> - <version>3.9.0-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - - <name>Camel :: Test Infra :: AWS SDK v1</name> - <artifactId>camel-test-infra-aws-v1</artifactId> - - <dependencies> - <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.testcontainers</groupId> - <artifactId>testcontainers</artifactId> - </dependency> - - <dependency> - <groupId>org.testcontainers</groupId> - <artifactId>localstack</artifactId> - </dependency> - - <dependency> - <groupId>com.amazonaws</groupId> - <artifactId>aws-java-sdk-core</artifactId> - <version>${aws-java-sdk-version}</version> - </dependency> - - <dependency> - <groupId>com.amazonaws</groupId> - <artifactId>aws-java-sdk-sqs</artifactId> - <version>${aws-java-sdk-version}</version> - </dependency> - - <dependency> - <groupId>com.amazonaws</groupId> - <artifactId>aws-java-sdk-kinesis</artifactId> - <version>${aws-java-sdk-version}</version> - </dependency> - - <dependency> - <groupId>com.amazonaws</groupId> - <artifactId>aws-java-sdk-s3</artifactId> - <version>${aws-java-sdk-version}</version> - </dependency> - - <dependency> - <groupId>com.amazonaws</groupId> - <artifactId>aws-java-sdk-sns</artifactId> - <version>${aws-java-sdk-version}</version> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-jar-plugin</artifactId> - </plugin> - </plugins> - </build> - -</project> \ No newline at end of file diff --git a/test-infra/camel-test-infra-aws-v1/src/main/resources/META-INF/MANIFEST.MF b/test-infra/camel-test-infra-aws-v1/src/main/resources/META-INF/MANIFEST.MF deleted file mode 100644 index e69de29..0000000 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 deleted file mode 100644 index c80b5c6..0000000 --- a/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/clients/AWSClientUtils.java +++ /dev/null @@ -1,168 +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.test.infra.aws.clients; - -import com.amazonaws.ClientConfiguration; -import com.amazonaws.Protocol; -import com.amazonaws.client.builder.AwsClientBuilder; -import com.amazonaws.regions.Regions; -import com.amazonaws.services.kinesis.AmazonKinesis; -import com.amazonaws.services.kinesis.AmazonKinesisClientBuilder; -import com.amazonaws.services.s3.AmazonS3; -import com.amazonaws.services.s3.AmazonS3ClientBuilder; -import com.amazonaws.services.sns.AmazonSNS; -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; - -public final class AWSClientUtils { - private static final Logger LOG = LoggerFactory.getLogger(AWSClientUtils.class); - - private AWSClientUtils() { - } - - private static String getRegion() { - String regionStr = System.getProperty(AWSConfigs.REGION); - String region; - - if (regionStr != null && !regionStr.isEmpty()) { - region = Regions.valueOf(regionStr).getName(); - } else { - region = Regions.US_EAST_1.getName(); - } - - return region; - } - - public static AmazonSNS newSNSClient() { - LOG.debug("Creating a custom SNS client for running a AWS SNS test"); - AmazonSNSClientBuilder clientBuilder = AmazonSNSClientBuilder - .standard(); - - String awsInstanceType = System.getProperty("aws-service.instance.type"); - String region = getRegion(); - - if (awsInstanceType == null || awsInstanceType.equals("local-aws-container")) { - String amazonHost = System.getProperty(AWSConfigs.AMAZON_AWS_HOST); - - ClientConfiguration clientConfiguration = new ClientConfiguration(); - clientConfiguration.setProtocol(Protocol.HTTP); - - clientBuilder - .withClientConfiguration(clientConfiguration) - .withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(amazonHost, region)) - .withCredentials(new TestAWSCredentialsProvider("accesskey", "secretkey")); - } else { - clientBuilder - .withRegion(region) - .withCredentials(new SystemPropertiesAWSCredentialsProvider()); - } - - return clientBuilder.build(); - } - - public static AmazonSQS newSQSClient() { - LOG.debug("Creating a custom SQS client"); - AmazonSQSClientBuilder clientBuilder = AmazonSQSClientBuilder - .standard(); - - 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); - - clientBuilder - .withClientConfiguration(clientConfiguration) - .withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(amazonHost, region)) - .withCredentials(new TestAWSCredentialsProvider("accesskey", "secretkey")); - } else { - clientBuilder - .withRegion(region) - .withCredentials(new SystemPropertiesAWSCredentialsProvider()); - } - - return clientBuilder.build(); - } - - public static AmazonS3 newS3Client() { - LOG.debug("Creating a new S3 client"); - AmazonS3ClientBuilder clientBuilder = AmazonS3ClientBuilder.standard(); - - String awsInstanceType = System.getProperty("aws-service.instance.type"); - String region = getRegion(); - - if (awsInstanceType == null || awsInstanceType.equals("local-aws-container")) { - String amazonHost = System.getProperty(AWSConfigs.AMAZON_AWS_HOST); - ClientConfiguration clientConfiguration = new ClientConfiguration(); - clientConfiguration.setProtocol(Protocol.HTTP); - - clientBuilder - .withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(amazonHost, region)) - .withClientConfiguration(clientConfiguration) - .withCredentials(new TestAWSCredentialsProvider("accesskey", "secretkey")); - } else { - clientBuilder - .withRegion(region) - .withCredentials(new SystemPropertiesAWSCredentialsProvider()); - } - - clientBuilder - .withPathStyleAccessEnabled(true); - - return clientBuilder.build(); - } - - public static AmazonKinesis newKinesisClient() { - LOG.debug("Creating a new AWS Kinesis client"); - AmazonKinesisClientBuilder clientBuilder = AmazonKinesisClientBuilder.standard(); - - String awsInstanceType = System.getProperty("aws-service.kinesis.instance.type"); - String region = getRegion(); - - if (awsInstanceType == null || awsInstanceType.equals("local-aws-container")) { - String amazonHost = System.getProperty(AWSConfigs.AMAZON_AWS_HOST); - - LOG.debug("Creating a new AWS Kinesis client to access {}", amazonHost); - - ClientConfiguration clientConfiguration = new ClientConfiguration(); - clientConfiguration.setProtocol(Protocol.HTTP); - - clientBuilder - .withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(amazonHost, region)) - .withClientConfiguration(clientConfiguration) - .withCredentials(new TestAWSCredentialsProvider("accesskey", "secretkey")); - } else { - clientBuilder - .withRegion(region) - .withCredentials(new SystemPropertiesAWSCredentialsProvider()); - } - - return clientBuilder.build(); - } -} diff --git a/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/common/SystemPropertiesAWSCredentialsProvider.java b/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/common/SystemPropertiesAWSCredentialsProvider.java deleted file mode 100644 index 88ab1f6..0000000 --- a/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/common/SystemPropertiesAWSCredentialsProvider.java +++ /dev/null @@ -1,26 +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.test.infra.aws.common; - -public class SystemPropertiesAWSCredentialsProvider extends TestAWSCredentialsProvider { - - public SystemPropertiesAWSCredentialsProvider() { - super(System.getProperty(AWSConfigs.ACCESS_KEY), System.getProperty(AWSConfigs.SECRET_KEY)); - } - -} diff --git a/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/common/TestAWSCredentials.java b/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/common/TestAWSCredentials.java deleted file mode 100644 index e5d77c1..0000000 --- a/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/common/TestAWSCredentials.java +++ /dev/null @@ -1,42 +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.test.infra.aws.common; - -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; - } - - @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 deleted file mode 100644 index d4c1d97..0000000 --- a/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/common/TestAWSCredentialsProvider.java +++ /dev/null @@ -1,38 +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.test.infra.aws.common; - -import com.amazonaws.auth.AWSCredentials; -import com.amazonaws.auth.AWSCredentialsProvider; - -public class TestAWSCredentialsProvider implements AWSCredentialsProvider { - private AWSCredentials credentials; - - public TestAWSCredentialsProvider(String accessKey, String secretKey) { - credentials = new TestAWSCredentials(accessKey, secretKey); - } - - @Override - public AWSCredentials getCredentials() { - return credentials; - } - - @Override - public void refresh() { - - } -} diff --git a/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/services/AWSKinesisLocalContainerService.java b/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/services/AWSKinesisLocalContainerService.java deleted file mode 100644 index 0b1844c..0000000 --- a/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/services/AWSKinesisLocalContainerService.java +++ /dev/null @@ -1,32 +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.test.infra.aws.services; - -import org.testcontainers.containers.localstack.LocalStackContainer; - -public class AWSKinesisLocalContainerService extends AWSLocalContainerService { - - public AWSKinesisLocalContainerService() { - super(LocalStackContainer.Service.KINESIS); - } - - @Override - public String getServiceEndpoint() { - return super.getServiceEndpoint(LocalStackContainer.Service.KINESIS); - } -} 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 deleted file mode 100644 index 3fa2b6e..0000000 --- a/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/services/AWSLocalContainerService.java +++ /dev/null @@ -1,114 +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.test.infra.aws.services; - -import java.util.Properties; - -import com.amazonaws.auth.AWSCredentials; -import com.amazonaws.regions.Regions; -import org.apache.camel.test.infra.aws.common.AWSConfigs; -import org.apache.camel.test.infra.aws.common.services.AWSService; -import org.apache.camel.test.infra.common.services.ContainerService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testcontainers.containers.localstack.LocalStackContainer; - -abstract class AWSLocalContainerService implements AWSService, ContainerService<LocalStackContainer> { - private static final Logger LOG = LoggerFactory.getLogger(AWSLocalContainerService.class); - private final LocalStackContainer container; - - public AWSLocalContainerService(LocalStackContainer.Service... services) { - this.container = new LocalStackContainer().withServices(services); - } - - protected abstract String getServiceEndpoint(); - - @Override - public void registerProperties() { - AWSCredentials credentials = getCredentials(); - - /** - * We need to set this one. For some sets, when they instantiate the clients within Camel, they need to know - * 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()); - System.setProperty(AWSConfigs.REGION, Regions.US_EAST_1.name()); - System.setProperty(AWSConfigs.PROTOCOL, "http"); - } - - @Override - public void initialize() { - LOG.debug("Trying to start the container"); - container.start(); - - registerProperties(); - LOG.info("AWS service running at address {}", getServiceEndpoint()); - } - - @Override - public void shutdown() { - LOG.info("Stopping local AWS service"); - container.stop(); - } - - private AWSCredentials getCredentials() { - return container.getDefaultCredentialsProvider().getCredentials(); - } - - @Override - public Properties getConnectionProperties() { - Properties properties = new Properties(); - - 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"); - - return properties; - } - - @Override - public LocalStackContainer getContainer() { - return container; - } - - protected String getAmazonHost(int port) { - return String.format("%s:%d", container.getContainerIpAddress(), container.getMappedPort(port)); - } - - public String getAmazonHost() { - final int edgePort = 4566; - - return getAmazonHost(edgePort); - } - - protected String getServiceEndpoint(LocalStackContainer.Service service) { - return container - .getEndpointConfiguration(service) - .getServiceEndpoint(); - } -} 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 deleted file mode 100644 index 02f21b4..0000000 --- a/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/services/AWSRemoteService.java +++ /dev/null @@ -1,63 +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.test.infra.aws.services; - -import java.util.Properties; - -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.SystemPropertiesAWSCredentialsProvider; -import org.apache.camel.test.infra.aws.common.services.AWSService; - -public class AWSRemoteService implements AWSService { - private static final AWSCredentialsProvider CREDENTIALS_PROVIDER = new SystemPropertiesAWSCredentialsProvider(); - - @Override - public void registerProperties() { - // NO-OP - } - - private AWSCredentials getCredentials() { - return CREDENTIALS_PROVIDER.getCredentials(); - } - - @Override - public Properties getConnectionProperties() { - Properties properties = new Properties(); - - 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()); - - return properties; - } - - @Override - public void initialize() { - registerProperties(); - } - - @Override - public void shutdown() { - - } -} diff --git a/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/services/AWSS3LocalContainerService.java b/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/services/AWSS3LocalContainerService.java deleted file mode 100644 index 8a3b371..0000000 --- a/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/services/AWSS3LocalContainerService.java +++ /dev/null @@ -1,32 +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.test.infra.aws.services; - -import org.testcontainers.containers.localstack.LocalStackContainer; - -public class AWSS3LocalContainerService extends AWSLocalContainerService { - - public AWSS3LocalContainerService() { - super(LocalStackContainer.Service.S3); - } - - @Override - public String getServiceEndpoint() { - return super.getServiceEndpoint(LocalStackContainer.Service.S3); - } -} diff --git a/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/services/AWSSNSLocalContainerService.java b/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/services/AWSSNSLocalContainerService.java deleted file mode 100644 index 628a6be..0000000 --- a/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/services/AWSSNSLocalContainerService.java +++ /dev/null @@ -1,33 +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.test.infra.aws.services; - -import org.testcontainers.containers.localstack.LocalStackContainer; - -public class AWSSNSLocalContainerService extends AWSLocalContainerService { - - public AWSSNSLocalContainerService() { - super(LocalStackContainer.Service.SQS, - LocalStackContainer.Service.SNS); - } - - @Override - public String getServiceEndpoint() { - return super.getServiceEndpoint(LocalStackContainer.Service.SNS); - } -} diff --git a/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/services/AWSSQSLocalContainerService.java b/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/services/AWSSQSLocalContainerService.java deleted file mode 100644 index c4fc609..0000000 --- a/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/services/AWSSQSLocalContainerService.java +++ /dev/null @@ -1,32 +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.test.infra.aws.services; - -import org.testcontainers.containers.localstack.LocalStackContainer; - -public class AWSSQSLocalContainerService extends AWSLocalContainerService { - - public AWSSQSLocalContainerService() { - super(LocalStackContainer.Service.SQS); - } - - @Override - public String getServiceEndpoint() { - return super.getServiceEndpoint(LocalStackContainer.Service.SQS); - } -} diff --git a/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/services/AWSServiceFactory.java b/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/services/AWSServiceFactory.java deleted file mode 100644 index 22ed21e..0000000 --- a/test-infra/camel-test-infra-aws-v1/src/test/java/org/apache/camel/test/infra/aws/services/AWSServiceFactory.java +++ /dev/null @@ -1,102 +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.test.infra.aws.services; - -import org.apache.camel.test.infra.aws.common.services.AWSService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public final class AWSServiceFactory { - private static final Logger LOG = LoggerFactory.getLogger(AWSServiceFactory.class); - - private AWSServiceFactory() { - } - - private static String getInstanceTypeName(String awsInstanceType) { - return awsInstanceType == null ? "default" : awsInstanceType; - } - - public static AWSService createSQSService() { - String awsInstanceType = System.getProperty("aws-service.instance.type"); - LOG.info("Creating a {} AWS SQS instance", getInstanceTypeName(awsInstanceType)); - - if (awsInstanceType == null || awsInstanceType.equals("local-aws-container")) { - return new AWSSQSLocalContainerService(); - } - - if (awsInstanceType.equals("remote")) { - return new AWSRemoteService(); - } - - LOG.error("Invalid AWS instance type: {}. Must be either 'remote' or 'local-aws-container'", - getInstanceTypeName(awsInstanceType)); - throw new UnsupportedOperationException("Invalid AWS instance type"); - } - - public static AWSService createSNSService() { - String awsInstanceType = System.getProperty("aws-service.instance.type"); - LOG.info("Creating a {} AWS SNS instance", getInstanceTypeName(awsInstanceType)); - - if (awsInstanceType == null || awsInstanceType.equals("local-aws-container")) { - return new AWSSNSLocalContainerService(); - } - - if (awsInstanceType.equals("remote")) { - return new AWSRemoteService(); - } - - LOG.error("Invalid AWS instance type: {}. Must be either 'remote' or 'local-aws-container'", - awsInstanceType); - throw new UnsupportedOperationException("Invalid AWS instance type"); - - } - - public static AWSService createKinesisService() { - String awsInstanceType = System.getProperty("aws-service.kinesis.instance.type"); - LOG.info("Creating a {} AWS kinesis instance", getInstanceTypeName(awsInstanceType)); - - if (awsInstanceType == null || awsInstanceType.equals("local-aws-container")) { - return new AWSKinesisLocalContainerService(); - } - - if (awsInstanceType.equals("remote")) { - return new AWSRemoteService(); - } - - LOG.error("Invalid AWS instance type: {}. Must be either 'remote' or 'local-aws-container'", - awsInstanceType); - throw new UnsupportedOperationException("Invalid AWS instance type"); - } - - public static AWSService createS3Service() { - String awsInstanceType = System.getProperty("aws-service.instance.type"); - LOG.info("Creating a {} AWS S3 instance", awsInstanceType); - - if (awsInstanceType == null || awsInstanceType.equals("local-aws-container")) { - return new AWSS3LocalContainerService(); - } - - if (awsInstanceType.equals("remote")) { - return new AWSRemoteService(); - } - - LOG.error("Invalid AWS instance type: {}. Must be either 'remote' or 'local-aws-container'", - awsInstanceType); - throw new UnsupportedOperationException("Invalid AWS instance type"); - } -} diff --git a/test-infra/pom.xml b/test-infra/pom.xml index 27f300b..c035bf9 100644 --- a/test-infra/pom.xml +++ b/test-infra/pom.xml @@ -37,7 +37,6 @@ <module>camel-test-infra-kafka</module> <module>camel-test-infra-parent</module> <module>camel-test-infra-aws-common</module> - <module>camel-test-infra-aws-v1</module> <module>camel-test-infra-aws-v2</module> <module>camel-test-infra-cassandra</module> <module>camel-test-infra-elasticsearch</module>