Search in sources :

Example 1 with ListModelEvaluationsPagedResponse

use of com.google.cloud.automl.v1beta1.AutoMlClient.ListModelEvaluationsPagedResponse in project java-automl by googleapis.

the class AutoMlClientTest method listModelEvaluationsTest2.

@Test
public void listModelEvaluationsTest2() throws Exception {
    ModelEvaluation responsesElement = ModelEvaluation.newBuilder().build();
    ListModelEvaluationsResponse expectedResponse = ListModelEvaluationsResponse.newBuilder().setNextPageToken("").addAllModelEvaluation(Arrays.asList(responsesElement)).build();
    mockAutoMl.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListModelEvaluationsPagedResponse pagedListResponse = client.listModelEvaluations(parent);
    List<ModelEvaluation> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getModelEvaluationList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockAutoMl.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListModelEvaluationsRequest actualRequest = ((ListModelEvaluationsRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListModelEvaluationsPagedResponse(com.google.cloud.automl.v1beta1.AutoMlClient.ListModelEvaluationsPagedResponse) Test(org.junit.Test)

Example 2 with ListModelEvaluationsPagedResponse

use of com.google.cloud.automl.v1beta1.AutoMlClient.ListModelEvaluationsPagedResponse in project java-automl by googleapis.

the class AutoMlClientTest method listModelEvaluationsTest2.

@Test
public void listModelEvaluationsTest2() throws Exception {
    ModelEvaluation responsesElement = ModelEvaluation.newBuilder().build();
    ListModelEvaluationsResponse expectedResponse = ListModelEvaluationsResponse.newBuilder().setNextPageToken("").addAllModelEvaluation(Arrays.asList(responsesElement)).build();
    mockAutoMl.addResponse(expectedResponse);
    String parent = "parent-995424086";
    String filter = "filter-1274492040";
    ListModelEvaluationsPagedResponse pagedListResponse = client.listModelEvaluations(parent, filter);
    List<ModelEvaluation> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getModelEvaluationList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockAutoMl.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListModelEvaluationsRequest actualRequest = ((ListModelEvaluationsRequest) 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) ListModelEvaluationsPagedResponse(com.google.cloud.automl.v1.AutoMlClient.ListModelEvaluationsPagedResponse) Test(org.junit.Test)

Example 3 with ListModelEvaluationsPagedResponse

use of com.google.cloud.automl.v1beta1.AutoMlClient.ListModelEvaluationsPagedResponse in project java-automl by googleapis.

the class AutoMlClientTest method listModelEvaluationsTest.

@Test
public void listModelEvaluationsTest() throws Exception {
    ModelEvaluation responsesElement = ModelEvaluation.newBuilder().build();
    ListModelEvaluationsResponse expectedResponse = ListModelEvaluationsResponse.newBuilder().setNextPageToken("").addAllModelEvaluation(Arrays.asList(responsesElement)).build();
    mockAutoMl.addResponse(expectedResponse);
    ModelName parent = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
    String filter = "filter-1274492040";
    ListModelEvaluationsPagedResponse pagedListResponse = client.listModelEvaluations(parent, filter);
    List<ModelEvaluation> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getModelEvaluationList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockAutoMl.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListModelEvaluationsRequest actualRequest = ((ListModelEvaluationsRequest) 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) ListModelEvaluationsPagedResponse(com.google.cloud.automl.v1.AutoMlClient.ListModelEvaluationsPagedResponse) Test(org.junit.Test)

Example 4 with ListModelEvaluationsPagedResponse

use of com.google.cloud.automl.v1beta1.AutoMlClient.ListModelEvaluationsPagedResponse in project java-automl by googleapis.

the class AutoMlClientTest method listModelEvaluationsTest.

@Test
public void listModelEvaluationsTest() throws Exception {
    ModelEvaluation responsesElement = ModelEvaluation.newBuilder().build();
    ListModelEvaluationsResponse expectedResponse = ListModelEvaluationsResponse.newBuilder().setNextPageToken("").addAllModelEvaluation(Arrays.asList(responsesElement)).build();
    mockAutoMl.addResponse(expectedResponse);
    ModelName parent = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
    ListModelEvaluationsPagedResponse pagedListResponse = client.listModelEvaluations(parent);
    List<ModelEvaluation> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getModelEvaluationList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockAutoMl.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListModelEvaluationsRequest actualRequest = ((ListModelEvaluationsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListModelEvaluationsPagedResponse(com.google.cloud.automl.v1beta1.AutoMlClient.ListModelEvaluationsPagedResponse) Test(org.junit.Test)

Aggregations

AbstractMessage (com.google.protobuf.AbstractMessage)4 Test (org.junit.Test)4 ListModelEvaluationsPagedResponse (com.google.cloud.automl.v1.AutoMlClient.ListModelEvaluationsPagedResponse)2 ListModelEvaluationsPagedResponse (com.google.cloud.automl.v1beta1.AutoMlClient.ListModelEvaluationsPagedResponse)2