diff --git a/texttospeech/beta/src/main/java/com/example/texttospeech/ListAllSupportedVoices.java b/texttospeech/beta/src/main/java/com/example/texttospeech/ListAllSupportedVoices.java deleted file mode 100644 index 81f0cfab764..00000000000 --- a/texttospeech/beta/src/main/java/com/example/texttospeech/ListAllSupportedVoices.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.texttospeech; - -// Imports the Google Cloud client library -import com.google.cloud.texttospeech.v1beta1.ListVoicesRequest; -import com.google.cloud.texttospeech.v1beta1.ListVoicesResponse; -import com.google.cloud.texttospeech.v1beta1.TextToSpeechClient; -import com.google.cloud.texttospeech.v1beta1.Voice; -import com.google.protobuf.ByteString; -import java.util.List; - -/** - * Google Cloud TextToSpeech API sample application. Example usage: mvn package exec:java - * -Dexec.mainClass='com.example.texttospeech.ListAllSupportedVoices' - */ -public class ListAllSupportedVoices { - - // [START tts_list_voices] - /** - * Demonstrates using the Text to Speech client to list the client's supported voices. - * - * @throws Exception on TextToSpeechClient Errors. - */ - public static void listAllSupportedVoices() throws Exception { - // Instantiates a client - try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) { - // Builds the text to speech list voices request - ListVoicesRequest request = ListVoicesRequest.getDefaultInstance(); - - // Performs the list voices request - ListVoicesResponse response = textToSpeechClient.listVoices(request); - List voices = response.getVoicesList(); - - for (Voice voice : voices) { - // Display the voice's name. Example: tpc-vocoded - System.out.format("Name: %s\n", voice.getName()); - - // Display the supported language codes for this voice. Example: "en-us" - List languageCodes = voice.getLanguageCodesList().asByteStringList(); - for (ByteString languageCode : languageCodes) { - System.out.format("Supported Language: %s\n", languageCode.toStringUtf8()); - } - - // Display the SSML Voice Gender - System.out.format("SSML Voice Gender: %s\n", voice.getSsmlGender()); - - // Display the natural sample rate hertz for this voice. Example: 24000 - System.out.format("Natural Sample Rate Hertz: %s\n\n", voice.getNaturalSampleRateHertz()); - } - } - } - // [END tts_list_voices] - - public static void main(String[] args) throws Exception { - listAllSupportedVoices(); - } -} diff --git a/texttospeech/beta/src/test/java/com/example/texttospeech/ListAllSupportedVoicesIT.java b/texttospeech/beta/src/test/java/com/example/texttospeech/ListAllSupportedVoicesIT.java deleted file mode 100644 index 3f6b43b3e44..00000000000 --- a/texttospeech/beta/src/test/java/com/example/texttospeech/ListAllSupportedVoicesIT.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.texttospeech; - -import static com.google.common.truth.Truth.assertThat; - -import java.io.ByteArrayOutputStream; -import java.io.PrintStream; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -/** Tests for ListAllSupportedVoices sample. */ -@RunWith(JUnit4.class) -@SuppressWarnings("checkstyle:abbreviationaswordinname") -public class ListAllSupportedVoicesIT { - - private ByteArrayOutputStream bout; - private PrintStream out; - private ListAllSupportedVoices listAllSupportedVoices; - - @Before - public void setUp() { - bout = new ByteArrayOutputStream(); - out = new PrintStream(bout); - System.setOut(out); - listAllSupportedVoices = new ListAllSupportedVoices(); - } - - @After - public void tearDown() { - System.setOut(null); - } - - @Test - public void testListAllSupportedVoices() throws Exception { - // Act - listAllSupportedVoices.listAllSupportedVoices(); - - // Assert - String got = bout.toString(); - assertThat(got).contains("en-US"); - assertThat(got).contains("SSML Voice Gender: MALE"); - assertThat(got).contains("SSML Voice Gender: FEMALE"); - } -} diff --git a/texttospeech/snippets/src/main/java/com/example/texttospeech/ListAllSupportedVoices.java b/texttospeech/snippets/src/main/java/com/example/texttospeech/ListAllSupportedVoices.java deleted file mode 100644 index fff4c7bbe59..00000000000 --- a/texttospeech/snippets/src/main/java/com/example/texttospeech/ListAllSupportedVoices.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.texttospeech; - -// Imports the Google Cloud client library -import com.google.cloud.texttospeech.v1.ListVoicesRequest; -import com.google.cloud.texttospeech.v1.ListVoicesResponse; -import com.google.cloud.texttospeech.v1.TextToSpeechClient; -import com.google.cloud.texttospeech.v1.Voice; -import com.google.protobuf.ByteString; -import java.util.List; - -/** - * Google Cloud TextToSpeech API sample application. Example usage: mvn package exec:java - * -Dexec.mainClass='com.example.texttospeech.ListAllSupportedVoices' - */ -public class ListAllSupportedVoices { - - // [START tts_list_voices] - /** - * Demonstrates using the Text to Speech client to list the client's supported voices. - * - * @throws Exception on TextToSpeechClient Errors. - */ - public static List listAllSupportedVoices() throws Exception { - // Instantiates a client - try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) { - // Builds the text to speech list voices request - ListVoicesRequest request = ListVoicesRequest.getDefaultInstance(); - - // Performs the list voices request - ListVoicesResponse response = textToSpeechClient.listVoices(request); - List voices = response.getVoicesList(); - - for (Voice voice : voices) { - // Display the voice's name. Example: tpc-vocoded - System.out.format("Name: %s\n", voice.getName()); - - // Display the supported language codes for this voice. Example: "en-us" - List languageCodes = voice.getLanguageCodesList().asByteStringList(); - for (ByteString languageCode : languageCodes) { - System.out.format("Supported Language: %s\n", languageCode.toStringUtf8()); - } - - // Display the SSML Voice Gender - System.out.format("SSML Voice Gender: %s\n", voice.getSsmlGender()); - - // Display the natural sample rate hertz for this voice. Example: 24000 - System.out.format("Natural Sample Rate Hertz: %s\n\n", voice.getNaturalSampleRateHertz()); - } - return voices; - } - } - // [END tts_list_voices] -} diff --git a/texttospeech/snippets/src/main/java/com/example/texttospeech/ListAllSupportedVoicesBeta.java b/texttospeech/snippets/src/main/java/com/example/texttospeech/ListAllSupportedVoicesBeta.java deleted file mode 100644 index 7d648639142..00000000000 --- a/texttospeech/snippets/src/main/java/com/example/texttospeech/ListAllSupportedVoicesBeta.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.texttospeech; - -// Imports the Google Cloud client library -import com.google.cloud.texttospeech.v1beta1.ListVoicesRequest; -import com.google.cloud.texttospeech.v1beta1.ListVoicesResponse; -import com.google.cloud.texttospeech.v1beta1.TextToSpeechClient; -import com.google.cloud.texttospeech.v1beta1.Voice; -import com.google.protobuf.ByteString; -import java.util.List; - -/** - * Google Cloud TextToSpeech API sample application. Example usage: mvn package exec:java - * -Dexec.mainClass='com.example.texttospeech.ListAllSupportedVoicesBeta' - */ -public class ListAllSupportedVoicesBeta { - - // [START tts_list_voices] - /** - * Demonstrates using the Text to Speech client to list the client's supported voices. - * - * @throws Exception on TextToSpeechClient Errors. - */ - public static void listAllSupportedVoices() throws Exception { - // Instantiates a client - try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) { - // Builds the text to speech list voices request - ListVoicesRequest request = ListVoicesRequest.getDefaultInstance(); - - // Performs the list voices request - ListVoicesResponse response = textToSpeechClient.listVoices(request); - List voices = response.getVoicesList(); - - for (Voice voice : voices) { - // Display the voice's name. Example: tpc-vocoded - System.out.format("Name: %s\n", voice.getName()); - - // Display the supported language codes for this voice. Example: "en-us" - List languageCodes = voice.getLanguageCodesList().asByteStringList(); - for (ByteString languageCode : languageCodes) { - System.out.format("Supported Language: %s\n", languageCode.toStringUtf8()); - } - - // Display the SSML Voice Gender - System.out.format("SSML Voice Gender: %s\n", voice.getSsmlGender()); - - // Display the natural sample rate hertz for this voice. Example: 24000 - System.out.format("Natural Sample Rate Hertz: %s\n\n", voice.getNaturalSampleRateHertz()); - } - } - } - // [END tts_list_voices] - - public static void main(String[] args) throws Exception { - listAllSupportedVoices(); - } -} diff --git a/texttospeech/snippets/src/test/java/com/example/texttospeech/ListAllSupportedVoicesBetaIT.java b/texttospeech/snippets/src/test/java/com/example/texttospeech/ListAllSupportedVoicesBetaIT.java deleted file mode 100644 index 220e7907d85..00000000000 --- a/texttospeech/snippets/src/test/java/com/example/texttospeech/ListAllSupportedVoicesBetaIT.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.texttospeech; - -import static com.google.common.truth.Truth.assertThat; - -import java.io.ByteArrayOutputStream; -import java.io.PrintStream; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -/** Tests for ListAllSupportedVoicesBeta sample. */ -@RunWith(JUnit4.class) -@SuppressWarnings("checkstyle:abbreviationaswordinname") -public class ListAllSupportedVoicesBetaIT { - - private ByteArrayOutputStream bout; - private PrintStream out; - private ListAllSupportedVoicesBeta listAllSupportedVoices; - - @Before - public void setUp() { - bout = new ByteArrayOutputStream(); - out = new PrintStream(bout); - System.setOut(out); - listAllSupportedVoices = new ListAllSupportedVoicesBeta(); - } - - @After - public void tearDown() { - System.setOut(null); - } - - @Test - public void testListAllSupportedVoicesBeta() throws Exception { - // Act - listAllSupportedVoices.listAllSupportedVoices(); - - // Assert - String got = bout.toString(); - assertThat(got).contains("en-US"); - assertThat(got).contains("SSML Voice Gender: MALE"); - assertThat(got).contains("SSML Voice Gender: FEMALE"); - } -} diff --git a/texttospeech/snippets/src/test/java/com/example/texttospeech/ListAllSupportedVoicesIT.java b/texttospeech/snippets/src/test/java/com/example/texttospeech/ListAllSupportedVoicesIT.java deleted file mode 100644 index 73dc3753caa..00000000000 --- a/texttospeech/snippets/src/test/java/com/example/texttospeech/ListAllSupportedVoicesIT.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.texttospeech; - -import static com.google.common.truth.Truth.assertThat; - -import com.google.cloud.texttospeech.v1.Voice; -import java.io.ByteArrayOutputStream; -import java.io.PrintStream; -import java.util.List; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -/** Tests for ListAllSupportedVoices sample. */ -@RunWith(JUnit4.class) -@SuppressWarnings("checkstyle:abbreviationaswordinname") -public class ListAllSupportedVoicesIT { - - private ByteArrayOutputStream bout; - private PrintStream out; - private ListAllSupportedVoices listAllSupportedVoices; - - @Before - public void setUp() { - bout = new ByteArrayOutputStream(); - out = new PrintStream(bout); - System.setOut(out); - listAllSupportedVoices = new ListAllSupportedVoices(); - } - - @After - public void tearDown() { - System.setOut(null); - } - - @Test - public void testListAllSupportedVoices() throws Exception { - // Act - List voices = listAllSupportedVoices.listAllSupportedVoices(); - - // Assert - assertThat(voices.isEmpty()).isFalse(); - String got = bout.toString(); - assertThat(got).contains("en-US"); - assertThat(got).contains("SSML Voice Gender: MALE"); - assertThat(got).contains("SSML Voice Gender: FEMALE"); - } -}