From e20a252b61d7e4df2bc9c258d58bc07da8f8860f Mon Sep 17 00:00:00 2001 From: Andrei Giurgiu Date: Wed, 7 Oct 2020 12:37:53 -0700 Subject: [PATCH 1/3] Removed the item return check on listReadReceipts for Live/Record tests. Removed .sleep statements --- .../chat/ChatThreadAsyncClientTest.java | 16 ++++++++-------- .../communication/chat/ChatThreadClientTest.java | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatThreadAsyncClientTest.java b/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatThreadAsyncClientTest.java index ec2dd0e07c9c1..3b9facd4f8f49 100644 --- a/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatThreadAsyncClientTest.java +++ b/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatThreadAsyncClientTest.java @@ -276,8 +276,6 @@ public void canSendThenListReadReceipts() throws InterruptedException { chatThreadClient.sendReadReceipt(response.getId()).block(); - Thread.sleep(500); - PagedIterable readReceiptsResponse = new PagedIterable(chatThreadClient.listReadReceipts()); // process the iterableByPage @@ -287,8 +285,10 @@ public void canSendThenListReadReceipts() throws InterruptedException { resp.getItems().forEach(item -> returnedReadReceipts.add(item)); }); - assertTrue(returnedReadReceipts.size() > 0); - checkReadReceiptListContainsMessageId(returnedReadReceipts, response.getId()); + if (interceptorManager.isPlaybackMode()) { + assertTrue(returnedReadReceipts.size() > 0); + checkReadReceiptListContainsMessageId(returnedReadReceipts, response.getId()); + } } @Test @@ -299,8 +299,6 @@ public void canSendThenListReadReceiptsWithResponse() throws InterruptedExceptio chatThreadClient.sendReadReceiptWithResponse(response.getId()).block(); - Thread.sleep(500); - PagedIterable readReceiptsResponse = new PagedIterable(chatThreadClient.listReadReceipts()); // process the iterableByPage @@ -310,7 +308,9 @@ public void canSendThenListReadReceiptsWithResponse() throws InterruptedExceptio resp.getItems().forEach(item -> returnedReadReceipts.add(item)); }); - assertTrue(returnedReadReceipts.size() > 0); - checkReadReceiptListContainsMessageId(returnedReadReceipts, response.getId()); + if (interceptorManager.isPlaybackMode()) { + assertTrue(returnedReadReceipts.size() > 0); + checkReadReceiptListContainsMessageId(returnedReadReceipts, response.getId()); + } } } diff --git a/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatThreadClientTest.java b/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatThreadClientTest.java index 25ea67cb80ac2..25751110396d7 100644 --- a/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatThreadClientTest.java +++ b/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatThreadClientTest.java @@ -279,8 +279,6 @@ public void canSendThenListReadReceipts() throws InterruptedException { chatThreadClient.sendReadReceipt(response.getId()); - Thread.sleep(500); - PagedIterable readReceiptsResponse = chatThreadClient.listReadReceipts(); // process the iterableByPage @@ -290,8 +288,10 @@ public void canSendThenListReadReceipts() throws InterruptedException { resp.getItems().forEach(item -> returnedReadReceipts.add(item)); }); - assertTrue(returnedReadReceipts.size() > 0); - checkReadReceiptListContainsMessageId(returnedReadReceipts, response.getId()); + if (interceptorManager.isPlaybackMode()) { + assertTrue(returnedReadReceipts.size() > 0); + checkReadReceiptListContainsMessageId(returnedReadReceipts, response.getId()); + } } @Test @@ -302,8 +302,6 @@ public void canSendThenListReadReceiptsWithResponse() throws InterruptedExceptio chatThreadClient.sendReadReceiptWithResponse(response.getId(), Context.NONE); - Thread.sleep(500); - PagedIterable readReceiptsResponse = chatThreadClient.listReadReceipts(); // process the iterableByPage @@ -313,7 +311,9 @@ public void canSendThenListReadReceiptsWithResponse() throws InterruptedExceptio resp.getItems().forEach(item -> returnedReadReceipts.add(item)); }); - assertTrue(returnedReadReceipts.size() > 0); - checkReadReceiptListContainsMessageId(returnedReadReceipts, response.getId()); + if (interceptorManager.isPlaybackMode()) { + assertTrue(returnedReadReceipts.size() > 0); + checkReadReceiptListContainsMessageId(returnedReadReceipts, response.getId()); + } } } From 0a8e11e7e53a874e2dc0ff9e21f74dd2e903a53c Mon Sep 17 00:00:00 2001 From: Andrei Giurgiu Date: Fri, 28 May 2021 12:19:09 -0700 Subject: [PATCH 2/3] Added missing Options methods in ChatThreadAsyncClient --- .../azure-communication-chat/CHANGELOG.md | 4 + .../chat/ChatThreadAsyncClient.java | 57 ++++++ .../chat/ChatThreadAsyncClientTest.java | 71 +++++++ ...stAndRemoveMembersWithOptionsAsync[1].json | 185 ++++++++++++++++++ ...endThenListReadReceiptsWithOptions[1].json | 99 ++++++++++ 5 files changed, 416 insertions(+) create mode 100644 sdk/communication/azure-communication-chat/src/test/resources/session-records/ChatThreadAsyncClientTest.canAddListAndRemoveMembersWithOptionsAsync[1].json create mode 100644 sdk/communication/azure-communication-chat/src/test/resources/session-records/ChatThreadAsyncClientTest.canSendThenListReadReceiptsWithOptions[1].json diff --git a/sdk/communication/azure-communication-chat/CHANGELOG.md b/sdk/communication/azure-communication-chat/CHANGELOG.md index d5f3208318668..165061aa2dc51 100644 --- a/sdk/communication/azure-communication-chat/CHANGELOG.md +++ b/sdk/communication/azure-communication-chat/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.0.2 (Unreleased) +- Added method `ChatThreadAsyncClient.listParticipants(ListParticipantsOptions listParticipantsOptions)` +- Added method `ChatThreadAsyncClient.listReadReceipts(ListReadReceiptOptions listReadReceiptOptions)` + ## 1.0.1 (2021-05-26) - Dependency versions updated. diff --git a/sdk/communication/azure-communication-chat/src/main/java/com/azure/communication/chat/ChatThreadAsyncClient.java b/sdk/communication/azure-communication-chat/src/main/java/com/azure/communication/chat/ChatThreadAsyncClient.java index c8f46652457c9..bf8d335fa0308 100644 --- a/sdk/communication/azure-communication-chat/src/main/java/com/azure/communication/chat/ChatThreadAsyncClient.java +++ b/sdk/communication/azure-communication-chat/src/main/java/com/azure/communication/chat/ChatThreadAsyncClient.java @@ -345,6 +345,35 @@ public PagedFlux listParticipants() { return listParticipants(listParticipantsOptions, Context.NONE); } + /** + * Gets the participants of a thread. + * + * @param listParticipantsOptions The request options. + * @return the participants of a thread. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listParticipants(ListParticipantsOptions listParticipantsOptions) { + final ListParticipantsOptions serviceListParticipantsOptions = + listParticipantsOptions == null ? new ListParticipantsOptions() : listParticipantsOptions; + + try { + return pagedFluxConvert(new PagedFlux<>( + () -> withContext(context -> + this.chatThreadClient.listChatParticipantsSinglePageAsync( + chatThreadId, + serviceListParticipantsOptions.getMaxPageSize(), + serviceListParticipantsOptions.getSkip(), + context) + .onErrorMap(CommunicationErrorResponseException.class, e -> translateException(e))), + nextLink -> withContext(context -> + this.chatThreadClient.listChatParticipantsNextSinglePageAsync(nextLink, context) + .onErrorMap(CommunicationErrorResponseException.class, e -> translateException(e)))), + f -> ChatParticipantConverter.convert(f)); + } catch (RuntimeException ex) { + return new PagedFlux<>(() -> monoError(logger, ex)); + } + } + /** * Gets the participants of a thread. * @@ -821,6 +850,34 @@ public PagedFlux listReadReceipts() { } } + /** + * Gets read receipts for a thread. + * + * @param listReadReceiptOptions The additional options for this operation. + * @return read receipts for a thread. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listReadReceipts(ListReadReceiptOptions listReadReceiptOptions) { + final ListReadReceiptOptions serviceListReadReceiptOptions = + listReadReceiptOptions == null ? new ListReadReceiptOptions() : listReadReceiptOptions; + + try { + return pagedFluxConvert(new PagedFlux<>( + () -> withContext(context -> this.chatThreadClient.listChatReadReceiptsSinglePageAsync( + chatThreadId, + serviceListReadReceiptOptions.getMaxPageSize(), + serviceListReadReceiptOptions.getSkip(), + context) + .onErrorMap(CommunicationErrorResponseException.class, e -> translateException(e))), + nextLink -> withContext(context -> this.chatThreadClient.listChatReadReceiptsNextSinglePageAsync( + nextLink, context) + .onErrorMap(CommunicationErrorResponseException.class, e -> translateException(e)))), + f -> ChatMessageReadReceiptConverter.convert(f)); + } catch (RuntimeException ex) { + return new PagedFlux<>(() -> monoError(logger, ex)); + } + } + /** * Gets read receipts for a thread. * diff --git a/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatThreadAsyncClientTest.java b/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatThreadAsyncClientTest.java index 064e3897c8dff..6e5dc89240c7b 100644 --- a/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatThreadAsyncClientTest.java +++ b/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatThreadAsyncClientTest.java @@ -195,6 +195,43 @@ public void canAddListAndRemoveMembersAsync(HttpClient httpClient) throws Interr } } + @ParameterizedTest + @MethodSource("com.azure.core.test.TestBase#getHttpClients") + public void canAddListAndRemoveMembersWithOptionsAsync(HttpClient httpClient) throws InterruptedException { + // Arrange + setupTest(httpClient, "canAddListAndRemoveMembersAsync"); + firstAddedParticipant = communicationClient.createUser(); + secondAddedParticipant = communicationClient.createUser(); + + Iterable participants = ChatOptionsProvider.addParticipantsOptions( + firstAddedParticipant.getId(), secondAddedParticipant.getId()); + + // Act & Assert + StepVerifier.create(chatThreadClient.addParticipants(participants)) + .assertNext(noResp -> { + PagedIterable participantsResponse = + new PagedIterable<>(chatThreadClient.listParticipants(new ListParticipantsOptions().setMaxPageSize(2))); + + // process the iterableByPage + List returnedParticipants = new ArrayList(); + participantsResponse.iterableByPage().forEach(resp -> { + assertEquals(200, resp.getStatusCode()); + resp.getItems().forEach(item -> returnedParticipants.add(item)); + }); + + for (ChatParticipant participant : participants) { + assertTrue(checkParticipantsListContainsParticipantId(returnedParticipants, + ((CommunicationUserIdentifier) participant.getCommunicationIdentifier()).getId())); + } + assertTrue(returnedParticipants.size() == 4); + }); + + for (ChatParticipant participant : participants) { + StepVerifier.create(chatThreadClient.removeParticipant(participant.getCommunicationIdentifier())) + .verifyComplete(); + } + } + @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void canAddListWithContextAndRemoveMembersAsync(HttpClient httpClient) throws InterruptedException { @@ -754,6 +791,40 @@ public void canSendThenListReadReceipts(HttpClient httpClient) throws Interrupte }); } + @ParameterizedTest + @MethodSource("com.azure.core.test.TestBase#getHttpClients") + @DisabledIfEnvironmentVariable( + named = "SKIP_LIVE_TEST", + matches = "(?i)(true)") + public void canSendThenListReadReceiptsWithOptions(HttpClient httpClient) throws InterruptedException { + // Arrange + setupTest(httpClient, "canSendThenListReadReceipts"); + SendChatMessageOptions messageRequest = ChatOptionsProvider.sendMessageOptions(); + AtomicReference messageResponseRef = new AtomicReference<>(); + + // Action & Assert + StepVerifier.create( + chatThreadClient.sendMessage(messageRequest) + .flatMap(response -> { + messageResponseRef.set(response.getId()); + return chatThreadClient.sendReadReceipt(response.getId()); + }) + ) + .assertNext(noResp -> { + PagedIterable readReceiptsResponse = new PagedIterable( + chatThreadClient.listReadReceipts(new ListReadReceiptOptions().setMaxPageSize(1))); + + // process the iterableByPage + List returnedReadReceipts = new ArrayList<>(); + readReceiptsResponse.iterableByPage().forEach(resp -> { + assertEquals(200, resp.getStatusCode()); + resp.getItems().forEach(item -> returnedReadReceipts.add(item)); + }); + assertTrue(returnedReadReceipts.size() > 0); + checkReadReceiptListContainsMessageId(returnedReadReceipts, messageResponseRef.get()); + }); + } + @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") @DisabledIfEnvironmentVariable( diff --git a/sdk/communication/azure-communication-chat/src/test/resources/session-records/ChatThreadAsyncClientTest.canAddListAndRemoveMembersWithOptionsAsync[1].json b/sdk/communication/azure-communication-chat/src/test/resources/session-records/ChatThreadAsyncClientTest.canAddListAndRemoveMembersWithOptionsAsync[1].json new file mode 100644 index 0000000000000..af09770de8999 --- /dev/null +++ b/sdk/communication/azure-communication-chat/src/test/resources/session-records/ChatThreadAsyncClientTest.canAddListAndRemoveMembersWithOptionsAsync[1].json @@ -0,0 +1,185 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/identities?api-version=2021-03-07", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-identity/1.1.0 (1.8.0_262; Windows 10; 10.0)", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Cache" : "CONFIG_NOCACHE", + "api-supported-versions" : "2020-07-20-preview2, 2021-02-22-preview1, 2021-03-07, 2021-03-31-preview1", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Thu, 27 May 2021 23:51:46 GMT", + "Strict-Transport-Security" : "max-age=2592000", + "X-Processing-Time" : "65ms", + "MS-CV" : "hqKed1k7x0S/mm6LYGzcSw.0", + "X-Azure-Ref" : "0kzCwYAAAAAChuA8zcmkMQYT4vvdf/WISV1NURURHRTA4MDYAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "Body" : "{\"identity\":{\"id\":\"8:acs:fa5c4fc3-a269-43e2-9eb6-0ca17b388993_0000000a-501f-6485-ceb1-a43a0d0027ee\"}}", + "x-ms-client-request-id" : "1fb6a2f3-9d13-44dd-9825-9aa4b6f8b89f", + "Content-Type" : "application/json; charset=utf-8", + "Request-Context" : "appId=" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/identities?api-version=2021-03-07", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-identity/1.1.0 (1.8.0_262; Windows 10; 10.0)", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Cache" : "CONFIG_NOCACHE", + "api-supported-versions" : "2020-07-20-preview2, 2021-02-22-preview1, 2021-03-07, 2021-03-31-preview1", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Thu, 27 May 2021 23:51:47 GMT", + "Strict-Transport-Security" : "max-age=2592000", + "X-Processing-Time" : "111ms", + "MS-CV" : "Je2DwMX8yk6PS/W8Qa0JtQ.0", + "X-Azure-Ref" : "0kzCwYAAAAABI9YzwMZsyQ7RZMB7krrLBV1NURURHRTA4MDgAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "Body" : "{\"identity\":{\"id\":\"8:acs:fa5c4fc3-a269-43e2-9eb6-0ca17b388993_0000000a-501f-6519-740a-113a0d0032ad\"}}", + "x-ms-client-request-id" : "fa3f8778-a7de-4f26-8c66-8437cd626f60", + "Content-Type" : "application/json; charset=utf-8", + "Request-Context" : "appId=" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/identities/8:acs:fa5c4fc3-a269-43e2-9eb6-0ca17b388993_0000000a-501f-6485-ceb1-a43a0d0027ee/:issueAccessToken?api-version=2021-03-07", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-identity/1.1.0 (1.8.0_262; Windows 10; 10.0)", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Cache" : "CONFIG_NOCACHE", + "api-supported-versions" : "2020-07-20-preview2, 2021-02-22-preview1, 2021-03-07, 2021-03-31-preview1", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 23:51:47 GMT", + "Strict-Transport-Security" : "max-age=2592000", + "X-Processing-Time" : "125ms", + "MS-CV" : "YjGZ7mhh8E6Rucg6dPGMAA.0", + "X-Azure-Ref" : "0kzCwYAAAAABYIwc+TdlCSLiyjspz8M40V1NURURHRTA4MDYAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "Body" : "{\"token\":\"REDACTED\",\"expiresOn\":\"2021-05-28T23:51:46.9935327+00:00\"}", + "x-ms-client-request-id" : "c8500a20-706c-4282-ae3f-43b4cf963cf8", + "Content-Type" : "application/json; charset=utf-8", + "Request-Context" : "appId=" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/chat/threads?api-version=2021-03-07", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-chat/1.0.1 (1.8.0_262; Windows 10; 10.0)", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Cache" : "CONFIG_NOCACHE", + "api-supported-versions" : "2020-09-21-preview2, 2020-11-01-preview3, 2021-01-27-preview4, 2021-03-01-preview5, 2021-03-07, 2021-04-05-preview6", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Thu, 27 May 2021 23:51:48 GMT", + "Strict-Transport-Security" : "max-age=2592000", + "X-Processing-Time" : "831ms", + "MS-CV" : "iLFmwh1kIEihViH/5X/rxA.0", + "X-Azure-Ref" : "0lDCwYAAAAAAaoMb88uUqRL44OB6f0ZNCV1NURURHRTA4MDgAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "Body" : "{\"chatThread\":{\"id\":\"19:eXCI9r5t4PcEHdHM4pZi4mjbmVpQsF5gATSJIxz_mL41@thread.v2\",\"topic\":\"Test\",\"createdOn\":\"2021-05-27T23:51:48Z\",\"createdByCommunicationIdentifier\":{\"rawId\":\"8:acs:fa5c4fc3-a269-43e2-9eb6-0ca17b388993_0000000a-501f-6485-ceb1-a43a0d0027ee\",\"communicationUser\":{\"id\":\"8:acs:fa5c4fc3-a269-43e2-9eb6-0ca17b388993_0000000a-501f-6485-ceb1-a43a0d0027ee\"}}}}", + "Content-Type" : "application/json; charset=utf-8", + "Location" : "https://chat-prod-e2e.communication.azure.com/chat/threads/19%3AeXCI9r5t4PcEHdHM4pZi4mjbmVpQsF5gATSJIxz_mL41@thread.v2" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/identities?api-version=2021-03-07", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-identity/1.1.0 (1.8.0_262; Windows 10; 10.0)", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Cache" : "CONFIG_NOCACHE", + "api-supported-versions" : "2020-07-20-preview2, 2021-02-22-preview1, 2021-03-07, 2021-03-31-preview1", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Thu, 27 May 2021 23:51:48 GMT", + "Strict-Transport-Security" : "max-age=2592000", + "X-Processing-Time" : "62ms", + "MS-CV" : "RXFlmlhlMUGIlISTXhYtpQ.0", + "X-Azure-Ref" : "0lDCwYAAAAAAd6CZA9n1KR6EvuE7we8DcV1NURURHRTA4MDYAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "Body" : "{\"identity\":{\"id\":\"8:acs:fa5c4fc3-a269-43e2-9eb6-0ca17b388993_0000000a-501f-69c0-ceb1-a43a0d0027ef\"}}", + "x-ms-client-request-id" : "ec9d25d1-bc5e-4723-ab47-5a3aca20234b", + "Content-Type" : "application/json; charset=utf-8", + "Request-Context" : "appId=" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/identities?api-version=2021-03-07", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-identity/1.1.0 (1.8.0_262; Windows 10; 10.0)", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Cache" : "CONFIG_NOCACHE", + "api-supported-versions" : "2020-07-20-preview2, 2021-02-22-preview1, 2021-03-07, 2021-03-31-preview1", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Thu, 27 May 2021 23:51:48 GMT", + "Strict-Transport-Security" : "max-age=2592000", + "X-Processing-Time" : "86ms", + "MS-CV" : "KVZRWdzijkCUR9JK1DndPg.0", + "X-Azure-Ref" : "0lTCwYAAAAACiK5KHtP2BSoA+i+C3ZzNxV1NURURHRTA4MDgAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "Body" : "{\"identity\":{\"id\":\"8:acs:fa5c4fc3-a269-43e2-9eb6-0ca17b388993_0000000a-501f-6a40-740a-113a0d0032af\"}}", + "x-ms-client-request-id" : "f00f8a1f-f26c-4a6e-ad26-8fe31ad313e5", + "Content-Type" : "application/json; charset=utf-8", + "Request-Context" : "appId=" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/chat/threads/19:eXCI9r5t4PcEHdHM4pZi4mjbmVpQsF5gATSJIxz_mL41@thread.v2/participants/:remove?api-version=2021-03-07", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-chat/1.0.1 (1.8.0_262; Windows 10; 10.0)", + "Content-Type" : "application/json" + }, + "Response" : { + "X-Cache" : "CONFIG_NOCACHE", + "Strict-Transport-Security" : "max-age=2592000", + "api-supported-versions" : "2020-11-01-preview3, 2021-01-27-preview4, 2021-03-01-preview5, 2021-03-07, 2021-04-05-preview6", + "X-Processing-Time" : "176ms", + "MS-CV" : "h6KGMwolGk6sV5PEJpf/jg.0", + "retry-after" : "0", + "X-Azure-Ref" : "0lTCwYAAAAAA3yWMV3OwYT6KImV3TNXrZV1NURURHRTA4MDYAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "StatusCode" : "204", + "Date" : "Thu, 27 May 2021 23:51:48 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/chat/threads/19:eXCI9r5t4PcEHdHM4pZi4mjbmVpQsF5gATSJIxz_mL41@thread.v2/participants/:remove?api-version=2021-03-07", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-chat/1.0.1 (1.8.0_262; Windows 10; 10.0)", + "Content-Type" : "application/json" + }, + "Response" : { + "X-Cache" : "CONFIG_NOCACHE", + "Strict-Transport-Security" : "max-age=2592000", + "api-supported-versions" : "2020-11-01-preview3, 2021-01-27-preview4, 2021-03-01-preview5, 2021-03-07, 2021-04-05-preview6", + "X-Processing-Time" : "403ms", + "MS-CV" : "spA6zr1ZB0OHd9VnV0/K2g.0", + "retry-after" : "0", + "X-Azure-Ref" : "0lTCwYAAAAACNNOLqovnwRoHfm01ydwNXV1NURURHRTA4MDgAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "StatusCode" : "204", + "Date" : "Thu, 27 May 2021 23:51:49 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/communication/azure-communication-chat/src/test/resources/session-records/ChatThreadAsyncClientTest.canSendThenListReadReceiptsWithOptions[1].json b/sdk/communication/azure-communication-chat/src/test/resources/session-records/ChatThreadAsyncClientTest.canSendThenListReadReceiptsWithOptions[1].json new file mode 100644 index 0000000000000..f4d102ff0a1b9 --- /dev/null +++ b/sdk/communication/azure-communication-chat/src/test/resources/session-records/ChatThreadAsyncClientTest.canSendThenListReadReceiptsWithOptions[1].json @@ -0,0 +1,99 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/identities?api-version=2021-03-07", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-identity/1.1.0 (1.8.0_262; Windows 10; 10.0)", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Cache" : "CONFIG_NOCACHE", + "api-supported-versions" : "2020-07-20-preview2, 2021-02-22-preview1, 2021-03-07, 2021-03-31-preview1", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Thu, 27 May 2021 23:52:12 GMT", + "Strict-Transport-Security" : "max-age=2592000", + "X-Processing-Time" : "61ms", + "MS-CV" : "TDyTtCHa6kqK44Rh3zuaJw.0", + "X-Azure-Ref" : "0rTCwYAAAAABLRDxBM+nLSayRS62sQnz1V1NURURHRTA4MDYAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "Body" : "{\"identity\":{\"id\":\"8:acs:fa5c4fc3-a269-43e2-9eb6-0ca17b388993_0000000a-501f-c903-ceb1-a43a0d002804\"}}", + "x-ms-client-request-id" : "6fbc1025-c3ce-46f8-8a08-ea3588f27116", + "Content-Type" : "application/json; charset=utf-8", + "Request-Context" : "appId=" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/identities?api-version=2021-03-07", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-identity/1.1.0 (1.8.0_262; Windows 10; 10.0)", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Cache" : "CONFIG_NOCACHE", + "api-supported-versions" : "2020-07-20-preview2, 2021-02-22-preview1, 2021-03-07, 2021-03-31-preview1", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Thu, 27 May 2021 23:52:13 GMT", + "Strict-Transport-Security" : "max-age=2592000", + "X-Processing-Time" : "85ms", + "MS-CV" : "wBhusif1zUitP9JUJIaPVw.0", + "X-Azure-Ref" : "0rTCwYAAAAAAU2eFs/5clTb91qKAtXWhAV1NURURHRTA4MDgAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "Body" : "{\"identity\":{\"id\":\"8:acs:fa5c4fc3-a269-43e2-9eb6-0ca17b388993_0000000a-501f-c981-740a-113a0d0032ca\"}}", + "x-ms-client-request-id" : "3ba392d9-5b8e-4bb5-946e-92804058d812", + "Content-Type" : "application/json; charset=utf-8", + "Request-Context" : "appId=" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/identities/8:acs:fa5c4fc3-a269-43e2-9eb6-0ca17b388993_0000000a-501f-c903-ceb1-a43a0d002804/:issueAccessToken?api-version=2021-03-07", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-identity/1.1.0 (1.8.0_262; Windows 10; 10.0)", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Cache" : "CONFIG_NOCACHE", + "api-supported-versions" : "2020-07-20-preview2, 2021-02-22-preview1, 2021-03-07, 2021-03-31-preview1", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 27 May 2021 23:52:12 GMT", + "Strict-Transport-Security" : "max-age=2592000", + "X-Processing-Time" : "128ms", + "MS-CV" : "0kyf4J1soE+vLa6kr8qtEA.0", + "X-Azure-Ref" : "0rTCwYAAAAACjVRmvYejgS5oPr/ek1xuiV1NURURHRTA4MDYAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "Body" : "{\"token\":\"REDACTED\",\"expiresOn\":\"2021-05-28T23:52:12.7058272+00:00\"}", + "x-ms-client-request-id" : "ad929ad9-0bc4-41c5-ac6b-62f913ecc920", + "Content-Type" : "application/json; charset=utf-8", + "Request-Context" : "appId=" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/chat/threads?api-version=2021-03-07", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-chat/1.0.1 (1.8.0_262; Windows 10; 10.0)", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Cache" : "CONFIG_NOCACHE", + "api-supported-versions" : "2020-09-21-preview2, 2020-11-01-preview3, 2021-01-27-preview4, 2021-03-01-preview5, 2021-03-07, 2021-04-05-preview6", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Thu, 27 May 2021 23:52:14 GMT", + "Strict-Transport-Security" : "max-age=2592000", + "X-Processing-Time" : "1090ms", + "MS-CV" : "/1oul2Rdhki5+y7QmKlChw.0", + "X-Azure-Ref" : "0rTCwYAAAAADHT172YwkAS4ZpcZ60/6qBV1NURURHRTA4MDgAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "Body" : "{\"chatThread\":{\"id\":\"19:7x968SeTYz5JaYALO9u9dXAHVpWcvdf2PWwhYjaKdxk1@thread.v2\",\"topic\":\"Test\",\"createdOn\":\"2021-05-27T23:52:13Z\",\"createdByCommunicationIdentifier\":{\"rawId\":\"8:acs:fa5c4fc3-a269-43e2-9eb6-0ca17b388993_0000000a-501f-c903-ceb1-a43a0d002804\",\"communicationUser\":{\"id\":\"8:acs:fa5c4fc3-a269-43e2-9eb6-0ca17b388993_0000000a-501f-c903-ceb1-a43a0d002804\"}}}}", + "Content-Type" : "application/json; charset=utf-8", + "Location" : "https://chat-prod-e2e.communication.azure.com/chat/threads/19%3A7x968SeTYz5JaYALO9u9dXAHVpWcvdf2PWwhYjaKdxk1@thread.v2" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file From 6f5bec880b73ffb5482dc64bc27d271bb798ead6 Mon Sep 17 00:00:00 2001 From: Andrei Giurgiu Date: Fri, 28 May 2021 12:38:26 -0700 Subject: [PATCH 3/3] Updated incorrect test name used for logging --- .../azure/communication/chat/ChatThreadAsyncClientTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatThreadAsyncClientTest.java b/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatThreadAsyncClientTest.java index 6e5dc89240c7b..44996f762f540 100644 --- a/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatThreadAsyncClientTest.java +++ b/sdk/communication/azure-communication-chat/src/test/java/com/azure/communication/chat/ChatThreadAsyncClientTest.java @@ -199,7 +199,7 @@ public void canAddListAndRemoveMembersAsync(HttpClient httpClient) throws Interr @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void canAddListAndRemoveMembersWithOptionsAsync(HttpClient httpClient) throws InterruptedException { // Arrange - setupTest(httpClient, "canAddListAndRemoveMembersAsync"); + setupTest(httpClient, "canAddListAndRemoveMembersWithOptionsAsync"); firstAddedParticipant = communicationClient.createUser(); secondAddedParticipant = communicationClient.createUser(); @@ -798,7 +798,7 @@ public void canSendThenListReadReceipts(HttpClient httpClient) throws Interrupte matches = "(?i)(true)") public void canSendThenListReadReceiptsWithOptions(HttpClient httpClient) throws InterruptedException { // Arrange - setupTest(httpClient, "canSendThenListReadReceipts"); + setupTest(httpClient, "canSendThenListReadReceiptsWithOptions"); SendChatMessageOptions messageRequest = ChatOptionsProvider.sendMessageOptions(); AtomicReference messageResponseRef = new AtomicReference<>();