Search in sources :

Example 1 with ListModelEvaluationSlicesPagedResponse

use of com.google.cloud.aiplatform.v1.ModelServiceClient.ListModelEvaluationSlicesPagedResponse in project java-aiplatform by googleapis.

the class ModelServiceClientTest method listModelEvaluationSlicesTest2.

@Test
public void listModelEvaluationSlicesTest2() throws Exception {
    ModelEvaluationSlice responsesElement = ModelEvaluationSlice.newBuilder().build();
    ListModelEvaluationSlicesResponse expectedResponse = ListModelEvaluationSlicesResponse.newBuilder().setNextPageToken("").addAllModelEvaluationSlices(Arrays.asList(responsesElement)).build();
    mockModelService.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListModelEvaluationSlicesPagedResponse pagedListResponse = client.listModelEvaluationSlices(parent);
    List<ModelEvaluationSlice> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getModelEvaluationSlicesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockModelService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListModelEvaluationSlicesRequest actualRequest = ((ListModelEvaluationSlicesRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListModelEvaluationSlicesPagedResponse(com.google.cloud.aiplatform.v1beta1.ModelServiceClient.ListModelEvaluationSlicesPagedResponse) Test(org.junit.Test)

Example 2 with ListModelEvaluationSlicesPagedResponse

use of com.google.cloud.aiplatform.v1.ModelServiceClient.ListModelEvaluationSlicesPagedResponse in project java-aiplatform by googleapis.

the class ModelServiceClientTest method listModelEvaluationSlicesTest.

@Test
public void listModelEvaluationSlicesTest() throws Exception {
    ModelEvaluationSlice responsesElement = ModelEvaluationSlice.newBuilder().build();
    ListModelEvaluationSlicesResponse expectedResponse = ListModelEvaluationSlicesResponse.newBuilder().setNextPageToken("").addAllModelEvaluationSlices(Arrays.asList(responsesElement)).build();
    mockModelService.addResponse(expectedResponse);
    ModelEvaluationName parent = ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]");
    ListModelEvaluationSlicesPagedResponse pagedListResponse = client.listModelEvaluationSlices(parent);
    List<ModelEvaluationSlice> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getModelEvaluationSlicesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockModelService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListModelEvaluationSlicesRequest actualRequest = ((ListModelEvaluationSlicesRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListModelEvaluationSlicesPagedResponse(com.google.cloud.aiplatform.v1beta1.ModelServiceClient.ListModelEvaluationSlicesPagedResponse) Test(org.junit.Test)

Example 3 with ListModelEvaluationSlicesPagedResponse

use of com.google.cloud.aiplatform.v1.ModelServiceClient.ListModelEvaluationSlicesPagedResponse in project java-aiplatform by googleapis.

the class ModelServiceClientTest method listModelEvaluationSlicesTest2.

@Test
public void listModelEvaluationSlicesTest2() throws Exception {
    ModelEvaluationSlice responsesElement = ModelEvaluationSlice.newBuilder().build();
    ListModelEvaluationSlicesResponse expectedResponse = ListModelEvaluationSlicesResponse.newBuilder().setNextPageToken("").addAllModelEvaluationSlices(Arrays.asList(responsesElement)).build();
    mockModelService.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListModelEvaluationSlicesPagedResponse pagedListResponse = client.listModelEvaluationSlices(parent);
    List<ModelEvaluationSlice> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getModelEvaluationSlicesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockModelService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListModelEvaluationSlicesRequest actualRequest = ((ListModelEvaluationSlicesRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListModelEvaluationSlicesPagedResponse(com.google.cloud.aiplatform.v1.ModelServiceClient.ListModelEvaluationSlicesPagedResponse) Test(org.junit.Test)

Example 4 with ListModelEvaluationSlicesPagedResponse

use of com.google.cloud.aiplatform.v1.ModelServiceClient.ListModelEvaluationSlicesPagedResponse in project java-aiplatform by googleapis.

the class ModelServiceClientTest method listModelEvaluationSlicesTest.

@Test
public void listModelEvaluationSlicesTest() throws Exception {
    ModelEvaluationSlice responsesElement = ModelEvaluationSlice.newBuilder().build();
    ListModelEvaluationSlicesResponse expectedResponse = ListModelEvaluationSlicesResponse.newBuilder().setNextPageToken("").addAllModelEvaluationSlices(Arrays.asList(responsesElement)).build();
    mockModelService.addResponse(expectedResponse);
    ModelEvaluationName parent = ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]");
    ListModelEvaluationSlicesPagedResponse pagedListResponse = client.listModelEvaluationSlices(parent);
    List<ModelEvaluationSlice> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getModelEvaluationSlicesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockModelService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListModelEvaluationSlicesRequest actualRequest = ((ListModelEvaluationSlicesRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListModelEvaluationSlicesPagedResponse(com.google.cloud.aiplatform.v1.ModelServiceClient.ListModelEvaluationSlicesPagedResponse) Test(org.junit.Test)

Aggregations

AbstractMessage (com.google.protobuf.AbstractMessage)4 Test (org.junit.Test)4 ListModelEvaluationSlicesPagedResponse (com.google.cloud.aiplatform.v1.ModelServiceClient.ListModelEvaluationSlicesPagedResponse)2 ListModelEvaluationSlicesPagedResponse (com.google.cloud.aiplatform.v1beta1.ModelServiceClient.ListModelEvaluationSlicesPagedResponse)2