Search in sources :

Example 6 with SearchFeaturesPagedResponse

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

Example 7 with SearchFeaturesPagedResponse

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

Example 8 with SearchFeaturesPagedResponse

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

Aggregations

AbstractMessage (com.google.protobuf.AbstractMessage)8 Test (org.junit.Test)8 SearchFeaturesPagedResponse (com.google.cloud.aiplatform.v1.FeaturestoreServiceClient.SearchFeaturesPagedResponse)4 SearchFeaturesPagedResponse (com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClient.SearchFeaturesPagedResponse)4