use of com.google.cloud.aiplatform.v1.ModelServiceClient.ListModelEvaluationsPagedResponse in project java-aiplatform by googleapis.
the class ModelServiceClientTest method listModelEvaluationsTest2.
@Test
public void listModelEvaluationsTest2() throws Exception {
ModelEvaluation responsesElement = ModelEvaluation.newBuilder().build();
ListModelEvaluationsResponse expectedResponse = ListModelEvaluationsResponse.newBuilder().setNextPageToken("").addAllModelEvaluations(Arrays.asList(responsesElement)).build();
mockModelService.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.getModelEvaluationsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockModelService.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()));
}
use of com.google.cloud.aiplatform.v1.ModelServiceClient.ListModelEvaluationsPagedResponse in project java-aiplatform by googleapis.
the class ModelServiceClientTest method listModelEvaluationsTest.
@Test
public void listModelEvaluationsTest() throws Exception {
ModelEvaluation responsesElement = ModelEvaluation.newBuilder().build();
ListModelEvaluationsResponse expectedResponse = ListModelEvaluationsResponse.newBuilder().setNextPageToken("").addAllModelEvaluations(Arrays.asList(responsesElement)).build();
mockModelService.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.getModelEvaluationsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockModelService.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()));
}
use of com.google.cloud.aiplatform.v1.ModelServiceClient.ListModelEvaluationsPagedResponse in project java-aiplatform by googleapis.
the class ModelServiceClientTest method listModelEvaluationsTest.
@Test
public void listModelEvaluationsTest() throws Exception {
ModelEvaluation responsesElement = ModelEvaluation.newBuilder().build();
ListModelEvaluationsResponse expectedResponse = ListModelEvaluationsResponse.newBuilder().setNextPageToken("").addAllModelEvaluations(Arrays.asList(responsesElement)).build();
mockModelService.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.getModelEvaluationsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockModelService.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()));
}
use of com.google.cloud.aiplatform.v1.ModelServiceClient.ListModelEvaluationsPagedResponse in project java-aiplatform by googleapis.
the class ModelServiceClientTest method listModelEvaluationsTest2.
@Test
public void listModelEvaluationsTest2() throws Exception {
ModelEvaluation responsesElement = ModelEvaluation.newBuilder().build();
ListModelEvaluationsResponse expectedResponse = ListModelEvaluationsResponse.newBuilder().setNextPageToken("").addAllModelEvaluations(Arrays.asList(responsesElement)).build();
mockModelService.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.getModelEvaluationsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockModelService.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()));
}
Aggregations