Skip to content
This repository was archived by the owner on Mar 11, 2022. It is now read-only.

Commit ca597ac

Browse files
authored
Merge pull request #606 from cloudant/update-cloudant-http-2.19.0
Updated cloudant-http to version 2.19.0
2 parents c6c07fa + 0700da9 commit ca597ac

File tree

4 files changed

+18
-10
lines changed

4 files changed

+18
-10
lines changed

AndroidTest/app/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ dependencies {
8585
compile 'commons-io:commons-io:2.4'
8686
compile 'commons-codec:commons-codec:1.9'
8787
compile 'org.apache.commons:commons-lang3:3.3.2'
88-
compile group: 'com.cloudant', name: 'cloudant-http', version:'2.12.0'
88+
compile group: 'com.cloudant', name: 'cloudant-http', version:'2.19.0'
8989
compile 'com.google.code.findbugs:jsr305:3.0.0' //this is needed for some versions of android
9090
compile files('../../cloudant-sync-datastore-android-encryption/libs/sqlcipher.jar') //required sqlcipher lib
9191
compile files('../../cloudant-sync-datastore-android/libs/android-support-v4.jar')

CHANGES.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# 2.x.y (Unreleased)
22
- [IMPROVED] Record checkpoint on empty `_changes` result in pull replications. This change optimizes
33
filtered replications when changes in remote database doesn't match the replication filter.
4+
- [UPGRADED] Upgraded to version 2.19.0 of the `cloudant-http` library.
5+
46
# 2.4.0 (2019-01-15)
57
- [NEW] `Database` methods `read`, `contains`, `create`, and `delete` now accept local
68
(non-replicating documents). These documents must have their document ID prefixed with `_local/`

cloudant-sync-datastore-core/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// ************ //
44
dependencies {
55

6-
compile group: 'com.cloudant', name: 'cloudant-http', version:'2.12.0'
6+
compile group: 'com.cloudant', name: 'cloudant-http', version:'2.19.0'
77
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version:'2.1.1'
88
compile group: 'commons-codec', name: 'commons-codec', version:'1.10'
99
compile group: 'commons-io', name: 'commons-io', version:'2.4'

cloudant-sync-datastore-core/src/test/java/com/cloudant/sync/internal/replication/ReplicationTestBase.java

+14-8
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package com.cloudant.sync.internal.replication;
1818

1919
import com.cloudant.common.CouchTestBase;
20+
import com.cloudant.http.HttpConnectionInterceptorContext;
2021
import com.cloudant.http.HttpConnectionRequestInterceptor;
2122
import com.cloudant.http.HttpConnectionResponseInterceptor;
2223
import com.cloudant.http.internal.interceptors.CookieInterceptor;
@@ -40,9 +41,12 @@
4041
import java.io.File;
4142
import java.io.UnsupportedEncodingException;
4243
import java.lang.reflect.Field;
44+
import java.lang.reflect.InvocationTargetException;
45+
import java.lang.reflect.Method;
4346
import java.net.MalformedURLException;
4447
import java.net.URISyntaxException;
4548
import java.net.URLEncoder;
49+
import java.nio.charset.Charset;
4650
import java.util.ArrayList;
4751
import java.util.List;
4852

@@ -266,25 +270,27 @@ protected PullResult pull(PullFilter filter) throws Exception {
266270
}
267271

268272
protected void assertCookieInterceptorPresent(ReplicatorBuilder p, String expectedRequestBody)
269-
throws NoSuchFieldException, IllegalAccessException {
273+
throws NoSuchFieldException, NoSuchMethodException, IllegalAccessException,
274+
InvocationTargetException {
270275
// peek inside these private fields to see that interceptors have been set
271276
Field reqI = ReplicatorBuilder.class.getDeclaredField("requestInterceptors");
272277
Field respI = ReplicatorBuilder.class.getDeclaredField("responseInterceptors");
273278
reqI.setAccessible(true);
274279
respI.setAccessible(true);
275-
List<HttpConnectionRequestInterceptor> reqIList = (List)reqI.get(p);
276-
List<HttpConnectionRequestInterceptor> respIList = (List)respI.get(p);
280+
List<HttpConnectionRequestInterceptor> reqIList = (List) reqI.get(p);
281+
List<HttpConnectionRequestInterceptor> respIList = (List) respI.get(p);
277282
// Note this introspection happens before the interceptors are passed to the CouchClient so
278283
// excludes any other interceptors (e.g. UserAgentInterceptor that might be added there).
279284
Assert.assertEquals(1, reqIList.size());
280285
Assert.assertEquals(CookieInterceptor.class, reqIList.get(0).getClass());
281286
Assert.assertEquals(1, respIList.size());
282287
Assert.assertEquals(CookieInterceptor.class, respIList.get(0).getClass());
283-
CookieInterceptorBase ci = (CookieInterceptorBase)reqIList.get(0);
284-
Field srbField = CookieInterceptorBase.class.getDeclaredField("sessionRequestBody");
285-
srbField.setAccessible(true);
286-
byte[] srb = (byte[])srbField.get(ci);
287-
String srbString = new String(srb);
288+
CookieInterceptor ci = (CookieInterceptor) reqIList.get(0);
289+
Method getPayloadMethod = CookieInterceptorBase.class.getDeclaredMethod(
290+
"getSessionRequestPayload", new Class[]{HttpConnectionInterceptorContext.class});
291+
getPayloadMethod.setAccessible(true);
292+
byte[] srb = (byte[]) getPayloadMethod.invoke(ci, new Object[]{null});
293+
String srbString = new String(srb, Charset.forName("UTF-8"));
288294
Assert.assertEquals(expectedRequestBody, srbString);
289295
}
290296

0 commit comments

Comments
 (0)