This is an automated email from the ASF dual-hosted git repository. github-bot pushed a commit to branch camel-main in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit d99b180435e262454c59d041dc8dd09a7919f8f9 Author: James Netherton <jamesnether...@gmail.com> AuthorDate: Wed Dec 11 08:18:21 2024 +0000 Fixup e5408e0 remove redundant tests --- .../observability-services/deployment/pom.xml | 16 --- .../deployment/MicroProfileHealthEnabledTest.java | 72 ------------- .../MicrometerMetricsConfigDefaultsTest.java | 111 --------------------- .../deployment/OpenTelemetryEnabledTest.java | 62 ------------ 4 files changed, 261 deletions(-) diff --git a/extensions/observability-services/deployment/pom.xml b/extensions/observability-services/deployment/pom.xml index 308de647f3..96b0dabca7 100644 --- a/extensions/observability-services/deployment/pom.xml +++ b/extensions/observability-services/deployment/pom.xml @@ -60,22 +60,6 @@ <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-management-deployment</artifactId> </dependency> - - <dependency> - <groupId>io.quarkus</groupId> - <artifactId>quarkus-junit5-internal</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>io.quarkus</groupId> - <artifactId>quarkus-security-deployment</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>io.quarkus</groupId> - <artifactId>quarkus-vertx-http</artifactId> - <scope>test</scope> - </dependency> </dependencies> <build> diff --git a/extensions/observability-services/deployment/src/test/java/org/apache/camel/quarkus/component/observabilityservices/deployment/MicroProfileHealthEnabledTest.java b/extensions/observability-services/deployment/src/test/java/org/apache/camel/quarkus/component/observabilityservices/deployment/MicroProfileHealthEnabledTest.java deleted file mode 100644 index e8c1b50d43..0000000000 --- a/extensions/observability-services/deployment/src/test/java/org/apache/camel/quarkus/component/observabilityservices/deployment/MicroProfileHealthEnabledTest.java +++ /dev/null @@ -1,72 +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.quarkus.component.observabilityservices.deployment; - -import io.quarkus.test.QuarkusUnitTest; -import jakarta.inject.Inject; -import org.apache.camel.CamelContext; -import org.apache.camel.health.HealthCheckRegistry; -import org.apache.camel.impl.health.ConsumersHealthCheckRepository; -import org.apache.camel.impl.health.ContextHealthCheck; -import org.apache.camel.impl.health.RoutesHealthCheckRepository; -import org.apache.camel.microprofile.health.CamelMicroProfileHealthCheckRegistry; -import org.jboss.shrinkwrap.api.ShrinkWrap; -import org.jboss.shrinkwrap.api.spec.JavaArchive; -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; -import static org.junit.jupiter.api.Assertions.assertTrue; - -public class MicroProfileHealthEnabledTest { - - @RegisterExtension - static final QuarkusUnitTest CONFIG = new QuarkusUnitTest() - .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)); - - @Inject - CamelContext context; - - @Test - public void healthCheckRegistryNotNull() { - HealthCheckRegistry registry = HealthCheckRegistry.get(context); - assertNotNull(registry); - assertTrue(registry instanceof CamelMicroProfileHealthCheckRegistry); - assertEquals("camel-microprofile-health", registry.getId()); - } - - @Test - public void contextHealthCheckNotNull() { - ContextHealthCheck contextHealthCheck = context.getRegistry().lookupByNameAndType("context", ContextHealthCheck.class); - assertNotNull(contextHealthCheck); - } - - @Test - public void routesHealthCheckNotNull() { - RoutesHealthCheckRepository routesRepository = context.getRegistry().lookupByNameAndType("routes", - RoutesHealthCheckRepository.class); - assertNotNull(routesRepository); - } - - @Test - public void consumersHealthCheckNotNull() { - ConsumersHealthCheckRepository consumersRepository = context.getRegistry().lookupByNameAndType("consumers", - ConsumersHealthCheckRepository.class); - assertNotNull(consumersRepository); - } -} diff --git a/extensions/observability-services/deployment/src/test/java/org/apache/camel/quarkus/component/observabilityservices/deployment/MicrometerMetricsConfigDefaultsTest.java b/extensions/observability-services/deployment/src/test/java/org/apache/camel/quarkus/component/observabilityservices/deployment/MicrometerMetricsConfigDefaultsTest.java deleted file mode 100644 index 048ea8110b..0000000000 --- a/extensions/observability-services/deployment/src/test/java/org/apache/camel/quarkus/component/observabilityservices/deployment/MicrometerMetricsConfigDefaultsTest.java +++ /dev/null @@ -1,111 +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.quarkus.component.observabilityservices.deployment; - -import java.util.List; -import java.util.Optional; - -import io.quarkus.test.QuarkusUnitTest; -import jakarta.inject.Inject; -import org.apache.camel.CamelContext; -import org.apache.camel.component.micrometer.eventnotifier.MicrometerExchangeEventNotifier; -import org.apache.camel.component.micrometer.eventnotifier.MicrometerExchangeEventNotifierNamingStrategy; -import org.apache.camel.component.micrometer.eventnotifier.MicrometerRouteEventNotifier; -import org.apache.camel.component.micrometer.eventnotifier.MicrometerRouteEventNotifierNamingStrategy; -import org.apache.camel.component.micrometer.routepolicy.MicrometerRoutePolicyConfiguration; -import org.apache.camel.component.micrometer.routepolicy.MicrometerRoutePolicyFactory; -import org.apache.camel.component.micrometer.routepolicy.MicrometerRoutePolicyNamingStrategy; -import org.apache.camel.component.micrometer.spi.InstrumentedThreadPoolFactory; -import org.apache.camel.impl.engine.DefaultMessageHistoryFactory; -import org.apache.camel.spi.EventNotifier; -import org.apache.camel.spi.MessageHistoryFactory; -import org.apache.camel.spi.RoutePolicyFactory; -import org.apache.camel.spi.ThreadPoolFactory; -import org.jboss.shrinkwrap.api.ShrinkWrap; -import org.jboss.shrinkwrap.api.spec.JavaArchive; -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.assertFalse; -import static org.junit.jupiter.api.Assertions.assertInstanceOf; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertTrue; - -public class MicrometerMetricsConfigDefaultsTest { - - @RegisterExtension - static final QuarkusUnitTest CONFIG = new QuarkusUnitTest() - .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)); - - @Inject - CamelContext context; - - @Test - public void testMicrometerMetricsConfiguration() { - List<RoutePolicyFactory> routePolicyFactories = context.getRoutePolicyFactories(); - assertEquals(1, routePolicyFactories.size()); - RoutePolicyFactory routePolicyFactory = routePolicyFactories.get(0); - assertInstanceOf(MicrometerRoutePolicyFactory.class, routePolicyFactory); - MicrometerRoutePolicyFactory micrometerRoutePolicyFactory = (MicrometerRoutePolicyFactory) routePolicyFactory; - assertEquals(MicrometerRoutePolicyNamingStrategy.DEFAULT, micrometerRoutePolicyFactory.getNamingStrategy()); - - MicrometerRoutePolicyConfiguration policyConfiguration = micrometerRoutePolicyFactory.getPolicyConfiguration(); - assertTrue(policyConfiguration.isContextEnabled()); - assertTrue(policyConfiguration.isRouteEnabled()); - assertNull(policyConfiguration.getExcludePattern()); - - MessageHistoryFactory messageHistoryFactory = context.getMessageHistoryFactory(); - assertNotNull(messageHistoryFactory); - assertInstanceOf(DefaultMessageHistoryFactory.class, messageHistoryFactory); - - List<EventNotifier> eventNotifiers = context.getManagementStrategy() - .getEventNotifiers() - .stream() - .filter(eventNotifier -> !eventNotifier.getClass().getName().contains("BaseMainSupport")) - .toList(); - assertEquals(3, eventNotifiers.size()); - - Optional<EventNotifier> optionalExchangeEventNotifier = context.getManagementStrategy() - .getEventNotifiers() - .stream() - .filter(eventNotifier -> eventNotifier.getClass().equals(MicrometerExchangeEventNotifier.class)) - .findFirst(); - assertTrue(optionalExchangeEventNotifier.isPresent()); - - MicrometerExchangeEventNotifier micrometerExchangeEventNotifier = (MicrometerExchangeEventNotifier) optionalExchangeEventNotifier - .get(); - assertEquals(MicrometerExchangeEventNotifierNamingStrategy.DEFAULT, - micrometerExchangeEventNotifier.getNamingStrategy()); - - Optional<EventNotifier> optionalRouteEventNotifier = context.getManagementStrategy() - .getEventNotifiers() - .stream() - .filter(eventNotifier -> eventNotifier.getClass().equals(MicrometerRouteEventNotifier.class)) - .findFirst(); - assertTrue(optionalRouteEventNotifier.isPresent()); - - MicrometerRouteEventNotifier micrometerRouteEventNotifier = (MicrometerRouteEventNotifier) optionalRouteEventNotifier - .get(); - assertEquals(MicrometerRouteEventNotifierNamingStrategy.DEFAULT, micrometerRouteEventNotifier.getNamingStrategy()); - - ThreadPoolFactory threadPoolFactory = context.getExecutorServiceManager().getThreadPoolFactory(); - assertNotNull(threadPoolFactory); - assertFalse(threadPoolFactory instanceof InstrumentedThreadPoolFactory); - } -} diff --git a/extensions/observability-services/deployment/src/test/java/org/apache/camel/quarkus/component/observabilityservices/deployment/OpenTelemetryEnabledTest.java b/extensions/observability-services/deployment/src/test/java/org/apache/camel/quarkus/component/observabilityservices/deployment/OpenTelemetryEnabledTest.java deleted file mode 100644 index b4c3f01062..0000000000 --- a/extensions/observability-services/deployment/src/test/java/org/apache/camel/quarkus/component/observabilityservices/deployment/OpenTelemetryEnabledTest.java +++ /dev/null @@ -1,62 +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.quarkus.component.observabilityservices.deployment; - -import java.util.Set; - -import io.quarkus.test.QuarkusUnitTest; -import jakarta.inject.Inject; -import org.apache.camel.CamelContext; -import org.apache.camel.opentelemetry.CamelQuarkusOpenTelemetryTracer; -import org.apache.camel.opentelemetry.OpenTelemetryTracer; -import org.apache.camel.opentelemetry.OpenTelemetryTracingStrategy; -import org.jboss.shrinkwrap.api.ShrinkWrap; -import org.jboss.shrinkwrap.api.spec.JavaArchive; -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.assertInstanceOf; -import static org.junit.jupiter.api.Assertions.assertTrue; - -public class OpenTelemetryEnabledTest { - - private static final String EXCLUDE_PATTERNS = "platform-http:*,platform-http:/prefix/.*"; - - @RegisterExtension - static final QuarkusUnitTest CONFIG = new QuarkusUnitTest() - .overrideConfigKey("quarkus.otel.sdk.disabled", "false") - .overrideConfigKey("quarkus.camel.opentelemetry.encoding", "true") - .overrideConfigKey("quarkus.camel.opentelemetry.exclude-patterns", EXCLUDE_PATTERNS) - .overrideConfigKey("quarkus.camel.opentelemetry.trace-processors", "true") - .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)); - - @Inject - CamelContext context; - - @Test - public void camelOpenTelemetryTracerRegistryBeanNotNull() { - Set<OpenTelemetryTracer> tracers = context.getRegistry().findByType(OpenTelemetryTracer.class); - assertEquals(1, tracers.size()); - - OpenTelemetryTracer tracer = tracers.iterator().next(); - assertInstanceOf(CamelQuarkusOpenTelemetryTracer.class, tracer); - assertInstanceOf(OpenTelemetryTracingStrategy.class, tracer.getTracingStrategy()); - assertTrue(tracer.isEncoding()); - assertEquals(EXCLUDE_PATTERNS, tracer.getExcludePatterns()); - } -}