Skip to content

Commit 0e26ec9

Browse files
Regenerate texttospeech client
1 parent 2aa9d80 commit 0e26ec9

File tree

3 files changed

+164
-13
lines changed

3 files changed

+164
-13
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*
2+
* Copyright 2018 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.google.cloud.texttospeech.v1;
17+
18+
import com.google.common.base.Preconditions;
19+
import java.util.logging.Level;
20+
import java.util.logging.Logger;
21+
import org.junit.Test;
22+
23+
@javax.annotation.Generated("by GAPIC")
24+
public class TextToSpeechSmokeTest {
25+
private static final String PROJECT_ENV_NAME = "GOOGLE_CLOUD_PROJECT";
26+
private static final String LEGACY_PROJECT_ENV_NAME = "GCLOUD_PROJECT";
27+
28+
@Test
29+
public void run() {
30+
main(null);
31+
}
32+
33+
public static void main(String args[]) {
34+
Logger.getLogger("").setLevel(Level.WARNING);
35+
try {
36+
executeNoCatch();
37+
System.out.println("OK");
38+
} catch (Exception e) {
39+
System.err.println("Failed with exception:");
40+
e.printStackTrace(System.err);
41+
System.exit(1);
42+
}
43+
}
44+
45+
public static void executeNoCatch() throws Exception {
46+
try (TextToSpeechClient client = TextToSpeechClient.create()) {
47+
String text = "test";
48+
SynthesisInput input = SynthesisInput.newBuilder().setText(text).build();
49+
String languageCode = "en-US";
50+
VoiceSelectionParams voice =
51+
VoiceSelectionParams.newBuilder().setLanguageCode(languageCode).build();
52+
AudioEncoding audioEncoding = AudioEncoding.MP3;
53+
AudioConfig audioConfig = AudioConfig.newBuilder().setAudioEncoding(audioEncoding).build();
54+
55+
SynthesizeSpeechResponse response = client.synthesizeSpeech(input, voice, audioConfig);
56+
}
57+
}
58+
59+
private static String getProjectId() {
60+
String projectId = System.getProperty(PROJECT_ENV_NAME, System.getenv(PROJECT_ENV_NAME));
61+
if (projectId == null) {
62+
projectId =
63+
System.getProperty(LEGACY_PROJECT_ENV_NAME, System.getenv(LEGACY_PROJECT_ENV_NAME));
64+
}
65+
Preconditions.checkArgument(projectId != null, "A project ID is required.");
66+
return projectId;
67+
}
68+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*
2+
* Copyright 2018 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.google.cloud.texttospeech.v1beta1;
17+
18+
import com.google.common.base.Preconditions;
19+
import java.util.logging.Level;
20+
import java.util.logging.Logger;
21+
import org.junit.Test;
22+
23+
@javax.annotation.Generated("by GAPIC")
24+
public class TextToSpeechSmokeTest {
25+
private static final String PROJECT_ENV_NAME = "GOOGLE_CLOUD_PROJECT";
26+
private static final String LEGACY_PROJECT_ENV_NAME = "GCLOUD_PROJECT";
27+
28+
@Test
29+
public void run() {
30+
main(null);
31+
}
32+
33+
public static void main(String args[]) {
34+
Logger.getLogger("").setLevel(Level.WARNING);
35+
try {
36+
executeNoCatch();
37+
System.out.println("OK");
38+
} catch (Exception e) {
39+
System.err.println("Failed with exception:");
40+
e.printStackTrace(System.err);
41+
System.exit(1);
42+
}
43+
}
44+
45+
public static void executeNoCatch() throws Exception {
46+
try (TextToSpeechClient client = TextToSpeechClient.create()) {
47+
String text = "test";
48+
SynthesisInput input = SynthesisInput.newBuilder().setText(text).build();
49+
String languageCode = "en-US";
50+
VoiceSelectionParams voice =
51+
VoiceSelectionParams.newBuilder().setLanguageCode(languageCode).build();
52+
AudioEncoding audioEncoding = AudioEncoding.MP3;
53+
AudioConfig audioConfig = AudioConfig.newBuilder().setAudioEncoding(audioEncoding).build();
54+
55+
SynthesizeSpeechResponse response = client.synthesizeSpeech(input, voice, audioConfig);
56+
}
57+
}
58+
59+
private static String getProjectId() {
60+
String projectId = System.getProperty(PROJECT_ENV_NAME, System.getenv(PROJECT_ENV_NAME));
61+
if (projectId == null) {
62+
projectId =
63+
System.getProperty(LEGACY_PROJECT_ENV_NAME, System.getenv(LEGACY_PROJECT_ENV_NAME));
64+
}
65+
Preconditions.checkArgument(projectId != null, "A project ID is required.");
66+
return projectId;
67+
}
68+
}
Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,42 @@
11
{
2+
"updateTime": "2019-01-12T08:51:17.352312Z",
23
"sources": [
4+
{
5+
"generator": {
6+
"name": "artman",
7+
"version": "0.16.5",
8+
"dockerImage": "googleapis/artman@sha256:5a96c2c5c6f9570cc9556b63dc9ce1838777fd9166b5b64e43ad8e0ecee2fe2c"
9+
}
10+
},
311
{
412
"git": {
513
"name": "googleapis",
614
"remote": "https://github.com/googleapis/googleapis.git",
7-
"sha": "5a57f0c13a358b2b15452bf2d67453774a5f6d4f",
8-
"internalRef": "221837528"
15+
"sha": "2156b3490f9fe4d79bcb34754a3aaed7ea52114d",
16+
"internalRef": "228970571"
917
}
10-
},
18+
}
19+
],
20+
"destinations": [
1121
{
12-
"git": {
13-
"name": "googleapis-private",
14-
"remote": "https://github.com/googleapis/googleapis-private.git",
15-
"sha": "6aa8e1a447bb8d0367150356a28cb4d3f2332641",
16-
"internalRef": "221340946"
22+
"client": {
23+
"source": "googleapis",
24+
"apiName": "texttospeech",
25+
"apiVersion": "v1",
26+
"language": "java",
27+
"generator": "gapic",
28+
"config": "google/cloud/texttospeech/artman_texttospeech_v1.yaml"
1729
}
1830
},
1931
{
20-
"generator": {
21-
"name": "artman",
22-
"version": "0.16.0",
23-
"dockerImage": "googleapis/artman@sha256:90f9d15e9bad675aeecd586725bce48f5667ffe7d5fc4d1e96d51ff34304815b"
32+
"client": {
33+
"source": "googleapis",
34+
"apiName": "texttospeech",
35+
"apiVersion": "v1beta1",
36+
"language": "java",
37+
"generator": "gapic",
38+
"config": "google/cloud/texttospeech/artman_texttospeech_v1beta1.yaml"
2439
}
2540
}
2641
]
27-
}
42+
}

0 commit comments

Comments
 (0)