From 8f4cf056b863298b323c503ba3ee70f04d462eaf Mon Sep 17 00:00:00 2001 From: Julien Viet Date: Mon, 20 Nov 2023 15:13:13 +0100 Subject: [PATCH] Update to vertx builder changes --- .../admin/ClusterDescriptionConverter.java | 48 ++++++++--------- .../kafka/admin/ConfigEntryConverter.java | 12 ++--- .../kafka/admin/ConfigSynonymConverter.java | 14 ++--- .../ConsumerGroupDescriptionConverter.java | 52 +++++++++---------- .../admin/ListOffsetsResultInfoConverter.java | 14 ++--- .../admin/MemberDescriptionConverter.java | 20 +++---- .../vertx/kafka/admin/NewTopicConverter.java | 30 +++++------ .../admin/TopicDescriptionConverter.java | 28 +++++----- .../common/ConfigResourceConverter.java | 12 ++--- .../common/KafkaClientOptionsConverter.java | 14 ++--- .../client/common/tracing/TracingTest.java | 2 +- 11 files changed, 123 insertions(+), 123 deletions(-) diff --git a/src/main/generated/io/vertx/kafka/admin/ClusterDescriptionConverter.java b/src/main/generated/io/vertx/kafka/admin/ClusterDescriptionConverter.java index d6ca7dc3..3a1bad39 100644 --- a/src/main/generated/io/vertx/kafka/admin/ClusterDescriptionConverter.java +++ b/src/main/generated/io/vertx/kafka/admin/ClusterDescriptionConverter.java @@ -20,19 +20,14 @@ public class ClusterDescriptionConverter { public static void fromJson(Iterable> json, ClusterDescription obj) { for (java.util.Map.Entry member : json) { switch (member.getKey()) { - case "authorizedOperations": + case "nodes": if (member.getValue() instanceof JsonArray) { - java.util.LinkedHashSet list = new java.util.LinkedHashSet<>(); + java.util.ArrayList list = new java.util.ArrayList<>(); ((Iterable)member.getValue()).forEach( item -> { - if (item instanceof String) - list.add(org.apache.kafka.common.acl.AclOperation.valueOf((String)item)); + if (item instanceof JsonObject) + list.add(new io.vertx.kafka.client.common.Node((io.vertx.core.json.JsonObject)item)); }); - obj.setAuthorizedOperations(list); - } - break; - case "clusterId": - if (member.getValue() instanceof String) { - obj.setClusterId((String)member.getValue()); + obj.setNodes(list); } break; case "controller": @@ -40,14 +35,19 @@ public static void fromJson(Iterable> json, obj.setController(new io.vertx.kafka.client.common.Node((io.vertx.core.json.JsonObject)member.getValue())); } break; - case "nodes": + case "clusterId": + if (member.getValue() instanceof String) { + obj.setClusterId((String)member.getValue()); + } + break; + case "authorizedOperations": if (member.getValue() instanceof JsonArray) { - java.util.ArrayList list = new java.util.ArrayList<>(); + java.util.LinkedHashSet list = new java.util.LinkedHashSet<>(); ((Iterable)member.getValue()).forEach( item -> { - if (item instanceof JsonObject) - list.add(new io.vertx.kafka.client.common.Node((io.vertx.core.json.JsonObject)item)); + if (item instanceof String) + list.add(org.apache.kafka.common.acl.AclOperation.valueOf((String)item)); }); - obj.setNodes(list); + obj.setAuthorizedOperations(list); } break; } @@ -59,21 +59,21 @@ public static void toJson(ClusterDescription obj, JsonObject json) { } public static void toJson(ClusterDescription obj, java.util.Map json) { - if (obj.getAuthorizedOperations() != null) { + if (obj.getNodes() != null) { JsonArray array = new JsonArray(); - obj.getAuthorizedOperations().forEach(item -> array.add(item.name())); - json.put("authorizedOperations", array); - } - if (obj.getClusterId() != null) { - json.put("clusterId", obj.getClusterId()); + obj.getNodes().forEach(item -> array.add(item.toJson())); + json.put("nodes", array); } if (obj.getController() != null) { json.put("controller", obj.getController().toJson()); } - if (obj.getNodes() != null) { + if (obj.getClusterId() != null) { + json.put("clusterId", obj.getClusterId()); + } + if (obj.getAuthorizedOperations() != null) { JsonArray array = new JsonArray(); - obj.getNodes().forEach(item -> array.add(item.toJson())); - json.put("nodes", array); + obj.getAuthorizedOperations().forEach(item -> array.add(item.name())); + json.put("authorizedOperations", array); } } } diff --git a/src/main/generated/io/vertx/kafka/admin/ConfigEntryConverter.java b/src/main/generated/io/vertx/kafka/admin/ConfigEntryConverter.java index 7c1883a9..c28bd5dc 100644 --- a/src/main/generated/io/vertx/kafka/admin/ConfigEntryConverter.java +++ b/src/main/generated/io/vertx/kafka/admin/ConfigEntryConverter.java @@ -20,16 +20,16 @@ public class ConfigEntryConverter { public static void fromJson(Iterable> json, ConfigEntry obj) { for (java.util.Map.Entry member : json) { switch (member.getKey()) { - case "default": - if (member.getValue() instanceof Boolean) { - obj.setDefault((Boolean)member.getValue()); - } - break; case "name": if (member.getValue() instanceof String) { obj.setName((String)member.getValue()); } break; + case "default": + if (member.getValue() instanceof Boolean) { + obj.setDefault((Boolean)member.getValue()); + } + break; case "readOnly": if (member.getValue() instanceof Boolean) { obj.setReadOnly((Boolean)member.getValue()); @@ -69,10 +69,10 @@ public static void toJson(ConfigEntry obj, JsonObject json) { } public static void toJson(ConfigEntry obj, java.util.Map json) { - json.put("default", obj.isDefault()); if (obj.getName() != null) { json.put("name", obj.getName()); } + json.put("default", obj.isDefault()); json.put("readOnly", obj.isReadOnly()); json.put("sensitive", obj.isSensitive()); if (obj.getSource() != null) { diff --git a/src/main/generated/io/vertx/kafka/admin/ConfigSynonymConverter.java b/src/main/generated/io/vertx/kafka/admin/ConfigSynonymConverter.java index cf7d652a..0e893e4d 100644 --- a/src/main/generated/io/vertx/kafka/admin/ConfigSynonymConverter.java +++ b/src/main/generated/io/vertx/kafka/admin/ConfigSynonymConverter.java @@ -25,14 +25,14 @@ public static void fromJson(Iterable> json, obj.setName((String)member.getValue()); } break; - case "source": + case "value": if (member.getValue() instanceof String) { - obj.setSource(org.apache.kafka.clients.admin.ConfigEntry.ConfigSource.valueOf((String)member.getValue())); + obj.setValue((String)member.getValue()); } break; - case "value": + case "source": if (member.getValue() instanceof String) { - obj.setValue((String)member.getValue()); + obj.setSource(org.apache.kafka.clients.admin.ConfigEntry.ConfigSource.valueOf((String)member.getValue())); } break; } @@ -47,11 +47,11 @@ public static void toJson(ConfigSynonym obj, java.util.Map json) if (obj.getName() != null) { json.put("name", obj.getName()); } - if (obj.getSource() != null) { - json.put("source", obj.getSource().name()); - } if (obj.getValue() != null) { json.put("value", obj.getValue()); } + if (obj.getSource() != null) { + json.put("source", obj.getSource().name()); + } } } diff --git a/src/main/generated/io/vertx/kafka/admin/ConsumerGroupDescriptionConverter.java b/src/main/generated/io/vertx/kafka/admin/ConsumerGroupDescriptionConverter.java index e1cdc41e..379b9dde 100644 --- a/src/main/generated/io/vertx/kafka/admin/ConsumerGroupDescriptionConverter.java +++ b/src/main/generated/io/vertx/kafka/admin/ConsumerGroupDescriptionConverter.java @@ -20,14 +20,14 @@ public class ConsumerGroupDescriptionConverter { public static void fromJson(Iterable> json, ConsumerGroupDescription obj) { for (java.util.Map.Entry member : json) { switch (member.getKey()) { - case "authorizedOperations": - if (member.getValue() instanceof JsonArray) { - java.util.LinkedHashSet list = new java.util.LinkedHashSet<>(); - ((Iterable)member.getValue()).forEach( item -> { - if (item instanceof String) - list.add(org.apache.kafka.common.acl.AclOperation.valueOf((String)item)); - }); - obj.setAuthorizedOperations(list); + case "groupId": + if (member.getValue() instanceof String) { + obj.setGroupId((String)member.getValue()); + } + break; + case "simpleConsumerGroup": + if (member.getValue() instanceof Boolean) { + obj.setSimpleConsumerGroup((Boolean)member.getValue()); } break; case "coordinator": @@ -35,11 +35,6 @@ public static void fromJson(Iterable> json, obj.setCoordinator(new io.vertx.kafka.client.common.Node((io.vertx.core.json.JsonObject)member.getValue())); } break; - case "groupId": - if (member.getValue() instanceof String) { - obj.setGroupId((String)member.getValue()); - } - break; case "members": if (member.getValue() instanceof JsonArray) { java.util.ArrayList list = new java.util.ArrayList<>(); @@ -55,16 +50,21 @@ public static void fromJson(Iterable> json, obj.setPartitionAssignor((String)member.getValue()); } break; - case "simpleConsumerGroup": - if (member.getValue() instanceof Boolean) { - obj.setSimpleConsumerGroup((Boolean)member.getValue()); - } - break; case "state": if (member.getValue() instanceof String) { obj.setState(org.apache.kafka.common.ConsumerGroupState.valueOf((String)member.getValue())); } break; + case "authorizedOperations": + if (member.getValue() instanceof JsonArray) { + java.util.LinkedHashSet list = new java.util.LinkedHashSet<>(); + ((Iterable)member.getValue()).forEach( item -> { + if (item instanceof String) + list.add(org.apache.kafka.common.acl.AclOperation.valueOf((String)item)); + }); + obj.setAuthorizedOperations(list); + } + break; } } } @@ -74,17 +74,13 @@ public static void toJson(ConsumerGroupDescription obj, JsonObject json) { } public static void toJson(ConsumerGroupDescription obj, java.util.Map json) { - if (obj.getAuthorizedOperations() != null) { - JsonArray array = new JsonArray(); - obj.getAuthorizedOperations().forEach(item -> array.add(item.name())); - json.put("authorizedOperations", array); + if (obj.getGroupId() != null) { + json.put("groupId", obj.getGroupId()); } + json.put("simpleConsumerGroup", obj.isSimpleConsumerGroup()); if (obj.getCoordinator() != null) { json.put("coordinator", obj.getCoordinator().toJson()); } - if (obj.getGroupId() != null) { - json.put("groupId", obj.getGroupId()); - } if (obj.getMembers() != null) { JsonArray array = new JsonArray(); obj.getMembers().forEach(item -> array.add(item.toJson())); @@ -93,9 +89,13 @@ public static void toJson(ConsumerGroupDescription obj, java.util.Map array.add(item.name())); + json.put("authorizedOperations", array); + } } } diff --git a/src/main/generated/io/vertx/kafka/admin/ListOffsetsResultInfoConverter.java b/src/main/generated/io/vertx/kafka/admin/ListOffsetsResultInfoConverter.java index 4feadbb7..855cbd06 100644 --- a/src/main/generated/io/vertx/kafka/admin/ListOffsetsResultInfoConverter.java +++ b/src/main/generated/io/vertx/kafka/admin/ListOffsetsResultInfoConverter.java @@ -20,11 +20,6 @@ public class ListOffsetsResultInfoConverter { public static void fromJson(Iterable> json, ListOffsetsResultInfo obj) { for (java.util.Map.Entry member : json) { switch (member.getKey()) { - case "leaderEpoch": - if (member.getValue() instanceof Number) { - obj.setLeaderEpoch(((Number)member.getValue()).intValue()); - } - break; case "offset": if (member.getValue() instanceof Number) { obj.setOffset(((Number)member.getValue()).longValue()); @@ -35,6 +30,11 @@ public static void fromJson(Iterable> json, obj.setTimestamp(((Number)member.getValue()).longValue()); } break; + case "leaderEpoch": + if (member.getValue() instanceof Number) { + obj.setLeaderEpoch(((Number)member.getValue()).intValue()); + } + break; } } } @@ -44,10 +44,10 @@ public static void toJson(ListOffsetsResultInfo obj, JsonObject json) { } public static void toJson(ListOffsetsResultInfo obj, java.util.Map json) { + json.put("offset", obj.getOffset()); + json.put("timestamp", obj.getTimestamp()); if (obj.getLeaderEpoch() != null) { json.put("leaderEpoch", obj.getLeaderEpoch()); } - json.put("offset", obj.getOffset()); - json.put("timestamp", obj.getTimestamp()); } } diff --git a/src/main/generated/io/vertx/kafka/admin/MemberDescriptionConverter.java b/src/main/generated/io/vertx/kafka/admin/MemberDescriptionConverter.java index f789c984..645df24b 100644 --- a/src/main/generated/io/vertx/kafka/admin/MemberDescriptionConverter.java +++ b/src/main/generated/io/vertx/kafka/admin/MemberDescriptionConverter.java @@ -20,9 +20,9 @@ public class MemberDescriptionConverter { public static void fromJson(Iterable> json, MemberDescription obj) { for (java.util.Map.Entry member : json) { switch (member.getKey()) { - case "assignment": - if (member.getValue() instanceof JsonObject) { - obj.setAssignment(new io.vertx.kafka.admin.MemberAssignment((io.vertx.core.json.JsonObject)member.getValue())); + case "consumerId": + if (member.getValue() instanceof String) { + obj.setConsumerId((String)member.getValue()); } break; case "clientId": @@ -30,9 +30,9 @@ public static void fromJson(Iterable> json, obj.setClientId((String)member.getValue()); } break; - case "consumerId": - if (member.getValue() instanceof String) { - obj.setConsumerId((String)member.getValue()); + case "assignment": + if (member.getValue() instanceof JsonObject) { + obj.setAssignment(new io.vertx.kafka.admin.MemberAssignment((io.vertx.core.json.JsonObject)member.getValue())); } break; case "host": @@ -49,14 +49,14 @@ public static void toJson(MemberDescription obj, JsonObject json) { } public static void toJson(MemberDescription obj, java.util.Map json) { - if (obj.getAssignment() != null) { - json.put("assignment", obj.getAssignment().toJson()); + if (obj.getConsumerId() != null) { + json.put("consumerId", obj.getConsumerId()); } if (obj.getClientId() != null) { json.put("clientId", obj.getClientId()); } - if (obj.getConsumerId() != null) { - json.put("consumerId", obj.getConsumerId()); + if (obj.getAssignment() != null) { + json.put("assignment", obj.getAssignment().toJson()); } if (obj.getHost() != null) { json.put("host", obj.getHost()); diff --git a/src/main/generated/io/vertx/kafka/admin/NewTopicConverter.java b/src/main/generated/io/vertx/kafka/admin/NewTopicConverter.java index e7afb066..9aeaf578 100644 --- a/src/main/generated/io/vertx/kafka/admin/NewTopicConverter.java +++ b/src/main/generated/io/vertx/kafka/admin/NewTopicConverter.java @@ -20,16 +20,6 @@ public class NewTopicConverter { public static void fromJson(Iterable> json, NewTopic obj) { for (java.util.Map.Entry member : json) { switch (member.getKey()) { - case "config": - if (member.getValue() instanceof JsonObject) { - java.util.Map map = new java.util.LinkedHashMap<>(); - ((Iterable>)member.getValue()).forEach(entry -> { - if (entry.getValue() instanceof String) - map.put(entry.getKey(), (String)entry.getValue()); - }); - obj.setConfig(map); - } - break; case "name": if (member.getValue() instanceof String) { obj.setName((String)member.getValue()); @@ -45,6 +35,16 @@ public static void fromJson(Iterable> json, obj.setReplicationFactor(((Number)member.getValue()).shortValue()); } break; + case "config": + if (member.getValue() instanceof JsonObject) { + java.util.Map map = new java.util.LinkedHashMap<>(); + ((Iterable>)member.getValue()).forEach(entry -> { + if (entry.getValue() instanceof String) + map.put(entry.getKey(), (String)entry.getValue()); + }); + obj.setConfig(map); + } + break; } } } @@ -54,15 +54,15 @@ public static void toJson(NewTopic obj, JsonObject json) { } public static void toJson(NewTopic obj, java.util.Map json) { - if (obj.getConfig() != null) { - JsonObject map = new JsonObject(); - obj.getConfig().forEach((key, value) -> map.put(key, value)); - json.put("config", map); - } if (obj.getName() != null) { json.put("name", obj.getName()); } json.put("numPartitions", obj.getNumPartitions()); json.put("replicationFactor", obj.getReplicationFactor()); + if (obj.getConfig() != null) { + JsonObject map = new JsonObject(); + obj.getConfig().forEach((key, value) -> map.put(key, value)); + json.put("config", map); + } } } diff --git a/src/main/generated/io/vertx/kafka/admin/TopicDescriptionConverter.java b/src/main/generated/io/vertx/kafka/admin/TopicDescriptionConverter.java index ab4f0487..50e12572 100644 --- a/src/main/generated/io/vertx/kafka/admin/TopicDescriptionConverter.java +++ b/src/main/generated/io/vertx/kafka/admin/TopicDescriptionConverter.java @@ -20,16 +20,6 @@ public class TopicDescriptionConverter { public static void fromJson(Iterable> json, TopicDescription obj) { for (java.util.Map.Entry member : json) { switch (member.getKey()) { - case "authorizedOperations": - if (member.getValue() instanceof JsonArray) { - java.util.LinkedHashSet list = new java.util.LinkedHashSet<>(); - ((Iterable)member.getValue()).forEach( item -> { - if (item instanceof String) - list.add(org.apache.kafka.common.acl.AclOperation.valueOf((String)item)); - }); - obj.setAuthorizedOperations(list); - } - break; case "internal": if (member.getValue() instanceof Boolean) { obj.setInternal((Boolean)member.getValue()); @@ -40,6 +30,16 @@ public static void fromJson(Iterable> json, obj.setName((String)member.getValue()); } break; + case "authorizedOperations": + if (member.getValue() instanceof JsonArray) { + java.util.LinkedHashSet list = new java.util.LinkedHashSet<>(); + ((Iterable)member.getValue()).forEach( item -> { + if (item instanceof String) + list.add(org.apache.kafka.common.acl.AclOperation.valueOf((String)item)); + }); + obj.setAuthorizedOperations(list); + } + break; case "partitions": if (member.getValue() instanceof JsonArray) { java.util.ArrayList list = new java.util.ArrayList<>(); @@ -59,15 +59,15 @@ public static void toJson(TopicDescription obj, JsonObject json) { } public static void toJson(TopicDescription obj, java.util.Map json) { + json.put("internal", obj.isInternal()); + if (obj.getName() != null) { + json.put("name", obj.getName()); + } if (obj.getAuthorizedOperations() != null) { JsonArray array = new JsonArray(); obj.getAuthorizedOperations().forEach(item -> array.add(item.name())); json.put("authorizedOperations", array); } - json.put("internal", obj.isInternal()); - if (obj.getName() != null) { - json.put("name", obj.getName()); - } if (obj.getPartitions() != null) { JsonArray array = new JsonArray(); obj.getPartitions().forEach(item -> array.add(item.toJson())); diff --git a/src/main/generated/io/vertx/kafka/client/common/ConfigResourceConverter.java b/src/main/generated/io/vertx/kafka/client/common/ConfigResourceConverter.java index b7750240..11d44e23 100644 --- a/src/main/generated/io/vertx/kafka/client/common/ConfigResourceConverter.java +++ b/src/main/generated/io/vertx/kafka/client/common/ConfigResourceConverter.java @@ -20,16 +20,16 @@ public class ConfigResourceConverter { public static void fromJson(Iterable> json, ConfigResource obj) { for (java.util.Map.Entry member : json) { switch (member.getKey()) { - case "default": - if (member.getValue() instanceof Boolean) { - obj.setDefault((Boolean)member.getValue()); - } - break; case "name": if (member.getValue() instanceof String) { obj.setName((String)member.getValue()); } break; + case "default": + if (member.getValue() instanceof Boolean) { + obj.setDefault((Boolean)member.getValue()); + } + break; case "type": if (member.getValue() instanceof String) { obj.setType(org.apache.kafka.common.config.ConfigResource.Type.valueOf((String)member.getValue())); @@ -44,10 +44,10 @@ public static void toJson(ConfigResource obj, JsonObject json) { } public static void toJson(ConfigResource obj, java.util.Map json) { - json.put("default", obj.isDefault()); if (obj.getName() != null) { json.put("name", obj.getName()); } + json.put("default", obj.isDefault()); if (obj.getType() != null) { json.put("type", obj.getType().name()); } diff --git a/src/main/generated/io/vertx/kafka/client/common/KafkaClientOptionsConverter.java b/src/main/generated/io/vertx/kafka/client/common/KafkaClientOptionsConverter.java index 9242e1a3..14ad9b23 100644 --- a/src/main/generated/io/vertx/kafka/client/common/KafkaClientOptionsConverter.java +++ b/src/main/generated/io/vertx/kafka/client/common/KafkaClientOptionsConverter.java @@ -30,14 +30,14 @@ public static void fromJson(Iterable> json, obj.setConfig(map); } break; - case "tracePeerAddress": + case "tracingPolicy": if (member.getValue() instanceof String) { - obj.setTracePeerAddress((String)member.getValue()); + obj.setTracingPolicy(io.vertx.core.tracing.TracingPolicy.valueOf((String)member.getValue())); } break; - case "tracingPolicy": + case "tracePeerAddress": if (member.getValue() instanceof String) { - obj.setTracingPolicy(io.vertx.core.tracing.TracingPolicy.valueOf((String)member.getValue())); + obj.setTracePeerAddress((String)member.getValue()); } break; } @@ -54,11 +54,11 @@ public static void toJson(KafkaClientOptions obj, java.util.Map obj.getConfig().forEach((key, value) -> map.put(key, value)); json.put("config", map); } - if (obj.getTracePeerAddress() != null) { - json.put("tracePeerAddress", obj.getTracePeerAddress()); - } if (obj.getTracingPolicy() != null) { json.put("tracingPolicy", obj.getTracingPolicy().name()); } + if (obj.getTracePeerAddress() != null) { + json.put("tracePeerAddress", obj.getTracePeerAddress()); + } } } diff --git a/src/test/java/io/vertx/kafka/client/common/tracing/TracingTest.java b/src/test/java/io/vertx/kafka/client/common/tracing/TracingTest.java index 343f43b6..272d50f9 100644 --- a/src/test/java/io/vertx/kafka/client/common/tracing/TracingTest.java +++ b/src/test/java/io/vertx/kafka/client/common/tracing/TracingTest.java @@ -64,7 +64,7 @@ public class TracingTest extends KafkaClusterTestBase { @Before public void beforeTest(TestContext ctx) { tracer = new TestTracer(ctx); - vertx = Vertx.vertx(new VertxOptions().setTracingOptions(new TracingOptions().setFactory(tracingOptions -> tracer))); + vertx = Vertx.builder().withTracer(tracingOptions -> tracer).build(); } @After