Search in sources :

Example 1 with SearchEvaluationsPagedResponse

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

the class DataLabelingServiceClientTest method searchEvaluationsTest.

@Test
public void searchEvaluationsTest() throws Exception {
    Evaluation responsesElement = Evaluation.newBuilder().build();
    SearchEvaluationsResponse expectedResponse = SearchEvaluationsResponse.newBuilder().setNextPageToken("").addAllEvaluations(Arrays.asList(responsesElement)).build();
    mockDataLabelingService.addResponse(expectedResponse);
    EvaluationName parent = EvaluationName.of("[PROJECT]", "[DATASET]", "[EVALUATION]");
    String filter = "filter-1274492040";
    SearchEvaluationsPagedResponse pagedListResponse = client.searchEvaluations(parent, filter);
    List<Evaluation> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getEvaluationsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockDataLabelingService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    SearchEvaluationsRequest actualRequest = ((SearchEvaluationsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertEquals(filter, actualRequest.getFilter());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : SearchEvaluationsPagedResponse(com.google.cloud.datalabeling.v1beta1.DataLabelingServiceClient.SearchEvaluationsPagedResponse) AbstractMessage(com.google.protobuf.AbstractMessage) Test(org.junit.Test)

Example 2 with SearchEvaluationsPagedResponse

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

the class DataLabelingServiceClientTest method searchEvaluationsTest2.

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

Aggregations

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