You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2020/02/04 16:34:29 UTC

[camel-k-runtime] branch master updated (998d8f3 -> 88ad7c7)

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

lburgazzoli pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git.


    from 998d8f3  Remove the need of jaxb in camel-k-runtime-core
     new 95a704f  Remove deprecated properties and processors in camel-knative
     new 88ad7c7  Create a KnativeTransportNoop test helper

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../camel/component/knative/KnativeComponent.java  | 10 -----
 .../component/knative/KnativeConfiguration.java    | 16 -------
 .../knative/KnativeConversionProcessor.java        | 46 -------------------
 .../camel/component/knative/KnativeEndpoint.java   |  3 +-
 .../component/knative/KnativeComponentTest.java    | 33 +-------------
 .../component/knative/KnativeTransportNoop.java    | 52 ++++++++++++++++++++++
 6 files changed, 54 insertions(+), 106 deletions(-)
 delete mode 100644 camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeConversionProcessor.java
 create mode 100644 camel-knative/camel-knative/src/test/java/org/apache/camel/component/knative/KnativeTransportNoop.java


[camel-k-runtime] 02/02: Create a KnativeTransportNoop test helper

Posted by lb...@apache.org.
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

commit 88ad7c7897d79eed6cbd2f26034ce839afe34a20
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Tue Feb 4 12:50:53 2020 +0100

    Create a KnativeTransportNoop test helper
---
 .../component/knative/KnativeComponentTest.java    | 33 +-------------
 .../component/knative/KnativeTransportNoop.java    | 52 ++++++++++++++++++++++
 2 files changed, 53 insertions(+), 32 deletions(-)

diff --git a/camel-knative/camel-knative/src/test/java/org/apache/camel/component/knative/KnativeComponentTest.java b/camel-knative/camel-knative/src/test/java/org/apache/camel/component/knative/KnativeComponentTest.java
index 57daf0f..7a1870c 100644
--- a/camel-knative/camel-knative/src/test/java/org/apache/camel/component/knative/KnativeComponentTest.java
+++ b/camel-knative/camel-knative/src/test/java/org/apache/camel/component/knative/KnativeComponentTest.java
@@ -17,18 +17,9 @@
 package org.apache.camel.component.knative;
 
 import org.apache.camel.CamelContext;
-import org.apache.camel.Consumer;
-import org.apache.camel.Endpoint;
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.Producer;
 import org.apache.camel.component.knative.spi.Knative;
 import org.apache.camel.component.knative.spi.KnativeEnvironment;
-import org.apache.camel.component.knative.spi.KnativeTransport;
-import org.apache.camel.component.knative.spi.KnativeTransportConfiguration;
 import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.support.DefaultConsumer;
