Search in sources :

Example 6 with ListInstructionsRequest

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

the class DataLabelingServiceClientTest method listInstructionsTest2.

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

Aggregations

ListInstructionsPagedResponse (com.google.cloud.datalabeling.v1beta1.DataLabelingServiceClient.ListInstructionsPagedResponse)6 DataLabelingServiceClient (com.google.cloud.datalabeling.v1beta1.DataLabelingServiceClient)4 Instruction (com.google.cloud.datalabeling.v1beta1.Instruction)4 ListInstructionsRequest (com.google.cloud.datalabeling.v1beta1.ListInstructionsRequest)4 ProjectName (com.google.cloud.datalabeling.v1beta1.ProjectName)4 IOException (java.io.IOException)4 AnnotationSpecSet (com.google.cloud.datalabeling.v1beta1.AnnotationSpecSet)3 ListAnnotationSpecSetsPagedResponse (com.google.cloud.datalabeling.v1beta1.DataLabelingServiceClient.ListAnnotationSpecSetsPagedResponse)3 ListDatasetsPagedResponse (com.google.cloud.datalabeling.v1beta1.DataLabelingServiceClient.ListDatasetsPagedResponse)3 Dataset (com.google.cloud.datalabeling.v1beta1.Dataset)3 ListAnnotationSpecSetsRequest (com.google.cloud.datalabeling.v1beta1.ListAnnotationSpecSetsRequest)3 ListDatasetsRequest (com.google.cloud.datalabeling.v1beta1.ListDatasetsRequest)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