This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git
The following commit(s) were added to refs/heads/master by this push: new 3fe9b8b chore(camel-3): fix camel 3 compatibility layer 3fe9b8b is described below commit 3fe9b8be9b583b018abb757f14870aba8327c795 Author: lburgazzoli <lburgazz...@gmail.com> AuthorDate: Fri Mar 1 10:18:24 2019 +0100 chore(camel-3): fix camel 3 compatibility layer --- .travis.yml | 4 +-- .../org/apache/camel/k/adapter/Exceptions.java | 29 ++++++++++++++++++++++ .../org/apache/camel/k/adapter/ServiceSupport.java | 20 +++++++++++++++ .../org/apache/camel/k/adapter/Exceptions.java | 28 +++++++++++++++++++++ .../org/apache/camel/k/adapter/ServiceSupport.java | 20 +++++++++++++++ .../apache/camel/k/listener/RoutesConfigurer.java | 5 ++-- .../org/apache/camel/k/health/HealthEndpoint.java | 2 +- camel-k-runtime-jvm/pom.xml | 9 ++++--- .../org/apache/camel/k/jvm/ApplicationRuntime.java | 4 +-- camel-k-runtime-yaml/pom.xml | 13 ++++++++++ .../knative/http/KnativeHttpComponent.java | 3 ++- .../camel/component/knative/KnativeEndpoint.java | 4 +-- 12 files changed, 127 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6d79b9e..965f955 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,5 +19,5 @@ language: java script: - - ./mvnw test -Dcamel2 - - ./mvnw test -Dcamel3 + - ./mvnw clean install -Dcamel2 + - ./mvnw clean install -Dcamel3 diff --git a/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/Exceptions.java b/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/Exceptions.java new file mode 100644 index 0000000..b70acee --- /dev/null +++ b/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/Exceptions.java @@ -0,0 +1,29 @@ +/** + * 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.adapter; + +import org.apache.camel.RuntimeCamelException; +import org.apache.camel.util.ObjectHelper; + +public final class Exceptions { + private Exceptions() { + } + + public static RuntimeCamelException wrapRuntimeCamelException(Throwable e) { + return ObjectHelper.wrapRuntimeCamelException(e); + } +} diff --git a/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/ServiceSupport.java b/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/ServiceSupport.java new file mode 100644 index 0000000..c7ed213 --- /dev/null +++ b/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/ServiceSupport.java @@ -0,0 +1,20 @@ +/** + * 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.adapter; + +public abstract class ServiceSupport extends org.apache.camel.support.ServiceSupport { +} diff --git a/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/Exceptions.java b/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/Exceptions.java new file mode 100644 index 0000000..dc4cb01 --- /dev/null +++ b/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/Exceptions.java @@ -0,0 +1,28 @@ +/** + * 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.adapter; + +import org.apache.camel.RuntimeCamelException; + +public final class Exceptions { + private Exceptions() { + } + + public static RuntimeCamelException wrapRuntimeCamelException(Throwable e) { + return RuntimeCamelException.wrapRuntimeCamelException(e); + } +} diff --git a/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/ServiceSupport.java b/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/ServiceSupport.java new file mode 100644 index 0000000..26c8c72 --- /dev/null +++ b/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/ServiceSupport.java @@ -0,0 +1,20 @@ +/** + * 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.adapter; + +public abstract class ServiceSupport extends org.apache.camel.support.service.ServiceSupport { +} diff --git a/camel-k-runtime-core/src/main/java/org/apache/camel/k/listener/RoutesConfigurer.java b/camel-k-runtime-core/src/main/java/org/apache/camel/k/listener/RoutesConfigurer.java index 6f7a9f9..2600c63 100644 --- a/camel-k-runtime-core/src/main/java/org/apache/camel/k/listener/RoutesConfigurer.java +++ b/camel-k-runtime-core/src/main/java/org/apache/camel/k/listener/RoutesConfigurer.java @@ -21,6 +21,7 @@ import org.apache.camel.k.Constants; import org.apache.camel.k.RoutesLoader; import org.apache.camel.k.Runtime; import org.apache.camel.k.Source; +import org.apache.camel.k.adapter.Exceptions; import org.apache.camel.k.support.RuntimeSupport; import org.apache.camel.util.ObjectHelper; import org.slf4j.Logger; @@ -59,7 +60,7 @@ public class RoutesConfigurer extends AbstractPhaseListener { loader = RuntimeSupport.loaderFor(runtime.getContext(), source); builder = loader.load(runtime.getRegistry(), source); } catch (Exception e) { - throw ObjectHelper.wrapRuntimeCamelException(e); + throw Exceptions.wrapRuntimeCamelException(e); } if (builder == null) { @@ -71,7 +72,7 @@ public class RoutesConfigurer extends AbstractPhaseListener { try { runtime.getContext().addRoutes(builder); } catch (Exception e) { - throw ObjectHelper.wrapRuntimeCamelException(e); + throw Exceptions.wrapRuntimeCamelException(e); } } } diff --git a/camel-k-runtime-health/src/main/java/org/apache/camel/k/health/HealthEndpoint.java b/camel-k-runtime-health/src/main/java/org/apache/camel/k/health/HealthEndpoint.java index 995f071..0599063 100644 --- a/camel-k-runtime-health/src/main/java/org/apache/camel/k/health/HealthEndpoint.java +++ b/camel-k-runtime-health/src/main/java/org/apache/camel/k/health/HealthEndpoint.java @@ -42,7 +42,7 @@ import io.netty.handler.logging.LoggingHandler; import io.netty.util.AsciiString; import org.apache.camel.CamelContext; import org.apache.camel.ServiceStatus; -import org.apache.camel.support.ServiceSupport; +import org.apache.camel.k.adapter.ServiceSupport; public class HealthEndpoint extends ServiceSupport { private static final AsciiString CONTENT_TYPE = AsciiString.cached("Content-Type"); diff --git a/camel-k-runtime-jvm/pom.xml b/camel-k-runtime-jvm/pom.xml index 3ae26c2..3186956 100644 --- a/camel-k-runtime-jvm/pom.xml +++ b/camel-k-runtime-jvm/pom.xml @@ -136,12 +136,13 @@ </property> </activation> <dependencies> - <!-- test --> + <!-- runtime --> <dependency> <groupId>org.apache.camel.k</groupId> <artifactId>camel-k-adapter-camel-3</artifactId> - <scope>test</scope> + <scope>provided</scope> </dependency> + <!-- test --> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-properties</artifactId> @@ -157,11 +158,11 @@ </property> </activation> <dependencies> - <!-- test --> + <!-- runtime --> <dependency> <groupId>org.apache.camel.k</groupId> <artifactId>camel-k-adapter-camel-2</artifactId> - <scope>test</scope> + <scope>provided</scope> </dependency> </dependencies> </profile> diff --git a/camel-k-runtime-jvm/src/main/java/org/apache/camel/k/jvm/ApplicationRuntime.java b/camel-k-runtime-jvm/src/main/java/org/apache/camel/k/jvm/ApplicationRuntime.java index 2bbb542..9182a64 100644 --- a/camel-k-runtime-jvm/src/main/java/org/apache/camel/k/jvm/ApplicationRuntime.java +++ b/camel-k-runtime-jvm/src/main/java/org/apache/camel/k/jvm/ApplicationRuntime.java @@ -27,10 +27,10 @@ import org.apache.camel.ProducerTemplate; import org.apache.camel.impl.DefaultCamelContext; import org.apache.camel.k.InMemoryRegistry; import org.apache.camel.k.Runtime; +import org.apache.camel.k.adapter.Exceptions; import org.apache.camel.k.support.RuntimeSupport; import org.apache.camel.main.MainSupport; import org.apache.camel.spi.HasId; -import org.apache.camel.util.ObjectHelper; import org.apache.camel.util.function.ThrowingConsumer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -101,7 +101,7 @@ public final class ApplicationRuntime implements Runtime { try { consumer.accept(runtime); } catch (Exception e) { - throw ObjectHelper.wrapRuntimeCamelException(e); + throw Exceptions.wrapRuntimeCamelException(e); } } }); diff --git a/camel-k-runtime-yaml/pom.xml b/camel-k-runtime-yaml/pom.xml index abfa4f0..1b72095 100644 --- a/camel-k-runtime-yaml/pom.xml +++ b/camel-k-runtime-yaml/pom.xml @@ -80,6 +80,19 @@ <version>${assertj.version}</version> <scope>test</scope> </dependency> + + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + <version>${log4j2.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-slf4j-impl</artifactId> + <version>${log4j2.version}</version> + <scope>test</scope> + </dependency> </dependencies> <profiles> diff --git a/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpComponent.java b/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpComponent.java index f639e68..d0567c7 100644 --- a/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpComponent.java +++ b/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpComponent.java @@ -39,6 +39,7 @@ import org.apache.camel.component.netty4.http.NettyHttpComponent; import org.apache.camel.component.netty4.http.NettyHttpConsumer; import org.apache.camel.component.netty4.http.handlers.HttpServerChannelHandler; import org.apache.camel.http.common.CamelServlet; +import org.apache.camel.k.adapter.Exceptions; import org.apache.camel.k.adapter.Services; import org.apache.camel.support.RestConsumerContextPathMatcher; import org.apache.camel.util.ObjectHelper; @@ -231,7 +232,7 @@ public class KnativeHttpComponent extends NettyHttpComponent { break; } } catch (Exception e) { - throw ObjectHelper.wrapRuntimeCamelException(e); + throw Exceptions.wrapRuntimeCamelException(e); } } } diff --git a/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeEndpoint.java b/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeEndpoint.java index 32752d9..8b2c45f 100644 --- a/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeEndpoint.java +++ b/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeEndpoint.java @@ -28,9 +28,9 @@ import org.apache.camel.Producer; import org.apache.camel.cloud.ServiceDefinition; import org.apache.camel.component.knative.ce.CloudEventsProcessors; import org.apache.camel.k.adapter.DefaultEndpoint; +import org.apache.camel.k.adapter.Exceptions; import org.apache.camel.k.adapter.Services; import org.apache.camel.processor.Pipeline; -import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; import org.apache.camel.spi.UriPath; @@ -204,7 +204,7 @@ public class KnativeEndpoint extends DefaultEndpoint implements DelegateEndpoint return context.getEndpoint(uri); } catch (Exception e) { - throw ObjectHelper.wrapRuntimeCamelException(e); + throw Exceptions.wrapRuntimeCamelException(e); } } }