-import org.apache.camel.support.DefaultProducer;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
@@ -74,29 +65,7 @@ public class KnativeComponentTest {
 
         KnativeComponent component = new KnativeComponent();
         component.setEnvironment(env);
-        component.setTransport(new KnativeTransport() {
-            @Override
-            public void start() {
-            }
-
-            @Override
-            public void stop() {
-            }
-
-            @Override
-            public Producer createProducer(Endpoint endpoint, KnativeTransportConfiguration configuration, KnativeEnvironment.KnativeServiceDefinition service) {
-                return new DefaultProducer(endpoint) {
-                    @Override
-                    public void process(Exchange exchange) throws Exception {
-                    }
-                };
-            }
-
-            @Override
-            public Consumer createConsumer(Endpoint endpoint, KnativeTransportConfiguration configuration, KnativeEnvironment.KnativeServiceDefinition service, Processor processor) {
-                return new DefaultConsumer(endpoint, processor);
-            }
-        });
+        component.setTransport(new KnativeTransportNoop());
 
         context.addComponent("knative", component);
 
diff --git a/camel-knative/camel-knative/src/test/java/org/apache/camel/component/knative/KnativeTransportNoop.java b/camel-knative/camel-knative/src/test/java/org/apache/camel/component/knative/KnativeTransportNoop.java
new file mode 100644
index 0000000..784ad7d
--- /dev/null
+++ b/camel-knative/camel-knative/src/test/java/org/apache/camel/component/knative/KnativeTransportNoop.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.knative;
+
+import org.apache.camel.Consumer;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.component.knative.spi.KnativeEnvironment;
+import org.apache.camel.component.knative.spi.KnativeTransport;
+import org.apache.camel.component.knative.spi.KnativeTransportConfiguration;
+import org.apache.camel.support.DefaultConsumer;
+import org.apache.camel.support.DefaultProducer;
+
+public class KnativeTransportNoop implements KnativeTransport {
+    @Override
+    public void start() {
+    }
+
+    @Override
+    public void stop() {
+    }
+
+    @Override
+    public Producer createProducer(Endpoint endpoint, KnativeTransportConfiguration configuration, KnativeEnvironment.KnativeServiceDefinition service) {
+        return new DefaultProducer(endpoint) {
+            @Override
+            public void process(Exchange exchange) throws Exception {
+            }
+        };
+    }
+
+    @Override
+    public Consumer createConsumer(Endpoint endpoint, KnativeTransportConfiguration configuration, KnativeEnvironment.KnativeServiceDefinition service, Processor processor) {
+        return new DefaultConsumer(endpoint, processor);
+    }
+}


[camel-k-runtime] 01/02: Remove deprecated properties and processors in camel-knative

Posted by lb...@apache.org.
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

commit 95a704f3998239682fa10a3f41ddcc586202970d
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Tue Feb 4 12:50:35 2020 +0100

    Remove deprecated properties and processors in camel-knative
---
 .../camel/component/knative/KnativeComponent.java  | 10 -----
 .../component/knative/KnativeConfiguration.java    | 16 --------
 .../knative/KnativeConversionProcessor.java        | 46 ----------------------
 .../camel/component/knative/KnativeEndpoint.java   |  3 +-
 4 files changed, 1 insertion(+), 74 deletions(-)

diff --git a/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeComponent.java b/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeComponent.java
index 987ca63..7056f4c 100644
--- a/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeComponent.java
+++ b/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeComponent.java
@@ -103,16 +103,6 @@ public class KnativeComponent extends DefaultComponent {
         configuration.setEnvironment(environment);
     }
 
-    @Deprecated
-    public boolean isJsonSerializationEnabled() {
-        return configuration.isJsonSerializationEnabled();
-    }
-
-    @Deprecated
-    public void setJsonSerializationEnabled(boolean jsonSerializationEnabled) {
-        configuration.setJsonSerializationEnabled(jsonSerializationEnabled);
-    }
-
     public String getCloudEventsSpecVersion() {
         return configuration.getCloudEventsSpecVersion();
     }
diff --git a/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeConfiguration.java b/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeConfiguration.java
index 1057782..5add382 100644
--- a/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeConfiguration.java
+++ b/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeConfiguration.java
@@ -30,9 +30,6 @@ public class KnativeConfiguration implements Cloneable {
     private KnativeEnvironment environment;
     @UriParam
     private String serviceName;
-    @UriParam(defaultValue = "false")
-    @Deprecated
-    private boolean jsonSerializationEnabled;
     @UriParam(defaultValue = "0.3", enums = "0.1,0.2,0.3")
     private String cloudEventsSpecVersion = CloudEvents.V03.version();
     @UriParam(defaultValue = "org.apache.camel.event")
@@ -98,19 +95,6 @@ public class KnativeConfiguration implements Cloneable {
         this.replyWithCloudEvent = replyWithCloudEvent;
     }
 
-    @Deprecated
-    public boolean isJsonSerializationEnabled() {
-        return jsonSerializationEnabled;
-    }
-
-    /**
-     * Enables automatic serialization to JSON of the produced events.
-     */
-    @Deprecated
-    public void setJsonSerializationEnabled(boolean jsonSerializationEnabled) {
-        this.jsonSerializationEnabled = jsonSerializationEnabled;
-    }
-
     public String getCloudEventsSpecVersion() {
         return cloudEventsSpecVersion;
     }
diff --git a/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeConversionProcessor.java b/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeConversionProcessor.java
deleted file mode 100644
index 433fa9e..0000000
--- a/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeConversionProcessor.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.knative;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.component.knative.spi.Knative;
-
-/**
- * Converts objects prior to serializing them to external endpoints or channels
- */
-@Deprecated
-public class KnativeConversionProcessor implements Processor {
-
-    private boolean enabled;
-
-    public KnativeConversionProcessor(boolean enabled) {
-        this.enabled = enabled;
-    }
-
-    @Override
-    public void process(Exchange exchange) throws Exception {
-        if (enabled) {
-            Object body = exchange.getIn().getBody();
-            if (body != null) {
-                byte[] newBody = Knative.MAPPER.writeValueAsBytes(body);
-                exchange.getIn().setBody(newBody);
-                exchange.getIn().setHeader(Exchange.CONTENT_TYPE, "application/json");
-            }
-        }
-    }
-}
diff --git a/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeEndpoint.java b/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeEndpoint.java
index b27b3bb..99b5bf3 100644
--- a/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeEndpoint.java
+++ b/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeEndpoint.java
@@ -75,7 +75,6 @@ public class KnativeEndpoint extends DefaultEndpoint {
     public Producer createProducer() throws Exception {
         final KnativeEnvironment.KnativeServiceDefinition service = lookupServiceDefinition(Knative.EndpointKind.sink);
         final Processor ceProcessor = cloudEvent.producer(this, service);
-        final Processor ceConverter = new KnativeConversionProcessor(configuration.isJsonSerializationEnabled());
         final Producer producer = getComponent().getTransport().createProducer(this, createTransportConfiguration(), service);
 
         PropertyBindingSupport.build()
@@ -85,7 +84,7 @@ public class KnativeEndpoint extends DefaultEndpoint {
             .withTarget(producer)
             .bind();
 
-        return new KnativeProducer(this, ceProcessor, ceConverter, e -> e.getMessage().removeHeader("Host"), producer);
+        return new KnativeProducer(this, ceProcessor, e -> e.getMessage().removeHeader("Host"), producer);
     }
 
     @Override