This is an automated email from the ASF dual-hosted git repository. davsclaus 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 cc2e29b Migrates camel-minio to the new test infra (#4705) cc2e29b is described below commit cc2e29b14c52fefdb8e68f15e875e5dc5fbfaca7 Author: Otavio Rodolfo Piske <orpi...@users.noreply.github.com> AuthorDate: Tue Dec 1 13:31:46 2020 +0100 Migrates camel-minio to the new test infra (#4705) --- components/camel-minio/pom.xml | 19 +++- .../minio/integration/MinioComponentTest.java | 8 +- .../minio/integration/MinioConsumerTest.java | 4 +- .../integration/MinioCopyObjectOperationTest.java | 4 +- .../MinioDeleteBucketOperationTest.java | 4 +- .../integration/MinioListObjectsOperationTest.java | 4 +- .../integration/MinioObjectRangeOperationTest.java | 4 +- .../integration/MinioTestContainerSupport.java | 47 ++------- test-infra/camel-test-infra-minio/pom.xml | 60 +++++++++++ .../src/main/resources/META-INF/MANIFEST.MF | 0 .../test/infra/minio/common/MinioProperties.java | 31 ++++++ .../minio/services/MinioLocalContainerService.java | 115 +++++++++++++++++++++ .../infra/minio/services/MinioRemoteService.java | 63 +++++++++++ .../test/infra/minio/services/MinioService.java | 46 +++++++++ .../infra/minio/services/MinioServiceFactory.java | 43 ++++++++ test-infra/pom.xml | 1 + 16 files changed, 398 insertions(+), 55 deletions(-) diff --git a/components/camel-minio/pom.xml b/components/camel-minio/pom.xml index 84f770c..9eca836 100644 --- a/components/camel-minio/pom.xml +++ b/components/camel-minio/pom.xml @@ -81,7 +81,24 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-testcontainers-junit5</artifactId> + <artifactId>camel-test-junit5</artifactId> + <scope>test</scope> + </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-minio</artifactId> + <version>${project.version}</version> + <type>test-jar</type> <scope>test</scope> </dependency> </dependencies> diff --git a/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioComponentTest.java b/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioComponentTest.java index 61832c2..30f4a5a 100644 --- a/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioComponentTest.java +++ b/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioComponentTest.java @@ -102,10 +102,10 @@ class MinioComponentTest extends MinioTestContainerSupport { @Override public void configure() { String minioEndpointUri - = "minio://mycamelbucket?accessKey=" + ACCESS_KEY - + "&secretKey=RAW(" + SECRET_KEY - + ")&autoCreateBucket=true&endpoint=http://" + CONTAINER.getHost() + "&proxyPort=" - + CONTAINER.getMappedPort(BROKER_PORT); + = "minio://mycamelbucket?accessKey=" + service.accessKey() + + "&secretKey=RAW(" + service.secretKey() + + ")&autoCreateBucket=true&endpoint=http://" + service.host() + "&proxyPort=" + + service.port(); from("direct:start").to(minioEndpointUri); from(minioEndpointUri).to("mock:result"); diff --git a/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioConsumerTest.java b/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioConsumerTest.java index a89d4c5..9af7e2e 100644 --- a/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioConsumerTest.java +++ b/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioConsumerTest.java @@ -29,8 +29,8 @@ class MinioConsumerTest extends MinioTestContainerSupport { @BindToRegistry("minioClient") MinioClient client = MinioClient.builder() - .endpoint("http://" + CONTAINER.getHost(), CONTAINER.getMappedPort(BROKER_PORT), false) - .credentials(ACCESS_KEY, SECRET_KEY) + .endpoint("http://" + service.host(), service.port(), false) + .credentials(service.accessKey(), service.secretKey()) .build(); @EndpointInject diff --git a/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioCopyObjectOperationTest.java b/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioCopyObjectOperationTest.java index f06ee3c..19c1e8f 100644 --- a/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioCopyObjectOperationTest.java +++ b/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioCopyObjectOperationTest.java @@ -32,8 +32,8 @@ class MinioCopyObjectOperationTest extends MinioTestContainerSupport { @BindToRegistry("minioClient") MinioClient client = MinioClient.builder() - .endpoint("http://" + CONTAINER.getHost(), CONTAINER.getMappedPort(BROKER_PORT), false) - .credentials(ACCESS_KEY, SECRET_KEY) + .endpoint("http://" + service.host(), service.port(), false) + .credentials(service.accessKey(), service.secretKey()) .build(); @EndpointInject diff --git a/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioDeleteBucketOperationTest.java b/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioDeleteBucketOperationTest.java index 9ac8002..27e8081 100644 --- a/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioDeleteBucketOperationTest.java +++ b/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioDeleteBucketOperationTest.java @@ -30,8 +30,8 @@ class MinioDeleteBucketOperationTest extends MinioTestContainerSupport { @BindToRegistry("minioClient") MinioClient client = MinioClient.builder() - .endpoint("http://" + CONTAINER.getHost(), CONTAINER.getMappedPort(BROKER_PORT), false) - .credentials(ACCESS_KEY, SECRET_KEY) + .endpoint("http://" + service.host(), service.port(), false) + .credentials(service.accessKey(), service.secretKey()) .build(); @EndpointInject diff --git a/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioListObjectsOperationTest.java b/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioListObjectsOperationTest.java index 64deecd..1b83e63 100644 --- a/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioListObjectsOperationTest.java +++ b/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioListObjectsOperationTest.java @@ -40,8 +40,8 @@ class MinioListObjectsOperationTest extends MinioTestContainerSupport { @BindToRegistry("minioClient") MinioClient client = MinioClient.builder() - .endpoint("http://" + CONTAINER.getHost(), CONTAINER.getMappedPort(BROKER_PORT), false) - .credentials(ACCESS_KEY, SECRET_KEY) + .endpoint("http://" + service.host(), service.port(), false) + .credentials(service.accessKey(), service.secretKey()) .build(); @EndpointInject diff --git a/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioObjectRangeOperationTest.java b/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioObjectRangeOperationTest.java index 1ccd568..9ad660d 100644 --- a/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioObjectRangeOperationTest.java +++ b/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioObjectRangeOperationTest.java @@ -41,8 +41,8 @@ class MinioObjectRangeOperationTest extends MinioTestContainerSupport { @BindToRegistry("minioClient") MinioClient client = MinioClient.builder() - .endpoint("http://" + CONTAINER.getHost(), CONTAINER.getMappedPort(BROKER_PORT), false) - .credentials(ACCESS_KEY, SECRET_KEY) + .endpoint("http://" + service.host(), service.port(), false) + .credentials(service.accessKey(), service.secretKey()) .build(); @EndpointInject diff --git a/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioTestContainerSupport.java b/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioTestContainerSupport.java index 54c24da..4387c85 100644 --- a/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioTestContainerSupport.java +++ b/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioTestContainerSupport.java @@ -16,46 +16,13 @@ */ package org.apache.camel.component.minio.integration; -import java.io.IOException; -import java.time.Duration; -import java.util.Properties; +import org.apache.camel.test.infra.minio.services.MinioService; +import org.apache.camel.test.infra.minio.services.MinioServiceFactory; +import org.apache.camel.test.junit5.CamelTestSupport; +import org.junit.jupiter.api.extension.RegisterExtension; -import org.apache.camel.component.minio.MinioTestUtils; -import org.apache.camel.test.testcontainers.junit5.ContainerAwareTestSupport; -import org.slf4j.LoggerFactory; -import org.testcontainers.containers.GenericContainer; -import org.testcontainers.containers.wait.strategy.HttpWaitStrategy; +class MinioTestContainerSupport extends CamelTestSupport { + @RegisterExtension + static MinioService service = MinioServiceFactory.createService(); -class MinioTestContainerSupport extends ContainerAwareTestSupport { - static Properties properties; - - static { - try { - properties = MinioTestUtils.loadMinioPropertiesFile(); - } catch (IOException e) { - LoggerFactory.getLogger(MinioTestContainerSupport.class) - .warn("I/O exception loading minio properties file: {}", e.getMessage(), e); - } - } - - static final String CONTAINER_IMAGE = "minio/minio:latest"; - static final String CONTAINER_NAME = "minio"; - static final String ACCESS_KEY = properties.getProperty("accessKey"); - static final String SECRET_KEY = properties.getProperty("secretKey"); - static final int BROKER_PORT = 9000; - static final GenericContainer CONTAINER; - - static { - CONTAINER = new GenericContainer<>(CONTAINER_IMAGE).withNetworkAliases(CONTAINER_NAME) - .withEnv("MINIO_ACCESS_KEY", ACCESS_KEY) - .withEnv("MINIO_SECRET_KEY", SECRET_KEY) - .withCommand("server /data") - .withExposedPorts(BROKER_PORT) - .waitingFor(new HttpWaitStrategy() - .forPath("/minio/health/ready") - .forPort(BROKER_PORT) - .withStartupTimeout(Duration.ofSeconds(10))); - - CONTAINER.start(); - } } diff --git a/test-infra/camel-test-infra-minio/pom.xml b/test-infra/camel-test-infra-minio/pom.xml new file mode 100644 index 0000000..693e459 --- /dev/null +++ b/test-infra/camel-test-infra-minio/pom.xml @@ -0,0 +1,60 @@ +<?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.7.0-SNAPSHOT</version> + </parent> + + <modelVersion>4.0.0</modelVersion> + + <artifactId>camel-test-infra-minio</artifactId> + <name>Camel :: Test Infra :: Minio</name> + + <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.testcontainers</groupId> + <artifactId>testcontainers</artifactId> + </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-minio/src/main/resources/META-INF/MANIFEST.MF b/test-infra/camel-test-infra-minio/src/main/resources/META-INF/MANIFEST.MF new file mode 100644 index 0000000..e69de29 diff --git a/test-infra/camel-test-infra-minio/src/test/java/org/apache/camel/test/infra/minio/common/MinioProperties.java b/test-infra/camel-test-infra-minio/src/test/java/org/apache/camel/test/infra/minio/common/MinioProperties.java new file mode 100644 index 0000000..1237924 --- /dev/null +++ b/test-infra/camel-test-infra-minio/src/test/java/org/apache/camel/test/infra/minio/common/MinioProperties.java @@ -0,0 +1,31 @@ +/* + * 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.minio.common; + +public final class MinioProperties { + public static final String ACCESS_KEY = "minio.access.key"; + public static final String SECRET_KEY = "minio.secret.key"; + public static final String USERNAME = "minio.access.username"; + public static final String SERVICE_HOST = "minio.service.host"; + public static final String SERVICE_PORT = "minio.service.port"; + public static final int DEFAULT_SERVICE_PORT = 9000; + + private MinioProperties() { + + } +} diff --git a/test-infra/camel-test-infra-minio/src/test/java/org/apache/camel/test/infra/minio/services/MinioLocalContainerService.java b/test-infra/camel-test-infra-minio/src/test/java/org/apache/camel/test/infra/minio/services/MinioLocalContainerService.java new file mode 100644 index 0000000..eb6176c --- /dev/null +++ b/test-infra/camel-test-infra-minio/src/test/java/org/apache/camel/test/infra/minio/services/MinioLocalContainerService.java @@ -0,0 +1,115 @@ +/* + * 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.minio.services; + +import java.time.Duration; + +import org.apache.camel.test.infra.common.services.ContainerService; +import org.apache.camel.test.infra.minio.common.MinioProperties; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.testcontainers.containers.GenericContainer; +import org.testcontainers.containers.wait.strategy.HttpWaitStrategy; + +public class MinioLocalContainerService implements MinioService, ContainerService<GenericContainer> { + public static final String CONTAINER_IMAGE = "minio/minio:latest"; + public static final String CONTAINER_NAME = "minio"; + private static final String ACCESS_KEY; + private static final String SECRET_KEY; + private static final int BROKER_PORT = 9000; + + private static final Logger LOG = LoggerFactory.getLogger(MinioLocalContainerService.class); + + static { + ACCESS_KEY = System.getProperty(MinioProperties.ACCESS_KEY, "testAccessKey"); + SECRET_KEY = System.getProperty(MinioProperties.SECRET_KEY, "testSecretKey"); + } + + private GenericContainer container; + + public MinioLocalContainerService() { + String containerName = System.getProperty("minio.container", CONTAINER_IMAGE); + + initContainer(containerName); + } + + public MinioLocalContainerService(String containerName) { + initContainer(containerName); + } + + protected void initContainer(String containerName) { + container = new GenericContainer(containerName) + .withNetworkAliases(CONTAINER_NAME) + .withEnv("MINIO_ACCESS_KEY", accessKey()) + .withEnv("MINIO_SECRET_KEY", secretKey()) + .withCommand("server /data") + .withExposedPorts(BROKER_PORT) + .waitingFor(new HttpWaitStrategy() + .forPath("/minio/health/ready") + .forPort(BROKER_PORT) + .withStartupTimeout(Duration.ofSeconds(10))); + } + + @Override + public void registerProperties() { + System.setProperty(MinioProperties.ACCESS_KEY, accessKey()); + System.setProperty(MinioProperties.SECRET_KEY, secretKey()); + System.setProperty(MinioProperties.SERVICE_HOST, host()); + System.setProperty(MinioProperties.SERVICE_PORT, String.valueOf(port())); + } + + @Override + public void initialize() { + LOG.info("Trying to start the Minio container"); + container.start(); + + registerProperties(); + + LOG.info("Minio instance running at {}:{}", host(), port()); + } + + @Override + public void shutdown() { + LOG.info("Stopping the Minio container"); + container.stop(); + } + + @Override + public GenericContainer getContainer() { + return container; + } + + @Override + public String secretKey() { + return SECRET_KEY; + } + + @Override + public String accessKey() { + return ACCESS_KEY; + } + + @Override + public int port() { + return container.getMappedPort(BROKER_PORT); + } + + @Override + public String host() { + return container.getHost(); + } +} diff --git a/test-infra/camel-test-infra-minio/src/test/java/org/apache/camel/test/infra/minio/services/MinioRemoteService.java b/test-infra/camel-test-infra-minio/src/test/java/org/apache/camel/test/infra/minio/services/MinioRemoteService.java new file mode 100644 index 0000000..b1df42c --- /dev/null +++ b/test-infra/camel-test-infra-minio/src/test/java/org/apache/camel/test/infra/minio/services/MinioRemoteService.java @@ -0,0 +1,63 @@ +/* + * 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.minio.services; + +import org.apache.camel.test.infra.minio.common.MinioProperties; + +public class MinioRemoteService implements MinioService { + + @Override + public void registerProperties() { + // NO-OP + } + + @Override + public void initialize() { + registerProperties(); + } + + @Override + public void shutdown() { + // NO-OP + } + + @Override + public String secretKey() { + return System.getProperty(MinioProperties.SECRET_KEY); + } + + @Override + public String accessKey() { + return System.getProperty(MinioProperties.ACCESS_KEY); + } + + @Override + public int port() { + String port = System.getProperty(MinioProperties.SERVICE_PORT); + + if (port == null) { + return MinioProperties.DEFAULT_SERVICE_PORT; + } + + return Integer.valueOf(port); + } + + @Override + public String host() { + return System.getProperty(MinioProperties.SERVICE_HOST); + } +} diff --git a/test-infra/camel-test-infra-minio/src/test/java/org/apache/camel/test/infra/minio/services/MinioService.java b/test-infra/camel-test-infra-minio/src/test/java/org/apache/camel/test/infra/minio/services/MinioService.java new file mode 100644 index 0000000..8586d6c --- /dev/null +++ b/test-infra/camel-test-infra-minio/src/test/java/org/apache/camel/test/infra/minio/services/MinioService.java @@ -0,0 +1,46 @@ +/* + * 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.minio.services; + +import org.apache.camel.test.infra.common.services.TestService; +import org.junit.jupiter.api.extension.AfterAllCallback; +import org.junit.jupiter.api.extension.BeforeAllCallback; +import org.junit.jupiter.api.extension.ExtensionContext; + +/** + * Test infra service for Minio + */ +public interface MinioService extends BeforeAllCallback, AfterAllCallback, TestService { + + String secretKey(); + + String accessKey(); + + int port(); + + String host(); + + @Override + default void beforeAll(ExtensionContext extensionContext) throws Exception { + initialize(); + } + + @Override + default void afterAll(ExtensionContext extensionContext) throws Exception { + shutdown(); + } +} diff --git a/test-infra/camel-test-infra-minio/src/test/java/org/apache/camel/test/infra/minio/services/MinioServiceFactory.java b/test-infra/camel-test-infra-minio/src/test/java/org/apache/camel/test/infra/minio/services/MinioServiceFactory.java new file mode 100644 index 0000000..9030888 --- /dev/null +++ b/test-infra/camel-test-infra-minio/src/test/java/org/apache/camel/test/infra/minio/services/MinioServiceFactory.java @@ -0,0 +1,43 @@ +/* + * 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.minio.services; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public final class MinioServiceFactory { + private static final Logger LOG = LoggerFactory.getLogger(MinioServiceFactory.class); + + private MinioServiceFactory() { + + } + + public static MinioService createService() { + String instanceType = System.getProperty("minio.instance.type"); + + if (instanceType == null || instanceType.equals("local-minio-container")) { + return new MinioLocalContainerService(); + } + + if (instanceType.equals("remote")) { + return new MinioRemoteService(); + } + + LOG.error("Minio instance must be one of 'local-minio-container' or 'remote"); + throw new UnsupportedOperationException("Invalid Minio instance type"); + } +} diff --git a/test-infra/pom.xml b/test-infra/pom.xml index 40907ec..a297446 100644 --- a/test-infra/pom.xml +++ b/test-infra/pom.xml @@ -58,5 +58,6 @@ <module>camel-test-infra-etcd</module> <module>camel-test-infra-hbase</module> <module>camel-test-infra-infinispan</module> + <module>camel-test-infra-minio</module> </modules> </project>