Skip to content

Commit 2acd268

Browse files
committed
refactor: Remove dependency on old reactive library
BREAKING CHANGE: The rx() and rxWithDetails() methods have been removed. This type of functionality should be replaced with the new reactiveRequest() and reactiveRequestWithDetails() methods
1 parent 68f0aae commit 2acd268

File tree

4 files changed

+0
-116
lines changed

4 files changed

+0
-116
lines changed

pom.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
<gson-version>2.8.5</gson-version>
4949
<commons-io-version>2.6</commons-io-version>
5050
<commons-lang3-version>3.8.1</commons-lang3-version>
51-
<jersey-version>2.25.1</jersey-version>
5251
<rx-version>2.2.7</rx-version>
5352
</properties>
5453

@@ -82,11 +81,6 @@
8281
<version>${okhttp3-version}</version>
8382
<scope>test</scope>
8483
</dependency>
85-
<dependency>
86-
<groupId>org.glassfish.jersey.bundles.repackaged</groupId>
87-
<artifactId>jersey-jsr166e</artifactId>
88-
<version>${jersey-version}</version>
89-
</dependency>
9084
<dependency>
9185
<groupId>commons-io</groupId>
9286
<artifactId>commons-io</artifactId>

src/main/java/com/ibm/cloud/sdk/core/http/ServiceCall.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
package com.ibm.cloud.sdk.core.http;
1414

1515
import io.reactivex.Single;
16-
import jersey.repackaged.jsr166e.CompletableFuture;
1716

1817
/**
1918
* Service Call.
@@ -62,21 +61,6 @@ public interface ServiceCall<T> {
6261
*/
6362
void enqueueWithDetails(ServiceCallbackWithDetails<T> callback);
6463

65-
/**
66-
* Reactive requests, in this case, you could take advantage both synchronous and asynchronous.
67-
*
68-
* @return a CompletableFuture wrapper for your response
69-
*/
70-
CompletableFuture<T> rx();
71-
72-
/**
73-
* Reactive requests with added HTTP information. In this case, you could take advantage both synchronous and
74-
* asynchronous.
75-
*
76-
* @return a CompletableFuture wrapper for your response
77-
*/
78-
CompletableFuture<Response<T>> rxWithDetails();
79-
8064
/**
8165
* Reactive request using the RxJava 2 library. See https://github.com/ReactiveX/RxJava.
8266
*

src/main/java/com/ibm/cloud/sdk/core/service/BaseService.java

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
import com.ibm.cloud.sdk.core.util.CredentialUtils;
3737
import com.ibm.cloud.sdk.core.util.RequestUtils;
3838
import io.reactivex.Single;
39-
import jersey.repackaged.jsr166e.CompletableFuture;
4039
import okhttp3.Call;
4140
import okhttp3.Callback;
4241
import okhttp3.Credentials;
@@ -540,54 +539,6 @@ public void onResponse(Call call, Response response) {
540539
});
541540
}
542541

543-
@Override
544-
public CompletableFuture<T> rx() {
545-
final CompletableFuture<T> completableFuture = new CompletableFuture<T>();
546-
547-
call.enqueue(new Callback() {
548-
@Override
549-
public void onFailure(Call call, IOException e) {
550-
completableFuture.completeExceptionally(e);
551-
}
552-
553-
@Override
554-
public void onResponse(Call call, Response response) {
555-
try {
556-
completableFuture.complete(processServiceCall(converter, response));
557-
} catch (Exception e) {
558-
completableFuture.completeExceptionally(e);
559-
}
560-
}
561-
});
562-
563-
return completableFuture;
564-
}
565-
566-
@Override
567-
public CompletableFuture<com.ibm.cloud.sdk.core.http.Response<T>> rxWithDetails() {
568-
final CompletableFuture<com.ibm.cloud.sdk.core.http.Response<T>> completableFuture
569-
= new CompletableFuture<>();
570-
571-
call.enqueue(new Callback() {
572-
@Override
573-
public void onFailure(Call call, IOException e) {
574-
completableFuture.completeExceptionally(e);
575-
}
576-
577-
@Override
578-
public void onResponse(Call call, Response response) {
579-
try {
580-
T responseModel = processServiceCall(converter, response);
581-
completableFuture.complete(new com.ibm.cloud.sdk.core.http.Response<>(responseModel, response));
582-
} catch (Exception e) {
583-
completableFuture.completeExceptionally(e);
584-
}
585-
}
586-
});
587-
588-
return completableFuture;
589-
}
590-
591542
@Override
592543
public Single<T> reactiveRequest() {
593544
return Single.fromCallable(new Callable<T>() {

src/test/java/com/ibm/cloud/sdk/core/test/service/ResponseTest.java

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -106,51 +106,6 @@ public void onFailure(Exception e) { }
106106
});
107107
}
108108

109-
/**
110-
* Test that all fields are populated when calling rxWithDetails() using a callback.
111-
*
112-
* @throws InterruptedException the interrupted exception
113-
*/
114-
@Test
115-
public void testRxWithDetailsCallback() throws InterruptedException {
116-
server.enqueue(new MockResponse().setBody("{\"test_key\": \"test_value\"}"));
117-
118-
service.testMethod().rxWithDetails().thenAccept(response -> {
119-
assertNotNull(response.getResult());
120-
assertNotNull(response.getHeaders());
121-
});
122-
}
123-
124-
/**
125-
* Test that all fields are populated when calling rxWithDetails() using an asynchronous callback.
126-
*
127-
* @throws InterruptedException the interrupted exception
128-
*/
129-
@Test
130-
public void testRxWithDetailsAsync() throws InterruptedException {
131-
server.enqueue(new MockResponse().setBody("{\"test_key\": \"test_value\"}"));
132-
133-
service.testMethod().rxWithDetails().thenAcceptAsync(response -> {
134-
assertNotNull(response.getResult());
135-
assertNotNull(response.getHeaders());
136-
});
137-
}
138-
139-
/**
140-
* Test that all fields are populated when calling rxWjthDetails() synchronously.
141-
*
142-
* @throws InterruptedException the interrupted exception
143-
* @throws ExecutionException the execution exception
144-
*/
145-
@Test
146-
public void testRxWithDetailsSync() throws InterruptedException, ExecutionException {
147-
server.enqueue(new MockResponse().setBody("{\"test_key\": \"test_value\"}"));
148-
149-
Response<TestModel> response = service.testMethod().rxWithDetails().get();
150-
assertNotNull(response.getResult());
151-
assertNotNull(response.getHeaders());
152-
}
153-
154109
/**
155110
* Test that headers are accessible from a HEAD method call using executeWithDetails().
156111
*

0 commit comments

Comments
 (0)