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

PR review test fixes #22263

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
6 changes: 6 additions & 0 deletions sdk/communication/azure-communication-callingserver/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@
<artifactId>azure-communication-common</artifactId>
<version>1.1.0-beta.1</version> <!-- {x-version-update;com.azure:azure-communication-common;current} -->
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-communication-identity</artifactId>
<version>1.1.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public static CreateCallRequestInternal convert(CommunicationIdentifier source,
request.setCallbackUri(createCallOptions.getCallbackUri());
request.setRequestedMediaTypes(requestedModalities);
request.setRequestedCallEvents(requestedCallEvents).setAlternateCallerId(sourceAlternateIdentity);

return request;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,10 @@
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 CallConnectionAsyncTests extends CallingServerTestBase {

private String from = getRandomUserId();
private String invitedUser = getRandomUserId();
private String joinedUser = getRandomUserId();
private String alternateId = "+11111111111";
private String to = "+11111111111";
private String callBackUri = "https://host.app/api/callback/calling";
private String audioFileUri = "https://host.app/audio/bot-callcenter-intro.wav";
public class CallConnectionAsyncLiveTests extends CallingServerTestBase {

private final String fromUser = getNewUserId();
private final String toUser = getNewUserId();

@ParameterizedTest
@MethodSource("com.azure.core.test.TestBase#getHttpClients")
Expand All @@ -42,15 +33,15 @@ public void runCreatePlayCancelHangupScenarioAsync(HttpClient httpClient) {
try {
// Establish a call
CreateCallOptions options = new CreateCallOptions(
callBackUri,
CALLBACK_URI,
new CallModality[] { CallModality.AUDIO },
new EventSubscriptionType[] { EventSubscriptionType.PARTICIPANTS_UPDATED });

options.setAlternateCallerId(new PhoneNumberIdentifier(alternateId));
options.setAlternateCallerId(new PhoneNumberIdentifier(FROM_PHONE_NUMBER));

CallConnectionAsync callConnectionAsync = callingServerAsyncClient.createCallConnection(
new CommunicationUserIdentifier(from),
new CommunicationIdentifier[] { new PhoneNumberIdentifier(to) },
new CommunicationUserIdentifier(fromUser),
new CommunicationIdentifier[] { new PhoneNumberIdentifier(TO_PHONE_NUMBER) },
options).block();

CallingServerTestUtils.validateCallConnectionAsync(callConnectionAsync);
Expand All @@ -59,7 +50,7 @@ public void runCreatePlayCancelHangupScenarioAsync(HttpClient httpClient) {
String operationContext = UUID.randomUUID().toString();
assert callConnectionAsync != null;
PlayAudioResult playAudioResult = callConnectionAsync.playAudio(
audioFileUri,
AUDIO_FILE_URI,
false,
UUID.randomUUID().toString(),
null,
Expand Down Expand Up @@ -88,15 +79,15 @@ public void runCreatePlayCancelHangupScenarioWithResponseAsync(HttpClient httpCl
try {
// Establish a call
CreateCallOptions options = new CreateCallOptions(
callBackUri,
CALLBACK_URI,
new CallModality[] { CallModality.AUDIO },
new EventSubscriptionType[] { EventSubscriptionType.PARTICIPANTS_UPDATED });

options.setAlternateCallerId(new PhoneNumberIdentifier(alternateId));
options.setAlternateCallerId(new PhoneNumberIdentifier(FROM_PHONE_NUMBER));

Response<CallConnectionAsync> callConnectionAsyncResponse = callingServerAsyncClient.createCallConnectionWithResponse(
new CommunicationUserIdentifier(from),
new CommunicationIdentifier[] { new PhoneNumberIdentifier(to) },
new CommunicationUserIdentifier(fromUser),
new CommunicationIdentifier[] { new PhoneNumberIdentifier(TO_PHONE_NUMBER) },
options).block();

CallingServerTestUtils.validateCallConnectionAsyncResponse(callConnectionAsyncResponse);
Expand All @@ -107,7 +98,7 @@ public void runCreatePlayCancelHangupScenarioWithResponseAsync(HttpClient httpCl
String operationContext = UUID.randomUUID().toString();
Response<PlayAudioResult> playAudioResponse =
callConnectionAsync.playAudioWithResponse(
audioFileUri,
AUDIO_FILE_URI,
false,
UUID.randomUUID().toString(),
null,
Expand Down Expand Up @@ -137,30 +128,30 @@ public void runCreateAddRemoveHangupScenarioAsync(HttpClient httpClient) {
try {
// Establish a call
CreateCallOptions options = new CreateCallOptions(
callBackUri,
CALLBACK_URI,
new CallModality[] { CallModality.AUDIO },
new EventSubscriptionType[] { EventSubscriptionType.PARTICIPANTS_UPDATED });

options.setAlternateCallerId(new PhoneNumberIdentifier(alternateId));
options.setAlternateCallerId(new PhoneNumberIdentifier(FROM_PHONE_NUMBER));

CallConnectionAsync callConnectionAsync = callingServerAsyncClient.createCallConnection(
new CommunicationUserIdentifier(from),
new CommunicationIdentifier[] { new PhoneNumberIdentifier(to) },
new CommunicationUserIdentifier(fromUser),
new CommunicationIdentifier[] { new PhoneNumberIdentifier(TO_PHONE_NUMBER) },
options).block();

CallingServerTestUtils.validateCallConnectionAsync(callConnectionAsync);

// Invite User
String operationContext = UUID.randomUUID().toString();
assert callConnectionAsync != null;
callConnectionAsync.addParticipant(new CommunicationUserIdentifier(invitedUser), null, operationContext).block();
callConnectionAsync.addParticipant(new CommunicationUserIdentifier(toUser), null, operationContext).block();

// Remove Participant
/**
* There is an update that we require to beable to get
* the participantId from the service when a user is
* added to a call. Until that is fixed this recorded
* valuse needs to be used.
/*
There is an update that we require to be able to get
the participantId from the service when a user is
added to a call. Until that is fixed this recorded
value needs to be used.
*/
String participantId = "e3560385-776f-41d1-bf04-07ef738f2fc1";
callConnectionAsync.removeParticipant(participantId).block();
Expand All @@ -182,15 +173,15 @@ public void runCreateAddRemoveHangupScenarioWithResponseAsync(HttpClient httpCli
try {
// Establish a call
CreateCallOptions options = new CreateCallOptions(
callBackUri,
CALLBACK_URI,
new CallModality[] { CallModality.AUDIO },
new EventSubscriptionType[] { EventSubscriptionType.PARTICIPANTS_UPDATED });

options.setAlternateCallerId(new PhoneNumberIdentifier(alternateId));
options.setAlternateCallerId(new PhoneNumberIdentifier(FROM_PHONE_NUMBER));

Response<CallConnectionAsync> callConnectionAsyncResponse = callingServerAsyncClient.createCallConnectionWithResponse(
new CommunicationUserIdentifier(from),
new CommunicationIdentifier[] { new PhoneNumberIdentifier(to) },
new CommunicationUserIdentifier(fromUser),
new CommunicationIdentifier[] { new PhoneNumberIdentifier(TO_PHONE_NUMBER) },
options).block();

CallingServerTestUtils.validateCallConnectionAsyncResponse(callConnectionAsyncResponse);
Expand All @@ -199,16 +190,16 @@ public void runCreateAddRemoveHangupScenarioWithResponseAsync(HttpClient httpCli

// Invite User
String operationContext = UUID.randomUUID().toString();
Response<Void> inviteParticipantResponse = callConnectionAsync.addParticipantWithResponse(new CommunicationUserIdentifier(invitedUser), null, operationContext).block();
Response<Void> inviteParticipantResponse = callConnectionAsync.addParticipantWithResponse(new CommunicationUserIdentifier(toUser), null, operationContext).block();
CallingServerTestUtils.validateResponse(inviteParticipantResponse);

// Remove Participant
/**
* There is an update that we require to beable to get
* the participantId from the service when a user is
* added to a call. Until that is fixed this recorded
* valuse needs to be used.
*/
/*
There is an update that we require to be able to get
the participantId from the service when a user is
added to a call. Until that is fixed this recorded
value needs to be used.
*/
String participantId = "80238d5f-9eda-481a-b911-e2e12eba9eda";
Response<Void> removeParticipantResponse = callConnectionAsync.removeParticipantWithResponse(participantId).block();
CallingServerTestUtils.validateResponse(removeParticipantResponse);
Expand All @@ -231,33 +222,33 @@ public void runCreateJoinHangupScenarioAsync(HttpClient httpClient) {
try {
// Establish a call
CreateCallOptions options = new CreateCallOptions(
callBackUri,
CALLBACK_URI,
new CallModality[] { CallModality.AUDIO },
new EventSubscriptionType[] { EventSubscriptionType.PARTICIPANTS_UPDATED });

options.setAlternateCallerId(new PhoneNumberIdentifier(alternateId));
options.setAlternateCallerId(new PhoneNumberIdentifier(FROM_PHONE_NUMBER));

CallConnectionAsync callConnectionAsync = callingServerAsyncClient.createCallConnection(
new CommunicationUserIdentifier(from),
new CommunicationIdentifier[] { new PhoneNumberIdentifier(to) },
new CommunicationUserIdentifier(fromUser),
new CommunicationIdentifier[] { new PhoneNumberIdentifier(TO_PHONE_NUMBER) },
options).block();

CallingServerTestUtils.validateCallConnectionAsync(callConnectionAsync);

// Join
/**
* Waiting for an upate to beable to get this serverCallId when using
* createCallConnection()
/*
Waiting for an update to be able to get this serverCallId when using
createCallConnection()
*/
String serverCallId = "aHR0cHM6Ly94LWNvbnYtdXN3ZS0wMS5jb252LnNreXBlLmNvbS9jb252L3VodHNzZEZ3NFVHX1J4d1lHYWlLRmc_aT0yJmU9NjM3NTg0Mzk2NDM5NzQ5NzY4";
JoinCallOptions joinCallOptions = new JoinCallOptions(
callBackUri,
CALLBACK_URI,
new CallModality[] { CallModality.AUDIO },
new EventSubscriptionType[] { EventSubscriptionType.PARTICIPANTS_UPDATED });
CallConnectionAsync joinedCallConnectionAsync =
callingServerAsyncClient.join(
serverCallId,
new CommunicationUserIdentifier(joinedUser),
new CommunicationUserIdentifier(toUser),
joinCallOptions).block();
CallingServerTestUtils.validateCallConnectionAsync(joinedCallConnectionAsync);

Expand All @@ -281,35 +272,35 @@ public void runCreateJoinHangupScenarioWithResponseAsync(HttpClient httpClient)
try {
// Establish a call
CreateCallOptions options = new CreateCallOptions(
callBackUri,
CALLBACK_URI,
new CallModality[] { CallModality.AUDIO },
new EventSubscriptionType[] { EventSubscriptionType.PARTICIPANTS_UPDATED });

options.setAlternateCallerId(new PhoneNumberIdentifier(alternateId));
options.setAlternateCallerId(new PhoneNumberIdentifier(FROM_PHONE_NUMBER));

Response<CallConnectionAsync> callConnectionAsyncResponse = callingServerAsyncClient.createCallConnectionWithResponse(
new CommunicationUserIdentifier(from),
new CommunicationIdentifier[] { new PhoneNumberIdentifier(to) },
new CommunicationUserIdentifier(fromUser),
new CommunicationIdentifier[] { new PhoneNumberIdentifier(TO_PHONE_NUMBER) },
options).block();

CallingServerTestUtils.validateCallConnectionAsyncResponse(callConnectionAsyncResponse);
assert callConnectionAsyncResponse != null;
CallConnectionAsync callConnectionAsync = callConnectionAsyncResponse.getValue();

// Join
/**
* Waiting for an upate to beable to get this serverCallId when using
* createCallConnection()
*/
/*
Waiting for an update to be able to get this serverCallId when using
createCallConnection()
*/
String serverCallId = "aHR0cHM6Ly94LWNvbnYtdXN3ZS0wMS5jb252LnNreXBlLmNvbS9jb252L3lKQXY0TnVlOEV5bUpYVm1IYklIeUE_aT0wJmU9NjM3NTg0MzkwMjcxMzg0MTc3";
JoinCallOptions joinCallOptions = new JoinCallOptions(
callBackUri,
CALLBACK_URI,
new CallModality[] { CallModality.AUDIO },
new EventSubscriptionType[] { EventSubscriptionType.PARTICIPANTS_UPDATED });
Response<CallConnectionAsync> joinedCallConnectionAsyncResponse =
callingServerAsyncClient.joinWithResponse(
serverCallId,
new CommunicationUserIdentifier(joinedUser),
new CommunicationUserIdentifier(toUser),
joinCallOptions).block();
CallingServerTestUtils.validateJoinCallConnectionAsyncResponse(joinedCallConnectionAsyncResponse);
assert joinedCallConnectionAsyncResponse != null;
Expand Down
Loading