From 2da8ea0185e3449d3c069376c1a7c5d1ca64e325 Mon Sep 17 00:00:00 2001 From: Lai Jiang Date: Wed, 4 Oct 2023 17:02:13 -0400 Subject: [PATCH] Replace JacksonFactory with GsonFactory (#2173) JacksonFactory is deprecated and GsonFactory is the recommended replacement. --- .../registry/groups/DirectoryGroupsConnectionTest.java | 4 ++-- .../src/test/java/google/registry/tools/AuthModuleTest.java | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/src/test/java/google/registry/groups/DirectoryGroupsConnectionTest.java b/core/src/test/java/google/registry/groups/DirectoryGroupsConnectionTest.java index f4aa0a149..7c501a7a1 100644 --- a/core/src/test/java/google/registry/groups/DirectoryGroupsConnectionTest.java +++ b/core/src/test/java/google/registry/groups/DirectoryGroupsConnectionTest.java @@ -34,7 +34,7 @@ import com.google.api.client.http.HttpTransport; import com.google.api.client.http.LowLevelHttpRequest; import com.google.api.client.http.LowLevelHttpResponse; import com.google.api.client.json.Json; -import com.google.api.client.json.jackson2.JacksonFactory; +import com.google.api.client.json.gson.GsonFactory; import com.google.api.client.testing.http.HttpTesting; import com.google.api.client.testing.http.MockHttpTransport; import com.google.api.client.testing.http.MockLowLevelHttpRequest; @@ -300,6 +300,6 @@ class DirectoryGroupsConnectionTest { HttpRequest request = transport.createRequestFactory() .buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL) .setThrowExceptionOnExecuteError(false); - return GoogleJsonResponseException.from(new JacksonFactory(), request.execute()); + return GoogleJsonResponseException.from(new GsonFactory(), request.execute()); } } diff --git a/core/src/test/java/google/registry/tools/AuthModuleTest.java b/core/src/test/java/google/registry/tools/AuthModuleTest.java index cf492ba75..3e32e1688 100644 --- a/core/src/test/java/google/registry/tools/AuthModuleTest.java +++ b/core/src/test/java/google/registry/tools/AuthModuleTest.java @@ -26,7 +26,7 @@ import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets; import com.google.api.client.http.GenericUrl; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.javanet.NetHttpTransport; -import com.google.api.client.json.jackson2.JacksonFactory; +import com.google.api.client.json.gson.GsonFactory; import com.google.api.client.util.store.AbstractDataStoreFactory; import com.google.api.client.util.store.DataStore; import com.google.common.collect.ImmutableList; @@ -74,7 +74,7 @@ class AuthModuleTest { // We need to set the following fields because they are checked when // Credential#setRefreshToken is called. However they are not actually persisted in the // DataStore and not actually used in tests. - .setJsonFactory(new JacksonFactory()) + .setJsonFactory(new GsonFactory()) .setTransport(new NetHttpTransport()) .setTokenServerUrl(new GenericUrl("https://accounts.google.com/o/oauth2/token")) .setClientAuthentication(new ClientParametersAuthentication(CLIENT_ID, CLIENT_SECRET)) @@ -146,7 +146,7 @@ class AuthModuleTest { private Credential getCredential() { // Reconstruct the entire dependency graph, injecting FakeDataStoreFactory and credential // parameters. - JacksonFactory jsonFactory = new JacksonFactory(); + GsonFactory jsonFactory = new GsonFactory(); GoogleClientSecrets clientSecrets = getSecrets(); ImmutableList scopes = ImmutableList.of("scope1"); return AuthModule.provideCredential(