Search in sources :

Example 1 with ListEvaluationJobsPagedResponse

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

the class DataLabelingServiceClientTest method listEvaluationJobsTest.

@Test
public void listEvaluationJobsTest() throws Exception {
    EvaluationJob responsesElement = EvaluationJob.newBuilder().build();
    ListEvaluationJobsResponse expectedResponse = ListEvaluationJobsResponse.newBuilder().setNextPageToken("").addAllEvaluationJobs(Arrays.asList(responsesElement)).build();
    mockDataLabelingService.addResponse(expectedResponse);
    ProjectName parent = ProjectName.of("[PROJECT]");
    String filter = "filter-1274492040";
    ListEvaluationJobsPagedResponse pagedListResponse = client.listEvaluationJobs(parent, filter);
    List<EvaluationJob> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getEvaluationJobsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockDataLabelingService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListEvaluationJobsRequest actualRequest = ((ListEvaluationJobsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertEquals(filter, actualRequest.getFilter());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListEvaluationJobsPagedResponse(com.google.cloud.datalabeling.v1beta1.DataLabelingServiceClient.ListEvaluationJobsPagedResponse) Test(org.junit.Test)

Example 2 with ListEvaluationJobsPagedResponse

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

the class DataLabelingServiceClientTest method listEvaluationJobsTest2.

@Test
public void listEvaluationJobsTest2() throws Exception {
    EvaluationJob responsesElement = EvaluationJob.newBuilder().build();
    ListEvaluationJobsResponse expectedResponse = ListEvaluationJobsResponse.newBuilder().setNextPageToken("").addAllEvaluationJobs(Arrays.asList(responsesElement)).build();
    mockDataLabelingService.addResponse(expectedResponse);
    String parent = "parent-995424086";
    String filter = "filter-1274492040";
    ListEvaluationJobsPagedResponse pagedListResponse = client.listEvaluationJobs(parent, filter);
    List<EvaluationJob> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getEvaluationJobsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockDataLabelingService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListEvaluationJobsRequest actualRequest = ((ListEvaluationJobsRequest) 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) ListEvaluationJobsPagedResponse(com.google.cloud.datalabeling.v1beta1.DataLabelingServiceClient.ListEvaluationJobsPagedResponse) Test(org.junit.Test)

Aggregations

ListEvaluationJobsPagedResponse (com.google.cloud.datalabeling.v1beta1.DataLabelingServiceClient.ListEvaluationJobsPagedResponse)2 AbstractMessage (com.google.protobuf.AbstractMessage)2 Test (org.junit.Test)2