Search in sources :

Example 6 with BatchAnnotateFilesRequest

use of com.google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest in project spring-cloud-gcp by GoogleCloudPlatform.

the class CloudVisionTemplateTests method testAddInputConfig_extractText.

@Test
public void testAddInputConfig_extractText() throws IOException {
    when(this.imageAnnotatorClient.batchAnnotateFiles(any(BatchAnnotateFilesRequest.class))).thenReturn(DEFAULT_FILES_API_RESPONSE);
    this.cloudVisionTemplate.extractTextFromPdf(FAKE_PDF);
    BatchAnnotateFilesRequest expectedRequest = BatchAnnotateFilesRequest.newBuilder().addRequests(AnnotateFileRequest.newBuilder().addFeatures(Feature.newBuilder().setType(Type.DOCUMENT_TEXT_DETECTION)).setInputConfig(InputConfig.newBuilder().setMimeType("application/pdf").setContent(ByteString.readFrom(FAKE_PDF.getInputStream())).build()).build()).build();
    verify(this.imageAnnotatorClient, times(1)).batchAnnotateFiles(expectedRequest);
}
Also used : BatchAnnotateFilesRequest(com.google.cloud.vision.v1.BatchAnnotateFilesRequest) Test(org.junit.Test)

Aggregations

BatchAnnotateFilesRequest (com.google.cloud.vision.v1.BatchAnnotateFilesRequest)4 AnnotateFileRequest (com.google.cloud.vision.v1.AnnotateFileRequest)3 AnnotateImageResponse (com.google.cloud.vision.v1.AnnotateImageResponse)3 BatchAnnotateFilesResponse (com.google.cloud.vision.v1.BatchAnnotateFilesResponse)3 Feature (com.google.cloud.vision.v1.Feature)3 ImageAnnotatorClient (com.google.cloud.vision.v1.ImageAnnotatorClient)3 InputConfig (com.google.cloud.vision.v1.InputConfig)3 ByteString (com.google.protobuf.ByteString)3 Block (com.google.cloud.vision.v1.Block)2 Page (com.google.cloud.vision.v1.Page)2 Paragraph (com.google.cloud.vision.v1.Paragraph)2 Symbol (com.google.cloud.vision.v1.Symbol)2 Word (com.google.cloud.vision.v1.Word)2 AnnotateFileRequest (com.google.cloud.vision.v1p4beta1.AnnotateFileRequest)2 AnnotateFileResponse (com.google.cloud.vision.v1p4beta1.AnnotateFileResponse)2 BatchAnnotateFilesRequest (com.google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest)2 BatchAnnotateFilesResponse (com.google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse)2 Block (com.google.cloud.vision.v1p4beta1.Block)2 Feature (com.google.cloud.vision.v1p4beta1.Feature)2 ImageAnnotatorClient (com.google.cloud.vision.v1p4beta1.ImageAnnotatorClient)2