use of com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient.SearchFeaturesPagedResponse in project java-aiplatform by googleapis.
the class FeaturestoreServiceClientTest method searchFeaturesTest3.
@Test
public void searchFeaturesTest3() throws Exception {
Feature responsesElement = Feature.newBuilder().build();
SearchFeaturesResponse expectedResponse = SearchFeaturesResponse.newBuilder().setNextPageToken("").addAllFeatures(Arrays.asList(responsesElement)).build();
mockFeaturestoreService.addResponse(expectedResponse);
LocationName location = LocationName.of("[PROJECT]", "[LOCATION]");
String query = "query107944136";
SearchFeaturesPagedResponse pagedListResponse = client.searchFeatures(location, query);
List<Feature> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getFeaturesList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockFeaturestoreService.getRequests();
Assert.assertEquals(1, actualRequests.size());
SearchFeaturesRequest actualRequest = ((SearchFeaturesRequest) actualRequests.get(0));
Assert.assertEquals(location.toString(), actualRequest.getLocation());
Assert.assertEquals(query, actualRequest.getQuery());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient.SearchFeaturesPagedResponse in project java-aiplatform by googleapis.
the class FeaturestoreServiceClientTest method searchFeaturesTest4.
@Test
public void searchFeaturesTest4() throws Exception {
Feature responsesElement = Feature.newBuilder().build();
SearchFeaturesResponse expectedResponse = SearchFeaturesResponse.newBuilder().setNextPageToken("").addAllFeatures(Arrays.asList(responsesElement)).build();
mockFeaturestoreService.addResponse(expectedResponse);
String location = "location1901043637";
String query = "query107944136";
SearchFeaturesPagedResponse pagedListResponse = client.searchFeatures(location, query);
List<Feature> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getFeaturesList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockFeaturestoreService.getRequests();
Assert.assertEquals(1, actualRequests.size());
SearchFeaturesRequest actualRequest = ((SearchFeaturesRequest) actualRequests.get(0));
Assert.assertEquals(location, actualRequest.getLocation());
Assert.assertEquals(query, actualRequest.getQuery());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient.SearchFeaturesPagedResponse in project java-aiplatform by googleapis.
the class FeaturestoreServiceClientTest method searchFeaturesTest2.
@Test
public void searchFeaturesTest2() throws Exception {
Feature responsesElement = Feature.newBuilder().build();
SearchFeaturesResponse expectedResponse = SearchFeaturesResponse.newBuilder().setNextPageToken("").addAllFeatures(Arrays.asList(responsesElement)).build();
mockFeaturestoreService.addResponse(expectedResponse);
String location = "location1901043637";
SearchFeaturesPagedResponse pagedListResponse = client.searchFeatures(location);
List<Feature> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getFeaturesList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockFeaturestoreService.getRequests();
Assert.assertEquals(1, actualRequests.size());
SearchFeaturesRequest actualRequest = ((SearchFeaturesRequest) actualRequests.get(0));
Assert.assertEquals(location, actualRequest.getLocation());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient.SearchFeaturesPagedResponse in project java-aiplatform by googleapis.
the class FeaturestoreServiceClientTest method searchFeaturesTest4.
@Test
public void searchFeaturesTest4() throws Exception {
Feature responsesElement = Feature.newBuilder().build();
SearchFeaturesResponse expectedResponse = SearchFeaturesResponse.newBuilder().setNextPageToken("").addAllFeatures(Arrays.asList(responsesElement)).build();
mockFeaturestoreService.addResponse(expectedResponse);
String location = "location1901043637";
String query = "query107944136";
SearchFeaturesPagedResponse pagedListResponse = client.searchFeatures(location, query);
List<Feature> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getFeaturesList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockFeaturestoreService.getRequests();
Assert.assertEquals(1, actualRequests.size());
SearchFeaturesRequest actualRequest = ((SearchFeaturesRequest) actualRequests.get(0));
Assert.assertEquals(location, actualRequest.getLocation());
Assert.assertEquals(query, actualRequest.getQuery());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient.SearchFeaturesPagedResponse in project java-aiplatform by googleapis.
the class FeaturestoreServiceClientTest method searchFeaturesTest.
@Test
public void searchFeaturesTest() throws Exception {
Feature responsesElement = Feature.newBuilder().build();
SearchFeaturesResponse expectedResponse = SearchFeaturesResponse.newBuilder().setNextPageToken("").addAllFeatures(Arrays.asList(responsesElement)).build();
mockFeaturestoreService.addResponse(expectedResponse);
LocationName location = LocationName.of("[PROJECT]", "[LOCATION]");
SearchFeaturesPagedResponse pagedListResponse = client.searchFeatures(location);
List<Feature> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getFeaturesList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockFeaturestoreService.getRequests();
Assert.assertEquals(1, actualRequests.size());
SearchFeaturesRequest actualRequest = ((SearchFeaturesRequest) actualRequests.get(0));
Assert.assertEquals(location.toString(), actualRequest.getLocation());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations