Skip to content

Commit 8cdcd55

Browse files
Testing
1 parent 7abf739 commit 8cdcd55

File tree

10 files changed

+109
-66
lines changed

10 files changed

+109
-66
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Add this dependency to your project's POM:
4040
<dependency>
4141
<groupId>com.bandwidth.sdk</groupId>
4242
<artifactId>bandwidth-sdk</artifactId>
43-
<version>9.1.4</version>
43+
<version>9.1.5</version>
4444
<scope>compile</scope>
4545
</dependency>
4646
```
@@ -56,7 +56,7 @@ Add this dependency to your project's build file:
5656
}
5757
5858
dependencies {
59-
implementation "com.bandwidth.sdk:bandwidth-sdk:9.1.4"
59+
implementation "com.bandwidth.sdk:bandwidth-sdk:9.1.5"
6060
}
6161
```
6262

@@ -70,7 +70,7 @@ mvn clean package
7070

7171
Then manually install the following JARs:
7272

73-
* `target/bandwidth-sdk-9.1.4.jar`
73+
* `target/bandwidth-sdk-9.1.5.jar`
7474
* `target/lib/*.jar`
7575

7676
## Getting Started

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ apply plugin: 'java'
44
apply plugin: 'com.diffplug.spotless'
55

66
group = 'com.bandwidth.sdk'
7-
version = '9.1.4'
7+
version = '9.1.5'
88

