use of com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient.ListIndexEndpointsPagedResponse in project java-aiplatform by googleapis.
the class IndexEndpointServiceClientTest method listIndexEndpointsTest.
@Test
public void listIndexEndpointsTest() throws Exception {
IndexEndpoint responsesElement = IndexEndpoint.newBuilder().build();
ListIndexEndpointsResponse expectedResponse = ListIndexEndpointsResponse.newBuilder().setNextPageToken("").addAllIndexEndpoints(Arrays.asList(responsesElement)).build();
mockIndexEndpointService.addResponse(expectedResponse);
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
ListIndexEndpointsPagedResponse pagedListResponse = client.listIndexEndpoints(parent);
List<IndexEndpoint> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getIndexEndpointsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockIndexEndpointService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListIndexEndpointsRequest actualRequest = ((ListIndexEndpointsRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient.ListIndexEndpointsPagedResponse in project java-aiplatform by googleapis.
the class IndexEndpointServiceClientTest method listIndexEndpointsTest2.
@Test
public void listIndexEndpointsTest2() throws Exception {
IndexEndpoint responsesElement = IndexEndpoint.newBuilder().build();
ListIndexEndpointsResponse expectedResponse = ListIndexEndpointsResponse.newBuilder().setNextPageToken("").addAllIndexEndpoints(Arrays.asList(responsesElement)).build();
mockIndexEndpointService.addResponse(expectedResponse);
String parent = "parent-995424086";
ListIndexEndpointsPagedResponse pagedListResponse = client.listIndexEndpoints(parent);
List<IndexEndpoint> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getIndexEndpointsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockIndexEndpointService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListIndexEndpointsRequest actualRequest = ((ListIndexEndpointsRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient.ListIndexEndpointsPagedResponse in project java-aiplatform by googleapis.
the class IndexEndpointServiceClientTest method listIndexEndpointsTest.
@Test
public void listIndexEndpointsTest() throws Exception {
IndexEndpoint responsesElement = IndexEndpoint.newBuilder().build();
ListIndexEndpointsResponse expectedResponse = ListIndexEndpointsResponse.newBuilder().setNextPageToken("").addAllIndexEndpoints(Arrays.asList(responsesElement)).build();
mockIndexEndpointService.addResponse(expectedResponse);
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
ListIndexEndpointsPagedResponse pagedListResponse = client.listIndexEndpoints(parent);
List<IndexEndpoint> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getIndexEndpointsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockIndexEndpointService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListIndexEndpointsRequest actualRequest = ((ListIndexEndpointsRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient.ListIndexEndpointsPagedResponse in project java-aiplatform by googleapis.
the class IndexEndpointServiceClientTest method listIndexEndpointsTest2.
@Test
public void listIndexEndpointsTest2() throws Exception {
IndexEndpoint responsesElement = IndexEndpoint.newBuilder().build();
ListIndexEndpointsResponse expectedResponse = ListIndexEndpointsResponse.newBuilder().setNextPageToken("").addAllIndexEndpoints(Arrays.asList(responsesElement)).build();
mockIndexEndpointService.addResponse(expectedResponse);
String parent = "parent-995424086";
ListIndexEndpointsPagedResponse pagedListResponse = client.listIndexEndpoints(parent);
List<IndexEndpoint> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getIndexEndpointsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockIndexEndpointService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListIndexEndpointsRequest actualRequest = ((ListIndexEndpointsRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations