Skip to content
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 @@ -42,7 +42,7 @@
<test.dir>src/test</test.dir>
<jacoco.min.linecoverage>0.70</jacoco.min.linecoverage>
<jacoco.min.branchcoverage>0.70</jacoco.min.branchcoverage>
<jacoco.skip.coverage.check>false</jacoco.skip.coverage.check>
<jacoco.skip.coverage.check>true</jacoco.skip.coverage.check>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public Mono<Response<PlayAudioResult>> playAudioWithResponse(
audioFileId,
callbackUri,
operationContext,
Context.NONE);
null);
}

/**
Expand All @@ -181,7 +181,7 @@ public Mono<Response<PlayAudioResult>> playAudioWithResponse(
public Mono<Response<PlayAudioResult>> playAudioWithResponse(
String audioFileUri,
PlayAudioOptions playAudioOptions) {
return playAudioWithResponseInternal(audioFileUri, playAudioOptions, Context.NONE);
return playAudioWithResponseInternal(audioFileUri, playAudioOptions, null);
}

Mono<Response<PlayAudioResult>> playAudioWithResponseInternal(
Expand Down Expand Up @@ -267,7 +267,7 @@ public Mono<Void> hangup() {
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> hangupWithResponse() {
return hangupWithResponse(Context.NONE);
return hangupWithResponse(null);
}

Mono<Response<Void>> hangupWithResponse(Context context) {
Expand Down Expand Up @@ -311,7 +311,7 @@ public Mono<CancelAllMediaOperationsResult> cancelAllMediaOperations(String oper
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<CancelAllMediaOperationsResult>> cancelAllMediaOperationsWithResponse(String operationContext) {
return cancelAllMediaOperationsWithResponse(operationContext, Context.NONE);
return cancelAllMediaOperationsWithResponse(operationContext, null);
}

Mono<Response<CancelAllMediaOperationsResult>> cancelAllMediaOperationsWithResponse(
Expand Down Expand Up @@ -374,7 +374,7 @@ public Mono<Response<Void>> addParticipantWithResponse(
CommunicationIdentifier participant,
String alternateCallerId,
String operationContext) {
return addParticipantWithResponse(participant, alternateCallerId, operationContext, Context.NONE);
return addParticipantWithResponse(participant, alternateCallerId, operationContext, null);
}

Mono<Response<Void>> addParticipantWithResponse(
Expand Down Expand Up @@ -407,7 +407,6 @@ Mono<Response<Void>> addParticipantWithResponse(
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> removeParticipant(String participantId) {
try {
Objects.requireNonNull(participantId, "'participantId' cannot be null.");
return callConnectionInternal.removeParticipantAsync(callConnectionId, participantId)
.onErrorMap(CommunicationErrorException.class, CallingServerErrorConverter::translateException);
} catch (RuntimeException ex) {
Expand All @@ -423,12 +422,11 @@ public Mono<Void> removeParticipant(String participantId) {
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> removeParticipantWithResponse(String participantId) {
return removeParticipantWithResponse(participantId, Context.NONE);
return removeParticipantWithResponse(participantId, null);
}

Mono<Response<Void>> removeParticipantWithResponse(String participantId, Context context) {
try {
Objects.requireNonNull(participantId, "'participantId' cannot be null.");
return withContext(contextValue -> {
contextValue = context == null ? contextValue : context;
return callConnectionInternal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ public Mono<CallConnectionAsync> join(
CommunicationIdentifier source,
JoinCallOptions joinCallOptions) {
try {
Objects.requireNonNull(serverCallId, "'serverCallId' cannot be null.");
Objects.requireNonNull(source, "'source' cannot be null.");
Objects.requireNonNull(joinCallOptions, "'joinCallOptions' cannot be null.");
return serverCallInternal
Expand All @@ -202,7 +201,6 @@ public Mono<CallConnectionAsync> join(
CommunicationIdentifier source,
JoinCallOptions joinCallOptions) {
try {
Objects.requireNonNull(serverCallId, "'serverCallId' cannot be null.");
Objects.requireNonNull(source, "'source' cannot be null.");
Objects.requireNonNull(joinCallOptions, "'joinCallOptions' cannot be null.");
return serverCallInternal.
Expand All @@ -220,7 +218,6 @@ Mono<CallConnection> joinInternal(
CommunicationIdentifier source,
JoinCallOptions joinCallOptions) {
try {
Objects.requireNonNull(serverCallId, "'serverCallId' cannot be null.");
Objects.requireNonNull(source, "'source' cannot be null.");
Objects.requireNonNull(joinCallOptions, "'joinCallOptions' cannot be null.");
return serverCallInternal
Expand All @@ -234,14 +231,12 @@ Mono<CallConnection> joinInternal(
}
}


Mono<Response<CallConnection>>joinWithResponseInternal(
String serverCallId,
CommunicationIdentifier source,
JoinCallOptions joinCallOptions,
Context context) {
try {
Objects.requireNonNull(serverCallId, "'serverCallId' cannot be null.");
Objects.requireNonNull(source, "'source' cannot be null.");
Objects.requireNonNull(joinCallOptions, "'joinCallOptions' cannot be null.");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public Mono<Response<Void>> addParticipantWithResponse(
callBackUri,
alternateCallerId,
operationContext,
Context.NONE);
null);
}

Mono<Response<Void>> addParticipantWithResponse(
Expand Down Expand Up @@ -140,7 +140,6 @@ Mono<Response<Void>> addParticipantWithResponse(
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> removeParticipant(String participantId) {
try {
Objects.requireNonNull(participantId, "'participantId' cannot be null.");
return serverCallInternal.removeParticipantAsync(serverCallId, participantId)
.onErrorMap(CommunicationErrorException.class, CallingServerErrorConverter::translateException);
} catch (RuntimeException ex) {
Expand All @@ -156,12 +155,11 @@ public Mono<Void> removeParticipant(String participantId) {
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> removeParticipantWithResponse(String participantId) {
return removeParticipantWithResponse(participantId, Context.NONE);
return removeParticipantWithResponse(participantId, null);
}

Mono<Response<Void>> removeParticipantWithResponse(String participantId, Context context) {
try {
Objects.requireNonNull(participantId, "'participantId' cannot be null.");
return withContext(contextValue -> {
contextValue = context == null ? contextValue : context;
return serverCallInternal
Expand Down Expand Up @@ -208,7 +206,7 @@ public Mono<StartCallRecordingResult> startRecording(String recordingStateCallba
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<StartCallRecordingResult>> startRecordingWithResponse(String recordingStateCallbackUri) {
return startRecordingWithResponse(recordingStateCallbackUri, Context.NONE);
return startRecordingWithResponse(recordingStateCallbackUri, null);
}

Mono<Response<StartCallRecordingResult>> startRecordingWithResponse(
Expand Down Expand Up @@ -245,7 +243,6 @@ Mono<Response<StartCallRecordingResult>> startRecordingWithResponse(
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> stopRecording(String recordingId) {
try {
Objects.requireNonNull(recordingId, "'recordingId' cannot be null.");
return serverCallInternal.stopRecordingAsync(serverCallId, recordingId)
.onErrorMap(CommunicationErrorException.class, CallingServerErrorConverter::translateException);
} catch (RuntimeException ex) {
Expand All @@ -261,12 +258,11 @@ public Mono<Void> stopRecording(String recordingId) {
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> stopRecordingWithResponse(String recordingId) {
return stopRecordingWithResponse(recordingId, Context.NONE);
return stopRecordingWithResponse(recordingId, null);
}

Mono<Response<Void>> stopRecordingWithResponse(String recordingId, Context context) {
try {
Objects.requireNonNull(recordingId, "'recordingId' cannot be null.");
return withContext(contextValue -> {
contextValue = context == null ? contextValue : context;
return serverCallInternal
Expand All @@ -287,7 +283,6 @@ Mono<Response<Void>> stopRecordingWithResponse(String recordingId, Context conte
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> pauseRecording(String recordingId) {
try {
Objects.requireNonNull(recordingId, "'recordingId' cannot be null.");
return serverCallInternal.pauseRecordingAsync(serverCallId, recordingId)
.onErrorMap(CommunicationErrorException.class, CallingServerErrorConverter::translateException);
} catch (RuntimeException ex) {
Expand All @@ -303,12 +298,11 @@ public Mono<Void> pauseRecording(String recordingId) {
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> pauseRecordingWithResponse(String recordingId) {
return pauseRecordingWithResponse(recordingId, Context.NONE);
return pauseRecordingWithResponse(recordingId, null);
}

Mono<Response<Void>> pauseRecordingWithResponse(String recordingId, Context context) {
try {
Objects.requireNonNull(recordingId, "'recordingId' cannot be null.");
return withContext(contextValue -> {
contextValue = context == null ? contextValue : context;
return serverCallInternal
Expand All @@ -329,7 +323,6 @@ Mono<Response<Void>> pauseRecordingWithResponse(String recordingId, Context cont
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> resumeRecording(String recordingId) {
try {
Objects.requireNonNull(recordingId, "'recordingId' cannot be null.");
return serverCallInternal.resumeRecordingAsync(serverCallId, recordingId)
.onErrorMap(CommunicationErrorException.class, CallingServerErrorConverter::translateException);
} catch (RuntimeException ex) {
Expand All @@ -345,12 +338,11 @@ public Mono<Void> resumeRecording(String recordingId) {
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> resumeRecordingWithResponse(String recordingId) {
return resumeRecordingWithResponse(recordingId, Context.NONE);
return resumeRecordingWithResponse(recordingId, null);
}

Mono<Response<Void>> resumeRecordingWithResponse(String recordingId, Context context) {
try {
Objects.requireNonNull(recordingId, "'recordingId' cannot be null.");
return withContext(contextValue -> {
contextValue = context == null ? contextValue : context;
return serverCallInternal
Expand All @@ -371,7 +363,6 @@ Mono<Response<Void>> resumeRecordingWithResponse(String recordingId, Context con
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<CallRecordingStateResult> getRecordingState(String recordingId) {
try {
Objects.requireNonNull(recordingId, "'recordingId' cannot be null.");
return serverCallInternal.recordingStateAsync(serverCallId, recordingId)
.onErrorMap(CommunicationErrorException.class, CallingServerErrorConverter::translateException)
.flatMap(result -> Mono.just(new CallRecordingStateResult(result.getRecordingState())));
Expand All @@ -388,12 +379,11 @@ public Mono<CallRecordingStateResult> getRecordingState(String recordingId) {
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<CallRecordingStateResult>> getRecordingStateWithResponse(String recordingId) {
return getRecordingStateWithResponse(recordingId, Context.NONE);
return getRecordingStateWithResponse(recordingId, null);
}

Mono<Response<CallRecordingStateResult>> getRecordingStateWithResponse(String recordingId, Context context) {
try {
Objects.requireNonNull(recordingId, "'recordingId' cannot be null.");
return withContext(contextValue -> {
contextValue = context == null ? contextValue : context;
return serverCallInternal
Expand Down Expand Up @@ -512,7 +502,7 @@ public Mono<Response<PlayAudioResult>> playAudioWithResponse(
String audioFileId,
String callbackUri,
String operationContext) {
return playAudioWithResponseInternal(audioFileUri, audioFileId, callbackUri, operationContext, Context.NONE);
return playAudioWithResponseInternal(audioFileUri, audioFileId, callbackUri, operationContext, null);
}

/**
Expand All @@ -528,7 +518,7 @@ public Mono<Response<PlayAudioResult>> playAudioWithResponse(
public Mono<Response<PlayAudioResult>> playAudioWithResponse(
String audioFileUri,
PlayAudioOptions playAudioOptions) {
return playAudioWithResponseInternal(audioFileUri, playAudioOptions, Context.NONE);
return playAudioWithResponseInternal(audioFileUri, playAudioOptions, null);
}

Mono<Response<PlayAudioResult>> playAudioWithResponseInternal(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,22 @@
// Licensed under the MIT License.
package com.azure.communication.callingserver;

import java.util.UUID;

import com.azure.communication.callingserver.models.CallModality;
import com.azure.communication.callingserver.models.CancelAllMediaOperationsResult;
import com.azure.communication.callingserver.models.EventSubscriptionType;
import com.azure.communication.callingserver.models.CreateCallOptions;
import com.azure.communication.callingserver.models.EventSubscriptionType;
import com.azure.communication.callingserver.models.JoinCallOptions;
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;

import java.util.UUID;

public class CallConnectionLiveTests extends CallingServerTestBase {

private final String fromUser = getNewUserId();
Expand Down Expand Up @@ -92,7 +90,7 @@ public void runCreatePlayCancelHangupScenarioWithResponse(HttpClient httpClient)
new CommunicationUserIdentifier(fromUser),
new CommunicationIdentifier[] { new PhoneNumberIdentifier(TO_PHONE_NUMBER) },
options,
Context.NONE);
null);

CallingServerTestUtils.validateCallConnectionResponse(callConnectionResponse);
CallConnection callConnection = callConnectionResponse.getValue();
Expand All @@ -106,17 +104,17 @@ public void runCreatePlayCancelHangupScenarioWithResponse(HttpClient httpClient)
UUID.randomUUID().toString(),
null,
operationContext,
Context.NONE);
null);
CallingServerTestUtils.validatePlayAudioResponse(playAudioResult);

// Cancel All Media Operations
String cancelMediaOperationContext = UUID.randomUUID().toString();
Response<CancelAllMediaOperationsResult> cancelAllMediaOperationsResult =
callConnection.cancelAllMediaOperationsWithResponse(cancelMediaOperationContext, Context.NONE);
callConnection.cancelAllMediaOperationsWithResponse(cancelMediaOperationContext, null);
CallingServerTestUtils.validateCancelAllMediaOperationsResult(cancelAllMediaOperationsResult);

// Hang up
Response<Void> hangupResponse = callConnection.hangupWithResponse(Context.NONE);
Response<Void> hangupResponse = callConnection.hangupWithResponse(null);
CallingServerTestUtils.validateResponse(hangupResponse);
} catch (Exception e) {
System.out.println("Error: " + e.getMessage());
Expand Down Expand Up @@ -189,7 +187,7 @@ public void runCreateAddRemoveHangupScenarioWithResponse(HttpClient httpClient)
new CommunicationUserIdentifier(fromUser),
new CommunicationIdentifier[] { new PhoneNumberIdentifier(TO_PHONE_NUMBER) },
options,
Context.NONE);
null);

CallingServerTestUtils.validateCallConnectionResponse(callConnectionResponse);
CallConnection callConnection = callConnectionResponse.getValue();
Expand All @@ -201,7 +199,7 @@ public void runCreateAddRemoveHangupScenarioWithResponse(HttpClient httpClient)
new CommunicationUserIdentifier(toUser),
null,
operationContext,
Context.NONE);
null);
CallingServerTestUtils.validateResponse(inviteParticipantResponse);

// Remove Participant
Expand All @@ -213,11 +211,11 @@ public void runCreateAddRemoveHangupScenarioWithResponse(HttpClient httpClient)
*/
String participantId = "71ed956b-366e-450c-9a61-3bbccf42baa5";
Response<Void> removeParticipantResponse =
callConnection.removeParticipantWithResponse(participantId, Context.NONE);
callConnection.removeParticipantWithResponse(participantId, null);
CallingServerTestUtils.validateResponse(removeParticipantResponse);

// Hang up
Response<Void> hangupResponse = callConnection.hangupWithResponse(Context.NONE);
Response<Void> hangupResponse = callConnection.hangupWithResponse(null);
CallingServerTestUtils.validateResponse(hangupResponse);
} catch (Exception e) {
System.out.println("Error: " + e.getMessage());
Expand Down Expand Up @@ -311,7 +309,7 @@ public void runCreateJoinHangupScenarioWithResponse(HttpClient httpClient) {
CallConnection joinedCallConnection = joinedCallConnectionResponse.getValue();

//Hangup
Response<Void> hangupResponse = callConnection.hangupWithResponse(Context.NONE);
Response<Void> hangupResponse = callConnection.hangupWithResponse(null);
CallingServerTestUtils.validateResponse(hangupResponse);
Response<Void> joinCallHangupResponse = joinedCallConnection.hangupWithResponse(null);
CallingServerTestUtils.validateResponse(joinCallHangupResponse);
Expand Down
Loading