99
buildscript {
1010
repositories {

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ lazy val root = (project in file(".")).
22
settings(
33
organization := "com.bandwidth.sdk",
44
name := "bandwidth-sdk",
5-
version := "9.1.4",
5+
version := "9.1.5",
66
scalaVersion := "2.11.4",
77
scalacOptions ++= Seq("-feature"),
88
javacOptions in compile ++= Seq("-Xlint:deprecation"),

openapi-config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
artifactId: bandwidth-sdk
2-
artifactVersion: 9.1.4
2+
artifactVersion: 9.1.5
33
artifactDescription: The official client SDK for Bandwidth's Voice, Messaging, MFA, and WebRTC APIs
44
artifactUrl: https://github.com/Bandwidth/java-sdk
55
developerEmail: [email protected]

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<artifactId>bandwidth-sdk</artifactId>
77
<packaging>jar</packaging>
88
<name>bandwidth-sdk</name>
9-
<version>9.1.4</version>
9+
<version>9.1.5</version>
1010
<url>https://github.com/Bandwidth/java-sdk</url>
1111
<description>The official client SDK for Bandwidth's Voice, Messaging, MFA, and WebRTC APIs</description>
1212
<scm>

src/main/java/com/bandwidth/sdk/ApiClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ private void init() {
140140
json = new JSON();
141141

142142
// Set default User-Agent.
143-
setUserAgent("OpenAPI-Generator/9.1.4/java");
143+
setUserAgent("OpenAPI-Generator/9.1.5/java");
144144

145145
authentications = new HashMap<String, Authentication>();
146146
}

src/main/java/com/bandwidth/sdk/Configuration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
1717
public class Configuration {
18-
public static final String VERSION = "9.1.4";
18+
public static final String VERSION = "9.1.5";
1919

2020
private static ApiClient defaultApiClient = new ApiClient();
2121

src/main/java/com/bandwidth/sdk/api/MediaApi.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ public okhttp3.Call uploadMediaCall(String accountId, String mediaId, File body,
691691
}
692692

693693
@SuppressWarnings("rawtypes")
694-
private okhttp3.Call uploadMediaValidateBeforeCall(String accountId, String mediaId, File body, String contentType, String cacheControl, final ApiCallback _callback) throws ApiException {
694+
public okhttp3.Call uploadMediaValidateBeforeCall(String accountId, String mediaId, File body, String contentType, String cacheControl, final ApiCallback _callback) throws ApiException {
695695
// verify the required parameter 'accountId' is set
696696
if (accountId == null) {
697697
throw new ApiException("Missing the required parameter 'accountId' when calling uploadMedia(Async)");

src/test/java/com/bandwidth/sdk/api/RecordingsApiTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import com.bandwidth.sdk.model.CreateCallResponse;
1212
import com.bandwidth.sdk.model.RecordingStateEnum;
1313
import com.bandwidth.sdk.model.TranscribeRecording;
14-
import com.bandwidth.sdk.model.TranscriptionList;
14+
import com.bandwidth.sdk.model.RecordingTranscriptions;
1515
import com.bandwidth.sdk.model.UpdateCall;
1616
import com.bandwidth.sdk.model.UpdateCallRecording;
1717
import com.bandwidth.sdk.utils.MantecaStatusResponse;
@@ -205,12 +205,12 @@ public void testCallRecordingAndTranscription() throws Exception {
205205
assertThat(transcriptionStatus, is(true));
206206

207207
// Validate the transcription metadata endpoint
208-
ApiResponse<TranscriptionList> listTranscriptionsResponse = recordingsApi
209-
.getCallTranscriptionWithHttpInfo(BW_ACCOUNT_ID, callId, recordingId);
208+
ApiResponse<RecordingTranscriptions> listTranscriptionsResponse = recordingsApi
209+
.getRecordingTranscriptionWithHttpInfo(BW_ACCOUNT_ID, callId, recordingId);
210210
assertThat(listTranscriptionsResponse.getStatusCode(), is(200));
211211

212212
// Delete transcription
213-
ApiResponse<Void> deleteTranscriptionResponse = recordingsApi.deleteCallTranscriptionWithHttpInfo(BW_ACCOUNT_ID,
213+
ApiResponse<Void> deleteTranscriptionResponse = recordingsApi.deleteRecordingTranscriptionWithHttpInfo(BW_ACCOUNT_ID,
214214
callId, recordingId);
215215
assertThat(deleteTranscriptionResponse.getStatusCode(), is(204));
216216

@@ -368,7 +368,7 @@ public void testUnauthorizedGetTranscription() {
368368
Basic.setPassword("bad_password");
369369

370370
ApiException exception = Assertions.assertThrows(ApiException.class,
371-
() -> recordingsApi.deleteCallTranscription(BW_ACCOUNT_ID, callId,
371+
() -> recordingsApi.deleteRecordingTranscription(BW_ACCOUNT_ID, callId,
372372
recordingId));
373373

374374
assertThat(exception.getCode(), is(401));
@@ -380,7 +380,7 @@ public void testForbiddenGetTranscription() {
380380
Basic.setPassword(FORBIDDEN_PASSWORD);
381381

382382
ApiException exception = Assertions.assertThrows(ApiException.class,
383-
() -> recordingsApi.deleteCallTranscription(BW_ACCOUNT_ID, callId,
383+
() -> recordingsApi.deleteRecordingTranscription(BW_ACCOUNT_ID, callId,
384384
recordingId));
385385

386386
assertThat(exception.getCode(), is(403));
@@ -416,7 +416,7 @@ public void testUnauthorizedDeleteTranscription() throws ApiException {
416416
Basic.setPassword("bad_password");
417417

418418
ApiException exception = Assertions.assertThrows(ApiException.class,
419-
() -> recordingsApi.deleteCallTranscription(BW_ACCOUNT_ID, callId,
419+
() -> recordingsApi.deleteRecordingTranscription(BW_ACCOUNT_ID, callId,
420420
recordingId));
421421

422422
assertThat(exception.getCode(), is(401));
@@ -428,7 +428,7 @@ public void testForbiddenDeleteTranscription() {
428428
Basic.setPassword(FORBIDDEN_PASSWORD);
429429

430430
ApiException exception = Assertions.assertThrows(ApiException.class,
431-
() -> recordingsApi.deleteCallTranscription(BW_ACCOUNT_ID, callId,
431+
() -> recordingsApi.deleteRecordingTranscription(BW_ACCOUNT_ID, callId,
432432
recordingId));
433433

434434
assertThat(exception.getCode(), is(403));

src/test/java/com/bandwidth/sdk/api/TranscriptionsApiTest.java

Lines changed: 91 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -10,74 +10,117 @@
1010
* Do not edit the class manually.
1111
*/
1212

13-
1413
package com.bandwidth.sdk.api;
1514

15+
import com.bandwidth.sdk.ApiResponse;
1616
import com.bandwidth.sdk.ApiException;
17+
import com.bandwidth.sdk.ApiClient;
18+
import com.bandwidth.sdk.auth.HttpBasicAuth;
19+
import com.bandwidth.sdk.Configuration;
20+
import com.bandwidth.sdk.model.CallbackMethodEnum;
21+
import com.bandwidth.sdk.model.CreateCall;
22+
import com.bandwidth.sdk.model.CreateCallResponse;
23+
import com.bandwidth.sdk.model.CallDirectionEnum;
24+
import com.bandwidth.sdk.model.CallState;
25+
import com.bandwidth.sdk.model.CallStateEnum;
26+
import com.bandwidth.sdk.model.UpdateCall;
1727
import com.bandwidth.sdk.model.CallTranscriptionMetadata;
1828
import com.bandwidth.sdk.model.CallTranscriptionResponse;
1929
import com.bandwidth.sdk.model.VoiceApiError;
20-
import org.junit.jupiter.api.Disabled;
30+
2131
import org.junit.jupiter.api.Test;
32+
import org.junit.jupiter.api.TestInstance;
33+
import org.junit.jupiter.api.TestMethodOrder;
34+
import org.junit.jupiter.api.Assertions;
2235

36+
import java.net.URI;
37+
import java.net.URISyntaxException;
2338
import java.util.ArrayList;
24-
import java.util.HashMap;
2539
import java.util.List;
40+
import java.util.HashMap;
2641
import java.util.Map;
42+
import java.time.OffsetDateTime;
43+
import java.util.concurrent.TimeUnit;
44+
45+
import static org.hamcrest.MatcherAssert.assertThat;
46+
import static org.hamcrest.CoreMatchers.instanceOf;
47+
import static org.hamcrest.Matchers.is;
48+
import static org.hamcrest.Matchers.anyOf;
49+
import static org.hamcrest.beans.HasPropertyWithValue.hasProperty;
50+
51+
import static com.bandwidth.sdk.utils.TestingEnvironmentVariables.*;
52+
53+
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
54+
2755

2856
/**
2957
* API tests for TranscriptionsApi
3058
*/
31-
@Disabled
3259
public class TranscriptionsApiTest {
3360

34-
private final TranscriptionsApi api = new TranscriptionsApi();
61+
ApiClient defaultClient = Configuration.getDefaultApiClient();
62+
HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic");
63+
private final CallsApi callsApi = new CallsApi(defaultClient);
64+
private final TranscriptionsApi transcriptionsApi = new TranscriptionsApi(defaultClient);
3565

36-
/**
37-
* Delete a specific transcription
38-
*
39-
* Delete the specified transcription that was created on this call via [startTranscription](/docs/voice/bxml/startTranscription). Note: After the deletion is requested and a &#x60;204&#x60; is returned, the transcription will not be accessible anymore. However, it is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours.
40-
*
41-
* @throws ApiException if the Api call fails
42-
*/
43-
@Test
44-
public void deleteRealTimeTranscriptionTest() throws ApiException {
45-
String accountId = null;
46-
String callId = null;
47-
String transcriptionId = null;
48-
api.deleteRealTimeTranscription(accountId, callId, transcriptionId);
49-
// TODO: test validations
50-
}
5166

52-
/**
53-
* Retrieve a specific transcription
54-
*
55-
* Retrieve the specified transcription that was created on this call via [startTranscription](/docs/voice/bxml/startTranscription).
56-
*
57-
* @throws ApiException if the Api call fails
58-
*/
59-
@Test
60-
public void getRealTimeTranscriptionTest() throws ApiException {
61-
String accountId = null;
62-
String callId = null;
63-
String transcriptionId = null;
64-
CallTranscriptionResponse response = api.getRealTimeTranscription(accountId, callId, transcriptionId);
65-
// TODO: test validations
66-
}
67+
private static CreateCall createMantecaCallBody = new CreateCall();
68+
private static UpdateCall completeMantecaCallBody = new UpdateCall();
69+
private static URI mantecaAnswerUrl;
70+
private static String bxmlBody = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Bxml><SpeakSentence locale=\"en_US\" gender=\"female\" voice=\"susan\">This is a bxml start transcription test.</SpeakSentence><StartTranscription tracks=\"both\"></StartTranscription><SpeakSentence voice=\"bridget\">Ideally this part is being transcribed.</SpeakSentence><Pause duration=\"3\"/></Response></Bxml>";
71+
private static int TEST_SLEEP = 6;
72+
6773

68-
/**
69-
* Enumerate transcriptions made with StartTranscription
70-
*
71-
* Enumerates the transcriptions created on this call via [startTranscription](/docs/voice/bxml/startTranscription).
72-
*
73-
* @throws ApiException if the Api call fails
74-
*/
7574
@Test
76-
public void listRealTimeTranscriptionsTest() throws ApiException {
77-
String accountId = null;
78-
String callId = null;
79-
List<CallTranscriptionMetadata> response = api.listRealTimeTranscriptions(accountId, callId);
80-
// TODO: test validations
81-
}
75+
public void getAndDeleteRealTimeTranscriptionsTest() throws ApiException, InterruptedException, URISyntaxException {
76+
Basic.setUsername(BW_USERNAME);
77+
Basic.setPassword(BW_PASSWORD);
78+
mantecaAnswerUrl = new URI(MANTECA_BASE_URL + "/bxml/pause");
79+
80+
createMantecaCallBody.setFrom(MANTECA_ACTIVE_NUMBER);
81+
createMantecaCallBody.setTo(MANTECA_IDLE_NUMBER);
82+
createMantecaCallBody.setApplicationId(MANTECA_APPLICATION_ID);
83+
createMantecaCallBody.setAnswerUrl(mantecaAnswerUrl);
84+
completeMantecaCallBody.setState(CallStateEnum.COMPLETED);
85+
86+
87+
// Create call
88+
TimeUnit.SECONDS.sleep(TEST_SLEEP);
89+
ApiResponse<CreateCallResponse> createCallResponse = callsApi.createCallWithHttpInfo(BW_ACCOUNT_ID,
90+
createMantecaCallBody);
8291

92+
assertThat(createCallResponse.getStatusCode(), is(201));
93+
94+
// Redirect call to different url
95+
TimeUnit.SECONDS.sleep(TEST_SLEEP);
96+
ApiResponse<Void> updateCallResponse = callsApi.updateCallBxmlWithHttpInfo(BW_ACCOUNT_ID,
97+
createCallResponse.getData().getCallId(), bxmlBody);
98+
99+
assertThat(updateCallResponse.getStatusCode(), is(204));
100+
101+
// Complete call
102+
TimeUnit.SECONDS.sleep(TEST_SLEEP);
103+
ApiResponse<Void> completeCallResponse = callsApi.updateCallWithHttpInfo(BW_ACCOUNT_ID,
104+
createCallResponse.getData().getCallId(), completeMantecaCallBody);
105+
106+
assertThat(completeCallResponse.getStatusCode(), is(200));
107+
108+
109+
ApiResponse<List<CallTranscriptionMetadata>> listRealTimeTranscriptionResponse = transcriptionsApi.listRealTimeTranscriptionsWithHttpInfo(BW_ACCOUNT_ID, createCallResponse.getData().getCallId());
110+
111+
String transcriptionId = listRealTimeTranscriptionResponse.getData().get(0).getTranscriptionId();
112+
TimeUnit.SECONDS.sleep(TEST_SLEEP);
113+
114+
ApiResponse<CallTranscriptionResponse> getRealTimeTranscriptionResponse = transcriptionsApi.getRealTimeTranscriptionWithHttpInfo(BW_ACCOUNT_ID, createCallResponse.getData().getCallId(), transcriptionId);
115+
116+
assertThat(getRealTimeTranscriptionResponse.getStatusCode(), is(200));
117+
118+
119+
ApiResponse<Void> deleteRealTimeTranscriptionResponse = transcriptionsApi.deleteRealTimeTranscriptionWithHttpInfo(BW_ACCOUNT_ID, createCallResponse.getData().getCallId(), transcriptionId);
120+
121+
assertThat(deleteRealTimeTranscriptionResponse.getStatusCode(), is(204));
122+
123+
}
83124
}
125+
126+

0 commit comments

Comments
 (0)