use of com.google.cloud.aiplatform.v1beta1.DatasetServiceClient.ListDataItemsPagedResponse in project java-aiplatform by googleapis.
the class DatasetServiceClientTest method listDataItemsTest.
@Test
public void listDataItemsTest() throws Exception {
DataItem responsesElement = DataItem.newBuilder().build();
ListDataItemsResponse expectedResponse = ListDataItemsResponse.newBuilder().setNextPageToken("").addAllDataItems(Arrays.asList(responsesElement)).build();
mockDatasetService.addResponse(expectedResponse);
DatasetName parent = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]");
ListDataItemsPagedResponse pagedListResponse = client.listDataItems(parent);
List<DataItem> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getDataItemsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockDatasetService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListDataItemsRequest actualRequest = ((ListDataItemsRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.aiplatform.v1beta1.DatasetServiceClient.ListDataItemsPagedResponse in project java-aiplatform by googleapis.
the class DatasetServiceClientTest method listDataItemsTest2.
@Test
public void listDataItemsTest2() throws Exception {
DataItem responsesElement = DataItem.newBuilder().build();
ListDataItemsResponse expectedResponse = ListDataItemsResponse.newBuilder().setNextPageToken("").addAllDataItems(Arrays.asList(responsesElement)).build();
mockDatasetService.addResponse(expectedResponse);
String parent = "parent-995424086";
ListDataItemsPagedResponse pagedListResponse = client.listDataItems(parent);
List<DataItem> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getDataItemsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockDatasetService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListDataItemsRequest actualRequest = ((ListDataItemsRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.aiplatform.v1beta1.DatasetServiceClient.ListDataItemsPagedResponse in project java-aiplatform by googleapis.
the class DatasetServiceClientTest method listDataItemsTest2.
@Test
public void listDataItemsTest2() throws Exception {
DataItem responsesElement = DataItem.newBuilder().build();
ListDataItemsResponse expectedResponse = ListDataItemsResponse.newBuilder().setNextPageToken("").addAllDataItems(Arrays.asList(responsesElement)).build();
mockDatasetService.addResponse(expectedResponse);
String parent = "parent-995424086";
ListDataItemsPagedResponse pagedListResponse = client.listDataItems(parent);
List<DataItem> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getDataItemsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockDatasetService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListDataItemsRequest actualRequest = ((ListDataItemsRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.aiplatform.v1beta1.DatasetServiceClient.ListDataItemsPagedResponse in project java-aiplatform by googleapis.
the class DatasetServiceClientTest method listDataItemsTest.
@Test
public void listDataItemsTest() throws Exception {
DataItem responsesElement = DataItem.newBuilder().build();
ListDataItemsResponse expectedResponse = ListDataItemsResponse.newBuilder().setNextPageToken("").addAllDataItems(Arrays.asList(responsesElement)).build();
mockDatasetService.addResponse(expectedResponse);
DatasetName parent = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]");
ListDataItemsPagedResponse pagedListResponse = client.listDataItems(parent);
List<DataItem> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getDataItemsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockDatasetService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListDataItemsRequest actualRequest = ((ListDataItemsRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations