Skip to content

Commit

Permalink
chore(dependencies): Autobump korkVersion (#6286)
Browse files Browse the repository at this point in the history
* chore(dependencies): Autobump korkVersion

* refactor(dependency): replace JacksonFactory to GsonFactory

---------

Co-authored-by: root <root@0e8a9747aac9>
Co-authored-by: Edgar Garcia <[email protected]>
  • Loading branch information
3 people authored Sep 26, 2024
1 parent 3cdf32e commit 7be08cd
Show file tree
Hide file tree
Showing 20 changed files with 47 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import com.google.api.client.http.HttpRequestInitializer;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.json.gson.GsonFactory;
import com.google.api.services.storage.Storage;
import com.google.api.services.storage.StorageScopes;
import com.google.api.services.storage.model.Objects;
Expand Down Expand Up @@ -56,7 +56,7 @@ public static class Factory {
public Factory(String applicationName) throws IOException, GeneralSecurityException {
applicationName_ = applicationName;
transport_ = GoogleNetHttpTransport.newTrustedTransport();
jsonFactory_ = JacksonFactory.getDefaultInstance();
jsonFactory_ = GsonFactory.getDefaultInstance();
}

public Factory(String applicationName, HttpTransport transport, JsonFactory jsonFactory) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import com.google.api.client.http.HttpRequestInitializer;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.json.gson.GsonFactory;
import com.google.api.services.appengine.v1.Appengine;
import com.google.auth.http.HttpCredentialsAdapter;
import com.google.auth.oauth2.GoogleCredentials;
Expand All @@ -35,7 +35,7 @@ public AppengineCredentials(String project) {

public Appengine getAppengine(String applicationName) {
HttpTransport httpTransport = buildHttpTransport();
JsonFactory jsonFactory = JacksonFactory.getDefaultInstance();
JsonFactory jsonFactory = GsonFactory.getDefaultInstance();
GoogleCredentials credentials = getCredentials();
HttpRequestInitializer requestInitializer = new HttpCredentialsAdapter(credentials);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import com.google.api.client.http.HttpRequestInitializer;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.json.gson.GsonFactory;
import com.google.api.services.storage.Storage;
import com.google.api.services.storage.StorageScopes;
import com.google.auth.http.HttpCredentialsAdapter;
Expand Down Expand Up @@ -52,7 +52,7 @@ public class GcsArtifactCredentials implements ArtifactCredentials {
GcsArtifactCredentials(String applicationName, GcsArtifactAccount account)
throws IOException, GeneralSecurityException {
HttpTransport transport = GoogleNetHttpTransport.newTrustedTransport();
JsonFactory jsonFactory = JacksonFactory.getDefaultInstance();
JsonFactory jsonFactory = GsonFactory.getDefaultInstance();
Optional<String> credentialsPath = account.getJsonPath();

GoogleCredentials credentials;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import com.google.api.client.http.HttpRequestInitializer;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.json.gson.GsonFactory;
import com.google.api.services.run.v1.CloudRun;
import com.google.auth.http.HttpCredentialsAdapter;
import com.google.auth.oauth2.GoogleCredentials;
Expand All @@ -35,7 +35,7 @@ public CloudrunCredentials(String project) {

public CloudRun getCloudrun(String applicationName) {
HttpTransport httpTransport = buildHttpTransport();
JsonFactory jsonFactory = JacksonFactory.getDefaultInstance();
JsonFactory jsonFactory = GsonFactory.getDefaultInstance();
GoogleCredentials credentials =
getCredentials().createScoped("https://www.googleapis.com/auth/cloud-platform");
HttpRequestInitializer requestInitializer = new HttpCredentialsAdapter(credentials);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import com.google.api.client.http.GenericUrl
import com.google.api.client.http.HttpHeaders
import com.google.api.client.http.HttpResponse
import com.google.api.client.json.JsonObjectParser
import com.google.api.client.json.jackson2.JacksonFactory
import com.google.api.client.json.gson.GsonFactory
import com.google.api.services.compute.Compute
import com.google.api.services.compute.model.*
import com.netflix.spinnaker.cats.cache.Cache
Expand Down Expand Up @@ -142,7 +142,7 @@ class GCEUtil {
{
return compute.getRequestFactory()
.buildGetRequest(new GenericUrl(reference))
.setParser(new JsonObjectParser(JacksonFactory.getDefaultInstance()))
.setParser(new JsonObjectParser(GsonFactory.getDefaultInstance()))
.execute()
},
"gce/image",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package com.netflix.spinnaker.clouddriver.google.security

import com.google.api.client.http.HttpTransport
import com.google.api.client.json.JsonFactory
import com.google.api.client.json.jackson2.JacksonFactory
import com.google.api.client.json.gson.GsonFactory
import com.google.api.services.compute.Compute
import com.netflix.spinnaker.clouddriver.google.ComputeVersion
import com.netflix.spinnaker.clouddriver.googlecommon.security.GoogleCommonCredentials
Expand All @@ -33,7 +33,7 @@ public class GoogleCredentials extends GoogleCommonCredentials {

Compute getCompute(String applicationName) {
HttpTransport httpTransport = buildHttpTransport()
JsonFactory jsonFactory = JacksonFactory.getDefaultInstance()
JsonFactory jsonFactory = GsonFactory.getDefaultInstance()

def credentials = getCredentials()
def reqInit = setHttpTimeout(credentials)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.json.gson.GsonFactory;
import com.google.api.services.compute.model.Image;
import com.google.common.annotations.VisibleForTesting;
import com.netflix.spinnaker.cats.cache.Cache;
Expand Down Expand Up @@ -55,7 +55,7 @@
public class GoogleNamedImageLookupController {

private final Cache cacheView;
private final JacksonFactory jsonMapper = new JacksonFactory();
private final GsonFactory jsonMapper = new GsonFactory();
private final ObjectMapper objectMapper =
new ObjectMapper().configure(JsonGenerator.Feature.WRITE_NUMBERS_AS_STRINGS, true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,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.jackson2.JacksonFactory;
import com.google.api.client.json.gson.GsonFactory;
import com.google.api.client.testing.http.MockLowLevelHttpResponse;
import com.google.api.services.compute.Compute;
import com.google.api.services.compute.Compute.Images.Get;
Expand Down Expand Up @@ -341,9 +341,7 @@ private interface ResponseSupplier {

private static Compute computeWithResponses(ResponseSupplier... responses) {
return new Compute(
responses(responses),
JacksonFactory.getDefaultInstance(),
/* httpRequestInitializer= */ null);
responses(responses), GsonFactory.getDefaultInstance(), /* httpRequestInitializer= */ null);
}

private static HttpTransport responses(ResponseSupplier... responses) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import static org.mockito.Mockito.mock;

import com.google.api.client.googleapis.testing.json.GoogleJsonResponseExceptionFactoryTesting;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.json.gson.GsonFactory;
import com.google.api.services.compute.Compute;
import com.google.api.services.compute.model.Image;
import com.google.api.services.compute.model.ImageList;
Expand Down Expand Up @@ -96,7 +96,7 @@ void exception() {
pageToken ->
FakeGoogleComputeRequest.createWithException(
GoogleJsonResponseExceptionFactoryTesting.newMock(
JacksonFactory.getDefaultInstance(), 500, "bad news"),
GsonFactory.getDefaultInstance(), 500, "bad news"),
mock(Compute.Images.List.class)),
ImageList::getNextPageToken,
ImageList::getItems));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import com.google.api.client.googleapis.testing.json.GoogleJsonResponseExceptionFactoryTesting;
import com.google.api.client.http.HttpResponseException;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.json.gson.GsonFactory;
import com.google.api.services.compute.Compute;
import com.google.api.services.compute.model.Image;
import java.io.IOException;
Expand Down Expand Up @@ -69,7 +69,7 @@ void notFound() throws IOException {
GetFirstBatchComputeRequest.create(new FakeBatchComputeRequest<>());
HttpResponseException notFoundException =
GoogleJsonResponseExceptionFactoryTesting.newMock(
JacksonFactory.getDefaultInstance(), 404, "not found");
GsonFactory.getDefaultInstance(), 404, "not found");
batchRequest.queue(FakeGoogleComputeRequest.createWithException(notFoundException));
batchRequest.queue(FakeGoogleComputeRequest.createWithException(notFoundException));
batchRequest.queue(FakeGoogleComputeRequest.createWithException(notFoundException));
Expand All @@ -87,10 +87,10 @@ void error() throws IOException {
GetFirstBatchComputeRequest.create(new FakeBatchComputeRequest<>());
HttpResponseException notFoundException =
GoogleJsonResponseExceptionFactoryTesting.newMock(
JacksonFactory.getDefaultInstance(), 404, "not found");
GsonFactory.getDefaultInstance(), 404, "not found");
HttpResponseException actualError =
GoogleJsonResponseExceptionFactoryTesting.newMock(
JacksonFactory.getDefaultInstance(), 500, "bad news");
GsonFactory.getDefaultInstance(), 500, "bad news");
batchRequest.queue(FakeGoogleComputeRequest.createWithException(notFoundException));
batchRequest.queue(FakeGoogleComputeRequest.createWithException(notFoundException));
batchRequest.queue(FakeGoogleComputeRequest.createWithException(actualError));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import static org.assertj.core.api.Assertions.assertThatIOException;

import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.json.gson.GsonFactory;
import com.google.api.client.testing.http.MockLowLevelHttpResponse;
import com.google.api.services.compute.Compute;
import com.google.api.services.compute.model.Image;
Expand Down Expand Up @@ -130,7 +130,7 @@ private static Images createImages(HttpTransport transport) {
private static Images createImages(HttpTransport transport, Registry registry) {
Compute compute =
new Compute(
transport, JacksonFactory.getDefaultInstance(), /* httpRequestInitializer= */ null);
transport, GsonFactory.getDefaultInstance(), /* httpRequestInitializer= */ null);
GoogleNamedAccountCredentials credentials =
new GoogleNamedAccountCredentials.Builder()
.name("plumpy")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import static org.assertj.core.api.Assertions.assertThatIOException;

import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.json.gson.GsonFactory;
import com.google.api.client.testing.http.MockHttpTransport;
import com.google.api.client.testing.http.MockLowLevelHttpResponse;
import com.google.api.services.compute.Compute;
Expand Down Expand Up @@ -198,7 +198,7 @@ private static InstanceTemplates createInstanceTemplates(
HttpTransport transport, Registry registry) {
Compute compute =
new Compute(
transport, JacksonFactory.getDefaultInstance(), /* httpRequestInitializer= */ null);
transport, GsonFactory.getDefaultInstance(), /* httpRequestInitializer= */ null);
GoogleNamedAccountCredentials credentials =
new GoogleNamedAccountCredentials.Builder()
.name("spin-user")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import static org.assertj.core.api.Assertions.assertThatIOException;

import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.json.gson.GsonFactory;
import com.google.api.client.testing.http.MockHttpTransport;
import com.google.api.client.testing.http.MockLowLevelHttpResponse;
import com.google.api.services.compute.Compute;
Expand Down Expand Up @@ -246,7 +246,7 @@ private static RegionGoogleServerGroupManagers createManagers(
HttpTransport transport, Registry registry) {
Compute compute =
new Compute(
transport, JacksonFactory.getDefaultInstance(), /* httpRequestInitializer= */ null);
transport, GsonFactory.getDefaultInstance(), /* httpRequestInitializer= */ null);
GoogleNamedAccountCredentials credentials =
new GoogleNamedAccountCredentials.Builder()
.name("spin-user")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import static org.assertj.core.api.Assertions.assertThatIOException;

import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.json.gson.GsonFactory;
import com.google.api.client.testing.http.MockHttpTransport;
import com.google.api.client.testing.http.MockLowLevelHttpResponse;
import com.google.api.services.compute.Compute;
Expand Down Expand Up @@ -246,7 +246,7 @@ private static ZoneGoogleServerGroupManagers createManagers(
HttpTransport transport, Registry registry) {
Compute compute =
new Compute(
transport, JacksonFactory.getDefaultInstance(), /* httpRequestInitializer= */ null);
transport, GsonFactory.getDefaultInstance(), /* httpRequestInitializer= */ null);
GoogleNamedAccountCredentials credentials =
new GoogleNamedAccountCredentials.Builder()
.name("spin-user")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ package com.netflix.spinnaker.clouddriver.google.deploy
import com.google.api.client.http.HttpRequest
import com.google.api.client.http.HttpRequestFactory
import com.google.api.client.http.HttpResponse
import com.google.api.client.json.jackson2.JacksonFactory
import com.google.api.client.json.gson.GsonFactory
import com.google.api.services.compute.Compute
import com.google.api.services.compute.model.*
import com.netflix.spectator.api.DefaultRegistry
Expand Down Expand Up @@ -88,7 +88,7 @@ package com.netflix.spinnaker.clouddriver.google.deploy
def executorMock = Mock(GoogleExecutorTraits)

def httpTransport = GoogleNetHttpTransport.newTrustedTransport()
def jsonFactory = JacksonFactory.defaultInstance
def jsonFactory = GsonFactory.defaultInstance
def httpRequestInitializer =
new GoogleCredential.Builder().setTransport(httpTransport).setJsonFactory(jsonFactory).build()
def compute = new Compute.Builder(
Expand Down Expand Up @@ -124,7 +124,7 @@ package com.netflix.spinnaker.clouddriver.google.deploy
def executorMock = Mock(GoogleExecutorTraits)

def httpTransport = GoogleNetHttpTransport.newTrustedTransport()
def jsonFactory = JacksonFactory.defaultInstance
def jsonFactory = GsonFactory.defaultInstance
def httpRequestInitializer =
new GoogleCredential.Builder().setTransport(httpTransport).setJsonFactory(jsonFactory).build()
def compute = new Compute.Builder(
Expand Down Expand Up @@ -157,7 +157,7 @@ package com.netflix.spinnaker.clouddriver.google.deploy
def executorMock = Mock(GoogleExecutorTraits)

def httpTransport = GoogleNetHttpTransport.newTrustedTransport()
def jsonFactory = JacksonFactory.defaultInstance
def jsonFactory = GsonFactory.defaultInstance
def httpRequestInitializer =
new GoogleCredential.Builder().setTransport(httpTransport).setJsonFactory(jsonFactory).build()
def compute = new Compute.Builder(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import com.google.api.client.googleapis.auth.oauth2.GoogleCredential
import com.google.api.client.googleapis.batch.BatchRequest
import com.google.api.client.googleapis.batch.json.JsonBatchCallback
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport
import com.google.api.client.json.jackson2.JacksonFactory
import com.google.api.client.json.gson.GsonFactory
import com.google.api.services.compute.Compute
import com.google.api.services.compute.model.Image
import com.google.api.services.compute.model.ImageList
Expand Down Expand Up @@ -69,7 +69,7 @@ class CreateGoogleInstanceAtomicOperationUnitSpec extends Specification implemen
def instancesInsertMock = Mock(Compute.Instances.Insert)

def httpTransport = GoogleNetHttpTransport.newTrustedTransport()
def jsonFactory = JacksonFactory.defaultInstance
def jsonFactory = GsonFactory.defaultInstance
def httpRequestInitializer =
new GoogleCredential.Builder().setTransport(httpTransport).setJsonFactory(jsonFactory).build()
def images = new Compute.Builder(
Expand Down Expand Up @@ -167,7 +167,7 @@ class CreateGoogleInstanceAtomicOperationUnitSpec extends Specification implemen
def listMock = new MockFor(Compute.Images.List)

def httpTransport = GoogleNetHttpTransport.newTrustedTransport()
def jsonFactory = JacksonFactory.defaultInstance
def jsonFactory = GsonFactory.defaultInstance
def httpRequestInitializer =
new GoogleCredential.Builder().setTransport(httpTransport).setJsonFactory(jsonFactory).build()
def images = new Compute.Builder(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

import com.google.api.client.googleapis.testing.json.GoogleJsonResponseExceptionFactoryTesting;
import com.google.api.client.http.HttpStatusCodes;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.json.gson.GsonFactory;
import com.google.api.services.compute.Compute;
import com.google.api.services.compute.Compute.InstanceTemplates.Delete;
import com.google.api.services.compute.Compute.InstanceTemplates.Insert;
Expand Down Expand Up @@ -239,9 +239,7 @@ private static FakeGoogleComputeRequest<Compute.Images.Get, Image> status404()
throws IOException {
return FakeGoogleComputeRequest.createWithException(
GoogleJsonResponseExceptionFactoryTesting.newMock(
JacksonFactory.getDefaultInstance(),
HttpStatusCodes.STATUS_CODE_NOT_FOUND,
"not found"));
GsonFactory.getDefaultInstance(), HttpStatusCodes.STATUS_CODE_NOT_FOUND, "not found"));
}

private static InstanceTemplate baseInstanceTemplate() {
Expand Down
Loading

0 comments on commit 7be08cd

Please sign in to comment.