use of com.google.cloud.aiplatform.v1beta1.MetadataServiceClient.ListMetadataStoresPagedResponse in project java-aiplatform by googleapis.
the class MetadataServiceClientTest method listMetadataStoresTest.
@Test
public void listMetadataStoresTest() throws Exception {
MetadataStore responsesElement = MetadataStore.newBuilder().build();
ListMetadataStoresResponse expectedResponse = ListMetadataStoresResponse.newBuilder().setNextPageToken("").addAllMetadataStores(Arrays.asList(responsesElement)).build();
mockMetadataService.addResponse(expectedResponse);
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
ListMetadataStoresPagedResponse pagedListResponse = client.listMetadataStores(parent);
List<MetadataStore> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getMetadataStoresList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockMetadataService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListMetadataStoresRequest actualRequest = ((ListMetadataStoresRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.aiplatform.v1beta1.MetadataServiceClient.ListMetadataStoresPagedResponse in project java-aiplatform by googleapis.
the class MetadataServiceClientTest method listMetadataStoresTest.
@Test
public void listMetadataStoresTest() throws Exception {
MetadataStore responsesElement = MetadataStore.newBuilder().build();
ListMetadataStoresResponse expectedResponse = ListMetadataStoresResponse.newBuilder().setNextPageToken("").addAllMetadataStores(Arrays.asList(responsesElement)).build();
mockMetadataService.addResponse(expectedResponse);
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
ListMetadataStoresPagedResponse pagedListResponse = client.listMetadataStores(parent);
List<MetadataStore> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getMetadataStoresList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockMetadataService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListMetadataStoresRequest actualRequest = ((ListMetadataStoresRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.aiplatform.v1beta1.MetadataServiceClient.ListMetadataStoresPagedResponse in project java-aiplatform by googleapis.
the class MetadataServiceClientTest method listMetadataStoresTest2.
@Test
public void listMetadataStoresTest2() throws Exception {
MetadataStore responsesElement = MetadataStore.newBuilder().build();
ListMetadataStoresResponse expectedResponse = ListMetadataStoresResponse.newBuilder().setNextPageToken("").addAllMetadataStores(Arrays.asList(responsesElement)).build();
mockMetadataService.addResponse(expectedResponse);
String parent = "parent-995424086";
ListMetadataStoresPagedResponse pagedListResponse = client.listMetadataStores(parent);
List<MetadataStore> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getMetadataStoresList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockMetadataService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListMetadataStoresRequest actualRequest = ((ListMetadataStoresRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.aiplatform.v1beta1.MetadataServiceClient.ListMetadataStoresPagedResponse in project java-aiplatform by googleapis.
the class MetadataServiceClientTest method listMetadataStoresTest2.
@Test
public void listMetadataStoresTest2() throws Exception {
MetadataStore responsesElement = MetadataStore.newBuilder().build();
ListMetadataStoresResponse expectedResponse = ListMetadataStoresResponse.newBuilder().setNextPageToken("").addAllMetadataStores(Arrays.asList(responsesElement)).build();
mockMetadataService.addResponse(expectedResponse);
String parent = "parent-995424086";
ListMetadataStoresPagedResponse pagedListResponse = client.listMetadataStores(parent);
List<MetadataStore> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getMetadataStoresList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockMetadataService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListMetadataStoresRequest actualRequest = ((ListMetadataStoresRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations