This is an automated email from the ASF dual-hosted git repository. claudio4j pushed a commit to branch release-1.17.x in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git
The following commit(s) were added to refs/heads/release-1.17.x by this push: new 1774b922 Remove unused cloudevents and webhook extensions (#1072) 1774b922 is described below commit 1774b92276ea71c4c8ba1009a5921584833fe3b3 Author: Claudio Miranda <clau...@claudius.com.br> AuthorDate: Fri Jul 14 09:36:44 2023 -0300 Remove unused cloudevents and webhook extensions (#1072) * Define a maven group for the quarkus maven plugin - also removes unused quarkus-extension-maven-plugin * Remove unused cloudevents and webhook extensions Also removes unused KnativeSourceLoaderInterceptor --- .github/workflows/ci-build.yml | 3 - .gitignore | 2 +- .../cloudevents/deployment/CloudEventsFeature.java | 29 ----- .../knative/KnativeSourceLoaderInterceptor.java | 53 ---------- .../quarkus/webhook/deployment/WebhookFeature.java | 40 ------- .../WebhookContextCustomizerConfigurer.java | 49 --------- ...apache.camel.k.webhook.WebhookContextCustomizer | 2 - .../camel/k/webhook/WebhookContextCustomizer.java | 45 -------- examples/cron/pom.xml | 7 +- examples/groovy/pom.xml | 7 +- examples/java/pom.xml | 7 +- examples/js/pom.xml | 7 +- examples/kafka-source-s3/pom.xml | 7 +- examples/kamelets-discovery/pom.xml | 7 +- examples/kamelets/pom.xml | 7 +- examples/knative/pom.xml | 7 +- examples/kotlin/pom.xml | 7 +- examples/xml/pom.xml | 7 +- examples/yaml/pom.xml | 9 +- .../knative/source/KnativeSourceApplication.java | 116 -------------------- .../src/main/resources/application.properties | 29 ----- .../it/knative/source/KnativeSourceGroovyTest.java | 88 ---------------- .../src/test/resources/source.groovy | 19 ---- .../knative/source/KnativeSourceApplication.java | 116 -------------------- .../src/main/resources/application.properties | 29 ----- .../it/knative/source/KnativeSourceJavaTest.java | 88 ---------------- .../src/test/resources/MySource.java | 27 ----- .../knative/source/KnativeSourceApplication.java | 116 -------------------- .../src/main/resources/application.properties | 29 ----- .../it/knative/source/KnativeSourceJsIT.java | 23 ---- .../it/knative/source/KnativeSourceJsTest.java | 88 ---------------- .../src/test/resources/source.js | 19 ---- .../knative/source/KnativeSourceApplication.java | 116 -------------------- .../src/main/resources/application.properties | 29 ----- .../it/knative/source/KnativeSourceXmlIT.java | 23 ---- .../it/knative/source/KnativeSourceXmlTest.java | 88 ---------------- .../src/test/resources/source.xml | 28 ----- .../knative/source/KnativeSourceApplication.java | 116 -------------------- .../src/main/resources/application.properties | 28 ----- .../it/knative/source/KnativeSourceYamlIT.java | 23 ---- .../it/knative/source/KnativeSourceYamlTest.java | 88 ---------------- .../src/test/resources/source.yaml | 23 ---- .../k/quarkus/it/RuntimeWithInterceptorIT.java | 23 ---- .../k/quarkus/it/RuntimeWithInterceptorTest.java | 67 ------------ .../camel/k/quarkus/it/webhook/Application.java | 117 --------------------- .../it/webhook/support/DummyWebhookComponent.java | 100 ------------------ .../src/main/resources/application.properties | 30 ------ .../WebhookFailureWithAutoRegisterDisbledTest.java | 62 ----------- .../WebhookFailureWithComponentFailingTest.java | 63 ----------- .../k/quarkus/it/webhook/WebhookRegisterTest.java | 64 ----------- .../quarkus/it/webhook/WebhookUnregisterTest.java | 64 ----------- .../test/resources/routes/registration_routes.yaml | 24 ----- itests/pom.xml | 10 +- pom.xml | 34 +----- support/camel-k-runtime-bom/pom.xml | 25 +---- 55 files changed, 22 insertions(+), 2312 deletions(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index c2719d6a..1cb1ef1e 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -105,9 +105,6 @@ jobs: - :camel-k-itests-knative-producer - :camel-k-itests-knative-consumer - :camel-k-itests-knative-sinkbinding - #- :camel-k-itests-knative-source-js - - :camel-k-itests-knative-source-xml - - :camel-k-itests-knative-source-yaml - :camel-k-itests-loader-xml - :camel-k-itests-loader-yaml #- :camel-k-itests-loader-js diff --git a/.gitignore b/.gitignore index fe1a519a..056869fc 100644 --- a/.gitignore +++ b/.gitignore @@ -8,5 +8,5 @@ target .settings .factorypath .classpath - +.vscode .DS_Store diff --git a/camel-k-cloudevents/deployment/src/main/java/org/apache/camel/k/quarkus/cloudevents/deployment/CloudEventsFeature.java b/camel-k-cloudevents/deployment/src/main/java/org/apache/camel/k/quarkus/cloudevents/deployment/CloudEventsFeature.java deleted file mode 100644 index 908f23f8..00000000 --- a/camel-k-cloudevents/deployment/src/main/java/org/apache/camel/k/quarkus/cloudevents/deployment/CloudEventsFeature.java +++ /dev/null @@ -1,29 +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.k.quarkus.cloudevents.deployment; - -import io.quarkus.deployment.annotations.BuildStep; -import io.quarkus.deployment.builditem.FeatureBuildItem; - -public class CloudEventsFeature { - private static final String FEATURE = "camel-k-cloudevents"; - - @BuildStep - FeatureBuildItem feature() { - return new FeatureBuildItem(FEATURE); - } -} diff --git a/camel-k-knative/impl/src/main/java/org/apache/camel/k/loader/knative/KnativeSourceLoaderInterceptor.java b/camel-k-knative/impl/src/main/java/org/apache/camel/k/loader/knative/KnativeSourceLoaderInterceptor.java deleted file mode 100644 index 93cfdcfc..00000000 --- a/camel-k-knative/impl/src/main/java/org/apache/camel/k/loader/knative/KnativeSourceLoaderInterceptor.java +++ /dev/null @@ -1,53 +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.k.loader.knative; - -import java.util.List; - -import org.apache.camel.CamelContext; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.builder.RouteBuilderLifecycleStrategy; -import org.apache.camel.k.annotation.LoaderInterceptor; -import org.apache.camel.model.RouteDefinition; -import org.apache.camel.model.ToDefinition; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@LoaderInterceptor("knative-source") -public class KnativeSourceLoaderInterceptor implements RouteBuilderLifecycleStrategy { - private static final Logger LOGGER = LoggerFactory.getLogger(KnativeSourceLoaderInterceptor.class); - - @Override - public void afterConfigure(RouteBuilder builder) { - final CamelContext camelContext = builder.getContext(); - final List<RouteDefinition> definitions = builder.getRouteCollection().getRoutes(); - - if (definitions.size() == 1) { - final String sinkName = camelContext.resolvePropertyPlaceholders("{{knative.sink:sink}}"); - final String sinkUri = String.format("knative://endpoint/%s", sinkName); - final RouteDefinition definition = definitions.get(0); - - LOGGER.info("Add sink:{} to route:{}", sinkUri, definition.getId()); - - // assuming that route is linear like there's no content based routing - // or ant other EIP that would branch the flow - definition.getOutputs().add(new ToDefinition(sinkUri)); - } else { - LOGGER.warn("Cannot determine route to enrich. the knative enpoint need to explicitly be defined"); - } - } -} diff --git a/camel-k-webhook/deployment/src/main/java/org/apache/camel/k/quarkus/webhook/deployment/WebhookFeature.java b/camel-k-webhook/deployment/src/main/java/org/apache/camel/k/quarkus/webhook/deployment/WebhookFeature.java deleted file mode 100644 index c88823b5..00000000 --- a/camel-k-webhook/deployment/src/main/java/org/apache/camel/k/quarkus/webhook/deployment/WebhookFeature.java +++ /dev/null @@ -1,40 +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.k.quarkus.webhook.deployment; - -import java.util.List; - -import io.quarkus.deployment.annotations.BuildStep; -import io.quarkus.deployment.builditem.FeatureBuildItem; -import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; -import org.apache.camel.component.webhook.WebhookConfiguration; - -public class WebhookFeature { - private static final String FEATURE = "camel-k-webhook"; - - @BuildStep - FeatureBuildItem feature() { - return new FeatureBuildItem(FEATURE); - } - - @BuildStep - List<ReflectiveClassBuildItem> reflectiveClasses() { - return List.of( - new ReflectiveClassBuildItem(true, false, WebhookConfiguration.class) - ); - } -} diff --git a/camel-k-webhook/impl/src/generated/java/org/apache/camel/k/webhook/WebhookContextCustomizerConfigurer.java b/camel-k-webhook/impl/src/generated/java/org/apache/camel/k/webhook/WebhookContextCustomizerConfigurer.java deleted file mode 100644 index 37ca1d44..00000000 --- a/camel-k-webhook/impl/src/generated/java/org/apache/camel/k/webhook/WebhookContextCustomizerConfigurer.java +++ /dev/null @@ -1,49 +0,0 @@ -/* Generated by camel build tools - do NOT edit this file! */ -package org.apache.camel.k.webhook; - -import java.util.Map; - -import org.apache.camel.CamelContext; -import org.apache.camel.spi.ExtendedPropertyConfigurerGetter; -import org.apache.camel.spi.PropertyConfigurerGetter; -import org.apache.camel.spi.ConfigurerStrategy; -import org.apache.camel.spi.GeneratedPropertyConfigurer; -import org.apache.camel.util.CaseInsensitiveMap; -import org.apache.camel.k.webhook.WebhookContextCustomizer; - -/** - * Generated by camel build tools - do NOT edit this file! - */ -@SuppressWarnings("unchecked") -public class WebhookContextCustomizerConfigurer extends org.apache.camel.support.component.PropertyConfigurerSupport implements GeneratedPropertyConfigurer, PropertyConfigurerGetter { - - @Override - public boolean configure(CamelContext camelContext, Object obj, String name, Object value, boolean ignoreCase) { - org.apache.camel.k.webhook.WebhookContextCustomizer target = (org.apache.camel.k.webhook.WebhookContextCustomizer) obj; - switch (ignoreCase ? name.toLowerCase() : name) { - case "action": - case "Action": target.setAction(property(camelContext, org.apache.camel.component.webhook.WebhookAction.class, value)); return true; - default: return false; - } - } - - @Override - public Class<?> getOptionType(String name, boolean ignoreCase) { - switch (ignoreCase ? name.toLowerCase() : name) { - case "action": - case "Action": return org.apache.camel.component.webhook.WebhookAction.class; - default: return null; - } - } - - @Override - public Object getOptionValue(Object obj, String name, boolean ignoreCase) { - org.apache.camel.k.webhook.WebhookContextCustomizer target = (org.apache.camel.k.webhook.WebhookContextCustomizer) obj; - switch (ignoreCase ? name.toLowerCase() : name) { - case "action": - case "Action": return target.getAction(); - default: return null; - } - } -} - diff --git a/camel-k-webhook/impl/src/generated/resources/META-INF/services/org/apache/camel/configurer/org.apache.camel.k.webhook.WebhookContextCustomizer b/camel-k-webhook/impl/src/generated/resources/META-INF/services/org/apache/camel/configurer/org.apache.camel.k.webhook.WebhookContextCustomizer deleted file mode 100644 index 77f12775..00000000 --- a/camel-k-webhook/impl/src/generated/resources/META-INF/services/org/apache/camel/configurer/org.apache.camel.k.webhook.WebhookContextCustomizer +++ /dev/null @@ -1,2 +0,0 @@ -# Generated by camel build tools - do NOT edit this file! -class=org.apache.camel.k.webhook.WebhookContextCustomizerConfigurer diff --git a/camel-k-webhook/impl/src/main/java/org/apache/camel/k/webhook/WebhookContextCustomizer.java b/camel-k-webhook/impl/src/main/java/org/apache/camel/k/webhook/WebhookContextCustomizer.java deleted file mode 100644 index c5e3e3e2..00000000 --- a/camel-k-webhook/impl/src/main/java/org/apache/camel/k/webhook/WebhookContextCustomizer.java +++ /dev/null @@ -1,45 +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.k.webhook; - -import org.apache.camel.CamelContext; -import org.apache.camel.component.webhook.WebhookAction; -import org.apache.camel.component.webhook.WebhookRoutePolicyFactory; -import org.apache.camel.k.ContextCustomizer; -import org.apache.camel.k.annotation.Customizer; -import org.apache.camel.spi.Configurer; - -@Configurer -@Customizer("webhook") -public class WebhookContextCustomizer implements ContextCustomizer { - private WebhookAction action; - - public WebhookAction getAction() { - return action; - } - - public void setAction(WebhookAction action) { - this.action = action; - } - - @Override - public void apply(CamelContext camelContext) { - if (action != null) { - camelContext.addRoutePolicyFactory(new WebhookRoutePolicyFactory(action)); - } - } -} diff --git a/examples/cron/pom.xml b/examples/cron/pom.xml index d95da1ef..e2f1ccaa 100644 --- a/examples/cron/pom.xml +++ b/examples/cron/pom.xml @@ -64,12 +64,7 @@ <build> <plugins> <plugin> - <groupId>io.quarkus</groupId> - <artifactId>quarkus-extension-maven-plugin</artifactId> - <version>${quarkus-version}</version> - </plugin> - <plugin> - <groupId>io.quarkus</groupId> + <groupId>${quarkus-platform-group}</groupId> <artifactId>quarkus-maven-plugin</artifactId> <version>${quarkus-version}</version> <executions> diff --git a/examples/groovy/pom.xml b/examples/groovy/pom.xml index a0147c7f..c7a09697 100644 --- a/examples/groovy/pom.xml +++ b/examples/groovy/pom.xml @@ -56,12 +56,7 @@ <build> <plugins> <plugin> - <groupId>io.quarkus</groupId> - <artifactId>quarkus-extension-maven-plugin</artifactId> - <version>${quarkus-version}</version> - </plugin> - <plugin> - <groupId>io.quarkus</groupId> + <groupId>${quarkus-platform-group}</groupId> <artifactId>quarkus-maven-plugin</artifactId> <version>${quarkus-version}</version> <executions> diff --git a/examples/java/pom.xml b/examples/java/pom.xml index 37f7b6ba..d0c6c9a2 100644 --- a/examples/java/pom.xml +++ b/examples/java/pom.xml @@ -56,12 +56,7 @@ <build> <plugins> <plugin> - <groupId>io.quarkus</groupId> - <artifactId>quarkus-extension-maven-plugin</artifactId> - <version>${quarkus-version}</version> - </plugin> - <plugin> - <groupId>io.quarkus</groupId> + <groupId>${quarkus-platform-group}</groupId> <artifactId>quarkus-maven-plugin</artifactId> <version>${quarkus-version}</version> <executions> diff --git a/examples/js/pom.xml b/examples/js/pom.xml index de9ec462..7e70e1eb 100644 --- a/examples/js/pom.xml +++ b/examples/js/pom.xml @@ -56,12 +56,7 @@ <build> <plugins> <plugin> - <groupId>io.quarkus</groupId> - <artifactId>quarkus-extension-maven-plugin</artifactId> - <version>${quarkus-version}</version> - </plugin> - <plugin> - <groupId>io.quarkus</groupId> + <groupId>${quarkus-platform-group}</groupId> <artifactId>quarkus-maven-plugin</artifactId> <version>${quarkus-version}</version> <executions> diff --git a/examples/kafka-source-s3/pom.xml b/examples/kafka-source-s3/pom.xml index fe9ca68d..d7c3f111 100644 --- a/examples/kafka-source-s3/pom.xml +++ b/examples/kafka-source-s3/pom.xml @@ -56,12 +56,7 @@ <build> <plugins> <plugin> - <groupId>io.quarkus</groupId> - <artifactId>quarkus-extension-maven-plugin</artifactId> - <version>${quarkus-version}</version> - </plugin> - <plugin> - <groupId>io.quarkus</groupId> + <groupId>${quarkus-platform-group}</groupId> <artifactId>quarkus-maven-plugin</artifactId> <version>${quarkus-version}</version> <executions> diff --git a/examples/kamelets-discovery/pom.xml b/examples/kamelets-discovery/pom.xml index 8ed7578a..4fc70c40 100644 --- a/examples/kamelets-discovery/pom.xml +++ b/examples/kamelets-discovery/pom.xml @@ -59,12 +59,7 @@ <build> <plugins> <plugin> - <groupId>io.quarkus</groupId> - <artifactId>quarkus-extension-maven-plugin</artifactId> - <version>${quarkus-version}</version> - </plugin> - <plugin> - <groupId>io.quarkus</groupId> + <groupId>${quarkus-platform-group}</groupId> <artifactId>quarkus-maven-plugin</artifactId> <version>${quarkus-version}</version> <executions> diff --git a/examples/kamelets/pom.xml b/examples/kamelets/pom.xml index 116ee8c9..8fd50039 100644 --- a/examples/kamelets/pom.xml +++ b/examples/kamelets/pom.xml @@ -59,12 +59,7 @@ <build> <plugins> <plugin> - <groupId>io.quarkus</groupId> - <artifactId>quarkus-extension-maven-plugin</artifactId> - <version>${quarkus-version}</version> - </plugin> - <plugin> - <groupId>io.quarkus</groupId> + <groupId>${quarkus-platform-group}</groupId> <artifactId>quarkus-maven-plugin</artifactId> <version>${quarkus-version}</version> <executions> diff --git a/examples/knative/pom.xml b/examples/knative/pom.xml index 1dcb2999..1c7f333b 100644 --- a/examples/knative/pom.xml +++ b/examples/knative/pom.xml @@ -63,12 +63,7 @@ <build> <plugins> <plugin> - <groupId>io.quarkus</groupId> - <artifactId>quarkus-extension-maven-plugin</artifactId> - <version>${quarkus-version}</version> - </plugin> - <plugin> - <groupId>io.quarkus</groupId> + <groupId>${quarkus-platform-group}</groupId> <artifactId>quarkus-maven-plugin</artifactId> <version>${quarkus-version}</version> <executions> diff --git a/examples/kotlin/pom.xml b/examples/kotlin/pom.xml index b59a6d77..a559b9ce 100644 --- a/examples/kotlin/pom.xml +++ b/examples/kotlin/pom.xml @@ -55,12 +55,7 @@ <build> <plugins> <plugin> - <groupId>io.quarkus</groupId> - <artifactId>quarkus-extension-maven-plugin</artifactId> - <version>${quarkus-version}</version> - </plugin> - <plugin> - <groupId>io.quarkus</groupId> + <groupId>${quarkus-platform-group}</groupId> <artifactId>quarkus-maven-plugin</artifactId> <version>${quarkus-version}</version> <executions> diff --git a/examples/xml/pom.xml b/examples/xml/pom.xml index c50b8eae..471af28f 100644 --- a/examples/xml/pom.xml +++ b/examples/xml/pom.xml @@ -55,12 +55,7 @@ <build> <plugins> <plugin> - <groupId>io.quarkus</groupId> - <artifactId>quarkus-extension-maven-plugin</artifactId> - <version>${quarkus-version}</version> - </plugin> - <plugin> - <groupId>io.quarkus</groupId> + <groupId>${quarkus-platform-group}</groupId> <artifactId>quarkus-maven-plugin</artifactId> <version>${quarkus-version}</version> <executions> diff --git a/examples/yaml/pom.xml b/examples/yaml/pom.xml index 6d339109..26393c2a 100644 --- a/examples/yaml/pom.xml +++ b/examples/yaml/pom.xml @@ -59,12 +59,7 @@ <build> <plugins> <plugin> - <groupId>io.quarkus</groupId> - <artifactId>quarkus-extension-maven-plugin</artifactId> - <version>${quarkus-version}</version> - </plugin> - <plugin> - <groupId>io.quarkus</groupId> + <groupId>${quarkus-platform-group}</groupId> <artifactId>quarkus-maven-plugin</artifactId> <version>${quarkus-version}</version> <executions> @@ -159,7 +154,7 @@ <defaultGoal>quarkus:dev</defaultGoal> <plugins> <plugin> - <groupId>io.quarkus</groupId> + <groupId>${quarkus-platform-group}</groupId> <artifactId>quarkus-maven-plugin</artifactId> <version>${quarkus-version}</version> <executions> diff --git a/itests/camel-k-itests-knative-source-groovy/src/main/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceApplication.java b/itests/camel-k-itests-knative-source-groovy/src/main/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceApplication.java deleted file mode 100644 index fce37ef3..00000000 --- a/itests/camel-k-itests-knative-source-groovy/src/main/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceApplication.java +++ /dev/null @@ -1,116 +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.k.quarkus.it.knative.source; - -import java.io.IOException; -import java.util.List; -import java.util.Locale; -import java.util.Objects; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.stream.Collectors; - -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; -import javax.json.Json; -import javax.json.JsonArray; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -import io.quarkus.arc.Unremovable; -import org.apache.camel.CamelContext; -import org.apache.camel.FluentProducerTemplate; -import org.apache.camel.component.knative.spi.Knative; -import org.apache.camel.component.knative.spi.KnativeEnvironment; -import org.apache.camel.model.ModelCamelContext; -import org.apache.camel.model.RouteDefinition; -import org.apache.camel.model.SendDefinition; -import org.apache.camel.model.ToDefinition; -import org.eclipse.microprofile.config.inject.ConfigProperty; - -@Path("/test") -@ApplicationScoped -public class KnativeSourceApplication { - @Inject - CamelContext context; - - private final BlockingQueue<String> queue = new LinkedBlockingQueue<>(); - - @POST - @Path("/toUpper") - @Produces(MediaType.TEXT_PLAIN) - public void toUpper(String data) throws InterruptedException { - queue.put(data.toUpperCase(Locale.US)); - } - - @GET - @Path("/inspect/endpoint-uris") - @Produces(MediaType.APPLICATION_JSON) - public JsonArray endpointUris() { - List<RouteDefinition> definitions = context.adapt(ModelCamelContext.class).getRouteDefinitions(); - - return Json.createArrayBuilder( - definitions.stream() - .map(d -> !d.getOutputs().isEmpty() ? d.getOutputs().get(d.getOutputs().size() -1 ) : null) - .filter(Objects::nonNull) - .filter(ToDefinition.class::isInstance) - .map(ToDefinition.class::cast) - .map(SendDefinition::getEndpointUri) - .collect(Collectors.toList()) - ).build(); - } - - @POST - @Path("/send") - @Produces(MediaType.TEXT_PLAIN) - public void send(String data) throws IOException { - try (FluentProducerTemplate template = context.createFluentProducerTemplate()){ - template.to("direct:start") - .withHeader("MyHeader", data) - .send(); - } - } - - @GET - @Path("/poll") - @Produces(MediaType.TEXT_PLAIN) - public Response poll() { - String result = queue.poll(); - - return result != null - ? Response.ok(result).build() - : Response.noContent().build(); - } - - @Unremovable - @javax.enterprise.inject.Produces - KnativeEnvironment environment( - @ConfigProperty(name = "kamel.k.sink.port") int port) { - - return KnativeEnvironment.on( - KnativeEnvironment.serviceBuilder(Knative.Type.endpoint, "sink") - .withUrl("http://localhost:" + port + "/test/toUpper") - .withEndpointKind(Knative.EndpointKind.sink) - .build() - ); - } -} - diff --git a/itests/camel-k-itests-knative-source-groovy/src/main/resources/application.properties b/itests/camel-k-itests-knative-source-groovy/src/main/resources/application.properties deleted file mode 100644 index 1e67872e..00000000 --- a/itests/camel-k-itests-knative-source-groovy/src/main/resources/application.properties +++ /dev/null @@ -1,29 +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. -## --------------------------------------------------------------------------- - -# -# Quarkus -# -quarkus.log.console.enable = true -quarkus.banner.enabled = false - -# -# Camel K -# -camel.k.sources[0].location = file:src/test/resources/source.groovy -camel.k.sources[0].interceptors[0] = knative-source - diff --git a/itests/camel-k-itests-knative-source-groovy/src/test/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceGroovyTest.java b/itests/camel-k-itests-knative-source-groovy/src/test/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceGroovyTest.java deleted file mode 100644 index 845a3045..00000000 --- a/itests/camel-k-itests-knative-source-groovy/src/test/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceGroovyTest.java +++ /dev/null @@ -1,88 +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.k.quarkus.it.knative.source; - -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import javax.ws.rs.core.MediaType; - -import io.quarkus.test.common.QuarkusTestResource; -import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; -import io.quarkus.test.junit.QuarkusTest; -import org.junit.jupiter.api.Order; -import org.junit.jupiter.api.Test; - -import static io.restassured.RestAssured.given; -import static org.assertj.core.api.Assertions.assertThat; -import static org.awaitility.Awaitility.await; - -@QuarkusTestResource(KnativeSourceGroovyTest.Resource.class) -@QuarkusTest -public class KnativeSourceGroovyTest { - @Test - @Order(0) - public void validateEndpointUris() { - List<String> p = given() - .accept(MediaType.APPLICATION_JSON) - .get("/test/inspect/endpoint-uris") - .then() - .statusCode(200) - .extract() - .body() - .jsonPath().getList(".", String.class); - - assertThat(p).contains("knative://endpoint/sink"); - } - - @Test - @Order(1) - public void validateBehavior() { - final String body = "test"; - - given() - .body(body) - .post("/test/send") - .then() - .statusCode(204); - - await().atMost(10, TimeUnit.SECONDS).until(() -> { - var response = given() - .accept(MediaType.TEXT_PLAIN) - .get("/test/poll"); - - return response.statusCode() == 200 - && body.toUpperCase(Locale.US).equals(response.body().asString()); - }); - - } - - public static class Resource implements QuarkusTestResourceLifecycleManager { - @Override - public Map<String, String> start() { - return Map.of( - "kamel.k.sink.port", - System.getProperty("camel.k.test.knative.listenting.port", "8081")); - } - - @Override - public void stop() { - } - } -} \ No newline at end of file diff --git a/itests/camel-k-itests-knative-source-groovy/src/test/resources/source.groovy b/itests/camel-k-itests-knative-source-groovy/src/test/resources/source.groovy deleted file mode 100644 index 6f1b3ced..00000000 --- a/itests/camel-k-itests-knative-source-groovy/src/test/resources/source.groovy +++ /dev/null @@ -1,19 +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. - */ -from('direct:start') - .setBody().header('MyHeader') - .to('log:knative') \ No newline at end of file diff --git a/itests/camel-k-itests-knative-source-java/src/main/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceApplication.java b/itests/camel-k-itests-knative-source-java/src/main/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceApplication.java deleted file mode 100644 index 334cdbf4..00000000 --- a/itests/camel-k-itests-knative-source-java/src/main/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceApplication.java +++ /dev/null @@ -1,116 +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.k.quarkus.it.knative.source; - -import java.io.IOException; -import java.util.List; -import java.util.Locale; -import java.util.Objects; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.stream.Collectors; - -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; -import javax.json.Json; -import javax.json.JsonArray; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -import io.quarkus.arc.Unremovable; -import org.apache.camel.CamelContext; -import org.apache.camel.FluentProducerTemplate; -import org.apache.camel.component.knative.spi.Knative; -import org.apache.camel.component.knative.spi.KnativeEnvironment; -import org.apache.camel.model.ModelCamelContext; -import org.apache.camel.model.RouteDefinition; -import org.apache.camel.model.SendDefinition; -import org.apache.camel.model.ToDefinition; -import org.eclipse.microprofile.config.inject.ConfigProperty; - -@Path("/test") -@ApplicationScoped -public class KnativeSourceApplication { - @Inject - CamelContext context; - - private final BlockingQueue<String> queue = new LinkedBlockingQueue<>(); - - @POST - @Path("/toUpper") - @Produces(MediaType.TEXT_PLAIN) - public void toUpper(String data) throws InterruptedException { - queue.put(data.toUpperCase(Locale.US)); - } - - @GET - @Path("/inspect/endpoint-uris") - @Produces(MediaType.APPLICATION_JSON) - public JsonArray endpointUris() { - List<RouteDefinition> definitions = context.adapt(ModelCamelContext.class).getRouteDefinitions(); - - return Json.createArrayBuilder( - definitions.stream() - .map(d -> !d.getOutputs().isEmpty() ? d.getOutputs().get(d.getOutputs().size() -1 ) : null) - .filter(Objects::nonNull) - .filter(ToDefinition.class::isInstance) - .map(ToDefinition.class::cast) - .map(SendDefinition::getEndpointUri) - .collect(Collectors.toList()) - ).build(); - } - - @POST - @Path("/send") - @Produces(MediaType.TEXT_PLAIN) - public void send(String data) throws IOException { - try (FluentProducerTemplate template = context.createFluentProducerTemplate()) { - template.to("direct:start") - .withHeader("MyHeader", data) - .send(); - } - } - - @GET - @Path("/poll") - @Produces(MediaType.TEXT_PLAIN) - public Response poll() { - String result = queue.poll(); - - return result != null - ? Response.ok(result).build() - : Response.noContent().build(); - } - - @Unremovable - @javax.enterprise.inject.Produces - KnativeEnvironment environment( - @ConfigProperty(name = "kamel.k.sink.port") int port) { - - return KnativeEnvironment.on( - KnativeEnvironment.serviceBuilder(Knative.Type.endpoint, "sink") - .withUrl("http://localhost:" + port + "/test/toUpper") - .withEndpointKind(Knative.EndpointKind.sink) - .build() - ); - } -} - diff --git a/itests/camel-k-itests-knative-source-java/src/main/resources/application.properties b/itests/camel-k-itests-knative-source-java/src/main/resources/application.properties deleted file mode 100644 index 0dc4a90f..00000000 --- a/itests/camel-k-itests-knative-source-java/src/main/resources/application.properties +++ /dev/null @@ -1,29 +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. -## --------------------------------------------------------------------------- - -# -# Quarkus -# -quarkus.log.console.enable = false -quarkus.banner.enabled = false - -# -# Camel K -# -camel.k.sources[0].location = file:src/test/resources/MySource.java -camel.k.sources[0].interceptors[0] = knative-source - diff --git a/itests/camel-k-itests-knative-source-java/src/test/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceJavaTest.java b/itests/camel-k-itests-knative-source-java/src/test/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceJavaTest.java deleted file mode 100644 index 46e6aca3..00000000 --- a/itests/camel-k-itests-knative-source-java/src/test/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceJavaTest.java +++ /dev/null @@ -1,88 +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.k.quarkus.it.knative.source; - -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import javax.ws.rs.core.MediaType; - -import io.quarkus.test.common.QuarkusTestResource; -import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; -import io.quarkus.test.junit.QuarkusTest; -import org.junit.jupiter.api.Order; -import org.junit.jupiter.api.Test; - -import static io.restassured.RestAssured.given; -import static org.assertj.core.api.Assertions.assertThat; -import static org.awaitility.Awaitility.await; - -@QuarkusTestResource(KnativeSourceJavaTest.Resource.class) -@QuarkusTest -public class KnativeSourceJavaTest { - @Test - @Order(0) - public void validateEndpointUris() { - List<String> p = given() - .accept(MediaType.APPLICATION_JSON) - .get("/test/inspect/endpoint-uris") - .then() - .statusCode(200) - .extract() - .body() - .jsonPath().getList(".", String.class); - - assertThat(p).contains("knative://endpoint/sink"); - } - - @Test - @Order(1) - public void validateBehavior() { - final String body = "test"; - - given() - .body(body) - .post("/test/send") - .then() - .statusCode(204); - - await().atMost(10, TimeUnit.SECONDS).until(() -> { - var response = given() - .accept(MediaType.TEXT_PLAIN) - .get("/test/poll"); - - return response.statusCode() == 200 - && body.toUpperCase(Locale.US).equals(response.body().asString()); - }); - - } - - public static class Resource implements QuarkusTestResourceLifecycleManager { - @Override - public Map<String, String> start() { - return Map.of( - "kamel.k.sink.port", - System.getProperty("camel.k.test.knative.listenting.port", "8081")); - } - - @Override - public void stop() { - } - } -} \ No newline at end of file diff --git a/itests/camel-k-itests-knative-source-java/src/test/resources/MySource.java b/itests/camel-k-itests-knative-source-java/src/test/resources/MySource.java deleted file mode 100644 index bda7d97a..00000000 --- a/itests/camel-k-itests-knative-source-java/src/test/resources/MySource.java +++ /dev/null @@ -1,27 +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. - */ -import org.apache.camel.BindToRegistry; -import org.apache.camel.builder.RouteBuilder; - -public class MySource extends RouteBuilder { - @Override - public void configure() throws Exception { - from("direct:start") - .setBody().header("MyHeader") - .to("log:knative"); - } -} \ No newline at end of file diff --git a/itests/camel-k-itests-knative-source-js/src/main/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceApplication.java b/itests/camel-k-itests-knative-source-js/src/main/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceApplication.java deleted file mode 100644 index 334cdbf4..00000000 --- a/itests/camel-k-itests-knative-source-js/src/main/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceApplication.java +++ /dev/null @@ -1,116 +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.k.quarkus.it.knative.source; - -import java.io.IOException; -import java.util.List; -import java.util.Locale; -import java.util.Objects; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.stream.Collectors; - -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; -import javax.json.Json; -import javax.json.JsonArray; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -import io.quarkus.arc.Unremovable; -import org.apache.camel.CamelContext; -import org.apache.camel.FluentProducerTemplate; -import org.apache.camel.component.knative.spi.Knative; -import org.apache.camel.component.knative.spi.KnativeEnvironment; -import org.apache.camel.model.ModelCamelContext; -import org.apache.camel.model.RouteDefinition; -import org.apache.camel.model.SendDefinition; -import org.apache.camel.model.ToDefinition; -import org.eclipse.microprofile.config.inject.ConfigProperty; - -@Path("/test") -@ApplicationScoped -public class KnativeSourceApplication { - @Inject - CamelContext context; - - private final BlockingQueue<String> queue = new LinkedBlockingQueue<>(); - - @POST - @Path("/toUpper") - @Produces(MediaType.TEXT_PLAIN) - public void toUpper(String data) throws InterruptedException { - queue.put(data.toUpperCase(Locale.US)); - } - - @GET - @Path("/inspect/endpoint-uris") - @Produces(MediaType.APPLICATION_JSON) - public JsonArray endpointUris() { - List<RouteDefinition> definitions = context.adapt(ModelCamelContext.class).getRouteDefinitions(); - - return Json.createArrayBuilder( - definitions.stream() - .map(d -> !d.getOutputs().isEmpty() ? d.getOutputs().get(d.getOutputs().size() -1 ) : null) - .filter(Objects::nonNull) - .filter(ToDefinition.class::isInstance) - .map(ToDefinition.class::cast) - .map(SendDefinition::getEndpointUri) - .collect(Collectors.toList()) - ).build(); - } - - @POST - @Path("/send") - @Produces(MediaType.TEXT_PLAIN) - public void send(String data) throws IOException { - try (FluentProducerTemplate template = context.createFluentProducerTemplate()) { - template.to("direct:start") - .withHeader("MyHeader", data) - .send(); - } - } - - @GET - @Path("/poll") - @Produces(MediaType.TEXT_PLAIN) - public Response poll() { - String result = queue.poll(); - - return result != null - ? Response.ok(result).build() - : Response.noContent().build(); - } - - @Unremovable - @javax.enterprise.inject.Produces - KnativeEnvironment environment( - @ConfigProperty(name = "kamel.k.sink.port") int port) { - - return KnativeEnvironment.on( - KnativeEnvironment.serviceBuilder(Knative.Type.endpoint, "sink") - .withUrl("http://localhost:" + port + "/test/toUpper") - .withEndpointKind(Knative.EndpointKind.sink) - .build() - ); - } -} - diff --git a/itests/camel-k-itests-knative-source-js/src/main/resources/application.properties b/itests/camel-k-itests-knative-source-js/src/main/resources/application.properties deleted file mode 100644 index a866588f..00000000 --- a/itests/camel-k-itests-knative-source-js/src/main/resources/application.properties +++ /dev/null @@ -1,29 +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. -## --------------------------------------------------------------------------- - -# -# Quarkus -# -quarkus.log.console.enable = false -quarkus.banner.enabled = false - -# -# Camel K -# -camel.k.sources[0].location = file:src/test/resources/source.js -camel.k.sources[0].interceptors[0] = knative-source - diff --git a/itests/camel-k-itests-knative-source-js/src/test/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceJsIT.java b/itests/camel-k-itests-knative-source-js/src/test/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceJsIT.java deleted file mode 100644 index 19bc8358..00000000 --- a/itests/camel-k-itests-knative-source-js/src/test/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceJsIT.java +++ /dev/null @@ -1,23 +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.k.quarkus.it.knative.source; - -import io.quarkus.test.junit.NativeImageTest; - -@NativeImageTest -public class KnativeSourceJsIT extends KnativeSourceJsTest { -} \ No newline at end of file diff --git a/itests/camel-k-itests-knative-source-js/src/test/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceJsTest.java b/itests/camel-k-itests-knative-source-js/src/test/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceJsTest.java deleted file mode 100644 index 0f2b2238..00000000 --- a/itests/camel-k-itests-knative-source-js/src/test/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceJsTest.java +++ /dev/null @@ -1,88 +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.k.quarkus.it.knative.source; - -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import javax.ws.rs.core.MediaType; - -import io.quarkus.test.common.QuarkusTestResource; -import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; -import io.quarkus.test.junit.QuarkusTest; -import org.junit.jupiter.api.Order; -import org.junit.jupiter.api.Test; - -import static io.restassured.RestAssured.given; -import static org.assertj.core.api.Assertions.assertThat; -import static org.awaitility.Awaitility.await; - -@QuarkusTestResource(KnativeSourceJsTest.Resource.class) -@QuarkusTest -public class KnativeSourceJsTest { - @Test - @Order(0) - public void validateEndpointUris() { - List<String> p = given() - .accept(MediaType.APPLICATION_JSON) - .get("/test/inspect/endpoint-uris") - .then() - .statusCode(200) - .extract() - .body() - .jsonPath().getList(".", String.class); - - assertThat(p).contains("knative://endpoint/sink"); - } - - @Test - @Order(1) - public void validateBehavior() { - final String body = "test"; - - given() - .body(body) - .post("/test/send") - .then() - .statusCode(204); - - await().atMost(10, TimeUnit.SECONDS).until(() -> { - var response = given() - .accept(MediaType.TEXT_PLAIN) - .get("/test/poll"); - - return response.statusCode() == 200 - && body.toUpperCase(Locale.US).equals(response.body().asString()); - }); - - } - - public static class Resource implements QuarkusTestResourceLifecycleManager { - @Override - public Map<String, String> start() { - return Map.of( - "kamel.k.sink.port", - System.getProperty("camel.k.test.knative.listenting.port", "8081")); - } - - @Override - public void stop() { - } - } -} \ No newline at end of file diff --git a/itests/camel-k-itests-knative-source-js/src/test/resources/source.js b/itests/camel-k-itests-knative-source-js/src/test/resources/source.js deleted file mode 100644 index 041e0456..00000000 --- a/itests/camel-k-itests-knative-source-js/src/test/resources/source.js +++ /dev/null @@ -1,19 +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. - */ -from('direct:start') - .setBody().header('MyHeader') - .to('log:knative'); \ No newline at end of file diff --git a/itests/camel-k-itests-knative-source-xml/src/main/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceApplication.java b/itests/camel-k-itests-knative-source-xml/src/main/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceApplication.java deleted file mode 100644 index 334cdbf4..00000000 --- a/itests/camel-k-itests-knative-source-xml/src/main/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceApplication.java +++ /dev/null @@ -1,116 +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.k.quarkus.it.knative.source; - -import java.io.IOException; -import java.util.List; -import java.util.Locale; -import java.util.Objects; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.stream.Collectors; - -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; -import javax.json.Json; -import javax.json.JsonArray; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -import io.quarkus.arc.Unremovable; -import org.apache.camel.CamelContext; -import org.apache.camel.FluentProducerTemplate; -import org.apache.camel.component.knative.spi.Knative; -import org.apache.camel.component.knative.spi.KnativeEnvironment; -import org.apache.camel.model.ModelCamelContext; -import org.apache.camel.model.RouteDefinition; -import org.apache.camel.model.SendDefinition; -import org.apache.camel.model.ToDefinition; -import org.eclipse.microprofile.config.inject.ConfigProperty; - -@Path("/test") -@ApplicationScoped -public class KnativeSourceApplication { - @Inject - CamelContext context; - - private final BlockingQueue<String> queue = new LinkedBlockingQueue<>(); - - @POST - @Path("/toUpper") - @Produces(MediaType.TEXT_PLAIN) - public void toUpper(String data) throws InterruptedException { - queue.put(data.toUpperCase(Locale.US)); - } - - @GET - @Path("/inspect/endpoint-uris") - @Produces(MediaType.APPLICATION_JSON) - public JsonArray endpointUris() { - List<RouteDefinition> definitions = context.adapt(ModelCamelContext.class).getRouteDefinitions(); - - return Json.createArrayBuilder( - definitions.stream() - .map(d -> !d.getOutputs().isEmpty() ? d.getOutputs().get(d.getOutputs().size() -1 ) : null) - .filter(Objects::nonNull) - .filter(ToDefinition.class::isInstance) - .map(ToDefinition.class::cast) - .map(SendDefinition::getEndpointUri) - .collect(Collectors.toList()) - ).build(); - } - - @POST - @Path("/send") - @Produces(MediaType.TEXT_PLAIN) - public void send(String data) throws IOException { - try (FluentProducerTemplate template = context.createFluentProducerTemplate()) { - template.to("direct:start") - .withHeader("MyHeader", data) - .send(); - } - } - - @GET - @Path("/poll") - @Produces(MediaType.TEXT_PLAIN) - public Response poll() { - String result = queue.poll(); - - return result != null - ? Response.ok(result).build() - : Response.noContent().build(); - } - - @Unremovable - @javax.enterprise.inject.Produces - KnativeEnvironment environment( - @ConfigProperty(name = "kamel.k.sink.port") int port) { - - return KnativeEnvironment.on( - KnativeEnvironment.serviceBuilder(Knative.Type.endpoint, "sink") - .withUrl("http://localhost:" + port + "/test/toUpper") - .withEndpointKind(Knative.EndpointKind.sink) - .build() - ); - } -} - diff --git a/itests/camel-k-itests-knative-source-xml/src/main/resources/application.properties b/itests/camel-k-itests-knative-source-xml/src/main/resources/application.properties deleted file mode 100644 index 424a670c..00000000 --- a/itests/camel-k-itests-knative-source-xml/src/main/resources/application.properties +++ /dev/null @@ -1,29 +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. -## --------------------------------------------------------------------------- - -# -# Quarkus -# -quarkus.log.console.enable = false -quarkus.banner.enabled = false - -# -# Camel K -# -camel.k.sources[0].location = file:src/test/resources/source.xml -camel.k.sources[0].interceptors[0] = knative-source - diff --git a/itests/camel-k-itests-knative-source-xml/src/test/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceXmlIT.java b/itests/camel-k-itests-knative-source-xml/src/test/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceXmlIT.java deleted file mode 100644 index fb12344a..00000000 --- a/itests/camel-k-itests-knative-source-xml/src/test/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceXmlIT.java +++ /dev/null @@ -1,23 +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.k.quarkus.it.knative.source; - -import io.quarkus.test.junit.NativeImageTest; - -@NativeImageTest -public class KnativeSourceXmlIT extends KnativeSourceXmlTest { -} \ No newline at end of file diff --git a/itests/camel-k-itests-knative-source-xml/src/test/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceXmlTest.java b/itests/camel-k-itests-knative-source-xml/src/test/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceXmlTest.java deleted file mode 100644 index cbb1b35a..00000000 --- a/itests/camel-k-itests-knative-source-xml/src/test/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceXmlTest.java +++ /dev/null @@ -1,88 +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.k.quarkus.it.knative.source; - -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import javax.ws.rs.core.MediaType; - -import io.quarkus.test.common.QuarkusTestResource; -import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; -import io.quarkus.test.junit.QuarkusTest; -import org.junit.jupiter.api.Order; -import org.junit.jupiter.api.Test; - -import static io.restassured.RestAssured.given; -import static org.assertj.core.api.Assertions.assertThat; -import static org.awaitility.Awaitility.await; - -@QuarkusTestResource(KnativeSourceXmlTest.Resource.class) -@QuarkusTest -public class KnativeSourceXmlTest { - @Test - @Order(0) - public void validateEndpointUris() { - List<String> p = given() - .accept(MediaType.APPLICATION_JSON) - .get("/test/inspect/endpoint-uris") - .then() - .statusCode(200) - .extract() - .body() - .jsonPath().getList(".", String.class); - - assertThat(p).contains("knative://endpoint/sink"); - } - - @Test - @Order(1) - public void validateBehavior() { - final String body = "test"; - - given() - .body(body) - .post("/test/send") - .then() - .statusCode(204); - - await().atMost(10, TimeUnit.SECONDS).until(() -> { - var response = given() - .accept(MediaType.TEXT_PLAIN) - .get("/test/poll"); - - return response.statusCode() == 200 - && body.toUpperCase(Locale.US).equals(response.body().asString()); - }); - - } - - public static class Resource implements QuarkusTestResourceLifecycleManager { - @Override - public Map<String, String> start() { - return Map.of( - "kamel.k.sink.port", - System.getProperty("camel.k.test.knative.listenting.port", "8081")); - } - - @Override - public void stop() { - } - } -} \ No newline at end of file diff --git a/itests/camel-k-itests-knative-source-xml/src/test/resources/source.xml b/itests/camel-k-itests-knative-source-xml/src/test/resources/source.xml deleted file mode 100644 index a7daa07e..00000000 --- a/itests/camel-k-itests-knative-source-xml/src/test/resources/source.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - ---> -<routes xmlns="http://camel.apache.org/schema/spring"> - <route> - <from uri="direct:start"/> - <setBody> - <header>MyHeader</header> - </setBody> - <to uri="log:knative"/> - </route> -</routes> \ No newline at end of file diff --git a/itests/camel-k-itests-knative-source-yaml/src/main/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceApplication.java b/itests/camel-k-itests-knative-source-yaml/src/main/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceApplication.java deleted file mode 100644 index 334cdbf4..00000000 --- a/itests/camel-k-itests-knative-source-yaml/src/main/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceApplication.java +++ /dev/null @@ -1,116 +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.k.quarkus.it.knative.source; - -import java.io.IOException; -import java.util.List; -import java.util.Locale; -import java.util.Objects; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.stream.Collectors; - -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; -import javax.json.Json; -import javax.json.JsonArray; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -import io.quarkus.arc.Unremovable; -import org.apache.camel.CamelContext; -import org.apache.camel.FluentProducerTemplate; -import org.apache.camel.component.knative.spi.Knative; -import org.apache.camel.component.knative.spi.KnativeEnvironment; -import org.apache.camel.model.ModelCamelContext; -import org.apache.camel.model.RouteDefinition; -import org.apache.camel.model.SendDefinition; -import org.apache.camel.model.ToDefinition; -import org.eclipse.microprofile.config.inject.ConfigProperty; - -@Path("/test") -@ApplicationScoped -public class KnativeSourceApplication { - @Inject - CamelContext context; - - private final BlockingQueue<String> queue = new LinkedBlockingQueue<>(); - - @POST - @Path("/toUpper") - @Produces(MediaType.TEXT_PLAIN) - public void toUpper(String data) throws InterruptedException { - queue.put(data.toUpperCase(Locale.US)); - } - - @GET - @Path("/inspect/endpoint-uris") - @Produces(MediaType.APPLICATION_JSON) - public JsonArray endpointUris() { - List<RouteDefinition> definitions = context.adapt(ModelCamelContext.class).getRouteDefinitions(); - - return Json.createArrayBuilder( - definitions.stream() - .map(d -> !d.getOutputs().isEmpty() ? d.getOutputs().get(d.getOutputs().size() -1 ) : null) - .filter(Objects::nonNull) - .filter(ToDefinition.class::isInstance) - .map(ToDefinition.class::cast) - .map(SendDefinition::getEndpointUri) - .collect(Collectors.toList()) - ).build(); - } - - @POST - @Path("/send") - @Produces(MediaType.TEXT_PLAIN) - public void send(String data) throws IOException { - try (FluentProducerTemplate template = context.createFluentProducerTemplate()) { - template.to("direct:start") - .withHeader("MyHeader", data) - .send(); - } - } - - @GET - @Path("/poll") - @Produces(MediaType.TEXT_PLAIN) - public Response poll() { - String result = queue.poll(); - - return result != null - ? Response.ok(result).build() - : Response.noContent().build(); - } - - @Unremovable - @javax.enterprise.inject.Produces - KnativeEnvironment environment( - @ConfigProperty(name = "kamel.k.sink.port") int port) { - - return KnativeEnvironment.on( - KnativeEnvironment.serviceBuilder(Knative.Type.endpoint, "sink") - .withUrl("http://localhost:" + port + "/test/toUpper") - .withEndpointKind(Knative.EndpointKind.sink) - .build() - ); - } -} - diff --git a/itests/camel-k-itests-knative-source-yaml/src/main/resources/application.properties b/itests/camel-k-itests-knative-source-yaml/src/main/resources/application.properties deleted file mode 100644 index 66f1eefe..00000000 --- a/itests/camel-k-itests-knative-source-yaml/src/main/resources/application.properties +++ /dev/null @@ -1,28 +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. -## --------------------------------------------------------------------------- - -# -# Quarkus -# -quarkus.log.console.enable = false -quarkus.banner.enabled = false - -# -# Camel K -# -camel.k.sources[0].location = file:src/test/resources/source.yaml -camel.k.sources[0].interceptors[0] = knative-source diff --git a/itests/camel-k-itests-knative-source-yaml/src/test/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceYamlIT.java b/itests/camel-k-itests-knative-source-yaml/src/test/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceYamlIT.java deleted file mode 100644 index b10cb4dd..00000000 --- a/itests/camel-k-itests-knative-source-yaml/src/test/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceYamlIT.java +++ /dev/null @@ -1,23 +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.k.quarkus.it.knative.source; - -import io.quarkus.test.junit.NativeImageTest; - -@NativeImageTest -public class KnativeSourceYamlIT extends KnativeSourceYamlTest { -} \ No newline at end of file diff --git a/itests/camel-k-itests-knative-source-yaml/src/test/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceYamlTest.java b/itests/camel-k-itests-knative-source-yaml/src/test/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceYamlTest.java deleted file mode 100644 index 6f1eac3d..00000000 --- a/itests/camel-k-itests-knative-source-yaml/src/test/java/org/apache/camel/k/quarkus/it/knative/source/KnativeSourceYamlTest.java +++ /dev/null @@ -1,88 +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.k.quarkus.it.knative.source; - -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import javax.ws.rs.core.MediaType; - -import io.quarkus.test.common.QuarkusTestResource; -import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; -import io.quarkus.test.junit.QuarkusTest; -import org.junit.jupiter.api.Order; -import org.junit.jupiter.api.Test; - -import static io.restassured.RestAssured.given; -import static org.assertj.core.api.Assertions.assertThat; -import static org.awaitility.Awaitility.await; - -@QuarkusTestResource(KnativeSourceYamlTest.Resource.class) -@QuarkusTest -public class KnativeSourceYamlTest { - @Test - @Order(0) - public void validateEndpointUris() { - List<String> p = given() - .accept(MediaType.APPLICATION_JSON) - .get("/test/inspect/endpoint-uris") - .then() - .statusCode(200) - .extract() - .body() - .jsonPath().getList(".", String.class); - - assertThat(p).contains("knative://endpoint/sink"); - } - - @Test - @Order(1) - public void validateBehavior() { - final String body = "test"; - - given() - .body(body) - .post("/test/send") - .then() - .statusCode(204); - - await().atMost(10, TimeUnit.SECONDS).until(() -> { - var response = given() - .accept(MediaType.TEXT_PLAIN) - .get("/test/poll"); - - return response.statusCode() == 200 - && body.toUpperCase(Locale.US).equals(response.body().asString()); - }); - - } - - public static class Resource implements QuarkusTestResourceLifecycleManager { - @Override - public Map<String, String> start() { - return Map.of( - "kamel.k.sink.port", - System.getProperty("camel.k.test.knative.listenting.port", "8081")); - } - - @Override - public void stop() { - } - } -} \ No newline at end of file diff --git a/itests/camel-k-itests-knative-source-yaml/src/test/resources/source.yaml b/itests/camel-k-itests-knative-source-yaml/src/test/resources/source.yaml deleted file mode 100644 index b1fd1f8f..00000000 --- a/itests/camel-k-itests-knative-source-yaml/src/test/resources/source.yaml +++ /dev/null @@ -1,23 +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. -# - -- from: - uri: "direct:start" - steps: - - set-body: - simple: "${header[MyHeader]}" - - to: "log:knative" diff --git a/itests/camel-k-itests-runtime-yaml/src/test/java/org/apache/camel/k/quarkus/it/RuntimeWithInterceptorIT.java b/itests/camel-k-itests-runtime-yaml/src/test/java/org/apache/camel/k/quarkus/it/RuntimeWithInterceptorIT.java deleted file mode 100644 index aee3a70b..00000000 --- a/itests/camel-k-itests-runtime-yaml/src/test/java/org/apache/camel/k/quarkus/it/RuntimeWithInterceptorIT.java +++ /dev/null @@ -1,23 +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.k.quarkus.it; - -import io.quarkus.test.junit.NativeImageTest; - -@NativeImageTest -public class RuntimeWithInterceptorIT extends RuntimeWithInterceptorTest { -} \ No newline at end of file diff --git a/itests/camel-k-itests-runtime-yaml/src/test/java/org/apache/camel/k/quarkus/it/RuntimeWithInterceptorTest.java b/itests/camel-k-itests-runtime-yaml/src/test/java/org/apache/camel/k/quarkus/it/RuntimeWithInterceptorTest.java deleted file mode 100644 index e74fb831..00000000 --- a/itests/camel-k-itests-runtime-yaml/src/test/java/org/apache/camel/k/quarkus/it/RuntimeWithInterceptorTest.java +++ /dev/null @@ -1,67 +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.k.quarkus.it; - -import java.util.List; -import java.util.Map; - -import javax.ws.rs.core.MediaType; - -import io.quarkus.test.common.QuarkusTestResource; -import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; -import io.quarkus.test.junit.QuarkusTest; -import org.junit.jupiter.api.Test; - -import static io.restassured.RestAssured.given; -import static org.apache.camel.util.CollectionHelper.mapOf; -import static org.assertj.core.api.Assertions.assertThat; - -@QuarkusTest -@QuarkusTestResource(RuntimeWithInterceptorTest.Resources.class) -public class RuntimeWithInterceptorTest { - @Test - public void inspect() { - List<String> endpoints = given() - .accept(MediaType.APPLICATION_JSON) - .get("/runtime/route-outputs/my-route") - .then() - .statusCode(200) - .extract() - .body() - .jsonPath().getList(".", String.class); - - assertThat(endpoints).last().isEqualTo("knative://endpoint/sink"); - } - - public static class Resources implements QuarkusTestResourceLifecycleManager { - @Override - public Map<String, String> start() { - final String res = System.getProperty("camel.k.test.dir.resources", "."); - - return mapOf( - // sources - "camel.k.sources[0].location", "file:" + res + "/routes-with-beans.yaml", - "camel.k.sources[0].type", "source", - "camel.k.sources[0].interceptors[0]", "knative-source" - ); - } - - @Override - public void stop() { - } - } -} \ No newline at end of file diff --git a/itests/camel-k-itests-webhook/src/main/java/org/apache/camel/k/quarkus/it/webhook/Application.java b/itests/camel-k-itests-webhook/src/main/java/org/apache/camel/k/quarkus/it/webhook/Application.java deleted file mode 100644 index 514ae4f5..00000000 --- a/itests/camel-k-itests-webhook/src/main/java/org/apache/camel/k/quarkus/it/webhook/Application.java +++ /dev/null @@ -1,117 +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.k.quarkus.it.webhook; - -import java.nio.charset.StandardCharsets; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.atomic.AtomicInteger; - -import javax.annotation.PostConstruct; -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; -import javax.inject.Named; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -import io.quarkus.arc.Unremovable; -import org.apache.camel.CamelContext; -import org.apache.camel.component.webhook.WebhookAction; -import org.apache.camel.dsl.yaml.YamlRoutesBuilderLoader; -import org.apache.camel.k.quarkus.it.webhook.support.DummyWebhookComponent; -import org.apache.camel.quarkus.core.CamelRuntime; -import org.apache.camel.support.ResourceHelper; - -@Path("/test") -@ApplicationScoped -public class Application { - @Inject - CamelContext context; - @Inject - CamelRuntime runtime; - - private Map<WebhookAction, AtomicInteger> registerCounters; - - @PostConstruct - void setUp() { - registerCounters = new ConcurrentHashMap<>(); - - for (WebhookAction a : WebhookAction.values()) { - registerCounters.put(a, new AtomicInteger()); - } - } - - @POST - @Path("/load") - public Response load(String code) { - try (YamlRoutesBuilderLoader loader = new YamlRoutesBuilderLoader()) { - runtime.getCamelContext().addRoutes( - loader.loadRoutesBuilder(ResourceHelper.fromBytes("my-webhook.yaml", code.getBytes(StandardCharsets.UTF_8))) - ); - - return Response.status(Response.Status.OK).build(); - } catch (Exception e) { - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); - } - } - - @GET - @Path("/counter/{action}") - @Produces(MediaType.TEXT_PLAIN) - public String counter(@PathParam("action") WebhookAction action) { - AtomicInteger result = registerCounters.get(action); - return result != null ? Integer.toString(result.get()) : ""; - } - - @Unremovable - @Named("dummy") - @javax.enterprise.inject.Produces - DummyWebhookComponent dummy() { - return new DummyWebhookComponent( - () -> registerCounters.get(WebhookAction.REGISTER).incrementAndGet(), - () -> registerCounters.get(WebhookAction.UNREGISTER).incrementAndGet()); - } - - @Unremovable - @Named("failing") - @javax.enterprise.inject.Produces - DummyWebhookComponent failing() { - return new DummyWebhookComponent( - () -> { - throw new RuntimeException("dummy error"); - }, - () -> { - throw new RuntimeException("dummy error"); - }); - } - - @Unremovable - @Named("doNothing") - @javax.enterprise.inject.Produces - DummyWebhookComponent doNothing() { - return new DummyWebhookComponent( - () -> { - }, - () -> { - }); - } -} diff --git a/itests/camel-k-itests-webhook/src/main/java/org/apache/camel/k/quarkus/it/webhook/support/DummyWebhookComponent.java b/itests/camel-k-itests-webhook/src/main/java/org/apache/camel/k/quarkus/it/webhook/support/DummyWebhookComponent.java deleted file mode 100644 index f04ad699..00000000 --- a/itests/camel-k-itests-webhook/src/main/java/org/apache/camel/k/quarkus/it/webhook/support/DummyWebhookComponent.java +++ /dev/null @@ -1,100 +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.k.quarkus.it.webhook.support; - -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import org.apache.camel.Component; -import org.apache.camel.Consumer; -import org.apache.camel.Endpoint; -import org.apache.camel.Processor; -import org.apache.camel.Producer; -import org.apache.camel.component.webhook.WebhookCapableEndpoint; -import org.apache.camel.component.webhook.WebhookConfiguration; -import org.apache.camel.support.DefaultComponent; -import org.apache.camel.support.DefaultConsumer; -import org.apache.camel.support.DefaultEndpoint; - -public class DummyWebhookComponent extends DefaultComponent { - private final Runnable onRegister; - private final Runnable onUnregister; - - public DummyWebhookComponent(Runnable onRegister, Runnable onUnregister) { - this.onRegister = onRegister; - this.onUnregister = onUnregister; - } - - @Override - protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { - parameters.clear(); - return new DummyWebhookEndpoint(uri, this); - } - - class DummyWebhookEndpoint extends DefaultEndpoint implements WebhookCapableEndpoint { - public DummyWebhookEndpoint(String endpointUri, Component component) { - super(endpointUri, component); - } - - @Override - public Producer createProducer() throws Exception { - throw new UnsupportedOperationException(); - } - - @Override - public Consumer createConsumer(Processor processor) throws Exception { - return new DummyWebhookConsumer(this, processor); - } - - @Override - public Processor createWebhookHandler(Processor next) { - return next; - } - - @Override - public void registerWebhook() throws Exception { - onRegister.run(); - } - - @Override - public void unregisterWebhook() throws Exception { - onUnregister.run(); - } - - @Override - public void setWebhookConfiguration(WebhookConfiguration webhookConfiguration) { - - } - - @Override - public List<String> getWebhookMethods() { - return Collections.singletonList("POST"); - } - - class DummyWebhookConsumer extends DefaultConsumer { - public DummyWebhookConsumer(Endpoint endpoint, Processor processor) { - super(endpoint, processor); - } - - @Override - protected void doStart() throws Exception { - throw new IllegalStateException("Webhook consumer must never be started"); - } - } - } -} diff --git a/itests/camel-k-itests-webhook/src/main/resources/application.properties b/itests/camel-k-itests-webhook/src/main/resources/application.properties deleted file mode 100644 index 1882d46d..00000000 --- a/itests/camel-k-itests-webhook/src/main/resources/application.properties +++ /dev/null @@ -1,30 +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. -## --------------------------------------------------------------------------- - -# -# Quarkus -# -quarkus.log.console.enable = false -quarkus.banner.enabled = false - -# -# Quarkus :: Camel -# -quarkus.camel.routes-discovery.enabled = false - - - diff --git a/itests/camel-k-itests-webhook/src/test/java/org/apache/camel/k/quarkus/it/webhook/WebhookFailureWithAutoRegisterDisbledTest.java b/itests/camel-k-itests-webhook/src/test/java/org/apache/camel/k/quarkus/it/webhook/WebhookFailureWithAutoRegisterDisbledTest.java deleted file mode 100644 index c171f2b3..00000000 --- a/itests/camel-k-itests-webhook/src/test/java/org/apache/camel/k/quarkus/it/webhook/WebhookFailureWithAutoRegisterDisbledTest.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.k.quarkus.it.webhook; - -import java.util.Map; - -import io.quarkus.test.junit.QuarkusTest; -import io.quarkus.test.junit.QuarkusTestProfile; -import io.quarkus.test.junit.TestProfile; -import org.apache.camel.component.webhook.WebhookAction; -import org.junit.jupiter.api.Test; - -import static io.restassured.RestAssured.given; -import static org.apache.camel.util.CollectionHelper.mapOf; - -@TestProfile(WebhookFailureWithAutoRegisterDisbledTest.Profile.class) -@QuarkusTest -public class WebhookFailureWithAutoRegisterDisbledTest { - @Test - public void testFailure() { - final String code = "" - + "\n- from:" - + "\n uri: \"webhook:doNothing:test?foo=bar\"" - + "\n steps:" - + "\n - to: \"log:webhook\"" - + "\n- from:" - + "\n uri: \"timer:tick\"" - + "\n steps:" - + "\n - to: \"log:tick\""; - - given() - .body(code) - .when() - .post("/test/load") - .then() - .statusCode(500); - } - - public static class Profile implements QuarkusTestProfile { - @Override - public Map<String, String> getConfigOverrides() { - return mapOf( - "camel.k.customizer.webhook.enabled", "true", - "camel.k.customizer.webhook.action", WebhookAction.REGISTER.name() - ); - } - } -} diff --git a/itests/camel-k-itests-webhook/src/test/java/org/apache/camel/k/quarkus/it/webhook/WebhookFailureWithComponentFailingTest.java b/itests/camel-k-itests-webhook/src/test/java/org/apache/camel/k/quarkus/it/webhook/WebhookFailureWithComponentFailingTest.java deleted file mode 100644 index 50990246..00000000 --- a/itests/camel-k-itests-webhook/src/test/java/org/apache/camel/k/quarkus/it/webhook/WebhookFailureWithComponentFailingTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.k.quarkus.it.webhook; - -import java.util.Map; - -import io.quarkus.test.junit.QuarkusTest; -import io.quarkus.test.junit.QuarkusTestProfile; -import io.quarkus.test.junit.TestProfile; -import org.apache.camel.component.webhook.WebhookAction; -import org.junit.jupiter.api.Test; - -import static io.restassured.RestAssured.given; -import static org.apache.camel.util.CollectionHelper.mapOf; - -@TestProfile(WebhookFailureWithComponentFailingTest.Profile.class) -@QuarkusTest -public class WebhookFailureWithComponentFailingTest { - @Test - public void testFailure() { - final String code = "" - + "\n- from:" - + "\n uri: \"webhook:failing:test?foo=bar\"" - + "\n steps:" - + "\n - to: \"log:webhook\"" - + "\n- from:" - + "\n uri: \"timer:tick\"" - + "\n steps:" - + "\n - to: \"log:tick\""; - - given() - .body(code) - .when() - .post("/test/load") - .then() - .statusCode(500); - } - - public static class Profile implements QuarkusTestProfile { - @Override - public Map<String, String> getConfigOverrides() { - return mapOf( - "camel.component.webhook.configuration.webhook-auto-register", "false", - "camel.k.customizer.webhook.enabled", "true", - "camel.k.customizer.webhook.action", WebhookAction.UNREGISTER.name() - ); - } - } -} diff --git a/itests/camel-k-itests-webhook/src/test/java/org/apache/camel/k/quarkus/it/webhook/WebhookRegisterTest.java b/itests/camel-k-itests-webhook/src/test/java/org/apache/camel/k/quarkus/it/webhook/WebhookRegisterTest.java deleted file mode 100644 index d8d325c5..00000000 --- a/itests/camel-k-itests-webhook/src/test/java/org/apache/camel/k/quarkus/it/webhook/WebhookRegisterTest.java +++ /dev/null @@ -1,64 +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.k.quarkus.it.webhook; - -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import io.quarkus.test.junit.QuarkusTest; -import io.quarkus.test.junit.QuarkusTestProfile; -import io.quarkus.test.junit.TestProfile; -import org.apache.camel.component.webhook.WebhookAction; -import org.assertj.core.util.Strings; -import org.junit.jupiter.api.Test; - -import static io.restassured.RestAssured.when; -import static org.apache.camel.util.CollectionHelper.mapOf; -import static org.awaitility.Awaitility.await; - -@TestProfile(WebhookRegisterTest.Profile.class) -@QuarkusTest -public class WebhookRegisterTest { - private static final WebhookAction ACTION = WebhookAction.REGISTER; - - @Test - public void testRegister() { - await().atMost(10, TimeUnit.SECONDS).until(() -> { - String result = when() - .get("/test/counter/{action}", ACTION.name()) - .then() - .statusCode(200) - .extract().body().asString(); - - return !Strings.isNullOrEmpty(result); - }); - } - - public static class Profile implements QuarkusTestProfile { - @Override - public Map<String, String> getConfigOverrides() { - String res = System.getProperty("camel.k.test.dir.resources", "./src/test/resources"); - - return mapOf( - "camel.component.webhook.configuration.webhook-auto-register", "false", - "camel.k.customizer.webhook.enabled", "true", - "camel.k.customizer.webhook.action", ACTION.name(), - "camel.k.sources[0].location", "file:" + res + "/routes/registration_routes.yaml" - ); - } - } -} diff --git a/itests/camel-k-itests-webhook/src/test/java/org/apache/camel/k/quarkus/it/webhook/WebhookUnregisterTest.java b/itests/camel-k-itests-webhook/src/test/java/org/apache/camel/k/quarkus/it/webhook/WebhookUnregisterTest.java deleted file mode 100644 index 0ef4fde9..00000000 --- a/itests/camel-k-itests-webhook/src/test/java/org/apache/camel/k/quarkus/it/webhook/WebhookUnregisterTest.java +++ /dev/null @@ -1,64 +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.k.quarkus.it.webhook; - -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import io.quarkus.test.junit.QuarkusTest; -import io.quarkus.test.junit.QuarkusTestProfile; -import io.quarkus.test.junit.TestProfile; -import org.apache.camel.component.webhook.WebhookAction; -import org.assertj.core.util.Strings; -import org.junit.jupiter.api.Test; - -import static io.restassured.RestAssured.when; -import static org.apache.camel.util.CollectionHelper.mapOf; -import static org.awaitility.Awaitility.await; - -@TestProfile(WebhookUnregisterTest.Profile.class) -@QuarkusTest -public class WebhookUnregisterTest { - private static final WebhookAction ACTION = WebhookAction.UNREGISTER; - - @Test - public void testRegister() { - await().atMost(10, TimeUnit.SECONDS).until(() -> { - String result = when() - .get("/test/counter/{action}", ACTION.name()) - .then() - .statusCode(200) - .extract().body().asString(); - - return !Strings.isNullOrEmpty(result); - }); - } - - public static class Profile implements QuarkusTestProfile { - @Override - public Map<String, String> getConfigOverrides() { - String res = System.getProperty("camel.k.test.dir.resources", "./src/test/resources"); - - return mapOf( - "camel.component.webhook.configuration.webhook-auto-register", "false", - "camel.k.customizer.webhook.enabled", "true", - "camel.k.customizer.webhook.action", ACTION.name(), - "camel.k.sources[0].location", "file:" + res + "/routes/registration_routes.yaml" - ); - } - } -} diff --git a/itests/camel-k-itests-webhook/src/test/resources/routes/registration_routes.yaml b/itests/camel-k-itests-webhook/src/test/resources/routes/registration_routes.yaml deleted file mode 100644 index cd81e98d..00000000 --- a/itests/camel-k-itests-webhook/src/test/resources/routes/registration_routes.yaml +++ /dev/null @@ -1,24 +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. -# -- from: - uri: "webhook:dummy:test?foo=bar" - steps: - - to: "log:webhook" -- from: - uri: "timer:tick" - steps: - - to: "log:tick" \ No newline at end of file diff --git a/itests/pom.xml b/itests/pom.xml index e2626e74..5fba2456 100644 --- a/itests/pom.xml +++ b/itests/pom.xml @@ -52,13 +52,7 @@ <module>camel-k-itests-knative-producer</module> <module>camel-k-itests-knative-consumer</module> <module>camel-k-itests-knative-sinkbinding</module> - <module>camel-k-itests-knative-source-groovy</module> - <module>camel-k-itests-knative-source-java</module> - <module>camel-k-itests-knative-source-js</module> - <module>camel-k-itests-knative-source-xml</module> - <module>camel-k-itests-knative-source-yaml</module> <module>camel-k-itests-kamelet</module> - <module>camel-k-itests-webhook</module> </modules> <build> @@ -84,7 +78,7 @@ </executions> </plugin> <plugin> - <groupId>io.quarkus</groupId> + <groupId>${quarkus-platform-group}</groupId> <artifactId>quarkus-maven-plugin</artifactId> <executions> <execution> @@ -112,7 +106,7 @@ <artifactId>build-helper-maven-plugin</artifactId> </plugin> <plugin> - <groupId>io.quarkus</groupId> + <groupId>${quarkus-platform-group}</groupId> <artifactId>quarkus-maven-plugin</artifactId> </plugin> <plugin> diff --git a/pom.xml b/pom.xml index fbc23d8f..26c1edff 100644 --- a/pom.xml +++ b/pom.xml @@ -46,6 +46,7 @@ <quarkus-version>2.16.0.Final</quarkus-version> <quarkus-platform-version>2.16.0.Final</quarkus-platform-version> <!-- The quarkus camel bom may differ from quarkus platfom --> + <quarkus-platform-group>io.quarkus.platform</quarkus-platform-group> <quarkus-camel-bom-version>2.16.0.Final</quarkus-camel-bom-version> <quarkus-native-builder-image>quay.io/quarkus/ubi-quarkus-mandrel:22.2.0.0-Final-java11</quarkus-native-builder-image> @@ -293,7 +294,7 @@ <version>${maven-plugin-plugin-version}</version> </plugin> <plugin> - <groupId>io.quarkus</groupId> + <groupId>${quarkus-platform-group}</groupId> <artifactId>quarkus-maven-plugin</artifactId> <version>${quarkus-version}</version> </plugin> @@ -382,10 +383,8 @@ <module>camel-k-core</module> <module>camel-k-cron</module> - <module>camel-k-cloudevents</module> <module>camel-k-knative</module> <module>camel-k-master</module> - <module>camel-k-webhook</module> <module>camel-k-runtime</module> <module>camel-k-resume-kafka</module> @@ -405,14 +404,14 @@ <scope>import</scope> </dependency> <dependency> - <groupId>io.quarkus.platform</groupId> + <groupId>${quarkus-platform-group}</groupId> <artifactId>quarkus-camel-bom</artifactId> <version>${quarkus-camel-bom-version}</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> - <groupId>io.quarkus.platform</groupId> + <groupId>${quarkus-platform-group}</groupId> <artifactId>quarkus-bom</artifactId> <version>${quarkus-platform-version}</version> <type>pom</type> @@ -447,16 +446,6 @@ <artifactId>camel-k-core-deployment</artifactId> <version>${project.version}</version> </dependency> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-cloudevents</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-cloudevents-deployment</artifactId> - <version>${project.version}</version> - </dependency> <dependency> <groupId>org.apache.camel.k</groupId> <artifactId>camel-k-master-impl</artifactId> @@ -494,21 +483,6 @@ <artifactId>camel-k-cron-deployment</artifactId> <version>${project.version}</version> </dependency> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-webhook-impl</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-webhook</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-webhook-deployment</artifactId> - <version>${project.version}</version> - </dependency> <dependency> <groupId>org.apache.camel.k</groupId> <artifactId>camel-k-runtime</artifactId> diff --git a/support/camel-k-runtime-bom/pom.xml b/support/camel-k-runtime-bom/pom.xml index 8ea67acf..858f09db 100644 --- a/support/camel-k-runtime-bom/pom.xml +++ b/support/camel-k-runtime-bom/pom.xml @@ -38,6 +38,7 @@ <jolokia-version>1.7.2</jolokia-version> <maven-enforcer-plugin-version>3.2.1</maven-enforcer-plugin-version> <maven-version>3.6.3</maven-version> + <quarkus-platform-group>io.quarkus.platform</quarkus-platform-group> <quarkus-platform-version>2.16.0.Final</quarkus-platform-version> <!-- The quarkus camel bom may differ from quarkus platfom --> <quarkus-camel-bom-version>2.16.0.Final</quarkus-camel-bom-version> @@ -98,14 +99,14 @@ <dependencyManagement> <dependencies> <dependency> - <groupId>io.quarkus.platform</groupId> + <groupId>${quarkus-platform-group}</groupId> <artifactId>quarkus-camel-bom</artifactId> <version>${quarkus-camel-bom-version}</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> - <groupId>io.quarkus.platform</groupId> + <groupId>${quarkus-platform-group}</groupId> <artifactId>quarkus-bom</artifactId> <version>${quarkus-platform-version}</version> <type>pom</type> @@ -132,26 +133,6 @@ <version>${project.version}</version> </dependency> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-cloudevents</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-cloudevents-deployment</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-webhook-impl</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-webhook</artifactId> - <version>${project.version}</version> - </dependency> <dependency> <groupId>org.apache.camel.k</groupId> <artifactId>camel-k-cron-impl</artifactId>