Search in sources :

Example 1 with ListMetadataStoresPagedResponse

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

Example 2 with ListMetadataStoresPagedResponse

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

Example 3 with ListMetadataStoresPagedResponse

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

Example 4 with ListMetadataStoresPagedResponse

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

Aggregations

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