Skip to content

Commit

Permalink
refactor(retrofit): remove all com.squareup.okhttp dependencies (#1286)
Browse files Browse the repository at this point in the history
  • Loading branch information
kirangodishala authored Nov 14, 2024
1 parent 17e4dd0 commit 9a02b4d
Show file tree
Hide file tree
Showing 21 changed files with 44 additions and 59 deletions.
2 changes: 1 addition & 1 deletion igor-monitor-artifactory/igor-monitor-artifactory.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ dependencies {
// TODO(rz): Get rid of this dependency!
implementation "com.squareup.retrofit:retrofit"

testImplementation "com.squareup.okhttp:mockwebserver"
testImplementation "com.squareup.okhttp3:mockwebserver"
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import com.netflix.spinnaker.igor.history.EchoService
import com.netflix.spinnaker.igor.polling.LockService
import com.netflix.spinnaker.kork.discovery.DiscoveryStatusListener
import com.netflix.spinnaker.kork.dynamicconfig.DynamicConfigService
import com.squareup.okhttp.mockwebserver.MockResponse
import com.squareup.okhttp.mockwebserver.MockWebServer
import okhttp3.mockwebserver.MockResponse
import okhttp3.mockwebserver.MockWebServer
import org.springframework.scheduling.TaskScheduler
import spock.lang.Specification

Expand Down
2 changes: 1 addition & 1 deletion igor-monitor-travis/igor-monitor-travis.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ dependencies {
implementation "javax.validation:validation-api"
implementation "javax.xml.bind:jaxb-api"

testImplementation "com.squareup.okhttp:mockwebserver"
testImplementation "com.squareup.okhttp3:mockwebserver"
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import com.netflix.spinnaker.igor.travis.client.model.v3.V3Build
import com.netflix.spinnaker.igor.travis.client.model.v3.V3Builds
import com.netflix.spinnaker.igor.travis.client.model.v3.V3Log
import com.netflix.spinnaker.igor.travis.config.TravisConfig
import com.squareup.okhttp.mockwebserver.MockResponse
import com.squareup.okhttp.mockwebserver.MockWebServer
import okhttp3.mockwebserver.MockResponse
import okhttp3.mockwebserver.MockWebServer
import spock.lang.Shared
import spock.lang.Specification

Expand Down Expand Up @@ -825,6 +825,6 @@ class TravisClientSpec extends Specification {
.setHeader('Content-Type', 'application/json;charset=utf-8')
)
server.start()
client = new TravisConfig().travisClient(server.getUrl('/').toString(), 3000, mapper)
client = new TravisConfig().travisClient(server.url('/').toString(), 3000, mapper)
}
}
5 changes: 1 addition & 4 deletions igor-web/igor-web.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ dependencies {

implementation "com.squareup.retrofit:retrofit"
implementation "com.squareup.retrofit:converter-jackson"
implementation "com.squareup.okhttp:okhttp"
implementation "com.squareup.okhttp:okhttp-urlconnection"
implementation "com.squareup.okhttp:okhttp-apache"
implementation "com.squareup.okhttp3:okhttp-sse"
implementation "com.jakewharton.retrofit:retrofit1-okhttp3-client:1.1.0"
implementation "io.spinnaker.fiat:fiat-api:$fiatVersion"
Expand Down Expand Up @@ -79,7 +76,7 @@ dependencies {

runtimeOnly "io.spinnaker.kork:kork-runtime"

testImplementation "com.squareup.okhttp:mockwebserver"
testImplementation "com.squareup.okhttp3:mockwebserver"
testImplementation "io.spinnaker.kork:kork-jedis-test"
testImplementation "org.apache.groovy:groovy-datetime"
testImplementation "org.apache.groovy:groovy-json"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import com.netflix.spinnaker.igor.scm.bitbucket.client.BitBucketClient
import com.netflix.spinnaker.igor.scm.bitbucket.client.BitBucketMaster
import com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerRetrofitErrorHandler
import com.netflix.spinnaker.retrofit.Slf4jRetrofitLogger
import com.squareup.okhttp.Credentials
import groovy.transform.CompileStatic
import groovy.util.logging.Slf4j
import okhttp3.Credentials
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.annotation.Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import com.jakewharton.retrofit.Ok3Client
import com.netflix.spinnaker.igor.scm.stash.client.StashClient
import com.netflix.spinnaker.igor.scm.stash.client.StashMaster
import com.netflix.spinnaker.retrofit.Slf4jRetrofitLogger
import com.squareup.okhttp.Credentials
import groovy.transform.CompileStatic
import groovy.util.logging.Slf4j
import okhttp3.Credentials
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.annotation.Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package com.netflix.spinnaker.igor.config.auth

import com.google.auth.oauth2.GoogleCredentials
import com.netflix.spinnaker.igor.config.JenkinsProperties
import com.squareup.okhttp.Credentials
import okhttp3.Credentials
import groovy.util.logging.Slf4j
import retrofit.RequestInterceptor

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import com.jakewharton.retrofit.Ok3Client
import com.netflix.spinnaker.igor.config.BitBucketProperties
import com.netflix.spinnaker.igor.scm.AbstractScmMaster
import com.netflix.spinnaker.retrofit.Slf4jRetrofitLogger
import com.squareup.okhttp.Credentials
import okhttp3.Credentials
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.context.annotation.Bean
import retrofit.Endpoints
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import com.netflix.spinnaker.igor.travis.service.TravisService
import com.netflix.spinnaker.kork.web.exceptions.ExceptionMessageDecorator
import com.netflix.spinnaker.kork.web.exceptions.GenericExceptionHandlers
import com.netflix.spinnaker.kork.web.exceptions.NotFoundException
import com.squareup.okhttp.mockwebserver.MockWebServer
import okhttp3.mockwebserver.MockWebServer
import org.springframework.http.HttpStatus
import org.springframework.http.MediaType
import org.springframework.mock.web.MockHttpServletResponse
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import com.netflix.spinnaker.igor.service.BuildOperations
import com.netflix.spinnaker.igor.service.BuildServices
import com.netflix.spinnaker.igor.travis.service.TravisService
import com.netflix.spinnaker.igor.wercker.WerckerService
import com.squareup.okhttp.mockwebserver.MockResponse
import com.squareup.okhttp.mockwebserver.MockWebServer
import okhttp3.mockwebserver.MockResponse
import okhttp3.mockwebserver.MockWebServer
import groovy.json.JsonSlurper
import io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry
import org.springframework.http.MediaType
Expand Down Expand Up @@ -315,7 +315,7 @@ class InfoControllerSpec extends Specification {
)
server.start()
def host = new JenkinsProperties.JenkinsHost(
address: server.getUrl('/').toString(),
address: server.url('/').toString(),
username: 'username',
password: 'password')
service = new JenkinsConfig().jenkinsService("jenkins", new JenkinsConfig().jenkinsClient(host), false, Permissions.EMPTY, circuitBreakerRegistry)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
package com.netflix.spinnaker.igor.concourse.client

import com.fasterxml.jackson.databind.ObjectMapper
import com.netflix.spinnaker.igor.concourse.client.ConcourseClient
import com.netflix.spinnaker.igor.concourse.client.SkyService
import com.netflix.spinnaker.igor.concourse.client.SkyServiceV2
import com.netflix.spinnaker.igor.concourse.client.TokenService
import com.netflix.spinnaker.igor.concourse.client.TokenServiceV2
import com.netflix.spinnaker.igor.concourse.client.model.Token
import com.squareup.okhttp.mockwebserver.MockResponse
import com.squareup.okhttp.mockwebserver.MockWebServer
import com.squareup.okhttp.mockwebserver.RecordedRequest
import okhttp3.mockwebserver.MockResponse
import okhttp3.mockwebserver.MockWebServer
import okhttp3.mockwebserver.RecordedRequest
import retrofit.client.Response;
import spock.lang.Shared
import spock.lang.Specification

import java.time.ZonedDateTime

class ConcourseClientSpec extends Specification {

@Shared
Expand Down Expand Up @@ -145,6 +136,6 @@ class ConcourseClientSpec extends Specification {
)
}
server.start()
client = new ConcourseClient(server.getUrl('/').toString(), "test-username", "test-password")
client = new ConcourseClient(server.url('/').toString(), "test-username", "test-password")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import com.netflix.spinnaker.igor.config.GitlabCiConfig
import com.netflix.spinnaker.igor.gitlabci.client.model.Pipeline
import com.netflix.spinnaker.igor.gitlabci.client.model.PipelineStatus
import com.netflix.spinnaker.igor.gitlabci.client.model.Project
import com.squareup.okhttp.mockwebserver.MockResponse
import com.squareup.okhttp.mockwebserver.MockWebServer
import okhttp3.mockwebserver.MockResponse
import okhttp3.mockwebserver.MockWebServer
import spock.lang.Shared
import spock.lang.Specification

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import com.netflix.spinnaker.igor.jenkins.client.model.JobConfig
import com.netflix.spinnaker.igor.jenkins.client.model.Project
import com.netflix.spinnaker.igor.jenkins.client.model.ProjectsList
import com.netflix.spinnaker.igor.model.Crumb
import com.squareup.okhttp.mockwebserver.MockResponse
import com.squareup.okhttp.mockwebserver.MockWebServer
import okhttp3.mockwebserver.MockResponse
import okhttp3.mockwebserver.MockWebServer
import spock.lang.Shared
import spock.lang.Specification
/**
Expand Down Expand Up @@ -233,7 +233,7 @@ class JenkinsClientSpec extends Specification {
)
server.start()
def host = new JenkinsProperties.JenkinsHost(
address: server.getUrl('/').toString(),
address: server.url('/').toString(),
username: 'username',
password: 'password')
client = new JenkinsConfig().jenkinsClient(host)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ import com.netflix.spinnaker.igor.jenkins.client.model.BuildArtifact
import com.netflix.spinnaker.igor.jenkins.client.model.BuildsList
import com.netflix.spinnaker.igor.jenkins.client.model.Project
import com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerHttpException
import com.squareup.okhttp.mockwebserver.MockResponse
import com.squareup.okhttp.mockwebserver.MockWebServer
import io.github.resilience4j.circuitbreaker.CircuitBreaker
import okhttp3.mockwebserver.MockResponse
import okhttp3.mockwebserver.MockWebServer
import io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry
import retrofit.RetrofitError
import retrofit.client.Response
Expand Down Expand Up @@ -189,7 +188,7 @@ class JenkinsServiceSpec extends Specification {
)
server.start()
def host = new JenkinsProperties.JenkinsHost(
address: server.getUrl('/').toString(),
address: server.url('/').toString(),
username: 'username',
password: 'password')
client = new JenkinsConfig().jenkinsClient(host)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ package com.netflix.spinnaker.igor.scm.bitbucket.client

import com.netflix.spinnaker.igor.config.BitBucketConfig
import com.netflix.spinnaker.igor.scm.bitbucket.client.model.CompareCommitsResponse
import com.squareup.okhttp.mockwebserver.MockResponse
import com.squareup.okhttp.mockwebserver.MockWebServer
import okhttp3.mockwebserver.MockResponse
import okhttp3.mockwebserver.MockWebServer
import spock.lang.Shared
import spock.lang.Specification

Expand Down Expand Up @@ -49,7 +49,7 @@ class BitBucketClientSpec extends Specification {
.setHeader('Content-Type', 'text/xml;charset=UTF-8')
)
server.start()
client = new BitBucketConfig().bitBucketClient(server.getUrl('/').toString(), 'username', 'password')
client = new BitBucketConfig().bitBucketClient(server.url('/').toString(), 'username', 'password')
}

void 'getCompareCommits'() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import com.fasterxml.jackson.databind.ObjectMapper
import com.netflix.spinnaker.igor.config.GitHubConfig
import com.netflix.spinnaker.igor.scm.github.client.model.CompareCommitsResponse
import com.netflix.spinnaker.igor.scm.github.client.model.GetRepositoryContentResponse
import com.squareup.okhttp.mockwebserver.MockResponse
import com.squareup.okhttp.mockwebserver.MockWebServer
import okhttp3.mockwebserver.MockResponse
import okhttp3.mockwebserver.MockWebServer
import spock.lang.Shared
import spock.lang.Specification

Expand Down Expand Up @@ -59,7 +59,7 @@ class GitHubClientSpec extends Specification {
.setHeader('Content-Type', 'text/xml;charset=UTF-8')
)
server.start()
client = new GitHubConfig().gitHubClient(server.getUrl('/').toString(), 'token', mapper)
client = new GitHubConfig().gitHubClient(server.url('/').toString(), 'token', mapper)
}

void 'getDirectoryContent'() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ package com.netflix.spinnaker.igor.scm.gitlab.client

import com.netflix.spinnaker.igor.config.GitLabConfig
import com.netflix.spinnaker.igor.scm.gitlab.client.model.CompareCommitsResponse
import com.squareup.okhttp.mockwebserver.MockResponse
import com.squareup.okhttp.mockwebserver.MockWebServer
import okhttp3.mockwebserver.MockResponse
import okhttp3.mockwebserver.MockWebServer
import spock.lang.Shared
import spock.lang.Specification

import java.time.Instant

class GitLabClientSpec extends Specification {

@Shared
Expand All @@ -48,7 +46,7 @@ class GitLabClientSpec extends Specification {
.setHeader('Content-Type', 'text/xml;charset=UTF-8')
)
server.start()
client = new GitLabConfig().gitLabClient(server.getUrl('/').toString(), "token")
client = new GitLabConfig().gitLabClient(server.url('/').toString(), "token")
}

void 'getCompareCommits'() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import com.netflix.spinnaker.igor.scm.ScmMaster
import com.netflix.spinnaker.igor.scm.stash.client.model.CompareCommitsResponse
import com.netflix.spinnaker.igor.scm.stash.client.model.DirectoryListingResponse
import com.netflix.spinnaker.igor.scm.stash.client.model.TextLinesResponse
import com.squareup.okhttp.mockwebserver.MockResponse
import com.squareup.okhttp.mockwebserver.MockWebServer
import okhttp3.mockwebserver.MockResponse
import okhttp3.mockwebserver.MockWebServer
import retrofit.RestAdapter
import spock.lang.Shared
import spock.lang.Specification
Expand Down Expand Up @@ -54,7 +54,7 @@ class StashClientSpec extends Specification {
.setHeader('Content-Type', contentType)
)
server.start()
client = new StashConfig().stashClient(server.getUrl('/').toString(), 'username', 'password', RestAdapter.LogLevel.BASIC)
client = new StashConfig().stashClient(server.url('/').toString(), 'username', 'password', RestAdapter.LogLevel.BASIC)
}

void 'getCompareCommits'() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import com.netflix.spinnaker.config.okhttp3.OkHttpClientProvider
import com.netflix.spinnaker.igor.config.*
import com.netflix.spinnaker.igor.config.WerckerProperties.WerckerHost
import com.netflix.spinnaker.igor.wercker.model.*
import com.squareup.okhttp.mockwebserver.MockResponse
import com.squareup.okhttp.mockwebserver.MockWebServer
import okhttp3.mockwebserver.MockResponse
import okhttp3.mockwebserver.MockWebServer
import okhttp3.OkHttpClient
import retrofit.RestAdapter
import spock.lang.Shared
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
import com.netflix.spinnaker.igor.service.BuildServices;
import com.netflix.spinnaker.kork.discovery.DiscoveryStatusListener;
import com.netflix.spinnaker.kork.dynamicconfig.DynamicConfigService;
import com.squareup.okhttp.mockwebserver.MockResponse;
import com.squareup.okhttp.mockwebserver.MockWebServer;
import java.util.Collections;
import java.util.Optional;
import okhttp3.mockwebserver.MockResponse;
import okhttp3.mockwebserver.MockWebServer;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.scheduling.TaskScheduler;
Expand Down

0 comments on commit 9a02b4d

Please sign in to comment.