You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gz...@apache.org on 2022/03/23 08:32:07 UTC

[camel-spring-boot] 01/02: Remove testcontainers from camel-consul starter

This is an automated email from the ASF dual-hosted git repository.

gzurowski pushed a commit to branch release/3.16.0
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git

commit dc45a6a0267effce166f1c5edb23ee93505147e5
Author: Gregor Zurowski <gr...@zurowski.org>
AuthorDate: Wed Mar 23 07:36:16 2022 +0000

    Remove testcontainers from camel-consul starter
---
 components-starter/camel-consul-starter/pom.xml    |  11 --
 .../springboot/cloud/ConsulServiceRegistryIT.java  | 120 ---------------------
 2 files changed, 131 deletions(-)

diff --git a/components-starter/camel-consul-starter/pom.xml b/components-starter/camel-consul-starter/pom.xml
index 50a84d8..283c991 100644
--- a/components-starter/camel-consul-starter/pom.xml
+++ b/components-starter/camel-consul-starter/pom.xml
@@ -51,17 +51,6 @@
       <version>${camel-version}</version>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.apache.camel</groupId>
-      <artifactId>camel-testcontainers</artifactId>
-      <version>${camel-version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.testcontainers</groupId>
-      <artifactId>junit-jupiter</artifactId>
-      <scope>test</scope>
-    </dependency>
     <!--START OF GENERATED CODE-->
     <dependency>
       <groupId>org.apache.camel.springboot</groupId>
diff --git a/components-starter/camel-consul-starter/src/test/java/org/apache/camel/component/consul/springboot/cloud/ConsulServiceRegistryIT.java b/components-starter/camel-consul-starter/src/test/java/org/apache/camel/component/consul/springboot/cloud/ConsulServiceRegistryIT.java
deleted file mode 100644
index 8ca8db2..0000000
--- a/components-starter/camel-consul-starter/src/test/java/org/apache/camel/component/consul/springboot/cloud/ConsulServiceRegistryIT.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.consul.springboot.cloud;
-
-import java.util.List;
-import java.util.UUID;
-
-import com.orbitz.consul.Consul;
-import com.orbitz.consul.model.catalog.CatalogService;
-import org.apache.camel.CamelContext;
-import org.apache.camel.cloud.ServiceRegistry;
-import org.apache.camel.impl.cloud.DefaultServiceDefinition;
-import org.apache.camel.test.testcontainers.Wait;
-import org.junit.jupiter.api.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.boot.test.context.runner.ApplicationContextRunner;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.util.SocketUtils;
-import org.testcontainers.containers.GenericContainer;
-import org.testcontainers.containers.output.Slf4jLogConsumer;
-import org.testcontainers.junit.jupiter.Container;
-import org.testcontainers.junit.jupiter.Testcontainers;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-@Testcontainers
-public class ConsulServiceRegistryIT {
-    private static final Logger LOGGER = LoggerFactory.getLogger(ConsulServiceRegistryIT.class);
-    private static final String SERVICE_ID = UUID.randomUUID().toString();
-    private static final String SERVICE_NAME = "my-service";
-    private static final String SERVICE_HOST = "localhost";
-    private static final int SERVICE_PORT = SocketUtils.findAvailableTcpPort();
-
-    @Container
-    public GenericContainer container = new GenericContainer("consul:1.5.3")
-        .withExposedPorts(Consul.DEFAULT_HTTP_PORT)
-        .waitingFor(Wait.forLogMessageContaining("Synced node info", 1))
-        .withLogConsumer(new Slf4jLogConsumer(LOGGER).withPrefix("consul"))
-        .withCommand(
-            "agent",
-            "-dev",
-            "-server",
-            "-bootstrap",
-            "-client",
-            "0.0.0.0",
-            "-log-level",
-            "trace"
-        );
-
-    @Test
-    public void testServiceRegistry() {
-        final String consulUrl = String.format("http://%s:%d", container.getContainerIpAddress(), container.getMappedPort(Consul.DEFAULT_HTTP_PORT));
-
-        new ApplicationContextRunner()
-            .withUserConfiguration(TestConfiguration.class)
-            .withPropertyValues(
-                "debug=false",
-                "spring.main.banner-mode=OFF",
-                "spring.application.name=" + UUID.randomUUID().toString(),
-                "camel.cloud.consul.enabled=true",
-                "camel.cloud.consul.url=" + consulUrl,
-                "camel.cloud.consul.id=" + UUID.randomUUID().toString(),
-                "camel.cloud.consul.service-host=localhost")
-            .run(
-                context -> {
-                    assertThat(context).hasSingleBean(CamelContext.class);
-                    assertThat(context).hasSingleBean(ServiceRegistry.class);
-
-                    final CamelContext camelContext =  context.getBean(CamelContext.class);
-                    final ServiceRegistry serviceRegistry = context.getBean(ServiceRegistry.class);
-                    
-
-                    assertThat(serviceRegistry).isNotNull();
-                    serviceRegistry.start();
-                    serviceRegistry.register(
-                        DefaultServiceDefinition.builder()
-                            .withHost(SERVICE_HOST)
-                            .withPort(SERVICE_PORT)
-                            .withName(SERVICE_NAME)
-                            .withId(SERVICE_ID)
-                            .build()
-                    );
-
-                    final Consul client = Consul.builder().withUrl(consulUrl).build();
-                    final List<CatalogService> services = client.catalogClient().getService(SERVICE_NAME).getResponse();
-
-                    assertThat(services).hasSize(1);
-                    assertThat(services).first().hasFieldOrPropertyWithValue("serviceId", SERVICE_ID);
-                    assertThat(services).first().hasFieldOrPropertyWithValue("serviceName", SERVICE_NAME);
-                    assertThat(services).first().hasFieldOrPropertyWithValue("serviceAddress", SERVICE_HOST);
-                    assertThat(services).first().hasFieldOrPropertyWithValue("servicePort", SERVICE_PORT);
-                }
-            );
-    }
-
-    // *************************************
-    // Config
-    // *************************************
-
-    @EnableAutoConfiguration
-    @Configuration
-    public static class TestConfiguration {
-    }
-}