kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ewe...@apache.org
Subject [kafka] branch 2.0 updated: KAFKA-7056: Moved Connect’s new numeric converters to runtime (KIP-305)
Date Fri, 15 Jun 2018 21:52:55 GMT
This is an automated email from the ASF dual-hosted git repository.

ewencp pushed a commit to branch 2.0
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/2.0 by this push:
     new e166188  KAFKA-7056: Moved Connect’s new numeric converters to runtime (KIP-305)
e166188 is described below

commit e1661884df5297d70478da83342403ad98a1dc9b
Author: Randall Hauch <rhauch@gmail.com>
AuthorDate: Fri Jun 15 14:52:28 2018 -0700

    KAFKA-7056: Moved Connect’s new numeric converters to runtime (KIP-305)
    
    KIP-305 added numeric converters to Connect, but these were added in Connect’s API module
in the same package as the `StringConverter`. This commit moves them into the Runtime module
and into the `converters` package where the `ByteArrayConverter` already lives. These numeric
converters have not yet been included in a release, and so they can be moved without concern.
    
    All of Connect’s converters must be referenced in worker / connector configurations
and are therefore part of the API, but otherwise do not need to be in the “api” module
as they do not need to be instantiated or directly used by extensions. This change makes them
more similar to and aligned with the `ByteArrayConverter`.
    
    It also gives us the opportunity to move them into the “api” module in the future
(keeping the same package name), should we ever want or need to do so. However, if we were
to start out with them in the “api” module, we would never be able to move them out into
the “runtime” module, even if we kept the same package name. Therefore, moving them to
“runtime” now gives us a bit more flexibility.
    
    This PR moves the unit tests for the numeric converters accordingly, and updates the `PluginsUtil`
and `PluginUtilsTest` as well.
    
    Author: Randall Hauch <rhauch@gmail.com>
    
    Reviewers: Konstantine Karantasis <konstantine@confluent.io>, Ewen Cheslack-Postava
<ewen@confluent.io>
    
    Closes #5222 from rhauch/kafka-7056
    
    (cherry picked from commit fab8b7e676bcaf4faf84d563ab48e3ebee61b4ab)
    Signed-off-by: Ewen Cheslack-Postava <me@ewencp.org>
---
 .../org/apache/kafka/connect/converters}/DoubleConverter.java  |  4 +++-
 .../org/apache/kafka/connect/converters}/FloatConverter.java   |  4 +++-
 .../org/apache/kafka/connect/converters}/IntegerConverter.java |  4 +++-
 .../org/apache/kafka/connect/converters}/LongConverter.java    |  4 +++-
 .../org/apache/kafka/connect/converters}/NumberConverter.java  |  6 +++++-
 .../kafka/connect/converters}/NumberConverterConfig.java       |  3 ++-
 .../org/apache/kafka/connect/converters}/ShortConverter.java   |  4 +++-
 .../apache/kafka/connect/runtime/isolation/PluginUtils.java    |  5 -----
 .../apache/kafka/connect/converters}/DoubleConverterTest.java  |  2 +-
 .../apache/kafka/connect/converters}/FloatConverterTest.java   |  2 +-
 .../apache/kafka/connect/converters}/IntegerConverterTest.java |  2 +-
 .../apache/kafka/connect/converters}/LongConverterTest.java    |  2 +-
 .../apache/kafka/connect/converters}/NumberConverterTest.java  |  2 +-
 .../apache/kafka/connect/converters}/ShortConverterTest.java   |  2 +-
 .../kafka/connect/runtime/isolation/PluginUtilsTest.java       | 10 +++++-----
 15 files changed, 33 insertions(+), 23 deletions(-)

