-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remove okhttp singleton #3047
remove okhttp singleton #3047
Conversation
f3ac2b9
to
32cf11e
Compare
6e6f172
to
524ba00
Compare
Waiting for #3096 before moving forward |
1a8ac6d
to
2844deb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a tiny question @theScrabi
owncloudData/build.gradle
Outdated
|
||
testOptions { | ||
unitTests { | ||
includeAndroidResources = true | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that we don't need this, am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved! Fix the conflicts before moving this forward 👍
dfd6ea0
to
78ab22d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some tiny suggestions more @theScrabi
build.gradle
Outdated
@@ -29,6 +29,7 @@ buildscript { | |||
fragmentTestVersion = "1.1.0" | |||
uiAutomatorTestVersion = "2.2.0" | |||
annotationTestVersion = "1.2.0" | |||
robolectricVersion = "4.4" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would try not to add this version here. At the moment we use robolectric just in the library, so there is no need to add this version in the app Gradle from my point of view.
// Step 1: check whether the root folder exists. | ||
val checkPathExistenceResult = | ||
serverInfoService.checkPathExistence(path, isUserLogged = false, client = owncloudClient) | ||
var checkPathExistenceResult = | ||
serverInfoService.checkPathExistence(path, isUserLogged = false, owncloudClient) | ||
var redirectionLocation = checkPathExistenceResult.redirectedLocation | ||
while (!redirectionLocation.isNullOrEmpty()) { | ||
checkPathExistenceResult = | ||
serverInfoService.checkPathExistence(redirectionLocation, isUserLogged = false, owncloudClient) | ||
redirectionLocation = checkPathExistenceResult.redirectedLocation | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change required? We removed this loop some PR ago. We should use the same client that requested the remote status, so it should follow redirections by itself. That's why we removed it.
Is it needed now after removing the singleton?
@Test | ||
fun getAuthenticationMethodFollowRedirections() { | ||
val checkPathExistenceResultFollowRedirectionMocked: RemoteOperationResult<Boolean> = | ||
createRemoteOperationResultMock( | ||
data = true, | ||
isSuccess = true, | ||
redirectedLocation = OC_SERVER_INFO.baseUrl | ||
) | ||
val checkPathExistenceResultMocked: RemoteOperationResult<Boolean> = | ||
createRemoteOperationResultMock( | ||
data = true, | ||
isSuccess = true, | ||
resultCode = OK_SSL, | ||
authenticationHeader = authHeadersBasic, | ||
httpCode = HTTP_UNAUTHORIZED | ||
) | ||
|
||
every { | ||
ocServerInfoService.checkPathExistence(redirectedLocation, false, ocClientMocked) | ||
} returns checkPathExistenceResultFollowRedirectionMocked | ||
|
||
every { | ||
ocServerInfoService.checkPathExistence(OC_SERVER_INFO.baseUrl, false, ocClientMocked) | ||
} returns checkPathExistenceResultMocked | ||
|
||
val authenticationMethod = ocRemoteServerInfoDatasource.getAuthenticationMethod(redirectedLocation) | ||
|
||
assertNotNull(authenticationMethod) | ||
assertEquals(AuthenticationMethod.BASIC_HTTP_AUTH, authenticationMethod) | ||
|
||
verify { ocServerInfoService.checkPathExistence(OC_SERVER_INFO.baseUrl, false, ocClientMocked) } | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related to the previous comment. If previous one is required, then keep this test, if not, we can remove it
78ab22d
to
423ef9d
Compare
3437682
to
4f9b97b
Compare
c893f48
to
63f5772
Compare
63f5772
to
10d0c34
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
10d0c34
to
e9a3176
Compare
Kudos, SonarCloud Quality Gate passed! |
70d77a3
to
06ac5f9
Compare
Kudos, SonarCloud Quality Gate passed! |
658e26b
to
a0db300
Compare
0ebd3a4
to
364ba2e
Compare
364ba2e
to
740581b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@theScrabi Tiny suggestions here
.../com/owncloud/android/data/server/datasources/implementation/OCRemoteServerInfoDataSource.kt
Outdated
Show resolved
Hide resolved
66bb9c2
to
d022510
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved. Let's QA this @jesmrec
This is working from my side. Since this change is transversal (affects everything that need some network operation), the way to do was checking same things as the network library switch.
From my side this is ready to go. Great job, @theScrabi! Beta version should help to find any other corner case. |
d022510
to
5d42c1e
Compare
issue: owncloud/android-library#357
depends on: owncloud/android-library#364