Skip to content

Commit f8d469c

Browse files
authored
Multiple changes. (#22421)
* Adding download samples * Disabling download tests for live testing
1 parent 7612080 commit f8d469c

File tree

4 files changed

+38
-4
lines changed

4 files changed

+38
-4
lines changed

sdk/communication/azure-communication-callingserver/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,16 @@ serverCall.stopRecording(recordingId);
133133
CallRecordingStateResult callRecordingStateResult = serverCall.getRecordingState(recordingId);
134134
```
135135

136+
#### Download a Recording into a file:
137+
<!-- embedme src/samples/java/com/azure/communication/callingserver/ReadmeSamples.java#L100-L100 -->
138+
```java
139+
callingServerClient.downloadTo(
140+
recordingUrl,
141+
Paths.get(filePath),
142+
null,
143+
true
144+
);
145+
```
136146
### Play Audio in Call
137147

138148
#### Play Audio:

sdk/communication/azure-communication-callingserver/src/samples/java/com/azure/communication/callingserver/ReadmeSamples.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import com.azure.communication.common.CommunicationIdentifier;
1010
import com.azure.communication.common.CommunicationUserIdentifier;
1111

12+
import java.nio.file.Paths;
1213
import java.util.Arrays;
1314
import java.util.List;
1415

@@ -88,4 +89,19 @@ public void addParticipant() {
8889
CommunicationIdentifier thirdCallee = new CommunicationUserIdentifier("<acs-user-identity-3>");
8990
callConnection.addParticipant(thirdCallee, "ACS User 3", "<string-for-tracing-responses>");
9091
}
92+
93+
/**
94+
* Sample code for downloading a recording into a file.
95+
*/
96+
public void getRecordingStream() {
97+
String recordingUrl = "https://ams.skype.com/objects/v1/document_id/video";
98+
String filePath = "filePath.mp4";
99+
CallingServerClient callingServerClient = createCallingServerClient();
100+
callingServerClient.downloadTo(
101+
recordingUrl,
102+
Paths.get(filePath),
103+
null,
104+
true
105+
);
106+
}
91107
}

sdk/communication/azure-communication-callingserver/src/test/java/com/azure/communication/callingserver/DownloadContentAsyncLiveTests.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public void downloadMetadataAsync(HttpClient httpClient) {
6363
disabledReason = "Requires human intervention")
6464
public void downloadMetadataRetryingAsync(HttpClient httpClient) {
6565
CallingServerClientBuilder builder = getConversationClientUsingConnectionString(httpClient);
66-
CallingServerAsyncClient conversationAsyncClient = setupAsyncClient(builder, "downloadMetadataAsync");
66+
CallingServerAsyncClient conversationAsyncClient = setupAsyncClient(builder, "downloadMetadataRetryingAsync");
6767

6868
try {
6969
Flux<ByteBuffer> content = conversationAsyncClient.downloadStream(METADATA_URL);
@@ -142,7 +142,7 @@ public void downloadToFileAsync(HttpClient httpClient) {
142142
disabledReason = "Requires human intervention")
143143
public void downloadToFileRetryingAsync(HttpClient httpClient) {
144144
CallingServerClientBuilder builder = getConversationClientUsingConnectionString(httpClient);
145-
CallingServerAsyncClient conversationAsyncClient = setupAsyncClient(builder, "downloadToFileAsync");
145+
CallingServerAsyncClient conversationAsyncClient = setupAsyncClient(builder, "downloadToFileRetryingAsync");
146146
AsynchronousFileChannel channel = Mockito.mock(AsynchronousFileChannel.class);
147147

148148
doAnswer(invocation -> {
@@ -171,6 +171,10 @@ public void downloadToFileRetryingAsync(HttpClient httpClient) {
171171

172172
@ParameterizedTest
173173
@MethodSource("com.azure.core.test.TestBase#getHttpClients")
174+
@DisabledIfEnvironmentVariable(
175+
named = "SKIP_LIVE_TEST",
176+
matches = "(?i)(true)",
177+
disabledReason = "Requires human intervention")
174178
public void downloadContent404Async(HttpClient httpClient) {
175179
CallingServerClientBuilder builder = getConversationClientUsingConnectionString(httpClient);
176180
CallingServerAsyncClient conversationAsyncClient = setupAsyncClient(builder, "downloadContent404Async");

sdk/communication/azure-communication-callingserver/src/test/java/com/azure/communication/callingserver/DownloadContentLiveTests.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ public void downloadVideo(HttpClient httpClient) {
7676

7777
@ParameterizedTest
7878
@MethodSource("com.azure.core.test.TestBase#getHttpClients")
79+
@DisabledIfEnvironmentVariable(
80+
named = "SKIP_LIVE_TEST",
81+
matches = "(?i)(true)",
82+
disabledReason = "Requires human intervention")
7983
public void downloadContent404(HttpClient httpClient) {
8084
CallingServerClientBuilder builder = getConversationClientUsingConnectionString(httpClient);
8185
CallingServerClient conversationClient = setupClient(builder, "downloadContent404");
@@ -91,7 +95,7 @@ public void downloadContent404(HttpClient httpClient) {
9195
@MethodSource("com.azure.core.test.TestBase#getHttpClients")
9296
public void downloadContentWrongUrl(HttpClient httpClient) {
9397
CallingServerClientBuilder builder = getConversationClientUsingConnectionString(httpClient);
94-
CallingServerClient conversationClient = setupClient(builder, "downloadContent404");
98+
CallingServerClient conversationClient = setupClient(builder, "downloadContentWrongUrl");
9599

96100
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
97101
IllegalArgumentException ex =
@@ -107,7 +111,7 @@ public void downloadContentWrongUrl(HttpClient httpClient) {
107111
@DisabledIfEnvironmentVariable(
108112
named = "SKIP_LIVE_TEST",
109113
matches = "(?i)(true)",
110-
disabledReason = "Requires human intervention")
114+
disabledReason = "Requires human intervention")
111115
public void downloadContentStreamFailure(HttpClient httpClient) throws IOException {
112116
CallingServerClientBuilder builder = getConversationClientUsingConnectionString(httpClient);
113117
CallingServerClient conversationClient = setupClient(builder, "downloadContent404");

0 commit comments

Comments
 (0)