diff --git a/connect/api/src/main/java/org/apache/kafka/connect/storage/DoubleConverter.java
b/connect/runtime/src/main/java/org/apache/kafka/connect/converters/DoubleConverter.java
similarity index 91%
rename from connect/api/src/main/java/org/apache/kafka/connect/storage/DoubleConverter.java
rename to connect/runtime/src/main/java/org/apache/kafka/connect/converters/DoubleConverter.java
index 04019a7..684caa1 100644
--- a/connect/api/src/main/java/org/apache/kafka/connect/storage/DoubleConverter.java
+++ b/connect/runtime/src/main/java/org/apache/kafka/connect/converters/DoubleConverter.java
@@ -14,11 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.kafka.connect.storage;
+package org.apache.kafka.connect.converters;
 
 import org.apache.kafka.common.serialization.DoubleDeserializer;
 import org.apache.kafka.common.serialization.DoubleSerializer;
 import org.apache.kafka.connect.data.Schema;
+import org.apache.kafka.connect.storage.Converter;
+import org.apache.kafka.connect.storage.HeaderConverter;
 
 /**
  * {@link Converter} and {@link HeaderConverter} implementation that only supports serializing
to and deserializing from double values.
diff --git a/connect/api/src/main/java/org/apache/kafka/connect/storage/FloatConverter.java
b/connect/runtime/src/main/java/org/apache/kafka/connect/converters/FloatConverter.java
similarity index 91%
rename from connect/api/src/main/java/org/apache/kafka/connect/storage/FloatConverter.java
rename to connect/runtime/src/main/java/org/apache/kafka/connect/converters/FloatConverter.java
index 16bf0e0..3f92b96 100644
--- a/connect/api/src/main/java/org/apache/kafka/connect/storage/FloatConverter.java
+++ b/connect/runtime/src/main/java/org/apache/kafka/connect/converters/FloatConverter.java
@@ -14,11 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.kafka.connect.storage;
+package org.apache.kafka.connect.converters;
 
 import org.apache.kafka.common.serialization.FloatDeserializer;
 import org.apache.kafka.common.serialization.FloatSerializer;
 import org.apache.kafka.connect.data.Schema;
+import org.apache.kafka.connect.storage.Converter;
+import org.apache.kafka.connect.storage.HeaderConverter;
 
 /**
  * {@link Converter} and {@link HeaderConverter} implementation that only supports serializing
to and deserializing from float values.
diff --git a/connect/api/src/main/java/org/apache/kafka/connect/storage/IntegerConverter.java
b/connect/runtime/src/main/java/org/apache/kafka/connect/converters/IntegerConverter.java
similarity index 91%
rename from connect/api/src/main/java/org/apache/kafka/connect/storage/IntegerConverter.java
rename to connect/runtime/src/main/java/org/apache/kafka/connect/converters/IntegerConverter.java
index 6f3c78a..f5388ce 100644
--- a/connect/api/src/main/java/org/apache/kafka/connect/storage/IntegerConverter.java
+++ b/connect/runtime/src/main/java/org/apache/kafka/connect/converters/IntegerConverter.java
@@ -14,11 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.kafka.connect.storage;
+package org.apache.kafka.connect.converters;
 
 import org.apache.kafka.common.serialization.IntegerDeserializer;
 import org.apache.kafka.common.serialization.IntegerSerializer;
 import org.apache.kafka.connect.data.Schema;
+import org.apache.kafka.connect.storage.Converter;
+import org.apache.kafka.connect.storage.HeaderConverter;
 
 /**
  * {@link Converter} and {@link HeaderConverter} implementation that only supports serializing
to and deserializing from integer values.
diff --git a/connect/api/src/main/java/org/apache/kafka/connect/storage/LongConverter.java
b/connect/runtime/src/main/java/org/apache/kafka/connect/converters/LongConverter.java
similarity index 91%
rename from connect/api/src/main/java/org/apache/kafka/connect/storage/LongConverter.java
rename to connect/runtime/src/main/java/org/apache/kafka/connect/converters/LongConverter.java
index 600c304..f91f4fa 100644
--- a/connect/api/src/main/java/org/apache/kafka/connect/storage/LongConverter.java
+++ b/connect/runtime/src/main/java/org/apache/kafka/connect/converters/LongConverter.java
@@ -14,11 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.kafka.connect.storage;
+package org.apache.kafka.connect.converters;
 
 import org.apache.kafka.common.serialization.LongDeserializer;
 import org.apache.kafka.common.serialization.LongSerializer;
 import org.apache.kafka.connect.data.Schema;
+import org.apache.kafka.connect.storage.Converter;
+import org.apache.kafka.connect.storage.HeaderConverter;
 
 /**
  * {@link Converter} and {@link HeaderConverter} implementation that only supports serializing
to and deserializing from long values.
diff --git a/connect/api/src/main/java/org/apache/kafka/connect/storage/NumberConverter.java
b/connect/runtime/src/main/java/org/apache/kafka/connect/converters/NumberConverter.java
similarity index 94%
rename from connect/api/src/main/java/org/apache/kafka/connect/storage/NumberConverter.java
rename to connect/runtime/src/main/java/org/apache/kafka/connect/converters/NumberConverter.java
index 9180444..131a097 100644
--- a/connect/api/src/main/java/org/apache/kafka/connect/storage/NumberConverter.java
+++ b/connect/runtime/src/main/java/org/apache/kafka/connect/converters/NumberConverter.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.kafka.connect.storage;
+package org.apache.kafka.connect.converters;
 
 import org.apache.kafka.common.config.ConfigDef;
 import org.apache.kafka.common.errors.SerializationException;
@@ -23,6 +23,10 @@ import org.apache.kafka.common.serialization.Serializer;
 import org.apache.kafka.connect.data.Schema;
 import org.apache.kafka.connect.data.SchemaAndValue;
 import org.apache.kafka.connect.errors.DataException;
+import org.apache.kafka.connect.storage.Converter;
+import org.apache.kafka.connect.storage.ConverterType;
+import org.apache.kafka.connect.storage.HeaderConverter;
+import org.apache.kafka.connect.storage.StringConverterConfig;
 
 import java.io.IOException;
 import java.util.HashMap;
diff --git a/connect/api/src/main/java/org/apache/kafka/connect/storage/NumberConverterConfig.java
b/connect/runtime/src/main/java/org/apache/kafka/connect/converters/NumberConverterConfig.java
similarity index 93%
rename from connect/api/src/main/java/org/apache/kafka/connect/storage/NumberConverterConfig.java
rename to connect/runtime/src/main/java/org/apache/kafka/connect/converters/NumberConverterConfig.java
index 2f7019d..49ad986 100644
--- a/connect/api/src/main/java/org/apache/kafka/connect/storage/NumberConverterConfig.java
+++ b/connect/runtime/src/main/java/org/apache/kafka/connect/converters/NumberConverterConfig.java
@@ -14,9 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.kafka.connect.storage;
+package org.apache.kafka.connect.converters;
 
 import org.apache.kafka.common.config.ConfigDef;
+import org.apache.kafka.connect.storage.ConverterConfig;
 
 import java.util.Map;
 
diff --git a/connect/api/src/main/java/org/apache/kafka/connect/storage/ShortConverter.java
b/connect/runtime/src/main/java/org/apache/kafka/connect/converters/ShortConverter.java
similarity index 91%
rename from connect/api/src/main/java/org/apache/kafka/connect/storage/ShortConverter.java
rename to connect/runtime/src/main/java/org/apache/kafka/connect/converters/ShortConverter.java
index 9a769ff..1c455b1 100644
--- a/connect/api/src/main/java/org/apache/kafka/connect/storage/ShortConverter.java
+++ b/connect/runtime/src/main/java/org/apache/kafka/connect/converters/ShortConverter.java
@@ -14,11 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.kafka.connect.storage;
+package org.apache.kafka.connect.converters;
 
 import org.apache.kafka.common.serialization.ShortDeserializer;
 import org.apache.kafka.common.serialization.ShortSerializer;
 import org.apache.kafka.connect.data.Schema;
+import org.apache.kafka.connect.storage.Converter;
+import org.apache.kafka.connect.storage.HeaderConverter;
 
 /**
  * {@link Converter} and {@link HeaderConverter} implementation that only supports serializing
to and deserializing from short values.
diff --git a/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/isolation/PluginUtils.java
b/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/isolation/PluginUtils.java
index 7468220..9c4151b 100644
--- a/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/isolation/PluginUtils.java
+++ b/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/isolation/PluginUtils.java
@@ -127,11 +127,6 @@ public class PluginUtils {
             + "|json\\..*"
             + "|file\\..*"
             + "|converters\\..*"
-            + "|storage\\.DoubleConverter"
-            + "|storage\\.FloatConverter"
-            + "|storage\\.IntegerConverter"
-            + "|storage\\.LongConverter"
-            + "|storage\\.ShortConverter"
             + "|storage\\.StringConverter"
             + "|rest\\.basic\\.auth\\.extension\\.BasicAuthSecurityRestExtension"
             + ")"
diff --git a/connect/api/src/test/java/org/apache/kafka/connect/storage/DoubleConverterTest.java
b/connect/runtime/src/test/java/org/apache/kafka/connect/converters/DoubleConverterTest.java
similarity index 97%
rename from connect/api/src/test/java/org/apache/kafka/connect/storage/DoubleConverterTest.java
rename to connect/runtime/src/test/java/org/apache/kafka/connect/converters/DoubleConverterTest.java
index 1744083..acc3dde 100644
--- a/connect/api/src/test/java/org/apache/kafka/connect/storage/DoubleConverterTest.java
+++ b/connect/runtime/src/test/java/org/apache/kafka/connect/converters/DoubleConverterTest.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.kafka.connect.storage;
+package org.apache.kafka.connect.converters;
 
 import org.apache.kafka.common.serialization.DoubleSerializer;
 import org.apache.kafka.common.serialization.Serializer;
diff --git a/connect/api/src/test/java/org/apache/kafka/connect/storage/FloatConverterTest.java
b/connect/runtime/src/test/java/org/apache/kafka/connect/converters/FloatConverterTest.java
similarity index 97%
rename from connect/api/src/test/java/org/apache/kafka/connect/storage/FloatConverterTest.java
rename to connect/runtime/src/test/java/org/apache/kafka/connect/converters/FloatConverterTest.java
index 57a1860..e95ff56 100644
--- a/connect/api/src/test/java/org/apache/kafka/connect/storage/FloatConverterTest.java
+++ b/connect/runtime/src/test/java/org/apache/kafka/connect/converters/FloatConverterTest.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.kafka.connect.storage;
+package org.apache.kafka.connect.converters;
 
 import org.apache.kafka.common.serialization.FloatSerializer;
 import org.apache.kafka.common.serialization.Serializer;
diff --git a/connect/api/src/test/java/org/apache/kafka/connect/storage/IntegerConverterTest.java
b/connect/runtime/src/test/java/org/apache/kafka/connect/converters/IntegerConverterTest.java
similarity index 97%
rename from connect/api/src/test/java/org/apache/kafka/connect/storage/IntegerConverterTest.java
rename to connect/runtime/src/test/java/org/apache/kafka/connect/converters/IntegerConverterTest.java
index 33fbe60..0c9ed28 100644
--- a/connect/api/src/test/java/org/apache/kafka/connect/storage/IntegerConverterTest.java
+++ b/connect/runtime/src/test/java/org/apache/kafka/connect/converters/IntegerConverterTest.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.kafka.connect.storage;
+package org.apache.kafka.connect.converters;
 
 import org.apache.kafka.common.serialization.IntegerSerializer;
 import org.apache.kafka.common.serialization.Serializer;
diff --git a/connect/api/src/test/java/org/apache/kafka/connect/storage/LongConverterTest.java
b/connect/runtime/src/test/java/org/apache/kafka/connect/converters/LongConverterTest.java
similarity index 97%
rename from connect/api/src/test/java/org/apache/kafka/connect/storage/LongConverterTest.java
rename to connect/runtime/src/test/java/org/apache/kafka/connect/converters/LongConverterTest.java
index 8f41bb5..35d26b7 100644
--- a/connect/api/src/test/java/org/apache/kafka/connect/storage/LongConverterTest.java
+++ b/connect/runtime/src/test/java/org/apache/kafka/connect/converters/LongConverterTest.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.kafka.connect.storage;
+package org.apache.kafka.connect.converters;
 
 import org.apache.kafka.common.serialization.LongSerializer;
 import org.apache.kafka.common.serialization.Serializer;
diff --git a/connect/api/src/test/java/org/apache/kafka/connect/storage/NumberConverterTest.java
b/connect/runtime/src/test/java/org/apache/kafka/connect/converters/NumberConverterTest.java
similarity index 98%
rename from connect/api/src/test/java/org/apache/kafka/connect/storage/NumberConverterTest.java
rename to connect/runtime/src/test/java/org/apache/kafka/connect/converters/NumberConverterTest.java
index 2936a71..2bd0732 100644
--- a/connect/api/src/test/java/org/apache/kafka/connect/storage/NumberConverterTest.java
+++ b/connect/runtime/src/test/java/org/apache/kafka/connect/converters/NumberConverterTest.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.kafka.connect.storage;
+package org.apache.kafka.connect.converters;
 
 import org.apache.kafka.common.serialization.Serializer;
 import org.apache.kafka.connect.data.Schema;
diff --git a/connect/api/src/test/java/org/apache/kafka/connect/storage/ShortConverterTest.java
b/connect/runtime/src/test/java/org/apache/kafka/connect/converters/ShortConverterTest.java
similarity index 97%
rename from connect/api/src/test/java/org/apache/kafka/connect/storage/ShortConverterTest.java
rename to connect/runtime/src/test/java/org/apache/kafka/connect/converters/ShortConverterTest.java
index 871f398..d1237c9 100644
--- a/connect/api/src/test/java/org/apache/kafka/connect/storage/ShortConverterTest.java
+++ b/connect/runtime/src/test/java/org/apache/kafka/connect/converters/ShortConverterTest.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.kafka.connect.storage;
+package org.apache.kafka.connect.converters;
 
 import org.apache.kafka.common.serialization.Serializer;
 import org.apache.kafka.common.serialization.ShortSerializer;
diff --git a/connect/runtime/src/test/java/org/apache/kafka/connect/runtime/isolation/PluginUtilsTest.java
b/connect/runtime/src/test/java/org/apache/kafka/connect/runtime/isolation/PluginUtilsTest.java
index a17520f..216e3ce 100644
--- a/connect/runtime/src/test/java/org/apache/kafka/connect/runtime/isolation/PluginUtilsTest.java
+++ b/connect/runtime/src/test/java/org/apache/kafka/connect/runtime/isolation/PluginUtilsTest.java
@@ -147,19 +147,19 @@ public class PluginUtilsTest {
                 "org.apache.kafka.connect.converters.ByteArrayConverter")
         );
         assertTrue(PluginUtils.shouldLoadInIsolation(
-                "org.apache.kafka.connect.storage.DoubleConverter")
+                "org.apache.kafka.connect.converters.DoubleConverter")
         );
         assertTrue(PluginUtils.shouldLoadInIsolation(
-                "org.apache.kafka.connect.storage.FloatConverter")
+                "org.apache.kafka.connect.converters.FloatConverter")
         );
         assertTrue(PluginUtils.shouldLoadInIsolation(
-                "org.apache.kafka.connect.storage.IntegerConverter")
+                "org.apache.kafka.connect.converters.IntegerConverter")
         );
         assertTrue(PluginUtils.shouldLoadInIsolation(
-                "org.apache.kafka.connect.storage.LongConverter")
+                "org.apache.kafka.connect.converters.LongConverter")
         );
         assertTrue(PluginUtils.shouldLoadInIsolation(
-                "org.apache.kafka.connect.storage.ShortConverter")
+                "org.apache.kafka.connect.converters.ShortConverter")
         );
         assertTrue(PluginUtils.shouldLoadInIsolation(
                 "org.apache.kafka.connect.storage.StringConverter")

-- 
To stop receiving notification emails like this one, please contact
ewencp@apache.org.

Mime
View raw message