Use EventGsonProvider from Gerrit core
EventGsonProvider was moved to Gerrit Core and removed from
events-broker library.
Bug: Issue 14438
Change-Id: Icded4cae01110ee9094717a62920632588a88fad
diff --git a/external_plugin_deps.bzl b/external_plugin_deps.bzl
index 0d432f4..0ed499d 100644
--- a/external_plugin_deps.bzl
+++ b/external_plugin_deps.bzl
@@ -45,8 +45,8 @@
maven_jar(
name = "events-broker",
- artifact = "com.gerritforge:events-broker:3.4.0.1",
- sha1 = "2d406afa8787621442d855e4b458c97bd24f1198",
+ artifact = "com.gerritforge:events-broker:3.4.0.2",
+ sha1 = "8a56300ce92c3e25b4669a0511b4c520b34851b2",
)
maven_jar(
diff --git a/src/main/java/com/googlesource/gerrit/plugins/pubsub/Module.java b/src/main/java/com/googlesource/gerrit/plugins/pubsub/Module.java
index 32110dd..50fad61 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/pubsub/Module.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/pubsub/Module.java
@@ -14,16 +14,13 @@
package com.googlesource.gerrit.plugins.pubsub;
-import com.gerritforge.gerrit.eventbroker.EventGsonProvider;
import com.google.api.gax.core.CredentialsProvider;
import com.google.gerrit.extensions.config.FactoryModule;
import com.google.gerrit.extensions.events.LifecycleListener;
import com.google.gerrit.extensions.registration.DynamicSet;
import com.google.gerrit.server.events.EventListener;
-import com.google.gson.Gson;
import com.google.inject.Inject;
import com.google.inject.Scopes;
-import com.google.inject.Singleton;
import com.googlesource.gerrit.plugins.pubsub.local.EnvironmentChecker;
import com.googlesource.gerrit.plugins.pubsub.local.LocalCredentialsProvider;
import com.googlesource.gerrit.plugins.pubsub.local.LocalPublisherProvider;
@@ -42,7 +39,6 @@
@Override
protected void configure() {
- bind(Gson.class).toProvider(EventGsonProvider.class).in(Singleton.class);
DynamicSet.bind(binder(), LifecycleListener.class).to(Manager.class);
DynamicSet.bind(binder(), EventListener.class).to(PubSubEventListener.class);
factory(PubSubPublisher.Factory.class);
diff --git a/src/main/java/com/googlesource/gerrit/plugins/pubsub/PubSubPublisher.java b/src/main/java/com/googlesource/gerrit/plugins/pubsub/PubSubPublisher.java
index 850a96d..df69922 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/pubsub/PubSubPublisher.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/pubsub/PubSubPublisher.java
@@ -25,6 +25,7 @@
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.gerrit.server.events.Event;
+import com.google.gerrit.server.events.EventGson;
import com.google.gson.Gson;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
@@ -51,7 +52,7 @@
public PubSubPublisher(
PubSubConfiguration pubSubProperties,
PublisherProvider publisherProvider,
- Gson gson,
+ @EventGson Gson gson,
PubSubPublisherMetrics publisherMetrics,
@Assisted String topic)
throws IOException {
diff --git a/src/test/java/com/googlesource/gerrit/plugins/pubsub/PubSubBrokerApiIT.java b/src/test/java/com/googlesource/gerrit/plugins/pubsub/PubSubBrokerApiIT.java
index 08a200b..4506217 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/pubsub/PubSubBrokerApiIT.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/pubsub/PubSubBrokerApiIT.java
@@ -37,6 +37,7 @@
import com.google.gerrit.acceptance.WaitUtil;
import com.google.gerrit.acceptance.config.GerritConfig;
import com.google.gerrit.server.events.Event;
+import com.google.gerrit.server.events.EventGson;
import com.google.gerrit.server.events.ProjectCreatedEvent;
import com.google.gerrit.server.events.RefUpdatedEvent;
import com.google.gson.Gson;
@@ -72,7 +73,7 @@
private static final Duration TEST_TIMEOUT = Duration.ofSeconds(5);
private static final String PRIVATE_KEY_LOCATION = "not used in test";
- @Inject private Gson gson;
+ @Inject @EventGson private Gson gson;
private TransportChannelProvider channelProvider;
private NoCredentialsProvider credentialsProvider;