Skip to content

Commit

Permalink
Add timeout for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nnegrey committed Mar 26, 2018
1 parent 43ba4dd commit 297d195
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions video/beta/src/main/java/com/example/video/Detect.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import com.google.cloud.videointelligence.v1p1beta1.VideoIntelligenceServiceClient;
import com.google.cloud.videointelligence.v1p1beta1.WordInfo;
import java.io.IOException;
import java.util.concurrent.TimeUnit;

public class Detect {
/**
Expand Down Expand Up @@ -117,7 +118,8 @@ public static void analyzeFacesBoundingBoxes(String gcsUri) throws Exception {
System.out.println("Waiting for operation to complete...");
boolean faceFound = false;
// Display the results
for (VideoAnnotationResults results : response.get().getAnnotationResultsList()) {
for (VideoAnnotationResults results : response.get(900, TimeUnit.SECONDS)
.getAnnotationResultsList()) {
int faceCount = 0;
// Display the results for each face
for (FaceDetectionAnnotation faceAnnotation : results.getFaceDetectionAnnotationsList()) {
Expand Down Expand Up @@ -194,7 +196,8 @@ public static void analyzeFaceEmotions(String gcsUri) throws Exception {
System.out.println("Waiting for operation to complete...");
boolean faceFound = false;
// Display the results
for (VideoAnnotationResults results : response.get().getAnnotationResultsList()) {
for (VideoAnnotationResults results : response.get(600, TimeUnit.SECONDS)
.getAnnotationResultsList()) {
int faceCount = 0;
// Display the results for each face
for (FaceDetectionAnnotation faceAnnotation : results.getFaceDetectionAnnotationsList()) {
Expand Down Expand Up @@ -271,7 +274,8 @@ public static void speechTranscription(String gcsUri) throws Exception {

System.out.println("Waiting for operation to complete...");
// Display the results
for (VideoAnnotationResults results : response.get().getAnnotationResultsList()) {
for (VideoAnnotationResults results : response.get(180, TimeUnit.SECONDS)
.getAnnotationResultsList()) {
for (SpeechTranscription speechTranscription : results.getSpeechTranscriptionsList()) {
try {
// Print the transcription
Expand Down

0 comments on commit 297d195

Please sign in to comment.