Search in sources :

Example 6 with ListAnnotationSpecSetsRequest

use of com.google.cloud.datalabeling.v1beta1.ListAnnotationSpecSetsRequest in project java-datalabeling by googleapis.

the class DataLabelingServiceClientTest method listAnnotationSpecSetsTest2.

@Test
public void listAnnotationSpecSetsTest2() throws Exception {
    AnnotationSpecSet responsesElement = AnnotationSpecSet.newBuilder().build();
    ListAnnotationSpecSetsResponse expectedResponse = ListAnnotationSpecSetsResponse.newBuilder().setNextPageToken("").addAllAnnotationSpecSets(Arrays.asList(responsesElement)).build();
    mockDataLabelingService.addResponse(expectedResponse);
    String parent = "parent-995424086";
    String filter = "filter-1274492040";
    ListAnnotationSpecSetsPagedResponse pagedListResponse = client.listAnnotationSpecSets(parent, filter);
    List<AnnotationSpecSet> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getAnnotationSpecSetsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockDataLabelingService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListAnnotationSpecSetsRequest actualRequest = ((ListAnnotationSpecSetsRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertEquals(filter, actualRequest.getFilter());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : ListAnnotationSpecSetsPagedResponse(com.google.cloud.datalabeling.v1beta1.DataLabelingServiceClient.ListAnnotationSpecSetsPagedResponse) AbstractMessage(com.google.protobuf.AbstractMessage) Test(org.junit.Test)

Aggregations

ListAnnotationSpecSetsPagedResponse (com.google.cloud.datalabeling.v1beta1.DataLabelingServiceClient.ListAnnotationSpecSetsPagedResponse)6 AnnotationSpecSet (com.google.cloud.datalabeling.v1beta1.AnnotationSpecSet)4 DataLabelingServiceClient (com.google.cloud.datalabeling.v1beta1.DataLabelingServiceClient)4 ListAnnotationSpecSetsRequest (com.google.cloud.datalabeling.v1beta1.ListAnnotationSpecSetsRequest)4 ProjectName (com.google.cloud.datalabeling.v1beta1.ProjectName)4 IOException (java.io.IOException)4 ListDatasetsPagedResponse (com.google.cloud.datalabeling.v1beta1.DataLabelingServiceClient.ListDatasetsPagedResponse)3 ListInstructionsPagedResponse (com.google.cloud.datalabeling.v1beta1.DataLabelingServiceClient.ListInstructionsPagedResponse)3 Dataset (com.google.cloud.datalabeling.v1beta1.Dataset)3 Instruction (com.google.cloud.datalabeling.v1beta1.Instruction)3 ListDatasetsRequest (com.google.cloud.datalabeling.v1beta1.ListDatasetsRequest)3 ListInstructionsRequest (com.google.cloud.datalabeling.v1beta1.ListInstructionsRequest)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 PrintStream (java.io.PrintStream)3 Before (org.junit.Before)3 GcsSource (com.google.cloud.datalabeling.v1beta1.GcsSource)2 ImportDataOperationResponse (com.google.cloud.datalabeling.v1beta1.ImportDataOperationResponse)2 ImportDataRequest (com.google.cloud.datalabeling.v1beta1.ImportDataRequest)2 InputConfig (com.google.cloud.datalabeling.v1beta1.InputConfig)2 AbstractMessage (com.google.protobuf.AbstractMessage)2