Search in sources :

Example 1 with ListIndexEndpointsPagedResponse

use of com.google.cloud.aiplatform.v1.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()));
}
Also used : ListIndexEndpointsPagedResponse(com.google.cloud.aiplatform.v1.IndexEndpointServiceClient.ListIndexEndpointsPagedResponse) AbstractMessage(com.google.protobuf.AbstractMessage) Test(org.junit.Test)

Example 2 with ListIndexEndpointsPagedResponse

use of com.google.cloud.aiplatform.v1.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()));
}
Also used : ListIndexEndpointsPagedResponse(com.google.cloud.aiplatform.v1.IndexEndpointServiceClient.ListIndexEndpointsPagedResponse) AbstractMessage(com.google.protobuf.AbstractMessage) Test(org.junit.Test)

Example 3 with ListIndexEndpointsPagedResponse

use of com.google.cloud.aiplatform.v1.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()));
}
Also used : ListIndexEndpointsPagedResponse(com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient.ListIndexEndpointsPagedResponse) AbstractMessage(com.google.protobuf.AbstractMessage) Test(org.junit.Test)

Example 4 with ListIndexEndpointsPagedResponse

use of com.google.cloud.aiplatform.v1.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()));
}
Also used : ListIndexEndpointsPagedResponse(com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClient.ListIndexEndpointsPagedResponse) AbstractMessage(com.google.protobuf.AbstractMessage) Test(org.junit.Test)

Aggregations

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