Skip to content
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

Update unsubscription request to include subscriber details #165

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,9 @@ public CompletionStage<UStatus> unsubscribe(UUri topic, UListener listener, Call
Objects.requireNonNull(listener, "listener missing");
Objects.requireNonNull(options, "CallOptions missing");

final UnsubscribeRequest unsubscribeRequest = UnsubscribeRequest.newBuilder().setTopic(topic).build();

final UnsubscribeRequest unsubscribeRequest = UnsubscribeRequest.newBuilder().setTopic(topic)
.setSubscriber(SubscriberInfo.newBuilder().setUri(transport.getSource()).build()).build();

return RpcMapper.mapResponseToResult(
// Send the unsubscribe request
rpcClient.invokeMethod(UNSUBSCRIBE_METHOD, UPayload.pack(unsubscribeRequest), options),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,8 @@ public void handleSubscriptionChange(UUri topic, SubscriptionStatus status) {
@Test
@DisplayName("Test unsubscribe using mock RpcClient and SimplerNotifier")
void test_unsubscribe_using_mock_RpcClient_and_SimplerNotifier() {
when(transport.getSource()).thenReturn(this.source);

when(notifier.registerNotificationListener(any(UUri.class), any(UListener.class)))
.thenReturn(CompletableFuture.completedFuture(UStatus.newBuilder().setCode(UCode.OK).build()));

Expand Down Expand Up @@ -434,6 +436,8 @@ void test_unsubscribe_using_mock_RpcClient_and_SimplerNotifier() {
@Test
@DisplayName("Test unsubscribe using when invokemethod return an exception")
void test_unsubscribe_when_invokemethod_return_an_exception() {
when(transport.getSource()).thenReturn(this.source);

when(notifier.registerNotificationListener(any(UUri.class), any(UListener.class)))
.thenReturn(CompletableFuture.completedFuture(UStatus.newBuilder().setCode(UCode.OK).build()));

Expand Down Expand Up @@ -465,6 +469,8 @@ void test_unsubscribe_when_invokemethod_return_an_exception() {
@Test
@DisplayName("Test unsubscribe when invokemethod returned OK but we failed to unregister the listener")
void test_unsubscribe_when_invokemethod_returned_OK_but_we_failed_to_unregister_the_listener() {
when(transport.getSource()).thenReturn(this.source);

when(notifier.registerNotificationListener(any(UUri.class), any(UListener.class)))
.thenReturn(CompletableFuture.completedFuture(UStatus.newBuilder().setCode(UCode.OK).build()));

Expand Down
Loading