use of com.google.cloud.aiplatform.v1.DatasetServiceClient.ListAnnotationsPagedResponse in project java-aiplatform by googleapis.
the class DatasetServiceClientTest method listAnnotationsTest2.
@Test
public void listAnnotationsTest2() throws Exception {
Annotation responsesElement = Annotation.newBuilder().build();
ListAnnotationsResponse expectedResponse = ListAnnotationsResponse.newBuilder().setNextPageToken("").addAllAnnotations(Arrays.asList(responsesElement)).build();
mockDatasetService.addResponse(expectedResponse);
String parent = "parent-995424086";
ListAnnotationsPagedResponse pagedListResponse = client.listAnnotations(parent);
List<Annotation> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getAnnotationsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockDatasetService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListAnnotationsRequest actualRequest = ((ListAnnotationsRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.aiplatform.v1.DatasetServiceClient.ListAnnotationsPagedResponse in project java-aiplatform by googleapis.
the class DatasetServiceClientTest method listAnnotationsTest.
@Test
public void listAnnotationsTest() throws Exception {
Annotation responsesElement = Annotation.newBuilder().build();
ListAnnotationsResponse expectedResponse = ListAnnotationsResponse.newBuilder().setNextPageToken("").addAllAnnotations(Arrays.asList(responsesElement)).build();
mockDatasetService.addResponse(expectedResponse);
DataItemName parent = DataItemName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[DATA_ITEM]");
ListAnnotationsPagedResponse pagedListResponse = client.listAnnotations(parent);
List<Annotation> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getAnnotationsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockDatasetService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListAnnotationsRequest actualRequest = ((ListAnnotationsRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.aiplatform.v1.DatasetServiceClient.ListAnnotationsPagedResponse in project java-aiplatform by googleapis.
the class DatasetServiceClientTest method listAnnotationsTest2.
@Test
public void listAnnotationsTest2() throws Exception {
Annotation responsesElement = Annotation.newBuilder().build();
ListAnnotationsResponse expectedResponse = ListAnnotationsResponse.newBuilder().setNextPageToken("").addAllAnnotations(Arrays.asList(responsesElement)).build();
mockDatasetService.addResponse(expectedResponse);
String parent = "parent-995424086";
ListAnnotationsPagedResponse pagedListResponse = client.listAnnotations(parent);
List<Annotation> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getAnnotationsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockDatasetService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListAnnotationsRequest actualRequest = ((ListAnnotationsRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.aiplatform.v1.DatasetServiceClient.ListAnnotationsPagedResponse in project java-aiplatform by googleapis.
the class DatasetServiceClientTest method listAnnotationsTest.
@Test
public void listAnnotationsTest() throws Exception {
Annotation responsesElement = Annotation.newBuilder().build();
ListAnnotationsResponse expectedResponse = ListAnnotationsResponse.newBuilder().setNextPageToken("").addAllAnnotations(Arrays.asList(responsesElement)).build();
mockDatasetService.addResponse(expectedResponse);
DataItemName parent = DataItemName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[DATA_ITEM]");
ListAnnotationsPagedResponse pagedListResponse = client.listAnnotations(parent);
List<Annotation> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getAnnotationsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockDatasetService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListAnnotationsRequest actualRequest = ((ListAnnotationsRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations