From c724613f6e22faea8ec1f5d597bcf5dbc49d984b Mon Sep 17 00:00:00 2001 From: Arif Saikat <71465659+arifsaikat-microsoft@users.noreply.github.com> Date: Wed, 2 Jun 2021 01:13:26 -0700 Subject: [PATCH 1/2] Added Unit tests for CallClient and CallAsyncClient --- .../callingserver/CallAsyncClient.java | 42 ++++++ .../callingserver/CallAsyncClientTests.java | 127 ++++++++++++++++++ .../callingserver/CallClientTests.java | 126 +++++++++++++++++ .../callingserver/CallingServerTestBase.java | 11 +- .../callingserver/CallingServerTestUtils.java | 52 +++++++ ...CreatePlayAudioHangupScenarioAsync[1].json | 61 +++++++++ ...dioHangupScenarioWithResponseAsync[1].json | 61 +++++++++ ...layAudioHangupScenarioWithResponse[1].json | 61 +++++++++ ...s.runCreatePlayAudioHangupScenario[1].json | 61 +++++++++ 9 files changed, 601 insertions(+), 1 deletion(-) create mode 100644 sdk/communication/azure-communication-callingserver/src/test/java/com/azure/communication/callingserver/CallAsyncClientTests.java create mode 100644 sdk/communication/azure-communication-callingserver/src/test/java/com/azure/communication/callingserver/CallClientTests.java create mode 100644 sdk/communication/azure-communication-callingserver/src/test/java/com/azure/communication/callingserver/CallingServerTestUtils.java create mode 100644 sdk/communication/azure-communication-callingserver/src/test/resources/session-records/CallAsyncClientTests.runCreatePlayAudioHangupScenarioAsync[1].json create mode 100644 sdk/communication/azure-communication-callingserver/src/test/resources/session-records/CallAsyncClientTests.runCreatePlayAudioHangupScenarioWithResponseAsync[1].json create mode 100644 sdk/communication/azure-communication-callingserver/src/test/resources/session-records/CallClientTests.runCreatePlayAudioHangupScenarioWithResponse[1].json create mode 100644 sdk/communication/azure-communication-callingserver/src/test/resources/session-records/CallClientTests.runCreatePlayAudioHangupScenario[1].json diff --git a/sdk/communication/azure-communication-callingserver/src/main/java/com/azure/communication/callingserver/CallAsyncClient.java b/sdk/communication/azure-communication-callingserver/src/main/java/com/azure/communication/callingserver/CallAsyncClient.java index 64ec5578c220..508b2518dcf2 100644 --- a/sdk/communication/azure-communication-callingserver/src/main/java/com/azure/communication/callingserver/CallAsyncClient.java +++ b/sdk/communication/azure-communication-callingserver/src/main/java/com/azure/communication/callingserver/CallAsyncClient.java @@ -119,6 +119,30 @@ Mono> createCallWithResponse(CommunicationIdentifier } } + /** + * Play audio in a call. + * + * @param callId The call id. + * @param audioFileUri The media resource uri of the play audio request. + * @param loop The flag indicating whether audio file needs to be played in loop or not. + * @param audioFileId An id for the media in the AudioFileUri, using which we cache the media. + * @param operationContext The value to identify context of the operation. + * @return the response payload for play audio operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono playAudio(String callId, String audioFileUri, boolean loop, String audioFileId, String operationContext) { + try { + Objects.requireNonNull(callId, "'callId' cannot be null."); + Objects.requireNonNull(audioFileUri, "'audioFileUri' cannot be null."); + + PlayAudioRequest playAudioRequest = new PlayAudioRequest(). + setAudioFileUri(audioFileUri).setLoop(loop).setAudioFileId(audioFileId).setOperationContext(operationContext); + return playAudio(callId, playAudioRequest); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + /** * Play audio in a call. * @@ -142,6 +166,24 @@ public Mono playAudio(String callId, PlayAudioRequest request) } } + /** + * Play audio in a call. + * + * @param callId The call id. + * @param audioFileUri The media resource uri of the play audio request. + * @param loop The flag indicating whether audio file needs to be played in loop or not. + * @param audioFileId An id for the media in the AudioFileUri, using which we cache the media. + * @param operationContext The value to identify context of the operation. + * @param context A {@link Context} representing the request context. + * @return the response payload for play audio operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> playAudioWithResponse(String callId, String audioFileUri, boolean loop, String audioFileId, String operationContext, Context context) { + PlayAudioRequest playAudioRequest = new PlayAudioRequest(). + setAudioFileUri(audioFileUri).setLoop(loop).setAudioFileId(audioFileId).setOperationContext(operationContext); + return playAudioWithResponse(callId, playAudioRequest, context); + } + /** * Play audio in a call. * diff --git a/sdk/communication/azure-communication-callingserver/src/test/java/com/azure/communication/callingserver/CallAsyncClientTests.java b/sdk/communication/azure-communication-callingserver/src/test/java/com/azure/communication/callingserver/CallAsyncClientTests.java new file mode 100644 index 000000000000..1187ae0e5edc --- /dev/null +++ b/sdk/communication/azure-communication-callingserver/src/test/java/com/azure/communication/callingserver/CallAsyncClientTests.java @@ -0,0 +1,127 @@ +package com.azure.communication.callingserver; + +import java.net.URISyntaxException; +import java.util.Arrays; +import java.util.LinkedList; +import java.util.UUID; + +import com.azure.communication.callingserver.models.CallModality; +import com.azure.communication.callingserver.models.CreateCallOptions; +import com.azure.communication.callingserver.models.CreateCallResult; +import com.azure.communication.callingserver.models.EventSubscriptionType; +import com.azure.communication.callingserver.models.PlayAudioResult; +import com.azure.communication.common.CommunicationIdentifier; +import com.azure.communication.common.CommunicationUserIdentifier; +import com.azure.communication.common.PhoneNumberIdentifier; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +/** + * Set the AZURE_TEST_MODE environment variable to either PLAYBACK or RECORD to determine if tests are playback or + * live. By default, tests are run in playback mode. + */ +public class CallAsyncClientTests extends CallingServerTestBase { + private String from = "8:acs:016a7064-0581-40b9-be73-6dde64d69d72_0000000a-6198-4a66-02c3-593a0d00560d"; + private String alternateId = "+18445764430"; + private String to = "+15125189815"; + private String callBackUri = "https://host.app/api/callback/calling"; + private String audioFileUri = "https://acstestapp1.azurewebsites.net/audio/bot-callcenter-intro.wav"; + + @ParameterizedTest + @MethodSource("com.azure.core.test.TestBase#getHttpClients") + public void runCreatePlayAudioHangupScenarioAsync(HttpClient httpClient) throws URISyntaxException, InterruptedException { + var builder = getCallClientUsingConnectionString(httpClient); + var callAsyncClient = setupAsyncClient(builder, "runCreatePlayAudioHangupScenarioAsync"); + + try { + // Establish a call + CreateCallOptions options = new CreateCallOptions( + callBackUri, + new LinkedList(Arrays.asList(CallModality.AUDIO)), + new LinkedList(Arrays.asList(EventSubscriptionType.PARTICIPANTS_UPDATED))); + + options.setAlternateCallerId(new PhoneNumberIdentifier(alternateId)); + + CreateCallResult createCallResult = callAsyncClient.createCall( + new CommunicationUserIdentifier(from), + new LinkedList(Arrays.asList(new PhoneNumberIdentifier(to))), + options).block(); + + CallingServerTestUtils.ValidateCreateCallResult(createCallResult); + var callId = createCallResult.getCallLegId(); + + // Play Audio + var operationContext = "ac794123-3820-4979-8e2d-50c7d3e07b12"; + PlayAudioResult playAudioResult = callAsyncClient.playAudio( + callId, + audioFileUri, + false, + UUID.randomUUID().toString(), + operationContext).block(); + CallingServerTestUtils.ValidatePlayAudioResult(playAudioResult, operationContext); + + // Hang up + callAsyncClient.hangupCall(callId).block(); + } catch (Exception e) { + System.out.println("Error: " + e.getMessage()); + throw e; + } + } + + @ParameterizedTest + @MethodSource("com.azure.core.test.TestBase#getHttpClients") + public void runCreatePlayAudioHangupScenarioWithResponseAsync(HttpClient httpClient) throws URISyntaxException, InterruptedException { + var builder = getCallClientUsingConnectionString(httpClient); + var callAsyncClient = setupAsyncClient(builder, "runCreatePlayAudioHangupScenarioWithResponseAsync"); + + try { + // Establish a call + CreateCallOptions options = new CreateCallOptions( + callBackUri, + new LinkedList(Arrays.asList(CallModality.AUDIO)), + new LinkedList(Arrays.asList(EventSubscriptionType.PARTICIPANTS_UPDATED))); + + options.setAlternateCallerId(new PhoneNumberIdentifier(alternateId)); + + Response createCallResponse = callAsyncClient.createCallWithResponse( + new CommunicationUserIdentifier(from), + new LinkedList(Arrays.asList(new PhoneNumberIdentifier(to))), + options, + Context.NONE).block(); + + CallingServerTestUtils.ValidateCreateCallResponse(createCallResponse); + var callId = createCallResponse.getValue().getCallLegId(); + + // Play Audio + var operationContext = "ac794123-3820-4979-8e2d-50c7d3e07b12"; + Response playAudioResponse = callAsyncClient.playAudioWithResponse( + callId, + audioFileUri, + false, + UUID.randomUUID().toString(), + operationContext, + Context.NONE).block(); + CallingServerTestUtils.ValidatePlayAudioResponse(playAudioResponse, operationContext); + + // Hang up + Response hangupResponse = callAsyncClient.hangupCallWithResponse(callId, Context.NONE).block(); + CallingServerTestUtils.ValidateHangupResponse(hangupResponse); + } catch (Exception e) { + System.out.println("Error: " + e.getMessage()); + throw e; + } + } + + private CallAsyncClient setupAsyncClient(CallClientBuilder builder, String testName) { + return addLoggingPolicy(builder, testName).buildAsyncClient(); + } + + protected CallClientBuilder addLoggingPolicy(CallClientBuilder builder, String testName) { + return builder.addPolicy((context, next) -> logHeaders(testName, next)); + } +} + diff --git a/sdk/communication/azure-communication-callingserver/src/test/java/com/azure/communication/callingserver/CallClientTests.java b/sdk/communication/azure-communication-callingserver/src/test/java/com/azure/communication/callingserver/CallClientTests.java new file mode 100644 index 000000000000..83cb026db7ab --- /dev/null +++ b/sdk/communication/azure-communication-callingserver/src/test/java/com/azure/communication/callingserver/CallClientTests.java @@ -0,0 +1,126 @@ +package com.azure.communication.callingserver; + +import java.net.URISyntaxException; +import java.util.Arrays; +import java.util.LinkedList; +import java.util.UUID; + +import com.azure.communication.callingserver.models.CallModality; +import com.azure.communication.callingserver.models.CreateCallOptions; +import com.azure.communication.callingserver.models.CreateCallResult; +import com.azure.communication.callingserver.models.EventSubscriptionType; +import com.azure.communication.callingserver.models.PlayAudioResult; +import com.azure.communication.common.CommunicationIdentifier; +import com.azure.communication.common.CommunicationUserIdentifier; +import com.azure.communication.common.PhoneNumberIdentifier; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +/** + * Set the AZURE_TEST_MODE environment variable to either PLAYBACK or RECORD to determine if tests are playback or + * live. By default, tests are run in playback mode. + */ +public class CallClientTests extends CallingServerTestBase { + private String from = "8:acs:016a7064-0581-40b9-be73-6dde64d69d72_0000000a-6198-4a66-02c3-593a0d00560d"; + private String alternateId = "+18445764430"; + private String to = "+15125189815"; + private String callBackUri = "https://host.app/api/callback/calling"; + private String audioFileUri = "https://acstestapp1.azurewebsites.net/audio/bot-callcenter-intro.wav"; + + @ParameterizedTest + @MethodSource("com.azure.core.test.TestBase#getHttpClients") + public void runCreatePlayAudioHangupScenario(HttpClient httpClient) throws URISyntaxException, InterruptedException { + var builder = getCallClientUsingConnectionString(httpClient); + var callClient = setupClient(builder, "runCreatePlayAudioHangupScenario"); + + try { + // Establish a call + CreateCallOptions options = new CreateCallOptions( + callBackUri, + new LinkedList(Arrays.asList(CallModality.AUDIO)), + new LinkedList(Arrays.asList(EventSubscriptionType.PARTICIPANTS_UPDATED))); + + options.setAlternateCallerId(new PhoneNumberIdentifier(alternateId)); + + CreateCallResult createCallResult = callClient.createCall( + new CommunicationUserIdentifier(from), + new LinkedList(Arrays.asList(new PhoneNumberIdentifier(to))), + options); + + CallingServerTestUtils.ValidateCreateCallResult(createCallResult); + var callId = createCallResult.getCallLegId(); + + // Play Audio + var operationContext = "ac794123-3820-4979-8e2d-50c7d3e07b12"; + PlayAudioResult playAudioResult = callClient.playAudio( + callId, + audioFileUri, + false, + UUID.randomUUID().toString(), + operationContext); + CallingServerTestUtils.ValidatePlayAudioResult(playAudioResult, operationContext); + + // Hang up + callClient.hangupCall(callId); + } catch (Exception e) { + System.out.println("Error: " + e.getMessage()); + throw e; + } + } + + @ParameterizedTest + @MethodSource("com.azure.core.test.TestBase#getHttpClients") + public void runCreatePlayAudioHangupScenarioWithResponse(HttpClient httpClient) throws URISyntaxException, InterruptedException { + var builder = getCallClientUsingConnectionString(httpClient); + var callClient = setupClient(builder, "runCreatePlayAudioHangupScenarioWithResponse"); + + try { + // Establish a call + CreateCallOptions options = new CreateCallOptions( + callBackUri, + new LinkedList(Arrays.asList(CallModality.AUDIO)), + new LinkedList(Arrays.asList(EventSubscriptionType.PARTICIPANTS_UPDATED))); + + options.setAlternateCallerId(new PhoneNumberIdentifier(alternateId)); + + Response createCallResponse = callClient.createCallWithResponse( + new CommunicationUserIdentifier(from), + new LinkedList(Arrays.asList(new PhoneNumberIdentifier(to))), + options, + Context.NONE); + + CallingServerTestUtils.ValidateCreateCallResponse(createCallResponse); + var callId = createCallResponse.getValue().getCallLegId(); + + // Play Audio + var operationContext = "ac794123-3820-4979-8e2d-50c7d3e07b12"; + Response playAudioResponse = callClient.playAudioWithResponse( + callId, + audioFileUri, + false, + UUID.randomUUID().toString(), + operationContext, + Context.NONE); + CallingServerTestUtils.ValidatePlayAudioResponse(playAudioResponse, operationContext); + + // Hang up + Response hangupResponse = callClient.hangupCallWithResponse(callId, Context.NONE); + CallingServerTestUtils.ValidateHangupResponse(hangupResponse); + } catch (Exception e) { + System.out.println("Error: " + e.getMessage()); + throw e; + } + } + + private CallClient setupClient(CallClientBuilder builder, String testName) { + return addLoggingPolicy(builder, testName).buildClient(); + } + + protected CallClientBuilder addLoggingPolicy(CallClientBuilder builder, String testName) { + return builder.addPolicy((context, next) -> logHeaders(testName, next)); + } +} diff --git a/sdk/communication/azure-communication-callingserver/src/test/java/com/azure/communication/callingserver/CallingServerTestBase.java b/sdk/communication/azure-communication-callingserver/src/test/java/com/azure/communication/callingserver/CallingServerTestBase.java index 925065c81de2..d18ed0bab9aa 100644 --- a/sdk/communication/azure-communication-callingserver/src/test/java/com/azure/communication/callingserver/CallingServerTestBase.java +++ b/sdk/communication/azure-communication-callingserver/src/test/java/com/azure/communication/callingserver/CallingServerTestBase.java @@ -59,7 +59,16 @@ protected ConversationClientBuilder getConversationClientWithToken(HttpClient ht } protected CallClientBuilder getCallClientUsingConnectionString(HttpClient httpClient) { - return null; + CallClientBuilder builder = new CallClientBuilder() + .connectionString(CONNECTION_STRING) + .httpClient(httpClient == null ? interceptorManager.getPlaybackClient() : httpClient); + + if (getTestMode() == TestMode.RECORD) { + List> redactors = new ArrayList<>(); + redactors.add(data -> redact(data, JSON_PROPERTY_VALUE_REDACTION_PATTERN.matcher(data), "REDACTED")); + builder.addPolicy(interceptorManager.getRecordPolicy(redactors)); + } + return builder; } protected ConversationClientBuilder getConversationClientUsingConnectionString(HttpClient httpClient) { diff --git a/sdk/communication/azure-communication-callingserver/src/test/java/com/azure/communication/callingserver/CallingServerTestUtils.java b/sdk/communication/azure-communication-callingserver/src/test/java/com/azure/communication/callingserver/CallingServerTestUtils.java new file mode 100644 index 000000000000..46e28bc7663e --- /dev/null +++ b/sdk/communication/azure-communication-callingserver/src/test/java/com/azure/communication/callingserver/CallingServerTestUtils.java @@ -0,0 +1,52 @@ +package com.azure.communication.callingserver; + +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.azure.communication.callingserver.models.CreateCallResult; +import com.azure.communication.callingserver.models.OperationStatus; +import com.azure.communication.callingserver.models.PlayAudioResult; + +import com.azure.core.http.rest.Response; + +public class CallingServerTestUtils { + protected static void ValidateCreateCallResponse(Response createCallResponse) + { + assertNotNull(createCallResponse); + assertTrue(createCallResponse.getStatusCode() == 201); + assertNotNull(createCallResponse.getValue()); + ValidateCreateCallResult(createCallResponse.getValue()); + } + + protected static void ValidateCreateCallResult(CreateCallResult createCallResult) + { + assertNotNull(createCallResult); + assertNotNull(createCallResult.getCallLegId()); + assertTrue(!createCallResult.getCallLegId().isEmpty()); + } + + protected static void ValidatePlayAudioResponse(Response playAudioResponse, String operationContext) + { + assertNotNull(playAudioResponse); + assertTrue(playAudioResponse.getStatusCode() == 202); + assertNotNull(playAudioResponse.getValue()); + ValidatePlayAudioResult(playAudioResponse.getValue(), operationContext); + } + + protected static void ValidatePlayAudioResult(PlayAudioResult playAudioResult, String operationContext) + { + assertNotNull(playAudioResult); + assertNotNull(playAudioResult.getId()); + assertTrue(!playAudioResult.getId().isEmpty()); + assertNotNull(playAudioResult.getOperationContext()); + assertTrue(playAudioResult.getOperationContext().equalsIgnoreCase(operationContext)); + assertNotNull(playAudioResult.getStatus()); + assertTrue(playAudioResult.getStatus() == OperationStatus.RUNNING); + } + + protected static void ValidateHangupResponse(Response hangupResponse) + { + assertNotNull(hangupResponse); + assertTrue(hangupResponse.getStatusCode() == 202); + } +} diff --git a/sdk/communication/azure-communication-callingserver/src/test/resources/session-records/CallAsyncClientTests.runCreatePlayAudioHangupScenarioAsync[1].json b/sdk/communication/azure-communication-callingserver/src/test/resources/session-records/CallAsyncClientTests.runCreatePlayAudioHangupScenarioAsync[1].json new file mode 100644 index 000000000000..6f477b5a6d81 --- /dev/null +++ b/sdk/communication/azure-communication-callingserver/src/test/resources/session-records/CallAsyncClientTests.runCreatePlayAudioHangupScenarioAsync[1].json @@ -0,0 +1,61 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/calling/calls?api-version=2021-04-15-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-callingserver/1.0.0-beta.1 (16.0.1; Windows 10; 10.0)", + "Content-Type" : "application/json" + }, + "Response" : { + "X-Cache" : "CONFIG_NOCACHE", + "content-length" : "52", + "retry-after" : "0", + "X-Azure-Ref" : "0kDq3YAAAAAC6s9Hz3g6fR5V/bLxX6rTfQ0hHRURHRTE2MDgAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "StatusCode" : "201", + "X-Microsoft-Skype-Chain-ID" : "ec63135a-3322-4947-a766-60b8280269e6", + "Body" : "{\"callLegId\":\"01000380-de86-47ab-ac15-333555df6883\"}", + "Date" : "Wed, 02 Jun 2021 08:00:16 GMT", + "Content-Type" : "application/json; charset=utf-8", + "Client-Request-Id" : "41a52131-cf30-4f65-a26d-7e2dd91560ec" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/calling/calls/01000380-de86-47ab-ac15-333555df6883/PlayAudio?api-version=2021-04-15-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-callingserver/1.0.0-beta.1 (16.0.1; Windows 10; 10.0)", + "Content-Type" : "application/json" + }, + "Response" : { + "X-Cache" : "CONFIG_NOCACHE", + "content-length" : "122", + "retry-after" : "0", + "X-Azure-Ref" : "0njq3YAAAAADksItuvxUoQo2aWVYD/SePQ0hHRURHRTE2MDgAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "StatusCode" : "202", + "X-Microsoft-Skype-Chain-ID" : "88a2ef11-bdaa-48a5-9a5e-d8f122bf9074", + "Body" : "{\"id\":\"1a66586b-9d20-44be-b8a4-4a93eb926a2d\",\"status\":\"running\",\"operationContext\":\"ac794123-3820-4979-8e2d-50c7d3e07b12\"}", + "Date" : "Wed, 02 Jun 2021 08:00:29 GMT", + "Content-Type" : "application/json; charset=utf-8", + "Client-Request-Id" : "d2342e5f-27a9-4b0d-bf59-238475adad92" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/calling/calls/01000380-de86-47ab-ac15-333555df6883/Hangup?api-version=2021-04-15-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-callingserver/1.0.0-beta.1 (16.0.1; Windows 10; 10.0)" + }, + "Response" : { + "X-Cache" : "CONFIG_NOCACHE", + "content-length" : "0", + "retry-after" : "0", + "X-Azure-Ref" : "0rjq3YAAAAAAqnwzqZm2yQ6UDGVDA9eRFQ0hHRURHRTE2MDgAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "StatusCode" : "202", + "X-Microsoft-Skype-Chain-ID" : "c63ebc3b-ff3f-452f-9cd3-bf7e25d4bc9e", + "Date" : "Wed, 02 Jun 2021 08:00:45 GMT", + "Client-Request-Id" : "9c4d0f57-9b4b-42ec-8fb2-93919ae959d1" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/communication/azure-communication-callingserver/src/test/resources/session-records/CallAsyncClientTests.runCreatePlayAudioHangupScenarioWithResponseAsync[1].json b/sdk/communication/azure-communication-callingserver/src/test/resources/session-records/CallAsyncClientTests.runCreatePlayAudioHangupScenarioWithResponseAsync[1].json new file mode 100644 index 000000000000..1ecd6da4e411 --- /dev/null +++ b/sdk/communication/azure-communication-callingserver/src/test/resources/session-records/CallAsyncClientTests.runCreatePlayAudioHangupScenarioWithResponseAsync[1].json @@ -0,0 +1,61 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/calling/calls?api-version=2021-04-15-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-callingserver/1.0.0-beta.1 (16.0.1; Windows 10; 10.0)", + "Content-Type" : "application/json" + }, + "Response" : { + "X-Cache" : "CONFIG_NOCACHE", + "content-length" : "52", + "retry-after" : "0", + "X-Azure-Ref" : "0vTq3YAAAAAAZSyg4P/BrQp/qEmne0yKdQ0hHRURHRTE2MDgAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "StatusCode" : "201", + "X-Microsoft-Skype-Chain-ID" : "9bb31ad5-8f0e-4f8b-adea-aac23d732713", + "Body" : "{\"callLegId\":\"01000380-001f-44c8-94e3-183942278d2b\"}", + "Date" : "Wed, 02 Jun 2021 08:01:00 GMT", + "Content-Type" : "application/json; charset=utf-8", + "Client-Request-Id" : "e4ca4ea2-1588-4571-bcbb-4f8bf03e1404" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/calling/calls/01000380-001f-44c8-94e3-183942278d2b/PlayAudio?api-version=2021-04-15-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-callingserver/1.0.0-beta.1 (16.0.1; Windows 10; 10.0)", + "Content-Type" : "application/json" + }, + "Response" : { + "X-Cache" : "CONFIG_NOCACHE", + "content-length" : "122", + "retry-after" : "0", + "X-Azure-Ref" : "0yDq3YAAAAACelp4186vDTIszXYLuygrIQ0hHRURHRTE2MDgAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "StatusCode" : "202", + "X-Microsoft-Skype-Chain-ID" : "a753053a-3ca9-4411-b4d2-c42d1e86419f", + "Body" : "{\"id\":\"cbfcf8a7-b05c-4b14-9284-69420a6695f1\",\"status\":\"running\",\"operationContext\":\"ac794123-3820-4979-8e2d-50c7d3e07b12\"}", + "Date" : "Wed, 02 Jun 2021 08:01:13 GMT", + "Content-Type" : "application/json; charset=utf-8", + "Client-Request-Id" : "9679223c-5d8e-4f78-a0ce-89b8ad299195" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/calling/calls/01000380-001f-44c8-94e3-183942278d2b/Hangup?api-version=2021-04-15-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-callingserver/1.0.0-beta.1 (16.0.1; Windows 10; 10.0)" + }, + "Response" : { + "X-Cache" : "CONFIG_NOCACHE", + "content-length" : "0", + "retry-after" : "0", + "X-Azure-Ref" : "02Tq3YAAAAAACCYONfUtxQJL5dofoEc1dQ0hHRURHRTE2MDgAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "StatusCode" : "202", + "X-Microsoft-Skype-Chain-ID" : "57f6cbf1-3f52-4093-8eb1-081aca406f1c", + "Date" : "Wed, 02 Jun 2021 08:01:29 GMT", + "Client-Request-Id" : "6c4e93a2-48aa-49fe-8edd-ccbfb78fe355" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/communication/azure-communication-callingserver/src/test/resources/session-records/CallClientTests.runCreatePlayAudioHangupScenarioWithResponse[1].json b/sdk/communication/azure-communication-callingserver/src/test/resources/session-records/CallClientTests.runCreatePlayAudioHangupScenarioWithResponse[1].json new file mode 100644 index 000000000000..d9fa769e0d5b --- /dev/null +++ b/sdk/communication/azure-communication-callingserver/src/test/resources/session-records/CallClientTests.runCreatePlayAudioHangupScenarioWithResponse[1].json @@ -0,0 +1,61 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/calling/calls?api-version=2021-04-15-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-callingserver/1.0.0-beta.1 (16.0.1; Windows 10; 10.0)", + "Content-Type" : "application/json" + }, + "Response" : { + "X-Cache" : "CONFIG_NOCACHE", + "content-length" : "52", + "retry-after" : "0", + "X-Azure-Ref" : "0WSq3YAAAAAAlLxPPVAcCQaNsQFIxPQGtREZXMzBFREdFMDkxMgA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "StatusCode" : "201", + "X-Microsoft-Skype-Chain-ID" : "de02bcc5-69f0-4049-8473-317b4b15e12d", + "Body" : "{\"callLegId\":\"441f3600-e3c1-4a7a-8983-bf9c33502087\"}", + "Date" : "Wed, 02 Jun 2021 06:51:05 GMT", + "Content-Type" : "application/json; charset=utf-8", + "Client-Request-Id" : "5b334bff-db95-421e-a00e-6efedd3ac8c7" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/calling/calls/441f3600-e3c1-4a7a-8983-bf9c33502087/PlayAudio?api-version=2021-04-15-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-callingserver/1.0.0-beta.1 (16.0.1; Windows 10; 10.0)", + "Content-Type" : "application/json" + }, + "Response" : { + "X-Cache" : "CONFIG_NOCACHE", + "content-length" : "122", + "retry-after" : "0", + "X-Azure-Ref" : "0aiq3YAAAAAAtMNAlfN+oQqw//4WBaGefREZXMzBFREdFMDkxMgA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "StatusCode" : "202", + "X-Microsoft-Skype-Chain-ID" : "081ffeae-5f41-465b-812c-b3e5ef936678", + "Body" : "{\"id\":\"305ac91f-afeb-42c0-af2f-5de89675fd02\",\"status\":\"running\",\"operationContext\":\"ac794123-3820-4979-8e2d-50c7d3e07b12\"}", + "Date" : "Wed, 02 Jun 2021 06:51:22 GMT", + "Content-Type" : "application/json; charset=utf-8", + "Client-Request-Id" : "1a52beae-ff1b-414c-a6a8-d6fab0f2d44a" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/calling/calls/441f3600-e3c1-4a7a-8983-bf9c33502087/Hangup?api-version=2021-04-15-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-callingserver/1.0.0-beta.1 (16.0.1; Windows 10; 10.0)" + }, + "Response" : { + "X-Cache" : "CONFIG_NOCACHE", + "content-length" : "0", + "retry-after" : "0", + "X-Azure-Ref" : "0eyq3YAAAAAAjZ9Qt15GESp/gcstsJ8zeREZXMzBFREdFMDkxMgA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "StatusCode" : "202", + "X-Microsoft-Skype-Chain-ID" : "33764a06-fc32-451c-ba14-724af6edaa1e", + "Date" : "Wed, 02 Jun 2021 06:51:38 GMT", + "Client-Request-Id" : "bf02cf3c-4644-4859-bc71-1f01217e5d88" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/communication/azure-communication-callingserver/src/test/resources/session-records/CallClientTests.runCreatePlayAudioHangupScenario[1].json b/sdk/communication/azure-communication-callingserver/src/test/resources/session-records/CallClientTests.runCreatePlayAudioHangupScenario[1].json new file mode 100644 index 000000000000..b80cea885f19 --- /dev/null +++ b/sdk/communication/azure-communication-callingserver/src/test/resources/session-records/CallClientTests.runCreatePlayAudioHangupScenario[1].json @@ -0,0 +1,61 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/calling/calls?api-version=2021-04-15-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-callingserver/1.0.0-beta.1 (16.0.1; Windows 10; 10.0)", + "Content-Type" : "application/json" + }, + "Response" : { + "X-Cache" : "CONFIG_NOCACHE", + "content-length" : "52", + "retry-after" : "0", + "X-Azure-Ref" : "0/zO3YAAAAAAOcYFCI/hNQ5XHNHyBpRXXQ0hHRURHRTE2MDcAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "StatusCode" : "201", + "X-Microsoft-Skype-Chain-ID" : "687a82e7-8bac-4ffa-8b33-9e3d182b38c3", + "Body" : "{\"callLegId\":\"02000c80-ccc5-45b3-95a1-e904bf9a8ecf\"}", + "Date" : "Wed, 02 Jun 2021 07:32:15 GMT", + "Content-Type" : "application/json; charset=utf-8", + "Client-Request-Id" : "bce07995-65a4-4207-8e17-3ebfa976d75e" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/calling/calls/02000c80-ccc5-45b3-95a1-e904bf9a8ecf/PlayAudio?api-version=2021-04-15-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-callingserver/1.0.0-beta.1 (16.0.1; Windows 10; 10.0)", + "Content-Type" : "application/json" + }, + "Response" : { + "X-Cache" : "CONFIG_NOCACHE", + "content-length" : "122", + "retry-after" : "0", + "X-Azure-Ref" : "0ETS3YAAAAADmeNcNnJ96R6DGWffAVUuUQ0hHRURHRTE2MDcAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "StatusCode" : "202", + "X-Microsoft-Skype-Chain-ID" : "a5b80a80-cd0b-49aa-b045-a615df9339ad", + "Body" : "{\"id\":\"3754af76-5277-46c8-a6a8-3f31d472a827\",\"status\":\"running\",\"operationContext\":\"ac794123-3820-4979-8e2d-50c7d3e07b12\"}", + "Date" : "Wed, 02 Jun 2021 07:32:33 GMT", + "Content-Type" : "application/json; charset=utf-8", + "Client-Request-Id" : "f942fad8-b7f8-4d2b-a9b3-34dec14b1930" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/calling/calls/02000c80-ccc5-45b3-95a1-e904bf9a8ecf/Hangup?api-version=2021-04-15-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-callingserver/1.0.0-beta.1 (16.0.1; Windows 10; 10.0)" + }, + "Response" : { + "X-Cache" : "CONFIG_NOCACHE", + "content-length" : "0", + "retry-after" : "0", + "X-Azure-Ref" : "0IjS3YAAAAAC9Mac/KIXMSL+p4gjlQfJyQ0hHRURHRTE2MDcAOWZjN2I1MTktYThjYy00Zjg5LTkzNWUtYzkxNDhhZTA5ZTgx", + "StatusCode" : "202", + "X-Microsoft-Skype-Chain-ID" : "c30448ca-845b-43ac-a6df-a44e43dc9ae8", + "Date" : "Wed, 02 Jun 2021 07:32:50 GMT", + "Client-Request-Id" : "79ab5393-9814-40ae-9d68-b0d7f6c26aa8" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file From a517514f1cc9bcf4c690819fb67e121dbb6b2463 Mon Sep 17 00:00:00 2001 From: Arif Saikat <71465659+arifsaikat-microsoft@users.noreply.github.com> Date: Wed, 2 Jun 2021 01:16:47 -0700 Subject: [PATCH 2/2] comment change --- .../com/azure/communication/callingserver/CallClientTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/communication/azure-communication-callingserver/src/test/java/com/azure/communication/callingserver/CallClientTests.java b/sdk/communication/azure-communication-callingserver/src/test/java/com/azure/communication/callingserver/CallClientTests.java index 83cb026db7ab..a6da182bb203 100644 --- a/sdk/communication/azure-communication-callingserver/src/test/java/com/azure/communication/callingserver/CallClientTests.java +++ b/sdk/communication/azure-communication-callingserver/src/test/java/com/azure/communication/callingserver/CallClientTests.java @@ -21,7 +21,7 @@ import org.junit.jupiter.params.provider.MethodSource; /** - * Set the AZURE_TEST_MODE environment variable to either PLAYBACK or RECORD to determine if tests are playback or + * Set the AZURE_TEST_MODE environment variable to either PLAYBACK or RECORD to setup if tests are playback or * live. By default, tests are run in playback mode. */ public class CallClientTests extends CallingServerTestBase {