This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit ba516f923563f1a5420fa46d0774efaefd756264 Author: Luca Burgazzoli <lburgazz...@gmail.com> AuthorDate: Fri Jun 16 19:23:46 2023 +0200 chore: fix various build/compilation warnings --- .../quarkus/core/deployment/ConsumeProcessor.java | 2 +- .../core/deployment/InjectionPointsProcessor.java | 1 + .../camel/quarkus/core/CamelContextRecorder.java | 12 ++++----- .../apache/camel/quarkus/core/CamelRecorder.java | 3 ++- .../camel/quarkus/main/CamelMainRecorder.java | 4 +-- .../main/resources/META-INF/quarkus-extension.yaml | 3 +-- .../freemarker/CamelFreemarkerRecorder.java | 2 +- .../groovy/deployment/GroovyProcessor.java | 11 ++++++-- .../component/joor/deployment/JoorProcessor.java | 31 +++++++++++++++++----- .../quarkus/component/jq/CamelJqRecorder.java | 2 +- .../dsl/js/deployment/JavaScriptDslProcessor.java | 7 ++++- .../kubernetes/CamelKubernetesRecorder.java | 2 +- .../main/resources/META-INF/quarkus-extension.yaml | 3 +-- .../apache/camel/component/qute/QuteEndpoint.java | 1 + .../quarkus/component/qute/CamelQuteRecorder.java | 2 +- .../component/slack/graal/SlackSubstitutions.java | 2 +- .../camel/quarkus/component/tika/TikaRecorder.java | 2 +- .../component/aws2/s3/it/Aws2S3Resource.java | 26 ++++++++++-------- .../storage/blob/it/AzureStorageBlobResource.java | 8 +++--- .../soap/converter/it/CxfSoapConverterRoutes.java | 1 + .../cxf/soap/mtom/it/CxfSoapMtomRoutes.java | 15 ++++++++--- .../quarkus/component/bean/eip/EipResource.java | 4 +-- .../quarkus/component/bean/BeanInjectMockTest.java | 2 +- .../apache/camel/quarkus/core/CoreResource.java | 6 ++--- .../camel/quarkus/core/MySerializationObject.java | 16 +++++------ .../quarkus/core/converter/it/TestConverters.java | 4 +-- .../quarkus/component/mongodb/it/MongoDbTest.java | 19 ++++++------- .../component/dsl/modeline/it/DslModelineTest.java | 6 +++-- .../camel/quarkus/test/EnabledIfCondition.java | 5 ++-- .../component/braintree/it/BraintreeResource.java | 2 ++ .../quarkus/component/git/it/GitResource.java | 4 ++- .../google/bigquery/it/GoogleBigqueryTest.java | 5 ++-- .../google/storage/it/GoogleStorageResource.java | 6 ++--- .../hazelcast/it/HazelcastReplicatedmapTest.java | 9 +++++-- .../quarkus/component/jcache/it/JcacheRoutes.java | 4 +-- .../camel/quarkus/component/jq/it/JqResource.java | 2 +- .../component/kafka/CamelKafkaResource.java | 2 +- .../quarkus/component/kafka/it/CamelKafkaTest.java | 5 ++-- .../component/kudu/it/KuduTestResource.java | 7 ++--- .../quarkus/component/leveldb/it/LeveldbTest.java | 7 +++-- .../quarkus/component/mail/CamelResource.java | 2 +- .../scheme/MessagingComponentSchemeProducer.java | 2 +- .../MicroProfileFaultToleranceHelper.java | 2 +- .../quarkus/component/minio/it/MinioResource.java | 14 +++++----- .../component/opentelemetry/it/GreetingsBean.java | 2 +- .../component/pgevent/it/PgEventTestResource.java | 7 +++-- .../quarkus/component/splunk/it/SplunkTest.java | 4 ++- .../component/sql/it/SqlConfigSourceFactory.java | 4 +-- .../quarkus/component/sql/it/SqlResource.java | 2 +- .../camel/quarkus/component/sql/it/SqlRoutes.java | 8 +++--- .../stringtemplate/it/StringtemplateTest.java | 9 +++---- integration-tests/swift/pom.xml | 1 + .../component/velocity/it/VelocityResource.java | 10 +++---- pom.xml | 28 ++++++++++++++++++- .../quarkus/maven/UpdateExtensionDocPageMojo.java | 9 ++++--- 55 files changed, 220 insertions(+), 139 deletions(-) diff --git a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/ConsumeProcessor.java b/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/ConsumeProcessor.java index 4e965536f2..ac30516ff4 100644 --- a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/ConsumeProcessor.java +++ b/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/ConsumeProcessor.java @@ -119,7 +119,7 @@ public class ConsumeProcessor { static String namedValue(ClassInfo classInfo) { String beanName = null; - final AnnotationInstance named = classInfo.classAnnotation(NAMED_ANNOTATION); + final AnnotationInstance named = classInfo.declaredAnnotation(NAMED_ANNOTATION); if (named != null) { if (named.value() != null) { beanName = named.value().asString(); diff --git a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/InjectionPointsProcessor.java b/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/InjectionPointsProcessor.java index d1739c77c3..86d11457ee 100644 --- a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/InjectionPointsProcessor.java +++ b/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/InjectionPointsProcessor.java @@ -377,6 +377,7 @@ public class InjectionPointsProcessor { } } + @SuppressWarnings("unchecked") private void endpointInjectBeans(CamelRecorder recorder, BuildProducer<SyntheticBeanBuildItem> syntheticBeans, IndexView index, AnnotationInstance annot, final DotName fieldType) { try { diff --git a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelContextRecorder.java b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelContextRecorder.java index a024637fc3..fbd7a4eb01 100644 --- a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelContextRecorder.java +++ b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelContextRecorder.java @@ -75,7 +75,7 @@ public class CamelContextRecorder { extendedCamelContext.addContextPlugin(ComponentNameResolver.class, componentNameResolver.getValue()); // register to the container - beanContainer.instance(CamelProducers.class).setContext(context); + beanContainer.beanInstance(CamelProducers.class).setContext(context); return new RuntimeValue<>(context); } @@ -88,17 +88,17 @@ public class CamelContextRecorder { final CamelRuntime runtime = new CamelContextRuntime(context.getValue()); // register to the container - beanContainer.instance(CamelProducers.class).setRuntime(runtime); + beanContainer.beanInstance(CamelProducers.class).setRuntime(runtime); return new RuntimeValue<>(runtime); } public RuntimeValue<CamelContextCustomizer> createNoShutdownStrategyCustomizer() { - return new RuntimeValue((CamelContextCustomizer) context -> context.setShutdownStrategy(new NoShutdownStrategy())); + return new RuntimeValue<>(context -> context.setShutdownStrategy(new NoShutdownStrategy())); } public RuntimeValue<CamelContextCustomizer> createSourceLocationEnabledCustomizer() { - return new RuntimeValue((CamelContextCustomizer) context -> context.setSourceLocationEnabled(true)); + return new RuntimeValue<>(context -> context.setSourceLocationEnabled(true)); } public void addRoutes(RuntimeValue<CamelContext> context, List<String> nonCdiRoutesBuilderClassNames) { @@ -130,9 +130,7 @@ public class CamelContextRecorder { }); } - for (RoutesBuilder cdiRoutesBuilder : context.getValue().getRegistry().findByType(RoutesBuilder.class)) { - allRoutesBuilders.add(cdiRoutesBuilder); - } + allRoutesBuilders.addAll(context.getValue().getRegistry().findByType(RoutesBuilder.class)); // Add RouteConfigurationsBuilders before RoutesBuilders for (RoutesBuilder routesBuilder : allRoutesBuilders) { diff --git a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelRecorder.java b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelRecorder.java index e83294aa40..1ae0c28f12 100644 --- a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelRecorder.java +++ b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelRecorder.java @@ -186,7 +186,8 @@ public class CamelRecorder { }; } - public Supplier<?> produceProxy(Class<?> clazz, String uri) { + @SuppressWarnings("unchecked") + public <T> Supplier<T> produceProxy(Class<T> clazz, String uri) { return () -> { final CamelContext camelContext = Arc.container().instance(CamelContext.class).get(); final BeanProxyFactory factory = PluginHelper.getBeanProxyFactory(camelContext); diff --git a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/main/CamelMainRecorder.java b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/main/CamelMainRecorder.java index 55e765102d..50ce307172 100644 --- a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/main/CamelMainRecorder.java +++ b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/main/CamelMainRecorder.java @@ -48,7 +48,7 @@ public class CamelMainRecorder { main.setDefaultPropertyPlaceholderLocation("false"); // register to the container - container.instance(CamelMainProducers.class).setMain(main); + container.beanInstance(CamelMainProducers.class).setMain(main); return new RuntimeValue<>(main); } @@ -91,7 +91,7 @@ public class CamelMainRecorder { final CamelRuntime runtime = new CamelMainRuntime(main.getValue(), shutdownTimeoutMs); // register to the container - beanContainer.instance(CamelProducers.class).setRuntime(runtime); + beanContainer.beanInstance(CamelProducers.class).setRuntime(runtime); return new RuntimeValue<>(runtime); } diff --git a/extensions/debug/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/debug/runtime/src/main/resources/META-INF/quarkus-extension.yaml index cc238350a3..3b6f93abb8 100644 --- a/extensions/debug/runtime/src/main/resources/META-INF/quarkus-extension.yaml +++ b/extensions/debug/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -25,9 +25,8 @@ name: "Camel Debug" description: "Enables Camel Route Debugging" icon-url: "https://camel.apache.org/_/img/logo-d-f21b25ba38.svg" metadata: - unlisted: true guide: "https://camel.apache.org/camel-quarkus/latest/reference/extensions/debug.html" categories: - "integration" status: - - "preview" + - "stable" diff --git a/extensions/freemarker/runtime/src/main/java/org/apache/camel/quarkus/component/freemarker/CamelFreemarkerRecorder.java b/extensions/freemarker/runtime/src/main/java/org/apache/camel/quarkus/component/freemarker/CamelFreemarkerRecorder.java index 67b01b158e..d57a333ac3 100644 --- a/extensions/freemarker/runtime/src/main/java/org/apache/camel/quarkus/component/freemarker/CamelFreemarkerRecorder.java +++ b/extensions/freemarker/runtime/src/main/java/org/apache/camel/quarkus/component/freemarker/CamelFreemarkerRecorder.java @@ -26,7 +26,7 @@ import org.apache.camel.component.freemarker.FreemarkerComponent; public class CamelFreemarkerRecorder { public RuntimeValue<FreemarkerComponent> createComponent(BeanContainer beanContainer) { - final Configuration configuration = beanContainer.instance(Configuration.class); + final Configuration configuration = beanContainer.beanInstance(Configuration.class); final FreemarkerComponent component = new FreemarkerComponent(); component.setConfiguration(configuration); diff --git a/extensions/groovy/deployment/src/main/java/org/apache/camel/quarkus/component/groovy/deployment/GroovyProcessor.java b/extensions/groovy/deployment/src/main/java/org/apache/camel/quarkus/component/groovy/deployment/GroovyProcessor.java index 03fcd47769..ad3027bc3d 100644 --- a/extensions/groovy/deployment/src/main/java/org/apache/camel/quarkus/component/groovy/deployment/GroovyProcessor.java +++ b/extensions/groovy/deployment/src/main/java/org/apache/camel/quarkus/component/groovy/deployment/GroovyProcessor.java @@ -145,17 +145,24 @@ class GroovyProcessor { } } + // We still need to use RecorderContext#classProxy as using i.e. Class.forName does not work + // at runtime. See https://github.com/apache/camel-quarkus/issues/5056 + @SuppressWarnings("deprecation") @Record(ExecutionTime.STATIC_INIT) @BuildStep(onlyIf = NativeBuild.class) CamelBeanBuildItem configureLanguage( RecorderContext recorderContext, GroovyExpressionRecorder recorder, ExpressionExtractionResultBuildItem result, - List<GroovyExpressionSourceBuildItem> sources) { + List<GroovyExpressionSourceBuildItem> sources) throws ClassNotFoundException { + if (result.isSuccess() && !sources.isEmpty()) { RuntimeValue<GroovyLanguage.Builder> builder = recorder.languageBuilder(); for (GroovyExpressionSourceBuildItem source : sources) { - recorder.addScript(builder, source.getOriginalCode(), recorderContext.classProxy(source.getClassName())); + recorder.addScript( + builder, + source.getOriginalCode(), + recorderContext.classProxy(source.getClassName())); } final RuntimeValue<GroovyLanguage> language = recorder.languageNewInstance(builder); return new CamelBeanBuildItem("groovy", GroovyLanguage.class.getName(), language); diff --git a/extensions/joor/deployment/src/main/java/org/apache/camel/quarkus/component/joor/deployment/JoorProcessor.java b/extensions/joor/deployment/src/main/java/org/apache/camel/quarkus/component/joor/deployment/JoorProcessor.java index 49a3e9c674..e025d5421a 100644 --- a/extensions/joor/deployment/src/main/java/org/apache/camel/quarkus/component/joor/deployment/JoorProcessor.java +++ b/extensions/joor/deployment/src/main/java/org/apache/camel/quarkus/component/joor/deployment/JoorProcessor.java @@ -121,7 +121,8 @@ class JoorProcessor { } @BuildStep(onlyIf = CompileAtBuildTime.class) - void compileExpressions(CurateOutcomeBuildItem curateOutcomeBuildItem, + void compileExpressions( + CurateOutcomeBuildItem curateOutcomeBuildItem, List<JoorExpressionSourceBuildItem> sources, BuildProducer<GeneratedClassBuildItem> generatedClass) { if (sources.isEmpty()) { @@ -151,35 +152,51 @@ class JoorProcessor { } } + // We still need to use RecorderContext#classProxy as using i.e. Class.forName does not work + // at runtime. See https://github.com/apache/camel-quarkus/issues/5056 + @SuppressWarnings("deprecation") @Record(ExecutionTime.STATIC_INIT) @BuildStep(onlyIf = CompileAtBuildTime.class) @Consume(CamelContextBuildItem.class) CamelBeanBuildItem configureLanguage( - JoorExpressionConfig config, RecorderContext recorderContext, + JoorExpressionConfig config, JoorExpressionRecorder recorder, CamelContextBuildItem context, ExpressionExtractionResultBuildItem result, - List<JoorExpressionSourceBuildItem> sources) { + List<JoorExpressionSourceBuildItem> sources) throws ClassNotFoundException { if (result.isSuccess() && !sources.isEmpty()) { final RuntimeValue<JoorExpressionCompiler.Builder> expressionCompilerBuilder = recorder .expressionCompilerBuilder(); final RuntimeValue<JoorExpressionScriptingCompiler.Builder> expressionScriptingCompilerBuilder = recorder .expressionScriptingCompilerBuilder(); + RuntimeValue<CamelContext> camelContext = context.getCamelContext(); for (JoorExpressionSourceBuildItem source : sources) { if (source.isScript()) { - recorder.addScript(expressionScriptingCompilerBuilder, camelContext, source.getId(), + recorder.addScript( + expressionScriptingCompilerBuilder, + camelContext, + source.getId(), recorderContext.classProxy(source.getClassName())); } else { - recorder.addExpression(expressionCompilerBuilder, camelContext, source.getId(), + recorder.addExpression( + expressionCompilerBuilder, + camelContext, + source.getId(), recorderContext.classProxy(source.getClassName())); } } final RuntimeValue<JoorLanguage> language = recorder.languageNewInstance(config, expressionCompilerBuilder, expressionScriptingCompilerBuilder); - config.resultType.ifPresent(c -> recorder.setResultType(language, recorderContext.classProxy(c))); + + if (config.resultType.isPresent()) { + recorder.setResultType( + language, + recorderContext.classProxy(config.resultType.get())); + } + return new CamelBeanBuildItem("joor", JoorLanguage.class.getName(), language); } return null; @@ -194,7 +211,7 @@ class JoorProcessor { @Override public boolean getAsBoolean() { - return config.compileAtBuildTime || packageConfig.type.equalsIgnoreCase(PackageConfig.NATIVE); + return config.compileAtBuildTime || packageConfig.type.equalsIgnoreCase(PackageConfig.BuiltInType.NATIVE.name()); } } } diff --git a/extensions/jq/runtime/src/main/java/org/apache/camel/quarkus/component/jq/CamelJqRecorder.java b/extensions/jq/runtime/src/main/java/org/apache/camel/quarkus/component/jq/CamelJqRecorder.java index 4003d13951..97292a27f7 100644 --- a/extensions/jq/runtime/src/main/java/org/apache/camel/quarkus/component/jq/CamelJqRecorder.java +++ b/extensions/jq/runtime/src/main/java/org/apache/camel/quarkus/component/jq/CamelJqRecorder.java @@ -25,7 +25,7 @@ import org.apache.camel.language.jq.JqFunctions; public class CamelJqRecorder { public void addCamelFunctionsToScope(BeanContainer beanContainer) { - Scope scope = beanContainer.instance(Scope.class); + Scope scope = beanContainer.beanInstance(Scope.class); if (scope != null) { JqFunctions.loadLocal(scope); } else { diff --git a/extensions/js-dsl/deployment/src/main/java/org/apache/camel/quarkus/dsl/js/deployment/JavaScriptDslProcessor.java b/extensions/js-dsl/deployment/src/main/java/org/apache/camel/quarkus/dsl/js/deployment/JavaScriptDslProcessor.java index ca640573c1..51d2cce969 100644 --- a/extensions/js-dsl/deployment/src/main/java/org/apache/camel/quarkus/dsl/js/deployment/JavaScriptDslProcessor.java +++ b/extensions/js-dsl/deployment/src/main/java/org/apache/camel/quarkus/dsl/js/deployment/JavaScriptDslProcessor.java @@ -147,7 +147,12 @@ public class JavaScriptDslProcessor { } } - reflectiveClass.produce(new ReflectiveClassBuildItem(true, type.isEnum(), type)); + reflectiveClass.produce( + ReflectiveClassBuildItem.builder(type) + .constructors(true) + .methods(true) + .fields(type.isEnum()) + .build()); } for (Class<?> type : JAVA_CLASSES) { diff --git a/extensions/kubernetes/runtime/src/main/java/org/apache/camel/quarkus/component/kubernetes/CamelKubernetesRecorder.java b/extensions/kubernetes/runtime/src/main/java/org/apache/camel/quarkus/component/kubernetes/CamelKubernetesRecorder.java index c32fa796f5..7e3994b2bd 100644 --- a/extensions/kubernetes/runtime/src/main/java/org/apache/camel/quarkus/component/kubernetes/CamelKubernetesRecorder.java +++ b/extensions/kubernetes/runtime/src/main/java/org/apache/camel/quarkus/component/kubernetes/CamelKubernetesRecorder.java @@ -24,7 +24,7 @@ import io.quarkus.runtime.annotations.Recorder; @Recorder public class CamelKubernetesRecorder { public RuntimeValue<?> getKubernetesClient(BeanContainer beanContainer) { - KubernetesClient client = beanContainer.instance(KubernetesClient.class); + KubernetesClient client = beanContainer.beanInstance(KubernetesClient.class); return new RuntimeValue<>(client); } } diff --git a/extensions/management/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/management/runtime/src/main/resources/META-INF/quarkus-extension.yaml index 077cd0b742..67b23ba84b 100644 --- a/extensions/management/runtime/src/main/resources/META-INF/quarkus-extension.yaml +++ b/extensions/management/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -25,9 +25,8 @@ name: "Camel Management" description: "JMX management strategy and associated managed resources" icon-url: "https://camel.apache.org/_/img/logo-d-f21b25ba38.svg" metadata: - unlisted: true guide: "https://camel.apache.org/camel-quarkus/latest/reference/extensions/management.html" categories: - "integration" status: - - "preview" + - "stable" diff --git a/extensions/qute/component/src/main/java/org/apache/camel/component/qute/QuteEndpoint.java b/extensions/qute/component/src/main/java/org/apache/camel/component/qute/QuteEndpoint.java index b197a05e34..dd736d4f08 100644 --- a/extensions/qute/component/src/main/java/org/apache/camel/component/qute/QuteEndpoint.java +++ b/extensions/qute/component/src/main/java/org/apache/camel/component/qute/QuteEndpoint.java @@ -146,6 +146,7 @@ public class QuteEndpoint extends ResourceEndpoint { return getCamelContext().getEndpoint(newUri, QuteEndpoint.class); } + @SuppressWarnings("unchecked") @Override protected void onExchange(Exchange exchange) throws Exception { String path = getResourceUri(); diff --git a/extensions/qute/runtime/src/main/java/org/apache/camel/quarkus/component/qute/CamelQuteRecorder.java b/extensions/qute/runtime/src/main/java/org/apache/camel/quarkus/component/qute/CamelQuteRecorder.java index 01c391b995..e9a5f944da 100644 --- a/extensions/qute/runtime/src/main/java/org/apache/camel/quarkus/component/qute/CamelQuteRecorder.java +++ b/extensions/qute/runtime/src/main/java/org/apache/camel/quarkus/component/qute/CamelQuteRecorder.java @@ -26,7 +26,7 @@ import org.apache.camel.component.qute.QuteComponent; public class CamelQuteRecorder { public RuntimeValue<QuteComponent> createQuteComponent(BeanContainer beanContainer) { - Engine quteEngine = beanContainer.instance(Engine.class); + Engine quteEngine = beanContainer.beanInstance(Engine.class); QuteComponent component = new QuteComponent(); component.setQuteEngine(quteEngine); diff --git a/extensions/slack/runtime/src/main/java/org/apache/camel/quarkus/component/slack/graal/SlackSubstitutions.java b/extensions/slack/runtime/src/main/java/org/apache/camel/quarkus/component/slack/graal/SlackSubstitutions.java index 1038f9aae3..1fad01d897 100644 --- a/extensions/slack/runtime/src/main/java/org/apache/camel/quarkus/component/slack/graal/SlackSubstitutions.java +++ b/extensions/slack/runtime/src/main/java/org/apache/camel/quarkus/component/slack/graal/SlackSubstitutions.java @@ -161,7 +161,7 @@ final class SlackConfigSubstitutions { }; @Alias - private List<HttpResponseListener> httpClientResponseHandlers = new ArrayList(); + private List<HttpResponseListener> httpClientResponseHandlers = new ArrayList<>(); @Substitute @TargetElement(name = "SlackConfig") diff --git a/extensions/tika/runtime/src/main/java/org/apache/camel/quarkus/component/tika/TikaRecorder.java b/extensions/tika/runtime/src/main/java/org/apache/camel/quarkus/component/tika/TikaRecorder.java index 6d6760baca..7c45a9cef4 100644 --- a/extensions/tika/runtime/src/main/java/org/apache/camel/quarkus/component/tika/TikaRecorder.java +++ b/extensions/tika/runtime/src/main/java/org/apache/camel/quarkus/component/tika/TikaRecorder.java @@ -47,7 +47,7 @@ import org.apache.tika.parser.Parser; public class TikaRecorder { public RuntimeValue<TikaComponent> createTikaComponent(BeanContainer container) { - return new RuntimeValue<>(new QuarkusTikaComponent(container.instance(TikaParserProducer.class))); + return new RuntimeValue<>(new QuarkusTikaComponent(container.beanInstance(TikaParserProducer.class))); } @org.apache.camel.spi.annotations.Component("tika") diff --git a/integration-test-groups/aws2/aws2-s3/src/main/java/org/apache/camel/quarkus/component/aws2/s3/it/Aws2S3Resource.java b/integration-test-groups/aws2/aws2-s3/src/main/java/org/apache/camel/quarkus/component/aws2/s3/it/Aws2S3Resource.java index 53bdcc45e5..13b949bd82 100644 --- a/integration-test-groups/aws2/aws2-s3/src/main/java/org/apache/camel/quarkus/component/aws2/s3/it/Aws2S3Resource.java +++ b/integration-test-groups/aws2/aws2-s3/src/main/java/org/apache/camel/quarkus/component/aws2/s3/it/Aws2S3Resource.java @@ -21,7 +21,6 @@ import java.io.File; import java.io.InputStreamReader; import java.io.Reader; import java.net.URI; -import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.StandardOpenOption; @@ -53,7 +52,6 @@ import org.apache.camel.quarkus.test.support.aws2.BaseAws2Resource; import org.eclipse.microprofile.config.inject.ConfigProperty; import software.amazon.awssdk.core.ResponseInputStream; import software.amazon.awssdk.services.s3.model.Bucket; -import software.amazon.awssdk.services.s3.model.GetObjectResponse; import software.amazon.awssdk.services.s3.model.NoSuchBucketException; import software.amazon.awssdk.services.s3.model.S3Object; @@ -143,11 +141,15 @@ public class Aws2S3Resource extends BaseAws2Resource { @GET @Produces(MediaType.APPLICATION_JSON) public List<String> objectKey() throws Exception { - final List<S3Object> objects = (List<S3Object>) producerTemplate.requestBody( + final List<?> objects = producerTemplate.requestBody( componentUri(AWS2S3Operations.listObjects), null, List.class); - return objects.stream().map(S3Object::key).collect(Collectors.toList()); + + return objects.stream() + .map(S3Object.class::cast) + .map(S3Object::key) + .collect(Collectors.toList()); } /** @@ -206,11 +208,15 @@ public class Aws2S3Resource extends BaseAws2Resource { @GET @Produces(MediaType.APPLICATION_JSON) public List<String> listBuckets() throws Exception { - List<Bucket> buckets = (List<Bucket>) producerTemplate.requestBody( + List<?> buckets = producerTemplate.requestBody( componentUri(AWS2S3Operations.listBuckets), null, List.class); - return buckets.stream().map(Bucket::name).collect(Collectors.toList()); + + return buckets.stream() + .map(Bucket.class::cast) + .map(Bucket::name) + .collect(Collectors.toList()); } @Path("bucket/{name}") @@ -238,14 +244,12 @@ public class Aws2S3Resource extends BaseAws2Resource { bucket = bucketName; } - String link = producerTemplate.requestBodyAndHeader( + return producerTemplate.requestBodyAndHeader( componentUri(bucket, AWS2S3Operations.createDownloadLink), null, AWS2S3Constants.KEY, key, String.class); - - return link; } @Path("object/range/{key}") @@ -259,7 +263,7 @@ public class Aws2S3Resource extends BaseAws2Resource { headers.put(AWS2S3Constants.RANGE_START, start); headers.put(AWS2S3Constants.RANGE_END, end); - ResponseInputStream<GetObjectResponse> s3Object = producerTemplate.requestBodyAndHeaders( + ResponseInputStream<?> s3Object = producerTemplate.requestBodyAndHeaders( componentUri(AWS2S3Operations.getObjectRange) + "&autoCreateBucket=false", null, headers, @@ -267,7 +271,7 @@ public class Aws2S3Resource extends BaseAws2Resource { StringBuilder textBuilder = new StringBuilder(); try (Reader reader = new BufferedReader( - new InputStreamReader(s3Object, Charset.forName(StandardCharsets.UTF_8.name())))) { + new InputStreamReader(s3Object, StandardCharsets.UTF_8))) { int c = 0; while ((c = reader.read()) != -1) { textBuilder.append((char) c); diff --git a/integration-test-groups/azure/azure-storage-blob/src/main/java/org/apache/camel/quarkus/component/azure/storage/blob/it/AzureStorageBlobResource.java b/integration-test-groups/azure/azure-storage-blob/src/main/java/org/apache/camel/quarkus/component/azure/storage/blob/it/AzureStorageBlobResource.java index 11bd5153df..f93789156a 100644 --- a/integration-test-groups/azure/azure-storage-blob/src/main/java/org/apache/camel/quarkus/component/azure/storage/blob/it/AzureStorageBlobResource.java +++ b/integration-test-groups/azure/azure-storage-blob/src/main/java/org/apache/camel/quarkus/component/azure/storage/blob/it/AzureStorageBlobResource.java @@ -29,7 +29,6 @@ import java.util.List; import java.util.Map; import java.util.Random; import java.util.stream.Collectors; -import java.util.stream.Stream; import com.azure.core.http.rest.PagedIterable; import com.azure.storage.blob.changefeed.models.BlobChangefeedEvent; @@ -320,13 +319,14 @@ public class AzureStorageBlobResource { @Produces(MediaType.APPLICATION_JSON) public JsonObject getPageBlobRanges(@QueryParam("pageStart") int start, @QueryParam("pageEnd") int end) { PageRange pageRange = new PageRange().setStart(start).setEnd(end); - PagedIterable pageIterable = producerTemplate.requestBodyAndHeader("direct:getPageBlobRanges", null, + PagedIterable<?> pageIterable = producerTemplate.requestBodyAndHeader("direct:getPageBlobRanges", null, BlobConstants.PAGE_BLOB_RANGE, pageRange, PagedIterable.class); JsonObjectBuilder objectBuilder = Json.createObjectBuilder(); JsonArrayBuilder arrayBuilder = Json.createArrayBuilder(); - ((Stream<PageRangeItem>) pageIterable - .stream()) + + pageIterable.stream() + .map(PageRangeItem.class::cast) .map(pr -> Json.createObjectBuilder() .add("offset", pr.getRange().getOffset()) .add("length", pr.getRange().getLength()) diff --git a/integration-test-groups/cxf-soap/cxf-soap-converter/src/main/java/org/apache/camel/quarkus/component/cxf/soap/converter/it/CxfSoapConverterRoutes.java b/integration-test-groups/cxf-soap/cxf-soap-converter/src/main/java/org/apache/camel/quarkus/component/cxf/soap/converter/it/CxfSoapConverterRoutes.java index 17b98b1441..6bc29a7588 100644 --- a/integration-test-groups/cxf-soap/cxf-soap-converter/src/main/java/org/apache/camel/quarkus/component/cxf/soap/converter/it/CxfSoapConverterRoutes.java +++ b/integration-test-groups/cxf-soap/cxf-soap-converter/src/main/java/org/apache/camel/quarkus/component/cxf/soap/converter/it/CxfSoapConverterRoutes.java @@ -106,6 +106,7 @@ public class CxfSoapConverterRoutes extends RouteBuilder { exchange.getMessage().setBody(String.format(RESPONSE_GET_PERSON, request.getPersonId() + "xml")); } else if ("consumer".equals(operation)) { + @SuppressWarnings("unchecked") CxfPayload<SoapHeader> requestPayload = exchange.getIn().getBody(CxfPayload.class); List<Source> inElements = requestPayload.getBodySources(); Element in = new XmlConverter().toDOMElement(inElements.get(0)); diff --git a/integration-test-groups/cxf-soap/cxf-soap-mtom/src/main/java/org/apache/camel/quarkus/component/cxf/soap/mtom/it/CxfSoapMtomRoutes.java b/integration-test-groups/cxf-soap/cxf-soap-mtom/src/main/java/org/apache/camel/quarkus/component/cxf/soap/mtom/it/CxfSoapMtomRoutes.java index 250b19603d..40a62e09d6 100644 --- a/integration-test-groups/cxf-soap/cxf-soap-mtom/src/main/java/org/apache/camel/quarkus/component/cxf/soap/mtom/it/CxfSoapMtomRoutes.java +++ b/integration-test-groups/cxf-soap/cxf-soap-mtom/src/main/java/org/apache/camel/quarkus/component/cxf/soap/mtom/it/CxfSoapMtomRoutes.java @@ -124,7 +124,7 @@ public class CxfSoapMtomRoutes extends RouteBuilder { elements.add(new DOMSource(StaxUtils .read(new StringReader(String.format(reqMessage, imageName, imageName))) .getDocumentElement())); - CxfPayload payload = new CxfPayload<>( + CxfPayload<?> payload = new CxfPayload<>( new ArrayList<SoapHeader>(), elements, null); exchange.getIn().setBody(payload); exchange.getIn(AttachmentMessage.class).addAttachment(imageName, @@ -136,7 +136,7 @@ public class CxfSoapMtomRoutes extends RouteBuilder { elements.add( new DOMSource(StaxUtils.read(new StringReader(String.format(REQ_DOWNLOAD_MSG, imageName))) .getDocumentElement())); - CxfPayload payload = new CxfPayload<>( + CxfPayload<?> payload = new CxfPayload<>( new ArrayList<SoapHeader>(), elements, null); exchange.getIn().setBody(payload); } @@ -175,7 +175,10 @@ public class CxfSoapMtomRoutes extends RouteBuilder { @Override public void process(Exchange exchange) throws Exception { + + @SuppressWarnings("unchecked") CxfPayload<SoapHeader> in = exchange.getIn().getBody(CxfPayload.class); + String operation = in.getBody().get(0).getLocalName(); if ("uploadImage".equals(operation)) { Map<String, String> ns = new HashMap<>(); @@ -193,7 +196,7 @@ public class CxfSoapMtomRoutes extends RouteBuilder { List<Source> elements = new ArrayList<>(); elements.add(new DOMSource(StaxUtils.read(new StringReader(String.format(RESP_UPLOAD_MSG, uploadStatus))) .getDocumentElement())); - CxfPayload payload = new CxfPayload<>( + CxfPayload<?> payload = new CxfPayload<>( new ArrayList<SoapHeader>(), elements, null); exchange.getIn().setBody(payload); // We have correctly uploaded the image, so we can put the upload status in the header, so we don't mess with CXFPayload in CxfSoapMtomResource @@ -216,7 +219,7 @@ public class CxfSoapMtomRoutes extends RouteBuilder { StaxUtils.read(new StringReader(String.format(respMessage, imageName, imageName))) .getDocumentElement())); ImageFile imageFile = imageService.downloadImage(imageName); - CxfPayload payload = new CxfPayload<>( + CxfPayload<?> payload = new CxfPayload<>( new ArrayList<SoapHeader>(), elements, null); exchange.getIn().setBody(payload); exchange.getIn(AttachmentMessage.class).addAttachment(imageName, new DataHandler( @@ -302,9 +305,13 @@ public class CxfSoapMtomRoutes extends RouteBuilder { result.setServiceClass(IImageService.class); result.setMtomEnabled(mtomEnabled); result.setAddress(address); + + @SuppressWarnings("rawtypes") List<Handler> handlers = new ArrayList<>(); + handlers.add(new MtomAttachmentChecker(mtomEnabled)); result.setHandlers(handlers); + return result; } diff --git a/integration-test-groups/foundation/bean/src/main/java/org/apache/camel/quarkus/component/bean/eip/EipResource.java b/integration-test-groups/foundation/bean/src/main/java/org/apache/camel/quarkus/component/bean/eip/EipResource.java index fc3a57bb3e..24f415fa4e 100644 --- a/integration-test-groups/foundation/bean/src/main/java/org/apache/camel/quarkus/component/bean/eip/EipResource.java +++ b/integration-test-groups/foundation/bean/src/main/java/org/apache/camel/quarkus/component/bean/eip/EipResource.java @@ -53,7 +53,7 @@ public class EipResource { @Produces(MediaType.TEXT_PLAIN) @GET public String mock(@PathParam("name") String name, @PathParam("count") int count, @PathParam("timeout") int timeout) { - List<String> results = context.getRegistry().lookupByNameAndType(name, List.class); - return results.stream().collect(Collectors.joining(",")); + List<?> results = context.getRegistry().lookupByNameAndType(name, List.class); + return results.stream().map(String.class::cast).collect(Collectors.joining(",")); } } diff --git a/integration-test-groups/foundation/bean/src/test/java/org/apache/camel/quarkus/component/bean/BeanInjectMockTest.java b/integration-test-groups/foundation/bean/src/test/java/org/apache/camel/quarkus/component/bean/BeanInjectMockTest.java index 815b74b201..01a32a4fe5 100644 --- a/integration-test-groups/foundation/bean/src/test/java/org/apache/camel/quarkus/component/bean/BeanInjectMockTest.java +++ b/integration-test-groups/foundation/bean/src/test/java/org/apache/camel/quarkus/component/bean/BeanInjectMockTest.java @@ -16,8 +16,8 @@ */ package org.apache.camel.quarkus.component.bean; +import io.quarkus.test.InjectMock; import io.quarkus.test.junit.QuarkusTest; -import io.quarkus.test.junit.mockito.InjectMock; import io.restassured.RestAssured; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/integration-test-groups/foundation/core/src/main/java/org/apache/camel/quarkus/core/CoreResource.java b/integration-test-groups/foundation/core/src/main/java/org/apache/camel/quarkus/core/CoreResource.java index 5fa2ad28ec..a4fb5e45c2 100644 --- a/integration-test-groups/foundation/core/src/main/java/org/apache/camel/quarkus/core/CoreResource.java +++ b/integration-test-groups/foundation/core/src/main/java/org/apache/camel/quarkus/core/CoreResource.java @@ -196,7 +196,7 @@ public class CoreResource { @PathParam("value") String value) { try { final Class<?> cl = Class.forName(className, true, Thread.currentThread().getContextClassLoader()); - final Object inst = cl.newInstance(); + final Object inst = cl.getDeclaredConstructor().newInstance(); final Method method = cl.getDeclaredMethod(methodName, Object.class); method.invoke(inst, value); return Response.ok(inst.toString()).build(); @@ -215,13 +215,13 @@ public class CoreResource { @PathParam("value") String value) { try { final Class<?> cl = Class.forName(className); - final Object inst = cl.newInstance(); + final Object inst = cl.getDeclaredConstructor().newInstance(); final Field field = cl.getDeclaredField(fieldName); field.setAccessible(true); field.set(inst, value); return Response.ok(inst.toString()).build(); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | NoSuchFieldException - | SecurityException | IllegalArgumentException e) { + | SecurityException | IllegalArgumentException | NoSuchMethodException | InvocationTargetException e) { return Response.serverError().entity(e.getClass().getName() + ": " + e.getMessage()).build(); } } diff --git a/integration-test-groups/foundation/core/src/main/java/org/apache/camel/quarkus/core/MySerializationObject.java b/integration-test-groups/foundation/core/src/main/java/org/apache/camel/quarkus/core/MySerializationObject.java index 9e834230ca..50cc56c004 100644 --- a/integration-test-groups/foundation/core/src/main/java/org/apache/camel/quarkus/core/MySerializationObject.java +++ b/integration-test-groups/foundation/core/src/main/java/org/apache/camel/quarkus/core/MySerializationObject.java @@ -35,25 +35,25 @@ public class MySerializationObject implements Serializable { private Float _float; private Double _double; private BigInteger _bigInteger; - private HashMap _hashMap; - private LinkedHashMap _linkedHashMap; + private HashMap<Integer, String> _hashMap; + private LinkedHashMap<Integer, String> _linkedHashMap; private Character _char; private Boolean _boolean; private Byte _byte; public void initValues() { - _long = 1l; + _long = 1L; _integer = 1; _date = Date.from(Instant.ofEpochMilli(123456789)); _string = "A"; - _float = Float.valueOf(1); - _double = Double.valueOf(1); + _float = 1F; + _double = 1.0; _bigInteger = BigInteger.valueOf(1); - _hashMap = new HashMap(); + _hashMap = new HashMap<>(); _hashMap.put(1, "one"); - _linkedHashMap = new LinkedHashMap(); + _linkedHashMap = new LinkedHashMap<>(); _linkedHashMap.put(1, "one"); - _char = Character.valueOf('a'); + _char = 'a'; _boolean = Boolean.FALSE; _byte = Byte.valueOf("1"); } diff --git a/integration-test-groups/foundation/type-converter/src/main/java/org/apache/camel/quarkus/core/converter/it/TestConverters.java b/integration-test-groups/foundation/type-converter/src/main/java/org/apache/camel/quarkus/core/converter/it/TestConverters.java index c9d39ca223..b477124b31 100644 --- a/integration-test-groups/foundation/type-converter/src/main/java/org/apache/camel/quarkus/core/converter/it/TestConverters.java +++ b/integration-test-groups/foundation/type-converter/src/main/java/org/apache/camel/quarkus/core/converter/it/TestConverters.java @@ -58,13 +58,13 @@ public class TestConverters { } @Converter(fallback = true) - public static Object convertTo(Class type, Exchange exchange, Object value, TypeConverterRegistry registry) + public static Object convertTo(Class<?> type, Exchange exchange, Object value, TypeConverterRegistry registry) throws ClassNotFoundException { if (value instanceof String) { String s = (String) value; String[] tokens = s.split(":"); if (tokens.length == 3) { - Class convertTo = Class.forName(tokens[0]); + Class<?> convertTo = Class.forName(tokens[0]); TypeConverter tc = registry.lookup(convertTo, String.class); if (tc != null) { return tc.convertTo(convertTo, s.replaceFirst(tokens[0] + ":", "")); diff --git a/integration-test-groups/mongodb/mongodb/src/test/java/org/apache/camel/quarkus/component/mongodb/it/MongoDbTest.java b/integration-test-groups/mongodb/mongodb/src/test/java/org/apache/camel/quarkus/component/mongodb/it/MongoDbTest.java index 38eebad0e8..3dbc48b506 100644 --- a/integration-test-groups/mongodb/mongodb/src/test/java/org/apache/camel/quarkus/component/mongodb/it/MongoDbTest.java +++ b/integration-test-groups/mongodb/mongodb/src/test/java/org/apache/camel/quarkus/component/mongodb/it/MongoDbTest.java @@ -57,8 +57,8 @@ class MongoDbTest { public static final String MSG = "Hello Camel Quarkus Mongo DB"; - private static String COLLECTION_OUTPUT_TYPE_DOCUMENT_LIST = "outputTypeDocumentList"; - private static String COLLECTION_OUTPUT_TYPE_DOCUMENT = "outputTypeDocument"; + private static final String COLLECTION_OUTPUT_TYPE_DOCUMENT_LIST = "outputTypeDocumentList"; + private static final String COLLECTION_OUTPUT_TYPE_DOCUMENT = "outputTypeDocument"; private static MongoClient mongoClient; @@ -68,10 +68,7 @@ class MongoDbTest { public static void setUp() throws SQLException { final String mongoUrl = "mongodb://" + ConfigProvider.getConfig().getValue("quarkus.mongodb.hosts", String.class); - if (mongoUrl != null) { - mongoClient = MongoClients.create(mongoUrl); - } - + mongoClient = MongoClients.create(mongoUrl); db = mongoClient.getDatabase("test"); } @@ -145,7 +142,7 @@ class MongoDbTest { @Test public void testTailingConsumer() throws Exception { - MongoCollection collection = db.getCollection(MongoDbConstants.COLLECTION_TAILING, Document.class); + MongoCollection<Document> collection = db.getCollection(MongoDbConstants.COLLECTION_TAILING, Document.class); for (int i = 1; i <= (10 * MongoDbConstants.CAP_NUMBER); i++) { collection.insertOne(new Document("increasing", i).append("string", "value" + i)); @@ -159,7 +156,7 @@ class MongoDbTest { @Test public void testPersistentTailingConsumer() throws Exception { - MongoCollection collection = db.getCollection(MongoDbConstants.COLLECTION_PERSISTENT_TAILING, Document.class); + MongoCollection<Document> collection = db.getCollection(MongoDbConstants.COLLECTION_PERSISTENT_TAILING, Document.class); for (int i = 1; i <= (3 * MongoDbConstants.CAP_NUMBER); i++) { collection.insertOne(new Document("increasing", i).append("string", "value" + i)); @@ -208,7 +205,7 @@ class MongoDbTest { @Test public void testStreamConsumerWithFilter() throws Exception { - MongoCollection collection = db.getCollection(MongoDbConstants.COLLECTION_STREAM_CHANGES, Document.class); + MongoCollection<Document> collection = db.getCollection(MongoDbConstants.COLLECTION_STREAM_CHANGES, Document.class); for (int i = 1; i <= 10; i++) { collection.insertOne(new Document("increasing", i).append("string", "value" + i)); @@ -240,7 +237,7 @@ class MongoDbTest { @Test public void testOutputTypeDocumentList() throws Exception { - MongoCollection collection = db.getCollection(COLLECTION_OUTPUT_TYPE_DOCUMENT_LIST, Document.class); + MongoCollection<Document> collection = db.getCollection(COLLECTION_OUTPUT_TYPE_DOCUMENT_LIST, Document.class); collection.insertOne(new Document("name", "Sheldon")); collection.insertOne(new Document("name", "Irma")); @@ -264,7 +261,7 @@ class MongoDbTest { @Test public void testOutputTypeDocument() throws Exception { - MongoCollection collection = db.getCollection(COLLECTION_OUTPUT_TYPE_DOCUMENT, Document.class); + MongoCollection<Document> collection = db.getCollection(COLLECTION_OUTPUT_TYPE_DOCUMENT, Document.class); collection.insertOne(new Document("name", "Sheldon")); diff --git a/integration-tests-jvm/dsl-modeline/src/test/java/org/apache/camel/quarkus/component/dsl/modeline/it/DslModelineTest.java b/integration-tests-jvm/dsl-modeline/src/test/java/org/apache/camel/quarkus/component/dsl/modeline/it/DslModelineTest.java index f20c5d2897..2bd193d3cd 100644 --- a/integration-tests-jvm/dsl-modeline/src/test/java/org/apache/camel/quarkus/component/dsl/modeline/it/DslModelineTest.java +++ b/integration-tests-jvm/dsl-modeline/src/test/java/org/apache/camel/quarkus/component/dsl/modeline/it/DslModelineTest.java @@ -20,6 +20,7 @@ import java.util.List; import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; +import io.restassured.common.mapper.TypeRef; import io.restassured.http.ContentType; import jakarta.ws.rs.core.Response; import org.junit.jupiter.api.Test; @@ -155,7 +156,7 @@ public class DslModelineTest { } - private List parseAndGetDependencies(String line) { + private <T> List<T> parseAndGetDependencies(String line) { // clear list clear(); @@ -170,7 +171,8 @@ public class DslModelineTest { .body(line) .get("/dsl-modeline/deps") .then() - .extract().body().as(List.class); + .extract().body().as(new TypeRef<>() { + }); } diff --git a/integration-tests-support/test-support/src/main/java/org/apache/camel/quarkus/test/EnabledIfCondition.java b/integration-tests-support/test-support/src/main/java/org/apache/camel/quarkus/test/EnabledIfCondition.java index 689a6115e2..898c83642c 100644 --- a/integration-tests-support/test-support/src/main/java/org/apache/camel/quarkus/test/EnabledIfCondition.java +++ b/integration-tests-support/test-support/src/main/java/org/apache/camel/quarkus/test/EnabledIfCondition.java @@ -16,6 +16,7 @@ */ package org.apache.camel.quarkus.test; +import java.lang.reflect.InvocationTargetException; import java.util.function.BooleanSupplier; import org.junit.jupiter.api.extension.ConditionEvaluationResult; @@ -39,10 +40,10 @@ class EnabledIfCondition implements ExecutionCondition { private ConditionEvaluationResult map(EnabledIf annotation) { for (Class<? extends BooleanSupplier> type : annotation.value()) { try { - if (!type.newInstance().getAsBoolean()) { + if (!type.getDeclaredConstructor().newInstance().getAsBoolean()) { return disabled(format("Condition %s is false", type.getName())); } - } catch (InstantiationException | IllegalAccessException e) { + } catch (InstantiationException | NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { return disabled(format("Unable to evaluate condition: %s", type.getName())); } } diff --git a/integration-tests/braintree/src/main/java/org/apache/camel/quarkus/component/braintree/it/BraintreeResource.java b/integration-tests/braintree/src/main/java/org/apache/camel/quarkus/component/braintree/it/BraintreeResource.java index bc81f5eac9..d0c181c9ba 100644 --- a/integration-tests/braintree/src/main/java/org/apache/camel/quarkus/component/braintree/it/BraintreeResource.java +++ b/integration-tests/braintree/src/main/java/org/apache/camel/quarkus/component/braintree/it/BraintreeResource.java @@ -55,6 +55,7 @@ public class BraintreeResource { @Path("/sale") @POST @Produces(MediaType.APPLICATION_JSON) + @SuppressWarnings("unchecked") public Response sale() throws Exception { String api = BraintreeApiCollection.getCollection().getApiName(TransactionGatewayApiMethod.class).getName(); TransactionRequest transaction = new TransactionRequest() @@ -81,6 +82,7 @@ public class BraintreeResource { @Path("/refund") @POST @Produces(MediaType.APPLICATION_JSON) + @SuppressWarnings("unchecked") public Response refund(String transactionId) throws Exception { String api = BraintreeApiCollection.getCollection().getApiName(TransactionGatewayApiMethod.class).getName(); Map<String, Object> headers = new HashMap<>(); diff --git a/integration-tests/git/src/main/java/org/apache/camel/quarkus/component/git/it/GitResource.java b/integration-tests/git/src/main/java/org/apache/camel/quarkus/component/git/it/GitResource.java index 1809755e3d..d902b94523 100644 --- a/integration-tests/git/src/main/java/org/apache/camel/quarkus/component/git/it/GitResource.java +++ b/integration-tests/git/src/main/java/org/apache/camel/quarkus/component/git/it/GitResource.java @@ -93,9 +93,11 @@ public class GitResource { @GET @Produces(MediaType.TEXT_PLAIN) public String log(@PathParam("repoName") String repoName) throws Exception { - Iterable<RevCommit> it = producerTemplate.requestBody("git:target/" + repoName + "?operation=log", null, + Iterable<?> it = producerTemplate.requestBody("git:target/" + repoName + "?operation=log", null, Iterable.class); + return StreamSupport.stream(it.spliterator(), false) + .map(RevCommit.class::cast) .map(commit -> commit.getName() + " " + commit.getFullMessage()) .collect(Collectors.joining("\n")); } diff --git a/integration-tests/google-bigquery/src/test/java/org/apache/camel/quarkus/component/google/bigquery/it/GoogleBigqueryTest.java b/integration-tests/google-bigquery/src/test/java/org/apache/camel/quarkus/component/google/bigquery/it/GoogleBigqueryTest.java index 512b662e91..8d0da04932 100644 --- a/integration-tests/google-bigquery/src/test/java/org/apache/camel/quarkus/component/google/bigquery/it/GoogleBigqueryTest.java +++ b/integration-tests/google-bigquery/src/test/java/org/apache/camel/quarkus/component/google/bigquery/it/GoogleBigqueryTest.java @@ -28,6 +28,7 @@ import java.util.Map; import java.util.stream.Collectors; import com.google.cloud.bigquery.BigQuery; +import com.google.cloud.bigquery.FieldValue; import com.google.cloud.bigquery.FieldValueList; import com.google.cloud.bigquery.Job; import com.google.cloud.bigquery.JobInfo; @@ -115,7 +116,7 @@ class GoogleBigqueryTest { @Test public void insertListTest() throws Exception { // Insert rows - List data = new LinkedList(); + List<Object> data = new LinkedList<>(); for (int i = 1; i <= 3; i++) { Map<String, String> object = new HashMap<>(); object.put("id", String.valueOf(i)); @@ -275,7 +276,7 @@ class GoogleBigqueryTest { private List<List<Object>> parseResult(TableResult tr) { List<List<Object>> retVal = new ArrayList<>(); for (FieldValueList flv : tr.getValues()) { - retVal.add(flv.stream().map(fv -> fv.getValue()).collect(Collectors.toList())); + retVal.add(flv.stream().map(FieldValue::getValue).collect(Collectors.toList())); } return retVal; } diff --git a/integration-tests/google-storage/src/main/java/org/apache/camel/quarkus/component/google/storage/it/GoogleStorageResource.java b/integration-tests/google-storage/src/main/java/org/apache/camel/quarkus/component/google/storage/it/GoogleStorageResource.java index 38f7fc779c..23fa010661 100644 --- a/integration-tests/google-storage/src/main/java/org/apache/camel/quarkus/component/google/storage/it/GoogleStorageResource.java +++ b/integration-tests/google-storage/src/main/java/org/apache/camel/quarkus/component/google/storage/it/GoogleStorageResource.java @@ -108,8 +108,8 @@ public class GoogleStorageResource { return new String(((CopyWriter) response).getResult().getContent()); } if (response instanceof List) { - List l = (List) response; - return (String) l.stream().map(o -> { + List<?> l = (List<?>) response; + return l.stream().map(o -> { if (o instanceof Bucket) { return ((Bucket) o).getName(); } @@ -165,7 +165,7 @@ public class GoogleStorageResource { buckets.remove(DEST_BUCKET); } - buckets.stream().forEach( + buckets.forEach( b -> { for (Blob blob : client.list(b).iterateAll()) { client.delete(blob.getBlobId()); diff --git a/integration-tests/hazelcast/src/test/java/org/apache/camel/quarkus/component/hazelcast/it/HazelcastReplicatedmapTest.java b/integration-tests/hazelcast/src/test/java/org/apache/camel/quarkus/component/hazelcast/it/HazelcastReplicatedmapTest.java index b134a2acec..1b6b4dc151 100644 --- a/integration-tests/hazelcast/src/test/java/org/apache/camel/quarkus/component/hazelcast/it/HazelcastReplicatedmapTest.java +++ b/integration-tests/hazelcast/src/test/java/org/apache/camel/quarkus/component/hazelcast/it/HazelcastReplicatedmapTest.java @@ -24,6 +24,7 @@ import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.common.http.TestHTTPEndpoint; import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; +import io.restassured.common.mapper.TypeRef; import io.restassured.http.ContentType; import org.apache.camel.quarkus.component.hazelcast.it.model.HazelcastMapRequest; import org.junit.jupiter.api.Test; @@ -125,13 +126,17 @@ public class HazelcastReplicatedmapTest { // verify that the consumer has received all added keys await().atMost(10L, TimeUnit.SECONDS).until(() -> { - List<String> body = RestAssured.get("/added").then().extract().body().as(List.class); + List<String> body = RestAssured.get("/added").then().extract().body().as(new TypeRef<>() { + }); + return body.size() == 2 && body.containsAll(Arrays.asList("1", "2")); }); // verify that the consumer has received all removed keys await().atMost(10L, TimeUnit.SECONDS).until(() -> { - List<String> body = RestAssured.get("/deleted").then().extract().body().as(List.class); + List<String> body = RestAssured.get("/deleted").then().extract().body().as(new TypeRef<>() { + }); + return body.size() == 1 && body.contains("1"); }); diff --git a/integration-tests/jcache/src/main/java/org/apache/camel/quarkus/component/jcache/it/JcacheRoutes.java b/integration-tests/jcache/src/main/java/org/apache/camel/quarkus/component/jcache/it/JcacheRoutes.java index 9bd0952e75..2b8a413a7c 100644 --- a/integration-tests/jcache/src/main/java/org/apache/camel/quarkus/component/jcache/it/JcacheRoutes.java +++ b/integration-tests/jcache/src/main/java/org/apache/camel/quarkus/component/jcache/it/JcacheRoutes.java @@ -52,11 +52,11 @@ public class JcacheRoutes extends RouteBuilder { @ApplicationScoped @Named public JCachePolicy jcachePolicy() { - MutableConfiguration configuration = new MutableConfiguration<>(); + MutableConfiguration<String, Object> configuration = new MutableConfiguration<>(); configuration.setTypes(String.class, Object.class); configuration.setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.SECONDS, 3))); CacheManager cacheManager = Caching.getCachingProvider().getCacheManager(); - Cache cache = cacheManager.createCache("MyJCache", configuration); + Cache<String, Object> cache = cacheManager.createCache("MyJCache", configuration); JCachePolicy jcachePolicy = new JCachePolicy(); jcachePolicy.setCache(cache); diff --git a/integration-tests/jq/src/main/java/org/apache/camel/quarkus/component/jq/it/JqResource.java b/integration-tests/jq/src/main/java/org/apache/camel/quarkus/component/jq/it/JqResource.java index f4cd3245a7..e7a539cd45 100644 --- a/integration-tests/jq/src/main/java/org/apache/camel/quarkus/component/jq/it/JqResource.java +++ b/integration-tests/jq/src/main/java/org/apache/camel/quarkus/component/jq/it/JqResource.java @@ -99,7 +99,7 @@ public class JqResource { endpoint.expectedBodiesReceived(new Book("foo", "bar")); ObjectNode node = mapper.createObjectNode(); - node.with("book").put("author", "foo").put("title", "bar"); + node.withObject("/book").put("author", "foo").put("title", "bar"); producerTemplate.sendBody("direct:expressionPojo", node); diff --git a/integration-tests/kafka/src/main/java/org/apache/camel/quarkus/component/kafka/CamelKafkaResource.java b/integration-tests/kafka/src/main/java/org/apache/camel/quarkus/component/kafka/CamelKafkaResource.java index 4361a63d1b..dbe194e187 100644 --- a/integration-tests/kafka/src/main/java/org/apache/camel/quarkus/component/kafka/CamelKafkaResource.java +++ b/integration-tests/kafka/src/main/java/org/apache/camel/quarkus/component/kafka/CamelKafkaResource.java @@ -181,7 +181,7 @@ public class CamelKafkaResource { @POST public Response postMessageWithHeader(@PathParam("id") Integer id, String message) { try (Producer<Integer, String> producer = new KafkaProducer<>(producerProperties)) { - ProducerRecord data = new ProducerRecord<>("test-propagation", id, message); + ProducerRecord<Integer, String> data = new ProducerRecord<>("test-propagation", id, message); data.headers().add(new RecordHeader("id", BigInteger.valueOf(id).toByteArray())); producer.send(data); } diff --git a/integration-tests/kafka/src/test/java/org/apache/camel/quarkus/component/kafka/it/CamelKafkaTest.java b/integration-tests/kafka/src/test/java/org/apache/camel/quarkus/component/kafka/it/CamelKafkaTest.java index 627e5c5c79..f6876a2639 100644 --- a/integration-tests/kafka/src/test/java/org/apache/camel/quarkus/component/kafka/it/CamelKafkaTest.java +++ b/integration-tests/kafka/src/test/java/org/apache/camel/quarkus/component/kafka/it/CamelKafkaTest.java @@ -16,7 +16,6 @@ */ package org.apache.camel.quarkus.component.kafka.it; -import java.util.List; import java.util.UUID; import java.util.concurrent.TimeUnit; @@ -75,8 +74,8 @@ public class CamelKafkaTest { .statusCode(202); } - List<String> body = RestAssured.get("/kafka/idempotent").then().extract().body().as(List.class); - assertEquals(5, body.size()); + String[] body = RestAssured.get("/kafka/idempotent").then().extract().body().as(String[].class); + assertEquals(5, body.length); } diff --git a/integration-tests/kudu/src/test/java/org/apache/camel/quarkus/component/kudu/it/KuduTestResource.java b/integration-tests/kudu/src/test/java/org/apache/camel/quarkus/component/kudu/it/KuduTestResource.java index dea287f6a0..bf070b64c5 100644 --- a/integration-tests/kudu/src/test/java/org/apache/camel/quarkus/component/kudu/it/KuduTestResource.java +++ b/integration-tests/kudu/src/test/java/org/apache/camel/quarkus/component/kudu/it/KuduTestResource.java @@ -46,7 +46,8 @@ public class KuduTestResource implements QuarkusTestResourceLifecycleManager { private static final String KUDU_MASTER_NETWORK_ALIAS = "kudu-master"; private static final String KUDU_TABLET_NETWORK_ALIAS = KuduInfrastructureTestHelper.KUDU_TABLET_SERVER_HOSTNAME; - private GenericContainer masterContainer, tabletContainer; + private GenericContainer<?> masterContainer; + private GenericContainer<?> tabletContainer; @Override public Map<String, String> start() { @@ -56,7 +57,7 @@ public class KuduTestResource implements QuarkusTestResourceLifecycleManager { Network kuduNetwork = Network.newNetwork(); // Setup the Kudu master server container - masterContainer = new GenericContainer(KUDU_IMAGE).withCommand("master") + masterContainer = new GenericContainer<>(KUDU_IMAGE).withCommand("master") .withExposedPorts(KUDU_MASTER_RPC_PORT, KUDU_MASTER_HTTP_PORT).withNetwork(kuduNetwork) .withNetworkAliases(KUDU_MASTER_NETWORK_ALIAS); masterContainer = masterContainer.withLogConsumer(new Slf4jLogConsumer(LOG)).waitingFor(Wait.forListeningPort()); @@ -73,7 +74,7 @@ public class KuduTestResource implements QuarkusTestResourceLifecycleManager { }; // Setup the Kudu tablet server container - tabletContainer = new GenericContainer(KUDU_IMAGE).withCommand("tserver") + tabletContainer = new GenericContainer<>(KUDU_IMAGE).withCommand("tserver") .withEnv("KUDU_MASTERS", KUDU_MASTER_NETWORK_ALIAS) .withExposedPorts(KUDU_TABLET_RPC_PORT, KUDU_TABLET_HTTP_PORT).withNetwork(kuduNetwork) .withNetworkAliases(KUDU_TABLET_NETWORK_ALIAS).withCreateContainerCmdModifier(consumer); diff --git a/integration-tests/leveldb/src/test/java/org/apache/camel/quarkus/component/leveldb/it/LeveldbTest.java b/integration-tests/leveldb/src/test/java/org/apache/camel/quarkus/component/leveldb/it/LeveldbTest.java index cdb9f3aec4..b8995eab06 100644 --- a/integration-tests/leveldb/src/test/java/org/apache/camel/quarkus/component/leveldb/it/LeveldbTest.java +++ b/integration-tests/leveldb/src/test/java/org/apache/camel/quarkus/component/leveldb/it/LeveldbTest.java @@ -25,6 +25,7 @@ import java.util.Map; import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; +import io.restassured.common.mapper.TypeRef; import io.restassured.http.ContentType; import io.restassured.specification.RequestSpecification; import org.apache.camel.Exchange; @@ -116,12 +117,14 @@ class LeveldbTest { rs = rs.queryParam("mocks", mocks); } - return (Map<String, List<Map<String, Object>>>) rs.contentType(ContentType.JSON) + return rs.contentType(ContentType.JSON) .body(messages) .post("/leveldb/aggregate") .then() .statusCode(201) - .extract().as(Map.class); + .extract() + .as(new TypeRef<>() { + }); } @AfterAll diff --git a/integration-tests/mail/src/main/java/org/apache/camel/quarkus/component/mail/CamelResource.java b/integration-tests/mail/src/main/java/org/apache/camel/quarkus/component/mail/CamelResource.java index 075cd7a247..06084dee3b 100644 --- a/integration-tests/mail/src/main/java/org/apache/camel/quarkus/component/mail/CamelResource.java +++ b/integration-tests/mail/src/main/java/org/apache/camel/quarkus/component/mail/CamelResource.java @@ -164,7 +164,7 @@ public class CamelResource { @GET @Produces(MediaType.APPLICATION_JSON) public List<Map<String, Object>> getReceivedAsString() throws MessagingException, IOException { - List<Map<String, Object>> result = new LinkedList(); + List<Map<String, Object>> result = new LinkedList<>(); for (Map<String, Object> email : mailReceivedMessages) { InputStream is = (InputStream) email.get("convertedStream"); result.add(Collections.singletonMap("body", camelContext.getTypeConverter().convertTo(String.class, is))); diff --git a/integration-tests/messaging/common/src/main/java/org/apache/camel/quarkus/component/messaging/it/util/scheme/MessagingComponentSchemeProducer.java b/integration-tests/messaging/common/src/main/java/org/apache/camel/quarkus/component/messaging/it/util/scheme/MessagingComponentSchemeProducer.java index 1578a5e7a3..1e3e4fc548 100644 --- a/integration-tests/messaging/common/src/main/java/org/apache/camel/quarkus/component/messaging/it/util/scheme/MessagingComponentSchemeProducer.java +++ b/integration-tests/messaging/common/src/main/java/org/apache/camel/quarkus/component/messaging/it/util/scheme/MessagingComponentSchemeProducer.java @@ -37,7 +37,7 @@ public class MessagingComponentSchemeProducer { @Singleton public ComponentScheme getMessagingComponentScheme(CamelContext camelContext) { ExtendedCamelContext context = camelContext.getCamelContextExtension(); - RuntimeCamelCatalog catalog = context.getRuntimeCamelCatalog(); + RuntimeCamelCatalog catalog = context.getContextPlugin(RuntimeCamelCatalog.class); ComponentNameResolver resolver = PluginHelper.getComponentNameResolver(context); List<JsonObject> schemas = new ArrayList<>(); diff --git a/integration-tests/microprofile/src/main/java/org/apache/camel/quarkus/component/microprofile/it/faulttolerance/MicroProfileFaultToleranceHelper.java b/integration-tests/microprofile/src/main/java/org/apache/camel/quarkus/component/microprofile/it/faulttolerance/MicroProfileFaultToleranceHelper.java index 63071b48bb..7da7c63d62 100644 --- a/integration-tests/microprofile/src/main/java/org/apache/camel/quarkus/component/microprofile/it/faulttolerance/MicroProfileFaultToleranceHelper.java +++ b/integration-tests/microprofile/src/main/java/org/apache/camel/quarkus/component/microprofile/it/faulttolerance/MicroProfileFaultToleranceHelper.java @@ -22,7 +22,7 @@ import java.util.concurrent.atomic.AtomicInteger; public class MicroProfileFaultToleranceHelper { - private static final Map<String, AtomicInteger> COUNTERS = new ConcurrentHashMap(); + private static final Map<String, AtomicInteger> COUNTERS = new ConcurrentHashMap<>(); private MicroProfileFaultToleranceHelper() { // Utility class diff --git a/integration-tests/minio/src/main/java/org/apache/camel/quarkus/component/minio/it/MinioResource.java b/integration-tests/minio/src/main/java/org/apache/camel/quarkus/component/minio/it/MinioResource.java index bdd540414d..74763f768a 100644 --- a/integration-tests/minio/src/main/java/org/apache/camel/quarkus/component/minio/it/MinioResource.java +++ b/integration-tests/minio/src/main/java/org/apache/camel/quarkus/component/minio/it/MinioResource.java @@ -162,7 +162,7 @@ public class MinioResource { } } - Iterable objectList; + Iterable<?> objectList; var sb = new StringBuilder(); var errorSB = new StringBuilder(); try { @@ -188,7 +188,7 @@ public class MinioResource { return respBuilder.build(); } - private void formatResult(Integer length, Integer offset, Iterable objectList, StringBuilder sb, StringBuilder errorSB) { + private void formatResult(Integer length, Integer offset, Iterable<?> objectList, StringBuilder sb, StringBuilder errorSB) { objectList.forEach(r -> { try { if (r instanceof Result) { @@ -221,19 +221,19 @@ public class MinioResource { private Map<String, Object> deserializeMap(String parametersString) { return Arrays.stream(parametersString.split(",")) - .map(s -> new Pair(s.split(":")[0], s.split(":")[1])) + .map(s -> new Pair<String>(s.split(":")[0], s.split(":")[1])) .map(p -> { - switch (p.getLeft().toString()) { + switch (p.getLeft()) { case MinioConstants.OFFSET: case MinioConstants.LENGTH: - return new Pair<>(p.getLeft(), Integer.parseInt(p.getRight().toString())); + return new Pair<>(p.getLeft(), Integer.parseInt(p.getRight())); case MinioConstants.MINIO_OPERATION: - return new Pair<>(p.getLeft(), MinioOperations.valueOf(p.getRight().toString())); + return new Pair<>(p.getLeft(), MinioOperations.valueOf(p.getRight())); default: return p; } }) - .collect(Collectors.toMap(p -> p.getLeft().toString(), p -> p.getRight())); + .collect(Collectors.toMap(p -> p.getLeft().toString(), Pair::getRight)); } } diff --git a/integration-tests/opentelemetry/src/main/java/org/apache/camel/quarkus/component/opentelemetry/it/GreetingsBean.java b/integration-tests/opentelemetry/src/main/java/org/apache/camel/quarkus/component/opentelemetry/it/GreetingsBean.java index bfcefa8b71..19108654fd 100644 --- a/integration-tests/opentelemetry/src/main/java/org/apache/camel/quarkus/component/opentelemetry/it/GreetingsBean.java +++ b/integration-tests/opentelemetry/src/main/java/org/apache/camel/quarkus/component/opentelemetry/it/GreetingsBean.java @@ -16,7 +16,7 @@ */ package org.apache.camel.quarkus.component.opentelemetry.it; -import io.opentelemetry.extension.annotations.WithSpan; +import io.opentelemetry.instrumentation.annotations.WithSpan; import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Named; diff --git a/integration-tests/pgevent/src/test/java/org/apache/camel/quarkus/component/pgevent/it/PgEventTestResource.java b/integration-tests/pgevent/src/test/java/org/apache/camel/quarkus/component/pgevent/it/PgEventTestResource.java index 582886460f..4f51131534 100644 --- a/integration-tests/pgevent/src/test/java/org/apache/camel/quarkus/component/pgevent/it/PgEventTestResource.java +++ b/integration-tests/pgevent/src/test/java/org/apache/camel/quarkus/component/pgevent/it/PgEventTestResource.java @@ -37,7 +37,7 @@ public class PgEventTestResource implements QuarkusTestResourceLifecycleManager private static final int POSTGRES_PORT = 5432; private static final String POSTGRES_IMAGE = "postgres:13.0"; - private GenericContainer container; + private GenericContainer<?> container; @Override public Map<String, String> start() { @@ -59,8 +59,8 @@ public class PgEventTestResource implements QuarkusTestResourceLifecycleManager } } - private GenericContainer createContainer() { - GenericContainer container = new GenericContainer(POSTGRES_IMAGE) + private GenericContainer<?> createContainer() { + return new GenericContainer<>(POSTGRES_IMAGE) .withCommand("postgres -c wal_level=logical") .withExposedPorts(POSTGRES_PORT) .withNetworkAliases(CONTAINER_NAME) @@ -69,6 +69,5 @@ public class PgEventTestResource implements QuarkusTestResourceLifecycleManager .withEnv("POSTGRES_DB", POSTGRES_DB) .withLogConsumer(new Slf4jLogConsumer(LOGGER)) .waitingFor(Wait.forListeningPort()); - return container; } } diff --git a/integration-tests/splunk/src/test/java/org/apache/camel/quarkus/component/splunk/it/SplunkTest.java b/integration-tests/splunk/src/test/java/org/apache/camel/quarkus/component/splunk/it/SplunkTest.java index 832ba9b601..7280e1cc2d 100644 --- a/integration-tests/splunk/src/test/java/org/apache/camel/quarkus/component/splunk/it/SplunkTest.java +++ b/integration-tests/splunk/src/test/java/org/apache/camel/quarkus/component/splunk/it/SplunkTest.java @@ -25,6 +25,7 @@ import java.util.stream.Collectors; import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; +import io.restassured.common.mapper.TypeRef; import io.restassured.http.ContentType; import org.apache.camel.util.CollectionHelper; import org.eclipse.microprofile.config.ConfigProvider; @@ -51,7 +52,8 @@ class SplunkTest { .post("/splunk/normal") .then() .statusCode(200) - .extract().as(List.class); + .extract().as(new TypeRef<>() { + }); Assertions.assertEquals(3, result.size()); Assertions.assertEquals("Irma_normal", result.get(0).get("name")); diff --git a/integration-tests/sql/src/main/java/org/apache/camel/quarkus/component/sql/it/SqlConfigSourceFactory.java b/integration-tests/sql/src/main/java/org/apache/camel/quarkus/component/sql/it/SqlConfigSourceFactory.java index 82c5782b61..403a922ddc 100644 --- a/integration-tests/sql/src/main/java/org/apache/camel/quarkus/component/sql/it/SqlConfigSourceFactory.java +++ b/integration-tests/sql/src/main/java/org/apache/camel/quarkus/component/sql/it/SqlConfigSourceFactory.java @@ -28,12 +28,12 @@ import org.eclipse.microprofile.config.spi.ConfigSource; public class SqlConfigSourceFactory implements ConfigSourceFactory { - private static MapBackedConfigSource source; + private static final MapBackedConfigSource source; static { String jdbcUrl = System.getenv("SQL_JDBC_URL"); - Map<String, String> props = new HashMap(); + Map<String, String> props = new HashMap<>(); //external db if (jdbcUrl != null) { props.put("quarkus.datasource.jdbc.url", jdbcUrl); diff --git a/integration-tests/sql/src/main/java/org/apache/camel/quarkus/component/sql/it/SqlResource.java b/integration-tests/sql/src/main/java/org/apache/camel/quarkus/component/sql/it/SqlResource.java index 860702b224..5eace4f388 100644 --- a/integration-tests/sql/src/main/java/org/apache/camel/quarkus/component/sql/it/SqlResource.java +++ b/integration-tests/sql/src/main/java/org/apache/camel/quarkus/component/sql/it/SqlResource.java @@ -181,7 +181,7 @@ public class SqlResource { @GET @Produces(MediaType.APPLICATION_JSON) public List consumerResults(@PathParam("resultId") String resultId) throws Exception { - List<Map> list = new LinkedList(this.results.get(resultId)); + List<Map> list = new LinkedList<>(this.results.get(resultId)); results.get(resultId).clear(); return list; } diff --git a/integration-tests/sql/src/main/java/org/apache/camel/quarkus/component/sql/it/SqlRoutes.java b/integration-tests/sql/src/main/java/org/apache/camel/quarkus/component/sql/it/SqlRoutes.java index c6f23a7294..07fa20034b 100644 --- a/integration-tests/sql/src/main/java/org/apache/camel/quarkus/component/sql/it/SqlRoutes.java +++ b/integration-tests/sql/src/main/java/org/apache/camel/quarkus/component/sql/it/SqlRoutes.java @@ -48,7 +48,7 @@ public class SqlRoutes extends RouteBuilder { @Inject @Named("results") - Map<String, List> results; + Map<String, List<Object>> results; @Inject TransactionManager tm; @@ -127,7 +127,7 @@ public class SqlRoutes extends RouteBuilder { while ((c = is.read()) >= 0) { baos.write(c); } - String content = new String(baos.toByteArray(), StandardCharsets.UTF_8); + String content = baos.toString(StandardCharsets.UTF_8); content = content.replaceAll("projectsViaClasspath", "projectsViaFile"); fos.write(content.getBytes(StandardCharsets.UTF_8)); } @@ -137,8 +137,8 @@ public class SqlRoutes extends RouteBuilder { @Produces @ApplicationScoped @Named("results") - Map<String, List> results() { - Map<String, List> result = new HashMap<>(); + Map<String, List<Object>> results() { + Map<String, List<Object>> result = new HashMap<>(); result.put("consumerRoute", new CopyOnWriteArrayList<>()); result.put("consumerClasspathRoute", new CopyOnWriteArrayList<>()); result.put("consumerFileRoute", new CopyOnWriteArrayList<>()); diff --git a/integration-tests/stringtemplate/src/test/java/org/apache/camel/quarkus/component/stringtemplate/it/StringtemplateTest.java b/integration-tests/stringtemplate/src/test/java/org/apache/camel/quarkus/component/stringtemplate/it/StringtemplateTest.java index 4e7d770d9e..80e431dac8 100644 --- a/integration-tests/stringtemplate/src/test/java/org/apache/camel/quarkus/component/stringtemplate/it/StringtemplateTest.java +++ b/integration-tests/stringtemplate/src/test/java/org/apache/camel/quarkus/component/stringtemplate/it/StringtemplateTest.java @@ -18,7 +18,6 @@ package org.apache.camel.quarkus.component.stringtemplate.it; import java.io.File; import java.io.IOException; -import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; import java.util.Collections; @@ -39,7 +38,7 @@ class StringtemplateTest { @Test public void testTemplateFromClasspath() { - Map<String, Object> headers = new HashMap() { + Map<String, Object> headers = new HashMap<>() { { put("name", "Sheldon"); put("item", "Camel in Action"); @@ -66,7 +65,7 @@ class StringtemplateTest { variableMap.put("headers", headersMap); variableMap.put("body", "Monday"); variableMap.put("item", "1"); - Map<String, Object> headers = new HashMap() { + Map<String, Object> headers = new HashMap<>() { { put("name", "Sheldon"); put("item", "7"); @@ -135,7 +134,7 @@ class StringtemplateTest { .body(equalTo("Hi Sheldon")); //override file - Files.write(Paths.get(template.getPath()), "Bye <headers.name>".getBytes(StandardCharsets.UTF_8)); + Files.writeString(Paths.get(template.getPath()), "Bye <headers.name>"); RestAssured.given() .queryParam("template", "file:" + template.getPath()) @@ -152,7 +151,7 @@ class StringtemplateTest { private File createFile(String fileName, String body) throws IOException { File tmpFile = File.createTempFile(fileName, ".tm"); - Files.write(tmpFile.toPath(), body.getBytes(StandardCharsets.UTF_8)); + Files.writeString(tmpFile.toPath(), body); tmpFile.deleteOnExit(); return tmpFile; diff --git a/integration-tests/swift/pom.xml b/integration-tests/swift/pom.xml index a1fb73facb..cdb6a5f60f 100644 --- a/integration-tests/swift/pom.xml +++ b/integration-tests/swift/pom.xml @@ -99,6 +99,7 @@ </property> </activation> <dependencies> + <!-- The following dependencies guarantee that this module is built after them. You can update them by running `mvn process-resources -Pformat -N` from the source tree root directory --> <dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-swift-deployment</artifactId> diff --git a/integration-tests/velocity/src/main/java/org/apache/camel/quarkus/component/velocity/it/VelocityResource.java b/integration-tests/velocity/src/main/java/org/apache/camel/quarkus/component/velocity/it/VelocityResource.java index 8e5b95d737..79f0da783d 100644 --- a/integration-tests/velocity/src/main/java/org/apache/camel/quarkus/component/velocity/it/VelocityResource.java +++ b/integration-tests/velocity/src/main/java/org/apache/camel/quarkus/component/velocity/it/VelocityResource.java @@ -58,7 +58,7 @@ public class VelocityResource { @QueryParam("contentCache") String contentCache, @QueryParam("expectFailure") String exectFaiure) throws Exception { LOG.infof("Sending to velocity: %s", message); - Map<String, Object> headers = new HashMap() { + Map<String, Object> headers = new HashMap<>() { { if (item != null) { put("item", item); @@ -86,7 +86,7 @@ public class VelocityResource { .entity(response) .build(); } catch (Exception e) { - if (exectFaiure != null && Boolean.parseBoolean(exectFaiure)) { + if (Boolean.parseBoolean(exectFaiure)) { return Response .created(new URI("https://camel.apache.org/")) .entity(e.toString()) @@ -149,7 +149,7 @@ public class VelocityResource { public Response templateViaHeader(String message, @QueryParam("body") String body, @QueryParam("item") String item, @QueryParam("name") String name) throws Exception { LOG.infof("Sending to velocity: %s", body); - Map<String, Object> headers = new HashMap() { + Map<String, Object> headers = new HashMap<>() { { put("item", item); put("name", name); @@ -172,7 +172,7 @@ public class VelocityResource { @Produces(MediaType.TEXT_PLAIN) public Response dynamicTemplate(String template, @QueryParam("body") String body, @QueryParam("item") String item, @QueryParam("name") String name) throws Exception { - Map<String, Object> headers = new HashMap() { + Map<String, Object> headers = new HashMap<>() { { put("item", item); put("name", name); @@ -219,7 +219,7 @@ public class VelocityResource { final Map<String, Object> supplementalContext = new HashMap<>(); supplementalContext.put("body", supplementalBody); - Map<String, Object> headers = new HashMap() { + Map<String, Object> headers = new HashMap<>() { { put(VelocityConstants.VELOCITY_TEMPLATE, message); put(VelocityConstants.VELOCITY_SUPPLEMENTAL_CONTEXT, supplementalContext); diff --git a/pom.xml b/pom.xml index c5cb3db30f..2540913ccc 100644 --- a/pom.xml +++ b/pom.xml @@ -192,12 +192,16 @@ <maven-release-plugin.version>3.0.0</maven-release-plugin.version> <maven-resources-plugin.version>3.3.1</maven-resources-plugin.version> <maven-scm-plugin.version>2.0.0</maven-scm-plugin.version> - <maven-shade-plugin.version>3.4.1</maven-shade-plugin.version> + <maven-shade-plugin.version>3.5.0</maven-shade-plugin.version> <!-- NOTE: We pin to this version due to https://github.com/apache/camel-quarkus/issues/723 --> <maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version> <os-maven-plugin.version>${os-maven-plugin-version}</os-maven-plugin.version> <protobuf-maven-plugin.version>${protobuf-maven-plugin-version}</protobuf-maven-plugin.version> <rpkgtests-maven-plugin.version>1.0.0</rpkgtests-maven-plugin.version> + <maven-clean-plugin.version>3.2.0</maven-clean-plugin.version> + <maven-install-plugin.version>3.1.1</maven-install-plugin.version> + <maven-antrun-plugin.version>3.1.0</maven-antrun-plugin.version> + <maven-remote-resources-plugin.version>3.1.0</maven-remote-resources-plugin.version> <!-- Plugin configuration through properties --> @@ -571,6 +575,28 @@ </dependency> </dependencies> </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-clean-plugin</artifactId> + <version>${maven-clean-plugin.version}</version> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-install-plugin</artifactId> + <version>${maven-install-plugin.version}</version> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <version>${maven-antrun-plugin.version}</version> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-remote-resources-plugin</artifactId> + <version>${maven-remote-resources-plugin.version}</version> + </plugin> + </plugins> </pluginManagement> diff --git a/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/UpdateExtensionDocPageMojo.java b/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/UpdateExtensionDocPageMojo.java index dcc6066be6..95394d322c 100644 --- a/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/UpdateExtensionDocPageMojo.java +++ b/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/UpdateExtensionDocPageMojo.java @@ -74,6 +74,7 @@ public class UpdateExtensionDocPageMojo extends AbstractDocGeneratorMojo { boolean skip = false; /** {@inheritDoc} */ + @SuppressWarnings("unchecked") @Override public void execute() throws MojoExecutionException, MojoFailureException { if (skip) { @@ -96,12 +97,12 @@ public class UpdateExtensionDocPageMojo extends AbstractDocGeneratorMojo { .resolve("integration-test-groups/aws2-quarkus-client"); final Path pomRelPath = multiModuleProjectDirectoryPath.relativize(basePath).resolve("pom.xml"); - if (!ext.getJvmSince().isPresent()) { + if (ext.getJvmSince().isEmpty()) { throw new IllegalStateException( CamelQuarkusExtension.CAMEL_QUARKUS_JVM_SINCE + " property must defined in " + pomRelPath); } final String extensionsDir = basePath.getParent().getParent().getFileName().toString(); - if (!"extensions-jvm".equals(extensionsDir) && !ext.getNativeSince().isPresent()) { + if (!"extensions-jvm".equals(extensionsDir) && ext.getNativeSince().isEmpty()) { throw new IllegalStateException( CamelQuarkusExtension.CAMEL_QUARKUS_NATIVE_SINCE + " property must defined in " + pomRelPath); } @@ -344,11 +345,11 @@ public class UpdateExtensionDocPageMojo extends AbstractDocGeneratorMojo { /* We assume Quarkus client exists if there is a test under integration-test-groups/aws2-quarkus-client */ final Path quarkusClientTestPath = quarkusAwsClienTestsDir.resolve(artifactIdBase + "/pom.xml"); if (Files.isRegularFile(quarkusClientTestPath)) { - if (!quarkusAwsClientBaseName.isPresent()) { + if (quarkusAwsClientBaseName.isEmpty()) { throw new IllegalStateException(quarkusClientTestPath + " exists but cq.quarkus.aws.client.baseName property is not defined in " + runtimePomPath); } - if (!quarkusAwsClientFqClassName.isPresent()) { + if (quarkusAwsClientFqClassName.isEmpty()) { throw new IllegalStateException(quarkusClientTestPath + " exists but cq.quarkus.aws.client.fqClassName property is not defined in " + runtimePomPath); }