@@ -0,0 +1,3643 @@
+/*%0A * Copyright 2020 Google LLC%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     https://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.google.cloud.mediatranslation.v1beta1.it;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.assertTrue;%0Aimport static org.junit.Assert.fail;%0A%0Aimport com.google.api.gax.rpc.BidiStream;%0Aimport com.google.api.gax.rpc.InvalidArgumentException;%0Aimport com.google.api.gax.rpc.StatusCode;%0Aimport com.google.cloud.mediatranslation.v1beta1.SpeechTranslationServiceClient;%0Aimport com.google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechConfig;%0Aimport com.google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechRequest;%0Aimport com.google.cloud.mediatranslation.v1beta1.StreamingTranslateSpeechResponse;%0Aimport com.google.cloud.mediatranslation.v1beta1.TranslateSpeechConfig;%0Aimport java.io.IOException;%0Aimport java.util.Iterator;%0Aimport java.util.concurrent.ExecutionException;%0Aimport org.junit.AfterClass;%0Aimport org.junit.BeforeClass;%0Aimport org.junit.Test;%0A%0Apublic class ITSystemTest %7B%0A%0A  private static SpeechTranslationServiceClient client;%0A%0A  @BeforeClass%0A  public static void setUp() throws IOException %7B%0A    client = SpeechTranslationServiceClient.create();%0A  %7D%0A%0A  @AfterClass%0A  public static void tearDown() %7B%0A    client.close();%0A  %7D%0A%0A  @Test%0A  @SuppressWarnings(%22all%22)%0A  public void streamingTranslateSpeechTest()%0A      throws ExecutionException, InterruptedException, IOException %7B%0A    TranslateSpeechConfig translateSpeechConfig =%0A        TranslateSpeechConfig.newBuilder()%0A            .setAudioEncoding(%22linear16%22)%0A            .setSourceLanguageCode(%22en%22)%0A            .setTargetLanguageCode(%22es%22)%0A            .build();%0A    StreamingTranslateSpeechConfig config =%0A        StreamingTranslateSpeechConfig.newBuilder()%0A            .setAudioConfig(translateSpeechConfig)%0A            .setSingleUtterance(true)%0A            .build();%0A    BidiStream%3CStreamingTranslateSpeechRequest, StreamingTranslateSpeechResponse%3E bidiStream =%0A        client.streamingTranslateSpeechCallable().call();%0A    StreamingTranslateSpeechRequest request =%0A        StreamingTranslateSpeechRequest.newBuilder().setStreamingConfig(config).build();%0A    bidiStream.send(request);%0A    Iterator%3CStreamingTranslateSpeechResponse%3E iterator = bidiStream.iterator();%0A    assertTrue(iterator.hasNext());%0A    assertTrue(iterator.next().hasResult());%0A  %7D%0A%0A  @Test%0A  @SuppressWarnings(%22all%22)%0A  public void streamingTranslateSpeechExceptionTest() %7B%0A    BidiStream%3CStreamingTranslateSpeechRequest, StreamingTranslateSpeechResponse%3E bidiStream =%0A        client.streamingTranslateSpeechCallable().call();%0A    StreamingTranslateSpeechConfig config = StreamingTranslateSpeechConfig.newBuilder().build();%0A    StreamingTranslateSpeechRequest request =%0A        StreamingTranslateSpeechRequest.newBuilder().setStreamingConfig(config).build();%0A    try %7B%0A      bidiStream.send(request);%0A      bidiStream.iterator().hasNext();%0A      fail();%0A    %7D catch (InvalidArgumentException ex) %7B%0A      assertTrue(ex.getMessage().contains(%22Unsupported encoding%22));%0A      assertEquals(StatusCode.Code.INVALID_ARGUMENT, ex.getStatusCode().getCode());%0A    %7D%0A  %7D%0A%7D%0A

add system test for v1beta1 (#105)